summaryrefslogtreecommitdiff
path: root/src/newgrf_town.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2008-04-15 22:27:28 +0000
committerrubidium <rubidium@openttd.org>2008-04-15 22:27:28 +0000
commit9d3a08523addb530bec6d02c09c1858856baca2f (patch)
treeb984bc7889cfdc2c91f3964301cf6d325ac896ea /src/newgrf_town.cpp
parent9346e067f39870943d979ae5deb82f831190dc25 (diff)
downloadopenttd-9d3a08523addb530bec6d02c09c1858856baca2f.tar.xz
(svn r12726) -Fix [FS#1877]: overflow causing strange building behaviour in towns.
Diffstat (limited to 'src/newgrf_town.cpp')
-rw-r--r--src/newgrf_town.cpp20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/newgrf_town.cpp b/src/newgrf_town.cpp
index d28fe9938..a15203fb7 100644
--- a/src/newgrf_town.cpp
+++ b/src/newgrf_town.cpp
@@ -36,16 +36,16 @@ uint32 TownGetVariable(byte variable, byte parameter, bool *available, const Tow
case 0x8A: return t->grow_counter;
case 0x92: return t->flags12; // In original game, 0x92 and 0x93 are really one word. Since flags12 is a byte, this is to adjust
case 0x93: return 0;
- case 0x94: return t->radius[0];
- case 0x95: return GB(t->radius[0], 8, 8);
- case 0x96: return t->radius[1];
- case 0x97: return GB(t->radius[1], 8, 8);
- case 0x98: return t->radius[2];
- case 0x99: return GB(t->radius[2], 8, 8);
- case 0x9A: return t->radius[3];
- case 0x9B: return GB(t->radius[3], 8, 8);
- case 0x9C: return t->radius[4];
- case 0x9D: return GB(t->radius[4], 8, 8);
+ case 0x94: return ClampToU16(t->squared_town_zone_radius[0]);
+ case 0x95: return GB(ClampToU16(t->squared_town_zone_radius[0]), 8, 8);
+ case 0x96: return ClampToU16(t->squared_town_zone_radius[1]);
+ case 0x97: return GB(ClampToU16(t->squared_town_zone_radius[1]), 8, 8);
+ case 0x98: return ClampToU16(t->squared_town_zone_radius[2]);
+ case 0x99: return GB(ClampToU16(t->squared_town_zone_radius[2]), 8, 8);
+ case 0x9A: return ClampToU16(t->squared_town_zone_radius[3]);
+ case 0x9B: return GB(ClampToU16(t->squared_town_zone_radius[3]), 8, 8);
+ case 0x9C: return ClampToU16(t->squared_town_zone_radius[4]);
+ case 0x9D: return GB(ClampToU16(t->squared_town_zone_radius[4]), 8, 8);
case 0x9E: return t->ratings[0];
case 0x9F: return GB(t->ratings[0], 8, 8);
case 0xA0: return t->ratings[1];