mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-03-06 14:27:16 +00:00
(svn r3285) -Codechange: Tron was confused by a name, so let's make him happy,
prefixed it with 'tmp', so now we know it is a temp char* :)
This commit is contained in:
parent
0de260182b
commit
be65f908c8
16
ai/ai.c
16
ai/ai.c
@ -99,7 +99,7 @@ int32 AI_DoCommand(uint tile, uint32 p1, uint32 p2, uint32 flags, uint procc)
|
|||||||
{
|
{
|
||||||
PlayerID old_lp;
|
PlayerID old_lp;
|
||||||
int32 res = 0;
|
int32 res = 0;
|
||||||
char *cmdtext = NULL;
|
char *tmp_cmdtext = NULL;
|
||||||
|
|
||||||
/* If you enable DC_EXEC with DC_QUERY_COST you are a really strange
|
/* If you enable DC_EXEC with DC_QUERY_COST you are a really strange
|
||||||
* person.. should we check for those funny jokes?
|
* person.. should we check for those funny jokes?
|
||||||
@ -107,20 +107,20 @@ int32 AI_DoCommand(uint tile, uint32 p1, uint32 p2, uint32 flags, uint procc)
|
|||||||
|
|
||||||
/* The test already free _cmd_text in most cases, so let's backup the string, else we have a problem ;) */
|
/* The test already free _cmd_text in most cases, so let's backup the string, else we have a problem ;) */
|
||||||
if (_cmd_text != NULL)
|
if (_cmd_text != NULL)
|
||||||
cmdtext = strdup(_cmd_text);
|
tmp_cmdtext = strdup(_cmd_text);
|
||||||
|
|
||||||
/* First, do a test-run to see if we can do this */
|
/* First, do a test-run to see if we can do this */
|
||||||
res = DoCommandByTile(tile, p1, p2, flags & ~DC_EXEC, procc);
|
res = DoCommandByTile(tile, p1, p2, flags & ~DC_EXEC, procc);
|
||||||
/* The command failed, or you didn't want to execute, or you are quering, return */
|
/* The command failed, or you didn't want to execute, or you are quering, return */
|
||||||
if ((CmdFailed(res)) || !(flags & DC_EXEC) || (flags & DC_QUERY_COST)) {
|
if ((CmdFailed(res)) || !(flags & DC_EXEC) || (flags & DC_QUERY_COST)) {
|
||||||
if (cmdtext != NULL)
|
if (tmp_cmdtext != NULL)
|
||||||
free(cmdtext);
|
free(tmp_cmdtext);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Recover _cmd_text */
|
/* Recover _cmd_text */
|
||||||
if (cmdtext != NULL)
|
if (tmp_cmdtext != NULL)
|
||||||
_cmd_text = cmdtext;
|
_cmd_text = tmp_cmdtext;
|
||||||
|
|
||||||
/* If we did a DC_EXEC, and the command did not return an error, execute it
|
/* If we did a DC_EXEC, and the command did not return an error, execute it
|
||||||
over the network */
|
over the network */
|
||||||
@ -147,8 +147,8 @@ int32 AI_DoCommand(uint tile, uint32 p1, uint32 p2, uint32 flags, uint procc)
|
|||||||
_local_player = old_lp;
|
_local_player = old_lp;
|
||||||
|
|
||||||
/* Free the temp _cmd_text var */
|
/* Free the temp _cmd_text var */
|
||||||
if (cmdtext != NULL)
|
if (tmp_cmdtext != NULL)
|
||||||
free(cmdtext);
|
free(tmp_cmdtext);
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user