summaryrefslogtreecommitdiff
path: root/src/newgrf_spritegroup.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2008-04-21 14:33:33 +0000
committerrubidium <rubidium@openttd.org>2008-04-21 14:33:33 +0000
commit5ef8c01ce7d7b554d678d5270baafb1146c80b57 (patch)
tree4c1ef67d89a0fbc13b10c3ed8a9880350b14ab12 /src/newgrf_spritegroup.cpp
parent22140d82c6efb1a6a03e1e4db0eca48766dce8ba (diff)
downloadopenttd-5ef8c01ce7d7b554d678d5270baafb1146c80b57.tar.xz
(svn r12819) -Codechange: handle more NewGRFs in the same way as TTDP does it, i.e. testing the low bits for 0xFF or 0 instead of all bits.
Diffstat (limited to 'src/newgrf_spritegroup.cpp')
-rw-r--r--src/newgrf_spritegroup.cpp41
1 files changed, 1 insertions, 40 deletions
diff --git a/src/newgrf_spritegroup.cpp b/src/newgrf_spritegroup.cpp
index 5e866d51d..b8103ae02 100644
--- a/src/newgrf_spritegroup.cpp
+++ b/src/newgrf_spritegroup.cpp
@@ -80,37 +80,6 @@ void InitializeSpriteGroupPool()
TemporaryStorageArray<uint32, 0x110> _temp_store;
-static inline bool Is8BitCallback(const ResolverObject *object)
-{
- /* Var 0x7E procedure results are always 15 bit */
- if (object == NULL || object->procedure_call) return false;
-
- switch (object->callback) {
- /* All these functions are 15 bit callbacks */
- case CBID_STATION_SPRITE_LAYOUT:
- case CBID_VEHICLE_REFIT_CAPACITY:
- case CBID_HOUSE_COLOUR:
- case CBID_HOUSE_CARGO_ACCEPTANCE:
- case CBID_INDUSTRY_LOCATION:
- case CBID_HOUSE_ACCEPT_CARGO:
- case CBID_INDTILE_CARGO_ACCEPTANCE:
- case CBID_INDTILE_ACCEPT_CARGO:
- case CBID_VEHICLE_COLOUR_MAPPING:
- case CBID_HOUSE_PRODUCE_CARGO:
- case CBID_INDTILE_SHAPE_CHECK:
- case CBID_VEHICLE_SOUND_EFFECT:
- case CBID_VEHICLE_MODIFY_PROPERTY: // depends on queried property
- case CBID_CARGO_PROFIT_CALC:
- case CBID_SOUNDS_AMBIENT_EFFECT:
- case CBID_CARGO_STATION_RATING_CALC:
- return false;
-
- /* The rest is a 8 bit callback, which should be truncated properly */
- default:
- return true;
- }
-}
-
static inline uint32 GetVariable(const ResolverObject *object, byte variable, byte parameter, bool *available)
{
/* First handle variables common with Action7/9/D */
@@ -236,7 +205,7 @@ static inline const SpriteGroup *ResolveVariable(const SpriteGroup *group, Resol
if (group->g.determ.num_ranges == 0) {
/* nvar == 0 is a special case -- we turn our value into a callback result */
nvarzero.type = SGT_CALLBACK;
- nvarzero.g.callback.result = GB(value, 0, Is8BitCallback(object) ? 8 : 15);
+ nvarzero.g.callback.result = value;
return &nvarzero;
}
@@ -295,14 +264,6 @@ const SpriteGroup *Resolve(const SpriteGroup *group, ResolverObject *object)
case SGT_REAL: return object->ResolveReal(object, group);
case SGT_DETERMINISTIC: return ResolveVariable(group, object);
case SGT_RANDOMIZED: return ResolveRandom(group, object);
- case SGT_CALLBACK: {
- if (!Is8BitCallback(object)) return group;
-
- static SpriteGroup result8bit;
- result8bit.type = SGT_CALLBACK;
- result8bit.g.callback.result = GB(group->g.callback.result, 0, 8);
- return &result8bit;
- }
default: return group;
}
}