summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpeter1138 <peter1138@openttd.org>2007-02-01 01:40:46 +0000
committerpeter1138 <peter1138@openttd.org>2007-02-01 01:40:46 +0000
commit74c842a3ef095688b81c48d28af935e98fa7f553 (patch)
tree0703107fb3563cbe8f9cfc8e33396f9dd2bdb175
parentd8edc2bb98d3e15c53a4174e91e6882b1f835235 (diff)
downloadopenttd-74c842a3ef095688b81c48d28af935e98fa7f553.tar.xz
(svn r8505) -Codechange: Ensure GRM allocated sprites will be below the original 16384 sprite limit. If not, fail and disable the NewGRF.
-rw-r--r--src/newgrf.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/newgrf.cpp b/src/newgrf.cpp
index 7d3277a0e..e253cda38 100644
--- a/src/newgrf.cpp
+++ b/src/newgrf.cpp
@@ -2826,6 +2826,16 @@ static void ParamSet(byte *buf, int len)
case 0x08: /* General sprites */
switch (op) {
case 0:
+ /* Check if the allocated sprites will fit below the original sprite limit */
+ if (_cur_spriteid + count >= 16384) {
+ grfmsg(0, "GRM: Unable to allocate %d sprites; try changing NewGRF order", count);
+ SETBIT(_cur_grfconfig->flags, GCF_DISABLED);
+ CLRBIT(_cur_grfconfig->flags, GCF_ACTIVATED);
+
+ _skip_sprites = -1;
+ return;
+ }
+
/* 'Reserve' space at the current sprite ID */
src1 = _cur_spriteid;
_cur_spriteid += count;