src/ai/default/default.cpp
branchgamebalance
changeset 9908 0fa543611bbe
parent 9906 6f41b8713b65
child 9910 0b2aebc8283e
equal deleted inserted replaced
9907:3b068c3a1c74 9908:0fa543611bbe
     3 #include "../../stdafx.h"
     3 #include "../../stdafx.h"
     4 #include "../../openttd.h"
     4 #include "../../openttd.h"
     5 #include "../../aircraft.h"
     5 #include "../../aircraft.h"
     6 #include "../../bridge_map.h"
     6 #include "../../bridge_map.h"
     7 #include "../../functions.h"
     7 #include "../../functions.h"
       
     8 #include "../../landscape.h"
     8 #include "../../map.h"
     9 #include "../../map.h"
     9 #include "../../rail_map.h"
    10 #include "../../rail_map.h"
    10 #include "../../road_map.h"
    11 #include "../../road_map.h"
    11 #include "../../roadveh.h"
    12 #include "../../roadveh.h"
    12 #include "../../station_map.h"
    13 #include "../../station_map.h"
  1422 		// Find a town
  1423 		// Find a town
  1423 		t = AiFindRandomTown();
  1424 		t = AiFindRandomTown();
  1424 		if (t != NULL) {
  1425 		if (t != NULL) {
  1425 			// Find a random oil rig industry
  1426 			// Find a random oil rig industry
  1426 			in = AiFindRandomIndustry();
  1427 			in = AiFindRandomIndustry();
  1427 			if (in != NULL && in->type == IT_OIL_RIG) {
  1428 			if (in != NULL && GetIndustrySpec(in->type)->behaviour & INDUSTRYBEH_AI_AIRSHIP_ROUTES) {
  1428 				if (DistanceManhattan(t->xy, in->xy) < 60)
  1429 				if (DistanceManhattan(t->xy, in->xy) < 60)
  1429 					break;
  1430 					break;
  1430 			}
  1431 			}
  1431 		}
  1432 		}
  1432 
  1433 
  3820 
  3821 
  3821 		// Too little money for computer to buy it?
  3822 		// Too little money for computer to buy it?
  3822 		if (best_pl->player_money >> 1 >= p->bankrupt_value) {
  3823 		if (best_pl->player_money >> 1 >= p->bankrupt_value) {
  3823 			// Computer wants to buy it.
  3824 			// Computer wants to buy it.
  3824 			PlayerID old_p = _current_player;
  3825 			PlayerID old_p = _current_player;
  3825 			_current_player = p->index;
  3826 			_current_player = best_pl->index;
  3826 			DoCommand(0, old_p, 0, DC_EXEC, CMD_BUY_COMPANY);
  3827 			DoCommand(0, old_p, 0, DC_EXEC, CMD_BUY_COMPANY);
  3827 			_current_player = old_p;
  3828 			_current_player = old_p;
  3828 		}
  3829 		}
  3829 	}
  3830 	}
  3830 }
  3831 }