From ed462507b26229732ebe45ea0a2583809ff90ee8 Mon Sep 17 00:00:00 2001 From: smatz Date: Sun, 1 Jun 2008 15:08:14 +0000 Subject: (svn r13351) -Codechange: disable warnings about unused variable for builds without asserts --- src/blitter/factory.hpp | 7 ++----- src/driver.cpp | 6 +----- src/gfxinit.cpp | 4 ---- src/newgrf_engine.cpp | 12 ++++-------- src/town_cmd.cpp | 6 +----- 5 files changed, 8 insertions(+), 27 deletions(-) (limited to 'src') diff --git a/src/blitter/factory.hpp b/src/blitter/factory.hpp index bd0a6daa8..f9dd9c463 100644 --- a/src/blitter/factory.hpp +++ b/src/blitter/factory.hpp @@ -43,11 +43,8 @@ protected: if (name == NULL) return; this->name = strdup(name); -#if !defined(NDEBUG) || defined(WITH_ASSERT) - /* NDEBUG disables asserts and gives a warning: unused variable 'P' */ - std::pair P = -#endif /* !NDEBUG */ - GetBlitters().insert(Blitters::value_type(name, this)); + + std::pair P = GetBlitters().insert(Blitters::value_type(name, this)); assert(P.second); } diff --git a/src/driver.cpp b/src/driver.cpp index a71f21cc7..202b84fab 100644 --- a/src/driver.cpp +++ b/src/driver.cpp @@ -156,11 +156,7 @@ void DriverFactoryBase::RegisterDriver(const char *name, Driver::Type type, int strecpy(buf, GetDriverTypeName(type), lastof(buf)); strecpy(buf + 5, name, lastof(buf)); -#if !defined(NDEBUG) || defined(WITH_ASSERT) - /* NDEBUG disables asserts and gives a warning: unused variable 'P' */ - std::pair P = -#endif /* !NDEBUG */ - GetDrivers().insert(Drivers::value_type(buf, this)); + std::pair P = GetDrivers().insert(Drivers::value_type(buf, this)); assert(P.second); } diff --git a/src/gfxinit.cpp b/src/gfxinit.cpp index fe79abf77..8b04b1517 100644 --- a/src/gfxinit.cpp +++ b/src/gfxinit.cpp @@ -71,12 +71,8 @@ void LoadSpritesIndexed(int file_index, uint *sprite_id, const SpriteID *index_t uint end = *index_tbl++; do { - #ifdef NDEBUG - LoadNextSprite(start, file_index, *sprite_id); - #else bool b = LoadNextSprite(start, file_index, *sprite_id); assert(b); - #endif (*sprite_id)++; } while (++start <= end); } diff --git a/src/newgrf_engine.cpp b/src/newgrf_engine.cpp index 039c2a186..e0355d3d4 100644 --- a/src/newgrf_engine.cpp +++ b/src/newgrf_engine.cpp @@ -886,23 +886,19 @@ SpriteID GetCustomEngineSprite(EngineID engine, const Vehicle *v, Direction dire SpriteID GetRotorOverrideSprite(EngineID engine, const Vehicle *v, bool info_view) { - #if !defined(NDEBUG) || defined(WITH_ASSERT) const Engine *e = GetEngine(engine); - #endif /* !defined(NDEBUG) || defined(WITH_ASSERT) */ - - const SpriteGroup *group; - ResolverObject object; - - assert(e->type == VEH_AIRCRAFT); /* Only valid for helicopters */ + assert(e->type == VEH_AIRCRAFT); assert(!(e->u.air.subtype & AIR_CTOL)); + ResolverObject object; + NewVehicleResolver(&object, engine, v); object.info_view = info_view; - group = GetWagonOverrideSpriteSet(engine, CT_DEFAULT, engine); + const SpriteGroup *group = GetWagonOverrideSpriteSet(engine, CT_DEFAULT, engine); group = Resolve(group, &object); if (group == NULL || group->type != SGT_RESULT) return 0; diff --git a/src/town_cmd.cpp b/src/town_cmd.cpp index a8b6d9135..c3dc04842 100644 --- a/src/town_cmd.cpp +++ b/src/town_cmd.cpp @@ -1639,11 +1639,7 @@ HouseZonesBits GetTownRadiusGroup(const Town *t, TileIndex tile) */ static inline void ClearMakeHouseTile(TileIndex tile, TownID tid, byte counter, byte stage, HouseID type, byte random_bits) { - #if !defined(NDEBUG) || defined(WITH_ASSERT) - CommandCost cc = - #endif /* !defined(NDEBUG) || defined(WITH_ASSERT) */ - - DoCommand(tile, 0, 0, DC_EXEC | DC_AUTO | DC_NO_WATER, CMD_LANDSCAPE_CLEAR); + CommandCost cc = DoCommand(tile, 0, 0, DC_EXEC | DC_AUTO | DC_NO_WATER, CMD_LANDSCAPE_CLEAR); assert(CmdSucceeded(cc)); -- cgit v1.2.3-70-g09d2