summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorsmatz <smatz@openttd.org>2008-06-01 15:08:14 +0000
committersmatz <smatz@openttd.org>2008-06-01 15:08:14 +0000
commited462507b26229732ebe45ea0a2583809ff90ee8 (patch)
treea69876051417b114e25b34280ada013d1522cee1 /src
parent10d6f6c5b841f8fb161a4715c74a043c11a70107 (diff)
downloadopenttd-ed462507b26229732ebe45ea0a2583809ff90ee8.tar.xz
(svn r13351) -Codechange: disable warnings about unused variable for builds without asserts
Diffstat (limited to 'src')
-rw-r--r--src/blitter/factory.hpp7
-rw-r--r--src/driver.cpp6
-rw-r--r--src/gfxinit.cpp4
-rw-r--r--src/newgrf_engine.cpp12
-rw-r--r--src/town_cmd.cpp6
5 files changed, 8 insertions, 27 deletions
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<Blitters::iterator, bool> P =
-#endif /* !NDEBUG */
- GetBlitters().insert(Blitters::value_type(name, this));
+
+ std::pair<Blitters::iterator, bool> 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<Drivers::iterator, bool> P =
-#endif /* !NDEBUG */
- GetDrivers().insert(Drivers::value_type(buf, this));
+ std::pair<Drivers::iterator, bool> 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));