Merge branch 'net' of https://github.com/mdiluz/ttrts into net
This commit is contained in:
commit
7811daa78b
2 changed files with 8 additions and 1 deletions
|
@ -238,6 +238,13 @@ sub PrintGameFromGamestateString
|
||||||
$map[$invalidPos[0]][$invalidPos[1]] = "~";
|
$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
|
# Fill with units
|
||||||
for my $unit (@units)
|
for my $unit (@units)
|
||||||
{
|
{
|
||||||
|
|
|
@ -233,7 +233,7 @@ std::string WaitForGamestateMessage(int sockfd)
|
||||||
int SendOrdersToServer(int sockfd, const std::string &orders)
|
int SendOrdersToServer(int sockfd, const std::string &orders)
|
||||||
{
|
{
|
||||||
int n = write(sockfd,orders.c_str(),orders.length());
|
int n = write(sockfd,orders.c_str(),orders.length());
|
||||||
if (0 < n)
|
if (n < 0)
|
||||||
fatal_perror("ERROR writing to socket");
|
fatal_perror("ERROR writing to socket");
|
||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue