summaryrefslogtreecommitdiff
path: root/newgrf.c
diff options
context:
space:
mode:
authorpeter1138 <peter1138@openttd.org>2006-04-20 13:33:40 +0000
committerpeter1138 <peter1138@openttd.org>2006-04-20 13:33:40 +0000
commit9ed8c6d4acea5c41246d3fa54301d4a0cc814985 (patch)
treea4293081de1ea050c6764d3a8961ef11264725aa /newgrf.c
parent62145d16b55aaf13451f7c6595d4675ff0499b47 (diff)
downloadopenttd-9ed8c6d4acea5c41246d3fa54301d4a0cc814985.tar.xz
(svn r4483) - NewGRF: Dynamically allocate memory for 'real' spritegroups. This removes the limit of 16 loading/unloading states, although will result in less memory usage as most of the time the full fixed allocation wasn't used.
Diffstat (limited to 'newgrf.c')
-rw-r--r--newgrf.c12
1 files changed, 3 insertions, 9 deletions
diff --git a/newgrf.c b/newgrf.c
index a5efdff4d..f3a886134 100644
--- a/newgrf.c
+++ b/newgrf.c
@@ -1480,15 +1480,6 @@ static void NewSpriteGroup(byte *buf, int len)
if (_cur_grffile->first_spriteset == 0)
_cur_grffile->first_spriteset = _cur_grffile->spriteset_start;
- if (numloaded > 16) {
- grfmsg(GMS_WARN, "NewSpriteGroup: More than 16 sprites in group %x, skipping the rest.", setid);
- numloaded = 16;
- }
- if (numloading > 16) {
- grfmsg(GMS_WARN, "NewSpriteGroup: More than 16 sprites in group %x, skipping the rest.", setid);
- numloading = 16;
- }
-
group = calloc(1, sizeof(*group));
group->type = SGT_REAL;
rg = &group->g.real;
@@ -1497,6 +1488,9 @@ static void NewSpriteGroup(byte *buf, int len)
rg->loaded_count = numloaded;
rg->loading_count = numloading;
+ rg->loaded = calloc(rg->loaded_count, sizeof(*rg->loaded));
+ rg->loading = calloc(rg->loading_count, sizeof(*rg->loading));
+
DEBUG(grf, 6) ("NewSpriteGroup: New SpriteGroup 0x%02hhx, %u views, %u loaded, %u loading, sprites %u - %u",
setid, rg->sprites_per_set, rg->loaded_count, rg->loading_count,
_cur_grffile->spriteset_start - _cur_grffile->sprite_offset,