summaryrefslogtreecommitdiff
path: root/src/newgrf_cargo.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2009-05-23 12:13:42 +0000
committerrubidium <rubidium@openttd.org>2009-05-23 12:13:42 +0000
commitf490394aa8d78f4118e73beccc724cbad3b44854 (patch)
tree066d0254c6624bdb2646e30d9b43076fc7de6726 /src/newgrf_cargo.cpp
parentb270ca84ba0002ae23aed3bb614e06b19c7197f5 (diff)
downloadopenttd-f490394aa8d78f4118e73beccc724cbad3b44854.tar.xz
(svn r16396) -Codechange: split NewGRF spritegroup into multiple subclasses instead of using a big union
Diffstat (limited to 'src/newgrf_cargo.cpp')
-rw-r--r--src/newgrf_cargo.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/newgrf_cargo.cpp b/src/newgrf_cargo.cpp
index b0f262098..95f560edc 100644
--- a/src/newgrf_cargo.cpp
+++ b/src/newgrf_cargo.cpp
@@ -35,12 +35,12 @@ static uint32 CargoGetVariable(const ResolverObject *object, byte variable, byte
}
-static const SpriteGroup *CargoResolveReal(const ResolverObject *object, const SpriteGroup *group)
+static const SpriteGroup *CargoResolveReal(const ResolverObject *object, const RealSpriteGroup *group)
{
/* Cargo action 2s should always have only 1 "loaded" state, but some
* times things don't follow the spec... */
- if (group->g.real.num_loaded > 0) return group->g.real.loaded[0];
- if (group->g.real.num_loading > 0) return group->g.real.loading[0];
+ if (group->num_loaded > 0) return group->loaded[0];
+ if (group->num_loading > 0) return group->loading[0];
return NULL;
}
@@ -75,9 +75,9 @@ SpriteID GetCustomCargoSprite(const CargoSpec *cs)
NewCargoResolver(&object, cs);
group = Resolve(cs->group, &object);
- if (group == NULL || group->type != SGT_RESULT) return 0;
+ if (group == NULL) return 0;
- return group->g.result.sprite;
+ return group->GetResult();
}
@@ -92,9 +92,9 @@ uint16 GetCargoCallback(CallbackID callback, uint32 param1, uint32 param2, const
object.callback_param2 = param2;
group = Resolve(cs->group, &object);
- if (group == NULL || group->type != SGT_CALLBACK) return CALLBACK_FAILED;
+ if (group == NULL) return CALLBACK_FAILED;
- return group->g.callback.result;
+ return group->GetCallbackResult();
}