summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbjarni <bjarni@openttd.org>2005-10-30 11:00:54 +0000
committerbjarni <bjarni@openttd.org>2005-10-30 11:00:54 +0000
commitc406487b141a604e73184bf42d8533f740d27014 (patch)
tree81d3e191bb55a842f02e48ffccf3a54262dc0450
parent6c4b37c9fedefc96e98004ff7e4be6b2d7058562 (diff)
downloadopenttd-c406487b141a604e73184bf42d8533f740d27014.tar.xz
(svn r3104) -Codechange: [refit] removed now obsolite code that the old autoreplace needed
-rw-r--r--aircraft_cmd.c9
-rw-r--r--ship_cmd.c13
2 files changed, 4 insertions, 18 deletions
diff --git a/aircraft_cmd.c b/aircraft_cmd.c
index 1b485216c..9fb0d3cda 100644
--- a/aircraft_cmd.c
+++ b/aircraft_cmd.c
@@ -497,15 +497,12 @@ int32 CmdChangeAircraftServiceInt(int x, int y, uint32 flags, uint32 p1, uint32
* @param p1 vehicle ID of the aircraft to refit
* @param p2 various bitstuffed elements
* - p2 = (bit 0-7) - the new cargo type to refit to (p2 & 0xFF)
- * - p2 = (bit 8) - skip check for stopped in hangar, used by autoreplace (p2 & 0x100)
- * @todo p2 bit8 check <b>NEEDS TO GO</b>
*/
int32 CmdRefitAircraft(int x, int y, uint32 flags, uint32 p1, uint32 p2)
{
Vehicle *v;
int pass, mail;
int32 cost;
- bool SkipStoppedInHangerCheck = !!HASBIT(p2, 8); // XXX - needs to go, yes?
CargoID new_cid = p2 & 0xFF; //gets the cargo number
const AircraftVehicleInfo *avi;
@@ -514,7 +511,7 @@ int32 CmdRefitAircraft(int x, int y, uint32 flags, uint32 p1, uint32 p2)
v = GetVehicle(p1);
if (v->type != VEH_Aircraft || !CheckOwnership(v->owner)) return CMD_ERROR;
- if (!SkipStoppedInHangerCheck && !CheckStoppedInHangar(v)) return_cmd_error(STR_A01B_AIRCRAFT_MUST_BE_STOPPED);
+ if (!CheckStoppedInHangar(v)) return_cmd_error(STR_A01B_AIRCRAFT_MUST_BE_STOPPED);
avi = AircraftVehInfo(v->engine_type);
@@ -553,10 +550,6 @@ int32 CmdRefitAircraft(int x, int y, uint32 flags, uint32 p1, uint32 p2)
u = v->next;
mail = (new_cid != CT_PASSENGERS) ? 0 : avi->mail_capacity;
u->cargo_cap = mail;
- //autorefitted planes wants to keep the cargo
- //it will be checked if the cargo is valid in CmdReplaceVehicle
- if (!(SkipStoppedInHangerCheck))
- v->cargo_count = u->cargo_count = 0;
v->cargo_type = new_cid;
InvalidateWindow(WC_VEHICLE_DETAILS, v->index);
}
diff --git a/ship_cmd.c b/ship_cmd.c
index d708b4f47..a75394e74 100644
--- a/ship_cmd.c
+++ b/ship_cmd.c
@@ -1063,25 +1063,22 @@ int32 CmdChangeShipServiceInt(int x, int y, uint32 flags, uint32 p1, uint32 p2)
* @param p1 vehicle ID of the ship to refit
* @param p2 various bitstuffed elements
* - p2 = (bit 0-7) - the new cargo type to refit to (p2 & 0xFF)
- * - p2 = (bit 8) - skip check for stopped in depot, used by autoreplace (p2 & 0x100)
- * @todo p2 bit8 check <b>NEEDS TO GO</b>
*/
int32 CmdRefitShip(int x, int y, uint32 flags, uint32 p1, uint32 p2)
{
Vehicle *v;
int32 cost;
CargoID new_cid = p2 & 0xFF; //gets the cargo number
- bool SkipStoppedInDepotCheck = !!HASBIT(p2, 8); // XXX - needs to go, yes?
if (!IsVehicleIndex(p1)) return CMD_ERROR;
v = GetVehicle(p1);
if (v->type != VEH_Ship || !CheckOwnership(v->owner)) return CMD_ERROR;
- if (!SkipStoppedInDepotCheck) {
- if (!IsTileDepotType(v->tile, TRANSPORT_WATER) || !(v->vehstatus&VS_STOPPED) || v->u.ship.state != 0x80)
+
+ if (!IsTileDepotType(v->tile, TRANSPORT_WATER) || !(v->vehstatus&VS_STOPPED) || v->u.ship.state != 0x80)
return_cmd_error(STR_980B_SHIP_MUST_BE_STOPPED_IN);
- }
+
/* Check cargo */
if (!ShipVehInfo(v->engine_type)->refittable) return CMD_ERROR;
@@ -1095,10 +1092,6 @@ int32 CmdRefitShip(int x, int y, uint32 flags, uint32 p1, uint32 p2)
}
if (flags & DC_EXEC) {
- //autorefitted ships wants to keep the cargo
- //it will be checked if the cargo is valid in CmdRenewVehicle
- if (!(SkipStoppedInDepotCheck))
- v->cargo_count = 0;
v->cargo_type = new_cid;
InvalidateWindow(WC_VEHICLE_DETAILS, v->index);
}