summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2011-05-17 20:11:19 +0000
committerfrosch <frosch@openttd.org>2011-05-17 20:11:19 +0000
commitbc6b348e7a67b758fd4de5268941226380e5be24 (patch)
treecda9cd898e385babc9de55be910713fd8140286a /src
parent64cf7202342767e4b9df6c90c48cd414c920e626 (diff)
downloadopenttd-bc6b348e7a67b758fd4de5268941226380e5be24.tar.xz
(svn r22472) -Fix: When a NewGRF assigned station properties 09 and/or 0A multiple times, the previously allocated sprite layouts were not freed.
Diffstat (limited to 'src')
-rw-r--r--src/newgrf.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/newgrf.cpp b/src/newgrf.cpp
index f5acb8625..51002f721 100644
--- a/src/newgrf.cpp
+++ b/src/newgrf.cpp
@@ -1221,6 +1221,8 @@ static ChangeInfoResult StationChangeInfo(uint stid, int numinfo, int prop, Byte
}
case 0x09: // Define sprite layout
+ delete[] statspec->renderdata; // delete earlier loaded stuff
+
statspec->tiles = buf->ReadExtendedByte();
statspec->renderdata = new NewGRFSpriteLayout[statspec->tiles];
@@ -1281,6 +1283,8 @@ static ChangeInfoResult StationChangeInfo(uint stid, int numinfo, int prop, Byte
continue;
}
+ delete[] statspec->renderdata; // delete earlier loaded stuff
+
statspec->tiles = srcstatspec->tiles;
statspec->renderdata = new NewGRFSpriteLayout[statspec->tiles];
for (uint t = 0; t < statspec->tiles; t++) {