diff options
author | rubidium <rubidium@openttd.org> | 2009-03-04 23:32:23 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2009-03-04 23:32:23 +0000 |
commit | c0d71b84f983070462a83cc60a17083d5ede4e50 (patch) | |
tree | 6aadaed591e7438c99bc3a02917a8c6e577ee422 /src/misc_cmd.cpp | |
parent | 890c5e3ae42bd7d9f904ba6c69f3c4ac3649cdf5 (diff) | |
download | openttd-c0d71b84f983070462a83cc60a17083d5ede4e50.tar.xz |
(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.
Diffstat (limited to 'src/misc_cmd.cpp')
-rw-r--r-- | src/misc_cmd.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
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(); } |