diff options
author | rubidium <rubidium@openttd.org> | 2007-01-10 18:56:51 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2007-01-10 18:56:51 +0000 |
commit | a7d0cdf95fd8847ab76b35446e1c9b77f8ef1cb7 (patch) | |
tree | 1a1c59c13ddb1d152052f3a3a0bcffe4fb531173 /src/newgrf_engine.cpp | |
parent | ce75f6549dd379b506c9f1e9383bd881aa7cf5c7 (diff) | |
download | openttd-a7d0cdf95fd8847ab76b35446e1c9b77f8ef1cb7.tar.xz |
(svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
Diffstat (limited to 'src/newgrf_engine.cpp')
-rw-r--r-- | src/newgrf_engine.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/newgrf_engine.cpp b/src/newgrf_engine.cpp index 0662f3fc8..5b0fa5179 100644 --- a/src/newgrf_engine.cpp +++ b/src/newgrf_engine.cpp @@ -17,6 +17,7 @@ #include "newgrf_spritegroup.h" #include "newgrf_cargo.h" #include "date.h" +#include "helpers.hpp" @@ -82,8 +83,7 @@ void SetWagonOverrideSprites(EngineID engine, CargoID cargo, const SpriteGroup * wos = &_engine_wagon_overrides[engine]; wos->overrides_count++; - wos->overrides = realloc(wos->overrides, - wos->overrides_count * sizeof(*wos->overrides)); + ReallocT(&wos->overrides, wos->overrides_count); wo = &wos->overrides[wos->overrides_count - 1]; /* FIXME: If we are replacing an override, release original SpriteGroup @@ -92,7 +92,7 @@ void SetWagonOverrideSprites(EngineID engine, CargoID cargo, const SpriteGroup * wo->group = group; wo->cargo = cargo; wo->trains = trains; - wo->train_id = malloc(trains); + MallocT(&wo->train_id, trains); memcpy(wo->train_id, train_id, trains); } @@ -563,7 +563,7 @@ static uint32 VehicleGetVariable(const ResolverObject *object, byte variable, by } *available = false; - return -1; + return UINT_MAX; } /* Calculated vehicle parameters */ @@ -628,7 +628,7 @@ static uint32 VehicleGetVariable(const ResolverObject *object, byte variable, by return v->owner; case 0x44: /* Aircraft information */ - if (v->type != VEH_Aircraft) return -1; + if (v->type != VEH_Aircraft) return UINT_MAX; { const Vehicle *w = v->next; @@ -806,7 +806,7 @@ static uint32 VehicleGetVariable(const ResolverObject *object, byte variable, by DEBUG(grf, 1, "Unhandled vehicle property 0x%X, type 0x%X", variable, v->type); *available = false; - return -1; + return UINT_MAX; } |