summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2008-05-10 22:43:33 +0000
committerrubidium <rubidium@openttd.org>2008-05-10 22:43:33 +0000
commit9e0e4c03428c6be3ce278a849db39d000012c971 (patch)
tree180102d6b6b007850a712cf0fa31c2cd68cb051a /src
parent1853a5629147f4455fef0811796785e3f73c5289 (diff)
downloadopenttd-9e0e4c03428c6be3ce278a849db39d000012c971.tar.xz
(svn r13035) -Codechange: remove two needless global-ish variables.
Diffstat (limited to 'src')
-rw-r--r--src/autoreplace_gui.cpp22
1 files changed, 7 insertions, 15 deletions
diff --git a/src/autoreplace_gui.cpp b/src/autoreplace_gui.cpp
index 4a8cfdcfb..7f347dc2a 100644
--- a/src/autoreplace_gui.cpp
+++ b/src/autoreplace_gui.cpp
@@ -40,9 +40,6 @@ assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(replaceveh_d));
static RailType _railtype_selected_in_replace_gui;
-static bool _rebuild_left_list;
-static bool _rebuild_right_list;
-
static const StringID _rail_types_list[] = {
STR_RAIL_VEHICLES,
STR_ELRAIL_VEHICLES,
@@ -99,19 +96,14 @@ void InitializeVehiclesGuiList()
void InvalidateAutoreplaceWindow(EngineID e, GroupID id_g)
{
Player *p = GetPlayer(_local_player);
- VehicleType type = GetEngine(e)->type;
uint num_engines = GetGroupNumEngines(_local_player, id_g, e);
if (num_engines == 0 || p->num_engines[e] == 0) {
/* We don't have any of this engine type.
* Either we just sold the last one, we build a new one or we stopped replacing it.
* In all cases, we need to update the left list */
- _rebuild_left_list = true;
- } else {
- _rebuild_left_list = false;
+ InvalidateWindowData(WC_REPLACE_VEHICLE, GetEngine(e)->type, true);
}
- _rebuild_right_list = false;
- InvalidateWindowData(WC_REPLACE_VEHICLE, type);
}
/** When an engine is made buildable or is removed from being buildable, add/remove it from the build/autoreplace lists
@@ -119,9 +111,7 @@ void InvalidateAutoreplaceWindow(EngineID e, GroupID id_g)
*/
void AddRemoveEngineFromAutoreplaceAndBuildWindows(VehicleType type)
{
- _rebuild_left_list = false; // left list is only for the vehicles the player owns and is not related to being buildable
- _rebuild_right_list = true;
- InvalidateWindowData(WC_REPLACE_VEHICLE, type); // Update the autoreplace window
+ InvalidateWindowData(WC_REPLACE_VEHICLE, type, false); // Update the autoreplace window
InvalidateWindowClassesData(WC_BUILD_VEHICLE); // The build windows needs updating as well
}
@@ -470,9 +460,11 @@ static void ReplaceVehicleWndProc(Window *w, WindowEvent *e)
} break;
case WE_INVALIDATE_DATA:
- if (_rebuild_left_list) WP(w, replaceveh_d).update_left = true;
- if (_rebuild_right_list) WP(w, replaceveh_d).update_right = true;
- w->SetDirty();
+ if (e->we.invalidate.data == true) {
+ WP(w, replaceveh_d).update_left = true;
+ } else {
+ WP(w, replaceveh_d).update_right = true;
+ }
break;
case WE_DESTROY: