Index: src/newgrf_engine.cpp =================================================================== --- src/newgrf_engine.cpp (revision 24932) +++ src/newgrf_engine.cpp (working copy) @@ -1015,6 +1015,7 @@ return e->grf_prop.spritegroup[CT_DEFAULT]; } +int _test_count = 0; SpriteID GetCustomEngineSprite(EngineID engine, const Vehicle *v, Direction direction, EngineImageType image_type) { @@ -1022,6 +1023,8 @@ const SpriteGroup *group = SpriteGroup::Resolve(GetVehicleSpriteGroup(engine, v), &object); if (group == NULL || group->GetNumResults() == 0) return 0; + _test_count++; + return group->GetResult() + (direction % group->GetNumResults()); } Index: src/viewport.cpp =================================================================== --- src/viewport.cpp (revision 24932) +++ src/viewport.cpp (working copy) @@ -1534,6 +1534,8 @@ } } +int _test_count2 = 0; + static inline void ViewportDraw(const ViewPort *vp, int left, int top, int right, int bottom) { if (right <= vp->left || bottom <= vp->top) return; @@ -1548,6 +1550,8 @@ if (top < vp->top) top = vp->top; if (bottom > vp->top + vp->height) bottom = vp->top + vp->height; + _test_count2++; + ViewportDrawChk(vp, left, top, right, bottom); } Index: src/openttd.cpp =================================================================== --- src/openttd.cpp (revision 24932) +++ src/openttd.cpp (working copy) @@ -1288,6 +1288,9 @@ } } +extern int _test_count; +extern int _test_count2; + /** * State controlling game loop. * The state must not be changed from anywhere but here. @@ -1345,6 +1348,12 @@ cur_company.Restore(); } + if (_tick_counter % 33 == 0) { + printf("Lookups %d, draws %d\n", _test_count, _test_count2); + _test_count = 0; + _test_count2 = 0; + } + assert(IsLocalCompany()); }