summaryrefslogtreecommitdiff
path: root/src/roadveh_cmd.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2010-08-18 00:47:31 +0000
committerrubidium <rubidium@openttd.org>2010-08-18 00:47:31 +0000
commitc5a670037bb18383143c6710f7b9ad5d058753f3 (patch)
treeb3c3a1284713d091e51b9d1a258c9bf69e774b9b /src/roadveh_cmd.cpp
parent82e37c3ccac0f406f3340cf52e84cf7adb800cab (diff)
downloadopenttd-c5a670037bb18383143c6710f7b9ad5d058753f3.tar.xz
(svn r20536) -Codechange: unify the refitting of vehicles
Diffstat (limited to 'src/roadveh_cmd.cpp')
-rw-r--r--src/roadveh_cmd.cpp46
1 files changed, 0 insertions, 46 deletions
diff --git a/src/roadveh_cmd.cpp b/src/roadveh_cmd.cpp
index b23bd8a5b..bc8786850 100644
--- a/src/roadveh_cmd.cpp
+++ b/src/roadveh_cmd.cpp
@@ -1692,49 +1692,3 @@ Trackdir RoadVehicle::GetVehicleTrackdir() const
* otherwise transform it into a valid track direction */
return (Trackdir)((IsReversingRoadTrackdir((Trackdir)this->state)) ? (this->state - 6) : this->state);
}
-
-
-/**
- * Refit a road vehicle to the specified cargo type
- * @param tile unused
- * @param flags operation to perform
- * @param p1 Vehicle ID of the vehicle to refit
- * @param p2 Bitstuffed elements
- * - p2 = (bit 0-7) - the new cargo type to refit to
- * - p2 = (bit 8-15) - the new cargo subtype to refit to
- * - p2 = (bit 16) - refit only this vehicle
- * @param text unused
- * @return the cost of this operation or an error
- */
-CommandCost CmdRefitRoadVeh(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
-{
- CargoID new_cid = GB(p2, 0, 8);
- byte new_subtype = GB(p2, 8, 8);
- bool only_this = HasBit(p2, 16);
-
- RoadVehicle *v = RoadVehicle::GetIfValid(p1);
- if (v == NULL) return CMD_ERROR;
-
- CommandCost ret = CheckOwnership(v->owner);
- if (ret.Failed()) return ret;
-
- if (!v->IsStoppedInDepot()) return_cmd_error(STR_ERROR_ROAD_VEHICLE_MUST_BE_STOPPED_INSIDE_DEPOT);
- if (v->vehstatus & VS_CRASHED) return_cmd_error(STR_ERROR_VEHICLE_IS_DESTROYED);
-
- if (new_cid >= NUM_CARGO) return CMD_ERROR;
-
- CommandCost cost = RefitVehicle(v, only_this, new_cid, new_subtype, flags);
-
- if (flags & DC_EXEC) {
- RoadVehicle *front = v->First();
- RoadVehUpdateCache(front);
- if (_settings_game.vehicle.roadveh_acceleration_model != AM_ORIGINAL) front->CargoChanged();
- InvalidateWindowData(WC_VEHICLE_DETAILS, front->index);
- SetWindowDirty(WC_VEHICLE_DEPOT, front->tile);
- InvalidateWindowClassesData(WC_ROADVEH_LIST, 0);
- } else {
- v->InvalidateNewGRFCacheOfChain(); // always invalidate; querycost might have filled it
- }
-
- return cost;
-}