X-Git-Url: http://aymargeddon.de/gitweb/?p=aymargeddon%2Fcurrent.git;a=blobdiff_plain;f=src%2FFROGS%2FCommand.pm;h=35075355c27068b9d4d63bb6be0e9a144da1372f;hp=c10a6c88d5a522862b160993c2fd560c3d3280f8;hb=448ecd81168816b51bf23219e8cc802ed4e2346e;hpb=8f037c123df00f587fda88e656579bcf17c8e66b diff --git a/src/FROGS/Command.pm b/src/FROGS/Command.pm index c10a6c8..3507535 100644 --- a/src/FROGS/Command.pm +++ b/src/FROGS/Command.pm @@ -1,23 +1,24 @@ ########################################################################## # -# Copyright (c) 2003 Aymargeddon Development Team +# Copyright (c) 2003-2012 Aymargeddon Development Team # -# This file is part of -# "FROGS" = Framework for Realtime Online Games of Strategy -# -# FROGS is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the Free -# Software Foundation; either version 2 of the License, or (at your option) -# any later version. -# -# FROGS is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for -# more details. -# You should have received a copy of the GNU General Public License along -# with this program; if not, write to the Free Software Foundation, Inc., 675 -# Mass Ave, Cambridge, MA 02139, USA. +# This file is part of "Last days of Aymargeddon" - a massive multi player +# online game of strategy +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # +# See the GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# ########################################################################### # @@ -182,6 +183,31 @@ sub done { # TODO?: send messages } +# returns a hash with all data wich is affected from the command +sub affected{ + my $self = shift; + + my $aff = $self->{-affected}; + for my $field (@{$aff->{-fields}}){ + #TODO? build field data + } + + return $aff; +} + +# returns a JSON-Object with all new infos which should displayd from client +sub first_phase_ajax{ + my $self = shift; + + my $ret = $self->first_phase(); + #TODO: which part of the logic in execute() is needed here? + + my $aff = $self->affected(); + use JSON; + return encode($aff); + +} + sub setDuration { # sets the duration of the command in units. Sheduler will schedule # the Phase 2 then for gametime+units*pace(game).