Changeset - r23147:1747db3d2973
[Not reviewed]
master
0 2 0
Joan Josep - 5 years ago 2019-01-13 22:29:17
juanjo.ng.83@gmail.com
Fix #5978: Ensure group GUI stats and lists are invalidated properly (3298, Juanjo) (#7046)
2 files changed with 7 insertions and 2 deletions:
0 comments (0 inline, 0 general)
src/autoreplace_cmd.cpp
Show inline comments
 
@@ -19,6 +19,7 @@
 
#include "autoreplace_gui.h"
 
#include "articulated_vehicles.h"
 
#include "core/random_func.hpp"
 
#include "vehiclelist.h"
 

	
 
#include "table/strings.h"
 

	
 
@@ -777,6 +778,9 @@ CommandCost CmdSetAutoReplace(TileIndex 
 
	if (flags & DC_EXEC) {
 
		GroupStatistics::UpdateAutoreplace(_current_company);
 
		if (IsLocalCompany()) SetWindowDirty(WC_REPLACE_VEHICLE, Engine::Get(old_engine_type)->type);
 

	
 
		const VehicleType vt = Engine::Get(old_engine_type)->type;
 
		SetWindowDirty(GetWindowClassForVehicleType(vt), VehicleListIdentifier(VL_GROUP_LIST, vt, _current_company).Pack());
 
	}
 
	if ((flags & DC_EXEC) && IsLocalCompany()) InvalidateAutoreplaceWindow(old_engine_type, id_g);
 

	
src/group_cmd.cpp
Show inline comments
 
@@ -232,7 +232,7 @@ void GroupStatistics::Clear()
 
			stats.autoreplace_defined = true;
 
			stats.autoreplace_finished = true;
 
		}
 
		if (stats.num_engines[erl->from] > 0) stats.autoreplace_finished = false;
 
		if (GetGroupNumEngines(company, erl->group_id, erl->from) > 0) stats.autoreplace_finished = false;
 
	}
 
}
 

	
 
@@ -409,11 +409,12 @@ CommandCost CmdAlterGroup(TileIndex tile
 

	
 
		if (flags & DC_EXEC) {
 
			g->parent = (pg == NULL) ? INVALID_GROUP : pg->index;
 
			GroupStatistics::UpdateAutoreplace(g->owner);
 
		}
 
	}
 

	
 
	if (flags & DC_EXEC) {
 
		SetWindowDirty(WC_REPLACE_VEHICLE, g->vehicle_type);
 
		InvalidateWindowData(WC_REPLACE_VEHICLE, g->vehicle_type, 1);
 
		InvalidateWindowData(GetWindowClassForVehicleType(g->vehicle_type), VehicleListIdentifier(VL_GROUP_LIST, g->vehicle_type, _current_company).Pack());
 
	}
 

	
0 comments (0 inline, 0 general)