From: Benni Bärmann Date: Sat, 20 Oct 2012 08:56:27 +0000 (+0200) Subject: some bugs with json fixed X-Git-Url: http://aymargeddon.de/gitweb/?p=aymargeddon%2Fcurrent.git;a=commitdiff_plain;h=HEAD some bugs with json fixed --- diff --git a/src/Aymargeddon.pm b/src/Aymargeddon.pm index e4fa7d1..c137c42 100644 --- a/src/Aymargeddon.pm +++ b/src/Aymargeddon.pm @@ -47,10 +47,10 @@ sub new{ sub get_map{ my $self = shift; - + unless (exists $self->{-map}){ - # TODO: HOME dupplication correct? - $self->{-map} = $self->read_map("TERRAIN,HOME,OCCUPANT,TEMPLE,PLAGUE,HOME"); + #TODO: HOME dupplication correct? + $self->{-map} = $self->read_map("TERRAIN,HOME,OCCUPANT,TEMPLE,PLAGUE,HOME"); } return $self->{-map}; } diff --git a/src/FROGS/Command.pm b/src/FROGS/Command.pm index 3507535..58bf52a 100644 --- a/src/FROGS/Command.pm +++ b/src/FROGS/Command.pm @@ -204,7 +204,7 @@ sub first_phase_ajax{ my $aff = $self->affected(); use JSON; - return encode($aff); + return encode_json($aff); } diff --git a/src/test2.pl b/src/test2.pl index 9197c44..db1df36 100755 --- a/src/test2.pl +++ b/src/test2.pl @@ -2,6 +2,8 @@ use strict; use FROGS::DataBase; use Data::Dumper; use Aymargeddon; +use AymCommand; +use FROGS::Command; $| = 1; @@ -13,11 +15,26 @@ $::conf->{-DEBUG} = 2; my $db = new DataBase(); -$db->update_hash('MOBILE', - "LOCATION=0_1", - {'COUNT' => 'COUNT + 1'},'noquote'); +my $dbhash = { + "PLAYER" => 5, + "GAME" => 1, + "ID" => 2, + "LOCATION" => "2_0", +}; -$db->commit(); +my $command = BUILD_ARK->new($dbhash,$db); + +print $command->first_phase_ajax()."\n"; + + + + + +#$db->update_hash('MOBILE', +# "LOCATION=0_1", +# {'COUNT' => 'COUNT + 1'},'noquote'); + +#$db->commit(); # print $db->relative("2004-05-13 03:40:37") ."\n";