From a0ff8680a3e5e4bd3845bfdd8e24f8559cbbc27b Mon Sep 17 00:00:00 2001 From: JackUnthank Date: Tue, 6 Jan 2015 17:01:15 +0000 Subject: [PATCH 1/2] Make the AI print out the walls not the map. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Don’t worry I wasn’t doing this all afternoon I had a spare 5 minutes whilst waiting for some .DAT files to md5. =P --- api/perl/ttrts.pm | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/api/perl/ttrts.pm b/api/perl/ttrts.pm index 6dc279e..793269b 100644 --- a/api/perl/ttrts.pm +++ b/api/perl/ttrts.pm @@ -238,6 +238,13 @@ sub PrintGameFromGamestateString $map[$invalidPos[0]][$invalidPos[1]] = "~"; } + # Fill with walls + foreach my $wall ( $info[8] =~ /\[(\d+,\d+)\]/g ) + { + $wall =~ /(\d+),(\d+)/; + $map[$1][$2] = "|"; + } + # Fill with units for my $unit (@units) { From 3291bf126e1831645531689c23fd4022fb31ae0d Mon Sep 17 00:00:00 2001 From: Marc Di Luzio Date: Wed, 7 Jan 2015 12:39:27 +0000 Subject: [PATCH 2/2] Compare write result correctly with 0 Fixes client sending of orders --- source/client/net.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/client/net.cpp b/source/client/net.cpp index 956c688..1de5847 100644 --- a/source/client/net.cpp +++ b/source/client/net.cpp @@ -233,7 +233,7 @@ std::string WaitForGamestateMessage(int sockfd) int SendOrdersToServer(int sockfd, const std::string &orders) { int n = write(sockfd,orders.c_str(),orders.length()); - if (0 < n) + if (n < 0) fatal_perror("ERROR writing to socket"); return n; }