(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.

This commit is contained in:
rubidium
2009-03-04 23:32:23 +00:00
parent 0860685417
commit b9aa5e17f2
4 changed files with 103 additions and 61 deletions

View File

@@ -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();
}