summaryrefslogtreecommitdiff
path: root/newgrf.c
diff options
context:
space:
mode:
authorpeter1138 <peter1138@openttd.org>2005-10-12 09:54:29 +0000
committerpeter1138 <peter1138@openttd.org>2005-10-12 09:54:29 +0000
commitec28f947aa3d7ac94a1cfeb6d86c15c81252ee03 (patch)
treef5a7c1c6a6479ae68b002a2fc606e9aff5153826 /newgrf.c
parent3fae53a61d9b17f91f7f3bc1665f3c920952708f (diff)
downloadopenttd-ec28f947aa3d7ac94a1cfeb6d86c15c81252ee03.tar.xz
(svn r3034) -NewGRF: Improve error checking of setting price bases.
Diffstat (limited to 'newgrf.c')
-rw-r--r--newgrf.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/newgrf.c b/newgrf.c
index 0693bcea1..e0876c8ec 100644
--- a/newgrf.c
+++ b/newgrf.c
@@ -1070,8 +1070,13 @@ static bool GlobalVarChangeInfo(uint gvid, int numinfo, int prop, byte **bufp, i
case 0x08: { /* Cost base factor */
FOR_EACH_OBJECT {
byte factor = grf_load_byte(&buf);
+ uint price = gvid + i;
- SetPriceBaseMultiplier(gvid + i, factor);
+ if (price < NUM_PRICES) {
+ SetPriceBaseMultiplier(price, factor);
+ } else {
+ grfmsg(GMS_WARN, "GlobalVarChangeInfo: Price %d out of range, ignoring.", price);
+ }
}
} break;
default: