summaryrefslogtreecommitdiff
path: root/src/ai
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2007-03-08 16:27:54 +0000
committerrubidium <rubidium@openttd.org>2007-03-08 16:27:54 +0000
commitce919e8c719f0f698ac86dcaa528368316f2e52d (patch)
treee32a4dc6207efbaacc5af4e5c41a353b98b9a897 /src/ai
parentaca3fb2b6ef69ae571b167d3071edd46d0ed383c (diff)
downloadopenttd-ce919e8c719f0f698ac86dcaa528368316f2e52d.tar.xz
(svn r9068) -Codechange: capitalize the VEH_Train etc. enums to match the coding style (and rest of the code).
Diffstat (limited to 'src/ai')
-rw-r--r--src/ai/default/default.cpp26
-rw-r--r--src/ai/trolly/trolly.cpp14
2 files changed, 20 insertions, 20 deletions
diff --git a/src/ai/default/default.cpp b/src/ai/default/default.cpp
index 8784b6f36..20aa5d1e9 100644
--- a/src/ai/default/default.cpp
+++ b/src/ai/default/default.cpp
@@ -93,12 +93,12 @@ static void AiStateVehLoop(Player *p)
FOR_ALL_VEHICLES_FROM(v, index) {
if (v->owner != _current_player) continue;
- if ((v->type == VEH_Train && v->subtype == 0) ||
- v->type == VEH_Road ||
- (v->type == VEH_Aircraft && IsNormalAircraft(v)) ||
- v->type == VEH_Ship) {
+ if ((v->type == VEH_TRAIN && v->subtype == 0) ||
+ v->type == VEH_ROAD ||
+ (v->type == VEH_AIRCRAFT && IsNormalAircraft(v)) ||
+ v->type == VEH_SHIP) {
/* replace engine? */
- if (v->type == VEH_Train && v->engine_type < 3 &&
+ if (v->type == VEH_TRAIN && v->engine_type < 3 &&
(_price.build_railvehicle >> 3) < p->player_money) {
p->ai.state = AIS_VEH_CHECK_REPLACE_VEHICLE;
p->ai.cur_veh = v;
@@ -427,8 +427,8 @@ static void AiStateCheckReplaceVehicle(Player *p)
if (!IsValidVehicle(v) ||
v->owner != _current_player ||
- v->type > VEH_Ship ||
- _veh_check_replace_proc[v->type - VEH_Train](p, v) == INVALID_ENGINE) {
+ v->type > VEH_SHIP ||
+ _veh_check_replace_proc[v->type - VEH_TRAIN](p, v) == INVALID_ENGINE) {
p->ai.state = AIS_VEH_LOOP;
} else {
p->ai.state_counter = 0;
@@ -443,7 +443,7 @@ static void AiStateDoReplaceVehicle(Player *p)
p->ai.state = AIS_VEH_LOOP;
// vehicle is not owned by the player anymore, something went very wrong.
if (!IsValidVehicle(v) || v->owner != _current_player) return;
- _veh_do_replace_proc[v->type - VEH_Train](p);
+ _veh_do_replace_proc[v->type - VEH_TRAIN](p);
}
struct FoundRoute {
@@ -3515,7 +3515,7 @@ static void AiStateSellVeh(Player *p)
Vehicle *v = p->ai.cur_veh;
if (v->owner == _current_player) {
- if (v->type == VEH_Train) {
+ if (v->type == VEH_TRAIN) {
if (!IsTileDepotType(v->tile, TRANSPORT_RAIL) || v->u.rail.track != 0x80 || !(v->vehstatus&VS_STOPPED)) {
if (v->current_order.type != OT_GOTO_DEPOT)
@@ -3526,7 +3526,7 @@ static void AiStateSellVeh(Player *p)
// Sell whole train
DoCommand(v->tile, v->index, 1, DC_EXEC, CMD_SELL_RAIL_WAGON);
- } else if (v->type == VEH_Road) {
+ } else if (v->type == VEH_ROAD) {
if (!IsRoadVehInDepotStopped(v)) {
if (v->current_order.type != OT_GOTO_DEPOT)
DoCommand(0, v->index, 0, DC_EXEC, CMD_SEND_ROADVEH_TO_DEPOT);
@@ -3534,7 +3534,7 @@ static void AiStateSellVeh(Player *p)
}
DoCommand(0, v->index, 0, DC_EXEC, CMD_SELL_ROAD_VEH);
- } else if (v->type == VEH_Aircraft) {
+ } else if (v->type == VEH_AIRCRAFT) {
if (!IsAircraftInHangarStopped(v)) {
if (v->current_order.type != OT_GOTO_DEPOT)
DoCommand(0, v->index, 0, DC_EXEC, CMD_SEND_AIRCRAFT_TO_HANGAR);
@@ -3542,9 +3542,9 @@ static void AiStateSellVeh(Player *p)
}
DoCommand(0, v->index, 0, DC_EXEC, CMD_SELL_AIRCRAFT);
- } else if (v->type == VEH_Ship) {
+ } else if (v->type == VEH_SHIP) {
// XXX: not implemented
- error("!v->type == VEH_Ship");
+ error("!v->type == VEH_SHIP");
}
}
diff --git a/src/ai/trolly/trolly.cpp b/src/ai/trolly/trolly.cpp
index 855f74c8f..bb1357c6d 100644
--- a/src/ai/trolly/trolly.cpp
+++ b/src/ai/trolly/trolly.cpp
@@ -126,7 +126,7 @@ static void AiNew_State_WakeUp(Player *p)
p->ainew.last_vehiclecheck_date = _date;
} else if (c < 100 && !_patches.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) <= _patches.max_roadveh) {
if (c < 85) {
p->ainew.action = AI_ACTION_TRUCK_ROUTE;
} else {
@@ -135,7 +135,7 @@ 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) {
+ if (GetFreeUnitNumber(VEH_TRAIN) <= _patches.max_trains) {
p->ainew.action = AI_ACTION_TRAIN_ROUTE;
}
#endif
@@ -173,7 +173,7 @@ static void AiNew_State_WakeUp(Player *p)
// to build the route anyway..
if (p->ainew.action == AI_ACTION_BUS_ROUTE &&
money > AI_MINIMUM_BUS_ROUTE_MONEY) {
- if (GetFreeUnitNumber(VEH_Road) > _patches.max_roadveh) {
+ if (GetFreeUnitNumber(VEH_ROAD) > _patches.max_roadveh) {
p->ainew.action = AI_ACTION_NONE;
return;
}
@@ -184,7 +184,7 @@ static void AiNew_State_WakeUp(Player *p)
}
if (p->ainew.action == AI_ACTION_TRUCK_ROUTE &&
money > AI_MINIMUM_TRUCK_ROUTE_MONEY) {
- if (GetFreeUnitNumber(VEH_Road) > _patches.max_roadveh) {
+ if (GetFreeUnitNumber(VEH_ROAD) > _patches.max_roadveh) {
p->ainew.action = AI_ACTION_NONE;
return;
}
@@ -1264,7 +1264,7 @@ static void AiNew_CheckVehicle(Player *p, Vehicle *v)
// We are already sending him back
if (AiNew_GetSpecialVehicleFlag(p, v) & AI_VEHICLEFLAG_SELL) {
- if (v->type == VEH_Road && IsTileDepotType(v->tile, TRANSPORT_ROAD) &&
+ if (v->type == VEH_ROAD && IsTileDepotType(v->tile, TRANSPORT_ROAD) &&
(v->vehstatus&VS_STOPPED)) {
// We are at the depot, sell the vehicle
AI_DoCommand(0, v->index, 0, DC_EXEC, CMD_SELL_ROAD_VEH);
@@ -1275,7 +1275,7 @@ static void AiNew_CheckVehicle(Player *p, Vehicle *v)
if (!AiNew_SetSpecialVehicleFlag(p, v, AI_VEHICLEFLAG_SELL)) return;
{
int ret = 0;
- if (v->type == VEH_Road)
+ if (v->type == VEH_ROAD)
ret = AI_DoCommand(0, v->index, 0, DC_EXEC, CMD_SEND_ROADVEH_TO_DEPOT);
// This means we can not find a depot :s
// if (CmdFailed(ret))
@@ -1293,7 +1293,7 @@ static void AiNew_State_CheckAllVehicles(Player *p)
FOR_ALL_VEHICLES(v) {
if (v->owner != p->index) continue;
// Currently, we only know how to handle road-vehicles
- if (v->type != VEH_Road) continue;
+ if (v->type != VEH_ROAD) continue;
AiNew_CheckVehicle(p, v);
}