From ec28f947aa3d7ac94a1cfeb6d86c15c81252ee03 Mon Sep 17 00:00:00 2001 From: peter1138 Date: Wed, 12 Oct 2005 09:54:29 +0000 Subject: (svn r3034) -NewGRF: Improve error checking of setting price bases. --- newgrf.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'newgrf.c') 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: -- cgit v1.2.3-54-g00ecf