equal
deleted
inserted
replaced
2215 case GSF_TRAIN: |
2215 case GSF_TRAIN: |
2216 case GSF_ROAD: |
2216 case GSF_ROAD: |
2217 case GSF_SHIP: |
2217 case GSF_SHIP: |
2218 case GSF_AIRCRAFT: |
2218 case GSF_AIRCRAFT: |
2219 case GSF_STATION: |
2219 case GSF_STATION: |
|
2220 case GSF_CARGOS: |
2220 { |
2221 { |
2221 byte sprites = _cur_grffile->spriteset_numents; |
2222 byte sprites = _cur_grffile->spriteset_numents; |
2222 byte num_loaded = type; |
2223 byte num_loaded = type; |
2223 byte num_loading = grf_load_byte(&buf); |
2224 byte num_loading = grf_load_byte(&buf); |
2224 |
2225 |
2554 |
2555 |
2555 hs->spritegroup = _cur_grffile->spritegroups[groupid]; |
2556 hs->spritegroup = _cur_grffile->spritegroups[groupid]; |
2556 } |
2557 } |
2557 } |
2558 } |
2558 |
2559 |
|
2560 |
|
2561 static void CargoMapSpriteGroup(byte *buf, uint8 idcount, uint8 cidcount) |
|
2562 { |
|
2563 byte *bp = &buf[4 + idcount + cidcount * 3]; |
|
2564 uint16 groupid = grf_load_word(&bp); |
|
2565 |
|
2566 if (groupid >= _cur_grffile->spritegroups_count || _cur_grffile->spritegroups[groupid] == NULL) { |
|
2567 grfmsg(1, "FeatureMapSpriteGroup: Spriteset 0x%04X out of range 0x%X or empty, skipping.", |
|
2568 groupid, _cur_grffile->spritegroups_count); |
|
2569 return; |
|
2570 } |
|
2571 |
|
2572 for (uint i = 0; i < idcount; i++) { |
|
2573 CargoID cid = buf[3 + i]; |
|
2574 |
|
2575 if (cid >= NUM_CARGO) { |
|
2576 grfmsg(1, "FeatureMapSpriteGroup: Cargo ID %d out of range, skipping"); |
|
2577 continue; |
|
2578 } |
|
2579 |
|
2580 CargoSpec *cs = &_cargo[cid]; |
|
2581 cs->grfid = _cur_grffile->grfid; |
|
2582 cs->group = _cur_grffile->spritegroups[groupid]; |
|
2583 } |
|
2584 } |
|
2585 |
|
2586 |
2559 /* Action 0x03 */ |
2587 /* Action 0x03 */ |
2560 static void FeatureMapSpriteGroup(byte *buf, int len) |
2588 static void FeatureMapSpriteGroup(byte *buf, int len) |
2561 { |
2589 { |
2562 /* <03> <feature> <n-id> <ids>... <num-cid> [<cargo-type> <cid>]... <def-cid> |
2590 /* <03> <feature> <n-id> <ids>... <num-cid> [<cargo-type> <cid>]... <def-cid> |
2563 * id-list := [<id>] [id-list] |
2591 * id-list := [<id>] [id-list] |
2610 StationMapSpriteGroup(buf, idcount, cidcount); |
2638 StationMapSpriteGroup(buf, idcount, cidcount); |
2611 return; |
2639 return; |
2612 |
2640 |
2613 case GSF_TOWNHOUSE: |
2641 case GSF_TOWNHOUSE: |
2614 TownHouseMapSpriteGroup(buf, idcount, cidcount); |
2642 TownHouseMapSpriteGroup(buf, idcount, cidcount); |
|
2643 return; |
|
2644 |
|
2645 case GSF_CARGOS: |
|
2646 CargoMapSpriteGroup(buf, idcount, cidcount); |
2615 return; |
2647 return; |
2616 |
2648 |
2617 default: |
2649 default: |
2618 grfmsg(1, "FeatureMapSpriteGroup: Unsupported feature %d, skipping", feature); |
2650 grfmsg(1, "FeatureMapSpriteGroup: Unsupported feature %d, skipping", feature); |
2619 return; |
2651 return; |