summaryrefslogtreecommitdiff
path: root/src/ai
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2008-05-25 19:17:03 +0000
committerrubidium <rubidium@openttd.org>2008-05-25 19:17:03 +0000
commit4625695653c3c0be16b61b640c206c557af9ec7b (patch)
treed480693e848eb121add7037faa150875d750cc98 /src/ai
parent6ea832ec7cbd572c72e96a179bb8c744834ee2e7 (diff)
downloadopenttd-4625695653c3c0be16b61b640c206c557af9ec7b.tar.xz
(svn r13251) -Codechange: rename _patches to _settings as that is more logic.
-Codechange: move all Settings into substructs of _settings in a way that they are logically grouped.
Diffstat (limited to 'src/ai')
-rw-r--r--src/ai/ai.cpp4
-rw-r--r--src/ai/ai.h4
-rw-r--r--src/ai/default/default.cpp22
-rw-r--r--src/ai/trolly/trolly.cpp18
4 files changed, 24 insertions, 24 deletions
diff --git a/src/ai/ai.cpp b/src/ai/ai.cpp
index 5e7330eb1..e48c8ef00 100644
--- a/src/ai/ai.cpp
+++ b/src/ai/ai.cpp
@@ -154,7 +154,7 @@ static void AI_RunTick(PlayerID player)
Player *p = GetPlayer(player);
_current_player = player;
- if (_patches.ainew_active) {
+ if (_settings.ai.ainew_active) {
AiNewDoGameLoop(p);
} else {
/* Enable all kind of cheats the old AI needs in order to operate correctly... */
@@ -178,7 +178,7 @@ void AI_RunGameLoop()
if (!_ai.enabled) return;
/* Don't do anything if we are a network-client, or the AI has been disabled */
- if (_networking && (!_network_server || !_patches.ai_in_multiplayer)) return;
+ if (_networking && (!_network_server || !_settings.ai.ai_in_multiplayer)) return;
/* New tick */
_ai.tick++;
diff --git a/src/ai/ai.h b/src/ai/ai.h
index 430d6a5e8..373cae191 100644
--- a/src/ai/ai.h
+++ b/src/ai/ai.h
@@ -67,14 +67,14 @@ static inline bool AI_AllowNewAI()
/* If in network, and server, possible AI */
if (_networking && _network_server) {
/* Do we want AIs in multiplayer? */
- if (!_patches.ai_in_multiplayer)
+ if (!_settings.ai.ai_in_multiplayer)
return false;
/* Only the NewAI is allowed... sadly enough the old AI just doesn't support this
* system, because all commands are delayed by at least 1 tick, which causes
* a big problem, because it uses variables that are only set AFTER the command
* is really executed... */
- if (!_patches.ainew_active)
+ if (!_settings.ai.ainew_active)
return false;
}
diff --git a/src/ai/default/default.cpp b/src/ai/default/default.cpp
index 2843d0dc7..70aaf2c04 100644
--- a/src/ai/default/default.cpp
+++ b/src/ai/default/default.cpp
@@ -1570,21 +1570,21 @@ static void AiStateWantNewRoute(Player *p)
for (;;) {
r = (uint16)Random();
- if (_patches.ai_disable_veh_train &&
- _patches.ai_disable_veh_roadveh &&
- _patches.ai_disable_veh_aircraft &&
- _patches.ai_disable_veh_ship) {
+ if (_settings.ai.ai_disable_veh_train &&
+ _settings.ai.ai_disable_veh_roadveh &&
+ _settings.ai.ai_disable_veh_aircraft &&
+ _settings.ai.ai_disable_veh_ship) {
return;
}
if (r < 0x7626) {
- if (_patches.ai_disable_veh_train) continue;
+ if (_settings.ai.ai_disable_veh_train) continue;
AiWantTrainRoute(p);
} else if (r < 0xC4EA) {
- if (_patches.ai_disable_veh_roadveh) continue;
+ if (_settings.ai.ai_disable_veh_roadveh) continue;
AiWantRoadRoute(p);
} else if (r < 0xD89B) {
- if (_patches.ai_disable_veh_aircraft) continue;
+ if (_settings.ai.ai_disable_veh_aircraft) continue;
AiWantAircraftRoute(p);
} else {
/* Ships are not implemented in this (broken) AI */
@@ -1603,7 +1603,7 @@ static void AiStateWantNewRoute(Player *p)
static bool AiCheckTrackResources(TileIndex tile, const AiDefaultBlockData *p, byte cargo)
{
- uint rad = (_patches.modified_catchment) ? CA_TRAIN : CA_UNMODIFIED;
+ uint rad = (_settings.station.modified_catchment) ? CA_TRAIN : CA_UNMODIFIED;
for (; p->mode != 4; p++) {
AcceptedCargo values;
@@ -2599,7 +2599,7 @@ static bool AiCheckRoadResources(TileIndex tile, const AiDefaultBlockData *p, by
uint values[NUM_CARGO];
int rad;
- if (_patches.modified_catchment) {
+ if (_settings.station.modified_catchment) {
rad = CA_TRUCK; // Same as CA_BUS at the moment?
} else { // change that at some point?
rad = 4;
@@ -3423,7 +3423,7 @@ static bool AiCheckAirportResources(TileIndex tile, const AiDefaultBlockData *p,
const AirportFTAClass* airport = GetAirport(p->attr);
uint w = airport->size_x;
uint h = airport->size_y;
- uint rad = _patches.modified_catchment ? airport->catchment : (uint)CA_UNMODIFIED;
+ uint rad = _settings.station.modified_catchment ? airport->catchment : (uint)CA_UNMODIFIED;
if (cargo & 0x80) {
GetProductionAroundTiles(values, tile2, w, h, rad);
@@ -3975,7 +3975,7 @@ void AiDoGameLoop(Player *p)
// to the patch-setting
// Also, it takes into account the setting if the service-interval is in days
// or in %
- _ai_service_interval = _patches.servint_ispercent ? 80 : 180;
+ _ai_service_interval = _settings.vehicle.servint_ispercent ? 80 : 180;
if (IsHumanPlayer(_current_player)) return;
diff --git a/src/ai/trolly/trolly.cpp b/src/ai/trolly/trolly.cpp
index 9672a9664..4be9819ca 100644
--- a/src/ai/trolly/trolly.cpp
+++ b/src/ai/trolly/trolly.cpp
@@ -130,9 +130,9 @@ static void AiNew_State_WakeUp(Player *p)
// Check all vehicles once in a while
_players_ainew[p->index].action = AI_ACTION_CHECK_ALL_VEHICLES;
_players_ainew[p->index].last_vehiclecheck_date = _date;
- } else if (c < 100 && !_patches.ai_disable_veh_roadveh) {
+ } else if (c < 100 && !_settings.ai.ai_disable_veh_roadveh) {
// Do we have any spots for road-vehicles left open?
- if (GetFreeUnitNumber(VEH_ROAD) <= _patches.max_roadveh) {
+ if (GetFreeUnitNumber(VEH_ROAD) <= _settings.vehicle.max_roadveh) {
if (c < 85) {
_players_ainew[p->index].action = AI_ACTION_TRUCK_ROUTE;
} else {
@@ -140,8 +140,8 @@ static void AiNew_State_WakeUp(Player *p)
}
}
#if 0
- } else if (c < 200 && !_patches.ai_disable_veh_train) {
- if (GetFreeUnitNumber(VEH_TRAIN) <= _patches.max_trains) {
+ } else if (c < 200 && !_settings.ai.ai_disable_veh_train) {
+ if (GetFreeUnitNumber(VEH_TRAIN) <= _settings.vehicle.max_trains) {
_players_ainew[p->index].action = AI_ACTION_TRAIN_ROUTE;
}
#endif
@@ -155,7 +155,7 @@ static void AiNew_State_WakeUp(Player *p)
return;
}
- if (_patches.ai_disable_veh_roadveh && (
+ if (_settings.ai.ai_disable_veh_roadveh && (
_players_ainew[p->index].action == AI_ACTION_BUS_ROUTE ||
_players_ainew[p->index].action == AI_ACTION_TRUCK_ROUTE
)) {
@@ -179,7 +179,7 @@ static void AiNew_State_WakeUp(Player *p)
// to build the route anyway..
if (_players_ainew[p->index].action == AI_ACTION_BUS_ROUTE &&
money > AI_MINIMUM_BUS_ROUTE_MONEY) {
- if (GetFreeUnitNumber(VEH_ROAD) > _patches.max_roadveh) {
+ if (GetFreeUnitNumber(VEH_ROAD) > _settings.vehicle.max_roadveh) {
_players_ainew[p->index].action = AI_ACTION_NONE;
return;
}
@@ -190,7 +190,7 @@ static void AiNew_State_WakeUp(Player *p)
}
if (_players_ainew[p->index].action == AI_ACTION_TRUCK_ROUTE &&
money > AI_MINIMUM_TRUCK_ROUTE_MONEY) {
- if (GetFreeUnitNumber(VEH_ROAD) > _patches.max_roadveh) {
+ if (GetFreeUnitNumber(VEH_ROAD) > _settings.vehicle.max_roadveh) {
_players_ainew[p->index].action = AI_ACTION_NONE;
return;
}
@@ -1035,7 +1035,7 @@ static void AiNew_State_BuildPath(Player *p)
if (_players_ainew[p->index].path_info.position == -2) {
// This means we are done building!
- if (_players_ainew[p->index].tbt == AI_TRUCK && !_patches.roadveh_queue) {
+ if (_players_ainew[p->index].tbt == AI_TRUCK && !_settings.pf.roadveh_queue) {
// If they not queue, they have to go up and down to try again at a station...
// We don't want that, so try building some road left or right of the station
DiagDirection dir1, dir2, dir3;
@@ -1186,7 +1186,7 @@ static void AiNew_State_GiveOrders(Player *p)
}
// Very handy for AI, goto depot.. but yeah, it needs to be activated ;)
- if (_patches.gotodepot) {
+ if (_settings.order.gotodepot) {
idx = 0;
order.MakeGoToDepot(GetDepotByTile(_players_ainew[p->index].depot_tile)->index, ODTFB_PART_OF_ORDERS);
AI_DoCommand(0, _players_ainew[p->index].veh_id + (idx << 16), order.Pack(), DC_EXEC, CMD_INSERT_ORDER);