summaryrefslogtreecommitdiff
path: root/src/vehicle_gui.cpp
diff options
context:
space:
mode:
authormichi_cc <michi_cc@openttd.org>2012-12-20 19:44:02 +0000
committermichi_cc <michi_cc@openttd.org>2012-12-20 19:44:02 +0000
commitc75962e04c0999c0c458b2ee54519f094d7c6543 (patch)
tree77dfc5b80771380cba34acf3f6ed564ce8be0657 /src/vehicle_gui.cpp
parent8eb1cb4ebbfa2b00ca27f860555f5397fe5a1c9e (diff)
downloadopenttd-c75962e04c0999c0c458b2ee54519f094d7c6543.tar.xz
(svn r24833) -Codechange: Replace magic numbers for invalidating vehicle-related windows with an enum.
Diffstat (limited to 'src/vehicle_gui.cpp')
-rw-r--r--src/vehicle_gui.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/vehicle_gui.cpp b/src/vehicle_gui.cpp
index 19cc7d217..554745e1d 100644
--- a/src/vehicle_gui.cpp
+++ b/src/vehicle_gui.cpp
@@ -534,7 +534,7 @@ struct RefitWindow : public Window {
if (this->sel == -1) this->vscroll->ScrollTowards(0);
} else {
/* Rebuild the refit list */
- this->OnInvalidateData(0);
+ this->OnInvalidateData(VIWD_CONSIST_CHANGED);
}
}
@@ -707,8 +707,8 @@ struct RefitWindow : public Window {
virtual void OnInvalidateData(int data = 0, bool gui_scope = true)
{
switch (data) {
- case -666: // Autoreplace replaced the vehicle; selected_vehicle became invalid.
- case 0: { // The consist has changed; rebuild the entire list.
+ case VIWD_AUTOREPLACE: // Autoreplace replaced the vehicle; selected_vehicle became invalid.
+ case VIWD_CONSIST_CHANGED: { // The consist has changed; rebuild the entire list.
/* Clear the selection. */
Vehicle *v = Vehicle::Get(this->window_number);
this->selected_vehicle = v->index;
@@ -1127,7 +1127,7 @@ static inline void ChangeVehicleWindow(WindowClass window_class, VehicleID from_
}
/* Notify the window. */
- w->InvalidateData(-666, false);
+ w->InvalidateData(VIWD_AUTOREPLACE, false);
}
}
@@ -1760,7 +1760,7 @@ struct VehicleDetailsWindow : Window {
*/
virtual void OnInvalidateData(int data = 0, bool gui_scope = true)
{
- if (data == -666) {
+ if (data == VIWD_AUTOREPLACE) {
/* Autoreplace replaced the vehicle.
* Nothing to do for this window. */
return;
@@ -2585,7 +2585,7 @@ public:
*/
virtual void OnInvalidateData(int data = 0, bool gui_scope = true)
{
- if (data == -666) {
+ if (data == VIWD_AUTOREPLACE) {
/* Autoreplace replaced the vehicle.
* Nothing to do for this window. */
return;