ai/ai.c
changeset 3886 fb87348ffec7
parent 3692 01468bf49e8b
child 3887 3e44ae3b1e7c
equal deleted inserted replaced
3885:327cdee1f0b6 3886:fb87348ffec7
    34 		_cmd_text = com->text;
    34 		_cmd_text = com->text;
    35 		DoCommandP(com->tile, com->p1, com->p2, NULL, com->procc);
    35 		DoCommandP(com->tile, com->p1, com->p2, NULL, com->procc);
    36 
    36 
    37 		/* Free item */
    37 		/* Free item */
    38 		entry_com = com->next;
    38 		entry_com = com->next;
    39 		if (com->text != NULL)
    39 		free(com->text);
    40 			free(com->text);
       
    41 		free(com);
    40 		free(com);
    42 	}
    41 	}
    43 }
    42 }
    44 
    43 
    45 /**
    44 /**
    97 
    96 
    98 	/* First, do a test-run to see if we can do this */
    97 	/* First, do a test-run to see if we can do this */
    99 	res = DoCommand(tile, p1, p2, flags & ~DC_EXEC, procc);
    98 	res = DoCommand(tile, p1, p2, flags & ~DC_EXEC, procc);
   100 	/* The command failed, or you didn't want to execute, or you are quering, return */
    99 	/* The command failed, or you didn't want to execute, or you are quering, return */
   101 	if ((CmdFailed(res)) || !(flags & DC_EXEC) || (flags & DC_QUERY_COST)) {
   100 	if ((CmdFailed(res)) || !(flags & DC_EXEC) || (flags & DC_QUERY_COST)) {
   102 		if (tmp_cmdtext != NULL)
   101 		free(tmp_cmdtext);
   103 			free(tmp_cmdtext);
       
   104 		return res;
   102 		return res;
   105 	}
   103 	}
   106 
   104 
   107 	/* Recover _cmd_text */
   105 	/* Recover _cmd_text */
   108 	if (tmp_cmdtext != NULL)
   106 	if (tmp_cmdtext != NULL)
   130 		AI_PutCommandInQueue(_current_player, tile, p1, p2, procc);
   128 		AI_PutCommandInQueue(_current_player, tile, p1, p2, procc);
   131 
   129 
   132 	/* Set _local_player back */
   130 	/* Set _local_player back */
   133 	_local_player = old_lp;
   131 	_local_player = old_lp;
   134 
   132 
   135 	/* Free the temp _cmd_text var */
   133 	free(tmp_cmdtext);
   136 	if (tmp_cmdtext != NULL)
       
   137 		free(tmp_cmdtext);
       
   138 
   134 
   139 	return res;
   135 	return res;
   140 }
   136 }
   141 
   137 
   142 /**
   138 /**