mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-03-06 06:15:04 +00:00
(svn r13035) -Codechange: remove two needless global-ish variables.
This commit is contained in:
parent
3749323e23
commit
c32559ac12
@ -40,9 +40,6 @@ assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(replaceveh_d));
|
|||||||
|
|
||||||
static RailType _railtype_selected_in_replace_gui;
|
static RailType _railtype_selected_in_replace_gui;
|
||||||
|
|
||||||
static bool _rebuild_left_list;
|
|
||||||
static bool _rebuild_right_list;
|
|
||||||
|
|
||||||
static const StringID _rail_types_list[] = {
|
static const StringID _rail_types_list[] = {
|
||||||
STR_RAIL_VEHICLES,
|
STR_RAIL_VEHICLES,
|
||||||
STR_ELRAIL_VEHICLES,
|
STR_ELRAIL_VEHICLES,
|
||||||
@ -99,19 +96,14 @@ void InitializeVehiclesGuiList()
|
|||||||
void InvalidateAutoreplaceWindow(EngineID e, GroupID id_g)
|
void InvalidateAutoreplaceWindow(EngineID e, GroupID id_g)
|
||||||
{
|
{
|
||||||
Player *p = GetPlayer(_local_player);
|
Player *p = GetPlayer(_local_player);
|
||||||
VehicleType type = GetEngine(e)->type;
|
|
||||||
uint num_engines = GetGroupNumEngines(_local_player, id_g, e);
|
uint num_engines = GetGroupNumEngines(_local_player, id_g, e);
|
||||||
|
|
||||||
if (num_engines == 0 || p->num_engines[e] == 0) {
|
if (num_engines == 0 || p->num_engines[e] == 0) {
|
||||||
/* We don't have any of this engine type.
|
/* 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.
|
* 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 */
|
* In all cases, we need to update the left list */
|
||||||
_rebuild_left_list = true;
|
InvalidateWindowData(WC_REPLACE_VEHICLE, GetEngine(e)->type, true);
|
||||||
} else {
|
|
||||||
_rebuild_left_list = false;
|
|
||||||
}
|
}
|
||||||
_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
|
/** 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)
|
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
|
InvalidateWindowData(WC_REPLACE_VEHICLE, type, false); // Update the autoreplace window
|
||||||
_rebuild_right_list = true;
|
|
||||||
InvalidateWindowData(WC_REPLACE_VEHICLE, type); // Update the autoreplace window
|
|
||||||
InvalidateWindowClassesData(WC_BUILD_VEHICLE); // The build windows needs updating as well
|
InvalidateWindowClassesData(WC_BUILD_VEHICLE); // The build windows needs updating as well
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -470,9 +460,11 @@ static void ReplaceVehicleWndProc(Window *w, WindowEvent *e)
|
|||||||
} break;
|
} break;
|
||||||
|
|
||||||
case WE_INVALIDATE_DATA:
|
case WE_INVALIDATE_DATA:
|
||||||
if (_rebuild_left_list) WP(w, replaceveh_d).update_left = true;
|
if (e->we.invalidate.data == true) {
|
||||||
if (_rebuild_right_list) WP(w, replaceveh_d).update_right = true;
|
WP(w, replaceveh_d).update_left = true;
|
||||||
w->SetDirty();
|
} else {
|
||||||
|
WP(w, replaceveh_d).update_right = true;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WE_DESTROY:
|
case WE_DESTROY:
|
||||||
|
Loading…
Reference in New Issue
Block a user