summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbelugas <belugas@openttd.org>2009-01-29 03:07:34 +0000
committerbelugas <belugas@openttd.org>2009-01-29 03:07:34 +0000
commit31adec86a0340b13eb50f84d44bb3e71b2648cde (patch)
tree0ad658a910ea1438adc2b6179d7cb216b07c9366
parent0e42a7bac73bb55f8a740ccc1aef388677ad28e8 (diff)
downloadopenttd-31adec86a0340b13eb50f84d44bb3e71b2648cde.tar.xz
(svn r15292) -Fix(r15290): Incrementing something that is already set to the correct value is a bit of a no-no
Also, protect against such misuse with an assert.
-rw-r--r--src/unmovable_map.h3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/unmovable_map.h b/src/unmovable_map.h
index 91782728b..0dd11e7dc 100644
--- a/src/unmovable_map.h
+++ b/src/unmovable_map.h
@@ -166,8 +166,7 @@ static inline void SetCompanyHQSection(TileIndex t, uint8 section)
static inline void EnlargeCompanyHQ(TileIndex t, byte size)
{
assert(GetCompanyHQSection(t) == 0);
-
- size++;
+ assert(size <= 4);
if (size <= GetCompanyHQSize(t)) return;
SetCompanyHQSize(t , size);