Merge branch 'net' of https://github.com/mdiluz/ttrts into net

This commit is contained in:
Marc Di Luzio 2015-01-07 12:40:44 +00:00
commit 7811daa78b
2 changed files with 8 additions and 1 deletions

View file

@ -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)
{

View file

@ -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;
}