summaryrefslogtreecommitdiff
path: root/src/ship_cmd.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2007-04-29 22:33:51 +0000
committerrubidium <rubidium@openttd.org>2007-04-29 22:33:51 +0000
commitec9ac99d01c74f1cb63e8c934c8a13d8aca2422a (patch)
tree81c46786f55f9842ddb4b237507c86df8fd72924 /src/ship_cmd.cpp
parent202009522c3075e26b675ed0408075b8663b0859 (diff)
downloadopenttd-ec9ac99d01c74f1cb63e8c934c8a13d8aca2422a.tar.xz
(svn r9755) -Codechange: refactor some more of the begin loading stuff.
Diffstat (limited to 'src/ship_cmd.cpp')
-rw-r--r--src/ship_cmd.cpp19
1 files changed, 6 insertions, 13 deletions
diff --git a/src/ship_cmd.cpp b/src/ship_cmd.cpp
index 10c93d97f..6ce767649 100644
--- a/src/ship_cmd.cpp
+++ b/src/ship_cmd.cpp
@@ -229,10 +229,10 @@ static void HandleBrokenShip(Vehicle *v)
}
}
-static void MarkShipDirty(Vehicle *v)
+void Ship::MarkDirty()
{
- v->cur_image = GetShipImage(v, v->direction);
- MarkAllViewportsDirty(v->left_coord, v->top_coord, v->right_coord + 1, v->bottom_coord + 1);
+ this->cur_image = GetShipImage(this, this->direction);
+ MarkAllViewportsDirty(this->left_coord, this->top_coord, this->right_coord + 1, this->bottom_coord + 1);
}
static void PlayShipSound(Vehicle *v)
@@ -313,7 +313,7 @@ static void HandleShipLoading(Vehicle *v)
SET_EXPENSES_TYPE(EXPENSES_SHIP_INC);
if (LoadUnloadVehicle(v, false)) {
InvalidateWindow(WC_SHIPS_LIST, v->owner);
- MarkShipDirty(v);
+ v->MarkDirty();
}
return;
}
@@ -359,7 +359,7 @@ void RecalcShipStuff(Vehicle *v)
{
UpdateShipDeltaXY(v, v->direction);
v->cur_image = GetShipImage(v, v->direction);
- MarkShipDirty(v);
+ v->MarkDirty();
InvalidateWindow(WC_VEHICLE_DEPOT, v->tile);
}
@@ -735,15 +735,8 @@ static void ShipController(Vehicle *v)
/* Process station in the orderlist. */
st = GetStation(v->current_order.dest);
if (st->facilities & FACIL_DOCK) { // ugly, ugly workaround for problem with ships able to drop off cargo at wrong stations
- v->BeginLoading();
ShipArrivesAt(v, st);
-
- SET_EXPENSES_TYPE(EXPENSES_SHIP_INC);
- if (LoadUnloadVehicle(v, true)) {
- InvalidateWindow(WC_SHIPS_LIST, v->owner);
- MarkShipDirty(v);
- }
- InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, STATUS_BAR);
+ v->BeginLoading();
} else { // leave stations without docks right aways
v->current_order.type = OT_LEAVESTATION;
v->cur_order_index++;