(svn r14371) -Fix [FS#2313]: loading indicator didn't stay with the front engine when turning a train in a station.
authorrubidium
Sun, 21 Sep 2008 18:28:35 +0000
changeset 10176 bd20cc54b41f
parent 10175 26b53a17bcbd
child 10177 41ce7529a331
(svn r14371) -Fix [FS#2313]: loading indicator didn't stay with the front engine when turning a train in a station.
src/misc_gui.cpp
src/texteff.hpp
src/train_cmd.cpp
src/vehicle.cpp
--- a/src/misc_gui.cpp	Sun Sep 21 14:03:47 2008 +0000
+++ b/src/misc_gui.cpp	Sun Sep 21 18:28:35 2008 +0000
@@ -607,9 +607,12 @@
 	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[] = {
--- a/src/texteff.hpp	Sun Sep 21 14:03:47 2008 +0000
+++ b/src/texteff.hpp	Sun Sep 21 18:28:35 2008 +0000
@@ -29,6 +29,6 @@
 /* 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 */
--- a/src/train_cmd.cpp	Sun Sep 21 14:03:47 2008 +0000
+++ b/src/train_cmd.cpp	Sun Sep 21 18:28:35 2008 +0000
@@ -1957,6 +1957,7 @@
 			} else {
 				v->cur_speed = 0;
 				SetLastSpeed(v, 0);
+				HideFillingPercent(&v->fill_percent_te_id);
 				ReverseTrainDirection(v);
 			}
 		}
--- a/src/vehicle.cpp	Sun Sep 21 14:03:47 2008 +0000
+++ b/src/vehicle.cpp	Sun Sep 21 18:28:35 2008 +0000
@@ -643,8 +643,7 @@
 	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 @@
 	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) */