summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2008-09-21 18:28:35 +0000
committerrubidium <rubidium@openttd.org>2008-09-21 18:28:35 +0000
commit7ef54069462d5aca6a995c84bcdb115fb5ad66bb (patch)
tree1e819cb68dd0710c53d955077906e09489b6b9c7
parent2bf182fb366e3feb5cdc917ba8c62fb5143e6c6b (diff)
downloadopenttd-7ef54069462d5aca6a995c84bcdb115fb5ad66bb.tar.xz
(svn r14371) -Fix [FS#2313]: loading indicator didn't stay with the front engine when turning a train in a station.
-rw-r--r--src/misc_gui.cpp7
-rw-r--r--src/texteff.hpp2
-rw-r--r--src/train_cmd.cpp1
-rw-r--r--src/vehicle.cpp6
4 files changed, 9 insertions, 7 deletions
diff --git a/src/misc_gui.cpp b/src/misc_gui.cpp
index 75d774909..91c03c2d2 100644
--- a/src/misc_gui.cpp
+++ b/src/misc_gui.cpp
@@ -607,9 +607,12 @@ void UpdateFillingPercent(TextEffectID te_id, uint8 percent, StringID string)
UpdateTextEffect(te_id, string);
}
-void HideFillingPercent(TextEffectID te_id)
+void HideFillingPercent(TextEffectID *te_id)
{
- if (te_id != INVALID_TE_ID) RemoveTextEffect(te_id);
+ if (*te_id == INVALID_TE_ID) return;
+
+ RemoveTextEffect(*te_id);
+ *te_id = INVALID_TE_ID;
}
static const Widget _tooltips_widgets[] = {
diff --git a/src/texteff.hpp b/src/texteff.hpp
index 7b59def8c..bf91db575 100644
--- a/src/texteff.hpp
+++ b/src/texteff.hpp
@@ -29,6 +29,6 @@ void RemoveTextEffect(TextEffectID effect_id);
/* misc_gui.cpp */
TextEffectID ShowFillingPercent(int x, int y, int z, uint8 percent, StringID color);
void UpdateFillingPercent(TextEffectID te_id, uint8 percent, StringID color);
-void HideFillingPercent(TextEffectID te_id);
+void HideFillingPercent(TextEffectID *te_id);
#endif /* TEXTEFF_HPP */
diff --git a/src/train_cmd.cpp b/src/train_cmd.cpp
index a4994f3ec..e940cb22f 100644
--- a/src/train_cmd.cpp
+++ b/src/train_cmd.cpp
@@ -1957,6 +1957,7 @@ CommandCost CmdReverseTrainDirection(TileIndex tile, uint32 flags, uint32 p1, ui
} else {
v->cur_speed = 0;
SetLastSpeed(v, 0);
+ HideFillingPercent(&v->fill_percent_te_id);
ReverseTrainDirection(v);
}
}
diff --git a/src/vehicle.cpp b/src/vehicle.cpp
index 1e6ffb374..941ad8153 100644
--- a/src/vehicle.cpp
+++ b/src/vehicle.cpp
@@ -643,8 +643,7 @@ void Vehicle::PreDestructor()
if (IsValidStationID(this->last_station_visited)) {
GetStation(this->last_station_visited)->loading_vehicles.remove(this);
- HideFillingPercent(this->fill_percent_te_id);
- this->fill_percent_te_id = INVALID_TE_ID;
+ HideFillingPercent(&this->fill_percent_te_id);
}
if (IsEngineCountable(this)) {
@@ -2533,8 +2532,7 @@ void Vehicle::LeaveStation()
Station *st = GetStation(this->last_station_visited);
st->loading_vehicles.remove(this);
- HideFillingPercent(this->fill_percent_te_id);
- this->fill_percent_te_id = INVALID_TE_ID;
+ HideFillingPercent(&this->fill_percent_te_id);
if (this->type == VEH_TRAIN) {
/* Trigger station animation (trains only) */