From c0d71b84f983070462a83cc60a17083d5ede4e50 Mon Sep 17 00:00:00 2001 From: rubidium Date: Wed, 4 Mar 2009 23:32:23 +0000 Subject: (svn r15617) -Change [FS#2694]: vehicle variables 40-43 weren't cached (though spec stated they are). Caching these variables can yield a 10+% speed increase when those vehicle variables are queried often. --- src/misc_cmd.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/misc_cmd.cpp') diff --git a/src/misc_cmd.cpp b/src/misc_cmd.cpp index d12b57743..aeda6f754 100644 --- a/src/misc_cmd.cpp +++ b/src/misc_cmd.cpp @@ -19,6 +19,7 @@ #include "company_base.h" #include "company_gui.h" #include "settings_type.h" +#include "vehicle_base.h" #include "table/strings.h" @@ -118,6 +119,12 @@ CommandCost CmdSetCompanyColour(TileIndex tile, DoCommandFlag flags, uint32 p1, } ResetVehicleColourMap(); MarkWholeScreenDirty(); + + /* Company colour data is indirectly cached. */ + Vehicle *v; + FOR_ALL_VEHICLES(v) { + if (v->owner == _current_company) v->cache_valid = 0; + } } return CommandCost(); } -- cgit v1.2.3-54-g00ecf