summaryrefslogtreecommitdiff
path: root/src/vehicle_gui.cpp
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2011-02-23 20:54:55 +0000
committerfrosch <frosch@openttd.org>2011-02-23 20:54:55 +0000
commit19b7249adee1dba623ba4ee69266cd13888deb3d (patch)
tree4f399e2587ff32b008c60b8f6211e1f7021f5210 /src/vehicle_gui.cpp
parent40cc3324fadce60522e97791604ae3a6643f4c2e (diff)
downloadopenttd-19b7249adee1dba623ba4ee69266cd13888deb3d.tar.xz
(svn r22135) -Fix [FS#4523]: When commands need to invalidate windows, process these events asynchronously before the next redraw. Calling window code directly from command scope uses wrong _current_company and might issue nested DoCommands() which interfer with the running command.
Diffstat (limited to 'src/vehicle_gui.cpp')
-rw-r--r--src/vehicle_gui.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/vehicle_gui.cpp b/src/vehicle_gui.cpp
index 96580dac9..61ef82ef5 100644
--- a/src/vehicle_gui.cpp
+++ b/src/vehicle_gui.cpp
@@ -585,6 +585,7 @@ struct RefitWindow : public Window {
*/
StringID GetCapacityString(RefitOption *option) const
{
+ assert(_current_company == _local_company);
Vehicle *v = Vehicle::Get(this->window_number);
CommandCost cost = DoCommand(v->tile, this->selected_vehicle, option->cargo | option->subtype << 8 |
this->num_vehicles << 16, DC_QUERY_COST, GetCmdRefitVeh(v->type));
@@ -1119,7 +1120,7 @@ static inline void ChangeVehicleWindow(WindowClass window_class, VehicleID from_
_thd.window_number = to_index;
}
- /* Notify the window */
+ /* Notify the window immediatelly, without scheduling. */
w->InvalidateData();
}
}