(svn r11352) -Codechange: cache callback 2D result (vehicle color mapping) instead calling it every time the vehicle is drawn

This commit is contained in:
glx
2007-10-28 15:40:18 +00:00
parent e6116d11b8
commit 6120d02751
4 changed files with 26 additions and 2 deletions

View File

@@ -41,6 +41,7 @@
#include "date.h"
#include "cargotype.h"
#include "group.h"
#include "table/sprites.h"
static bool TrainCheckIfLineEnds(Vehicle *v);
static void TrainController(Vehicle *v, bool update_image);
@@ -176,6 +177,9 @@ void TrainConsistChanged(Vehicle* v)
/* Cache wagon override sprite group. NULL is returned if there is none */
u->u.rail.cached_override = GetWagonOverrideSpriteSet(u->engine_type, u->cargo_type, u->u.rail.first_engine);
/* Reset color map */
u->colormap = PAL_NONE;
if (rvi_u->visual_effect != 0) {
u->u.rail.cached_vis_effect = rvi_u->visual_effect;
} else {