src/ai/api/ai_object.cpp
branchnoai
changeset 9695 708f1e3cc4c4
parent 9688 8ada9fe60ce0
child 9703 d2a6acdbd665
equal deleted inserted replaced
9694:e72987579514 9695:708f1e3cc4c4
   100 	command_struct->costs = CommandCost();
   100 	command_struct->costs = CommandCost();
   101 	if (command_struct->event_data != NULL) AIEventController::FreeEventPointer();
   101 	if (command_struct->event_data != NULL) AIEventController::FreeEventPointer();
   102 	command_struct->event_data = NULL;
   102 	command_struct->event_data = NULL;
   103 }
   103 }
   104 
   104 
   105 bool AIObject::DoCommand(TileIndex tile, uint32 p1, uint32 p2, uint procc)
   105 bool AIObject::DoCommand(TileIndex tile, uint32 p1, uint32 p2, uint procc, bool water_protection)
   106 {
   106 {
   107 	uint32 flags = 0;
   107 	uint32 flags = 0;
   108 	PlayerID old_lp;
   108 	PlayerID old_lp;
   109 	CommandCost res;
   109 	CommandCost res;
   110 	const char* tmp_cmdtext;
   110 	const char* tmp_cmdtext;
   111 
   111 
   112 	if (procc != CMD_LANDSCAPE_CLEAR) flags |= DC_AUTO;
   112 	if (procc != CMD_LANDSCAPE_CLEAR) flags |= DC_AUTO;
       
   113 	if (water_protection) flags |= DC_NO_WATER;
   113 
   114 
   114 	/* The test already resets _cmd_text, so backup the pointer */
   115 	/* The test already resets _cmd_text, so backup the pointer */
   115 	tmp_cmdtext = _cmd_text;
   116 	tmp_cmdtext = _cmd_text;
   116 
   117 
   117 	/* First, do a test-run to see if we can do this */
   118 	/* First, do a test-run to see if we can do this */