1
0
mirror of https://github.com/OpenTTD/OpenTTD synced 2026-01-20 19:02:41 +01:00

(svn r24423) [1.2] -Backport from trunk:

- Fix: ReInit could crash for windows with NWidgetMatrix widgets [FS#5218] (r24378)
- Fix: [NewGRF] Extended action A1 did not work correctly [FS#5227] (r24369, r24361)
- Fix: Add C(XX)FLAGS_BUILD to all the executables that are compiled for the build enviroment (r24365)
- Fix: [NewGRF] Ship-specific 80+x variables were missing for unknown reason [FS#5224] (r24360)
This commit is contained in:
rubidium
2012-07-20 19:42:00 +00:00
parent 975b6de604
commit b704037039
6 changed files with 42 additions and 23 deletions

View File

@@ -4384,11 +4384,13 @@ static void ReserveChangeInfo(ByteReader *buf)
/* Action 0x01 */
static void NewSpriteSet(ByteReader *buf)
{
/* <01> <feature> <num-sets> <num-ent>
/* Basic format: <01> <feature> <num-sets> <num-ent>
* Extended format: <01> <feature> 00 <first-set> <num-sets> <num-ent>
*
* B feature feature to define sprites for
* 0, 1, 2, 3: veh-type, 4: train stations
* B num-sets number of sprite sets
* E first-set first sprite set to define
* B num-sets number of sprite sets (extended byte in extended format)
* E num-ent how many entries per sprite set
* For vehicles, this is the number of different
* vehicle directions in each sprite set
@@ -4396,11 +4398,11 @@ static void NewSpriteSet(ByteReader *buf)
* In that case, use num-dirs=4.
*/
uint8 feature = buf->ReadByte();
uint8 num_sets = buf->ReadByte();
uint8 feature = buf->ReadByte();
uint16 num_sets = buf->ReadByte();
uint16 first_set = 0;
if (num_sets == 0 && buf->HasData(2)) {
if (num_sets == 0 && buf->HasData(3)) {
/* Extended Action1 format.
* Some GRFs define zero sets of zero sprites, though there is actually no use in that. Ignore them. */
first_set = buf->ReadExtendedByte();
@@ -4424,7 +4426,14 @@ static void NewSpriteSet(ByteReader *buf)
static void SkipAct1(ByteReader *buf)
{
buf->ReadByte();
uint8 num_sets = buf->ReadByte();
uint16 num_sets = buf->ReadByte();
if (num_sets == 0 && buf->HasData(3)) {
/* Extended Action1 format.
* Some GRFs define zero sets of zero sprites, though there is actually no use in that. Ignore them. */
buf->ReadExtendedByte(); // first_set
num_sets = buf->ReadExtendedByte();
}
uint16 num_ents = buf->ReadExtendedByte();
_cur.skip_sprites = num_sets * num_ents;