equal
deleted
inserted
replaced
37 #include "newgrf_spritegroup.h" |
37 #include "newgrf_spritegroup.h" |
38 #include "helpers.hpp" |
38 #include "helpers.hpp" |
39 #include "table/town_land.h" |
39 #include "table/town_land.h" |
40 #include "cargotype.h" |
40 #include "cargotype.h" |
41 #include "industry.h" |
41 #include "industry.h" |
|
42 #include "newgrf_canal.h" |
42 |
43 |
43 /* TTDPatch extended GRF format codec |
44 /* TTDPatch extended GRF format codec |
44 * (c) Petr Baudis 2004 (GPL'd) |
45 * (c) Petr Baudis 2004 (GPL'd) |
45 * Changes by Florian octo Forster are (c) by the OpenTTD development team. |
46 * Changes by Florian octo Forster are (c) by the OpenTTD development team. |
46 * |
47 * |
2242 case GSF_TRAIN: |
2243 case GSF_TRAIN: |
2243 case GSF_ROAD: |
2244 case GSF_ROAD: |
2244 case GSF_SHIP: |
2245 case GSF_SHIP: |
2245 case GSF_AIRCRAFT: |
2246 case GSF_AIRCRAFT: |
2246 case GSF_STATION: |
2247 case GSF_STATION: |
|
2248 case GSF_CANAL: |
2247 case GSF_CARGOS: |
2249 case GSF_CARGOS: |
2248 { |
2250 { |
2249 byte sprites = _cur_grffile->spriteset_numents; |
2251 byte sprites = _cur_grffile->spriteset_numents; |
2250 byte num_loaded = type; |
2252 byte num_loaded = type; |
2251 byte num_loading = grf_load_byte(&buf); |
2253 byte num_loading = grf_load_byte(&buf); |
2511 } |
2513 } |
2512 } |
2514 } |
2513 } |
2515 } |
2514 |
2516 |
2515 |
2517 |
|
2518 static void CanalMapSpriteGroup(byte *buf, uint8 idcount, uint8 cidcount) |
|
2519 { |
|
2520 byte *bp = &buf[4 + idcount + cidcount * 3]; |
|
2521 uint16 groupid = grf_load_word(&bp); |
|
2522 |
|
2523 if (groupid >= _cur_grffile->spritegroups_count || _cur_grffile->spritegroups[groupid] == NULL) { |
|
2524 grfmsg(1, "CanalMapSpriteGroup: Spriteset 0x%04X out of range 0x%X or empty, skipping.", |
|
2525 groupid, _cur_grffile->spritegroups_count); |
|
2526 return; |
|
2527 } |
|
2528 |
|
2529 for (uint i = 0; i < idcount; i++) { |
|
2530 CanalFeature cf = (CanalFeature)buf[3 + i]; |
|
2531 |
|
2532 if (cf >= CF_END) { |
|
2533 grfmsg(1, "CanalMapSpriteGroup: Canal subset %d out of range, skipping", cf); |
|
2534 continue; |
|
2535 } |
|
2536 |
|
2537 _canal_sg[cf] = _cur_grffile->spritegroups[groupid]; |
|
2538 } |
|
2539 } |
|
2540 |
|
2541 |
2516 static void StationMapSpriteGroup(byte *buf, uint8 idcount, uint8 cidcount) |
2542 static void StationMapSpriteGroup(byte *buf, uint8 idcount, uint8 cidcount) |
2517 { |
2543 { |
2518 for (uint i = 0; i < idcount; i++) { |
2544 for (uint i = 0; i < idcount; i++) { |
2519 uint8 stid = buf[3 + i]; |
2545 uint8 stid = buf[3 + i]; |
2520 StationSpec *statspec = _cur_grffile->stations[stid]; |
2546 StationSpec *statspec = _cur_grffile->stations[stid]; |
2657 case GSF_TRAIN: |
2683 case GSF_TRAIN: |
2658 case GSF_ROAD: |
2684 case GSF_ROAD: |
2659 case GSF_SHIP: |
2685 case GSF_SHIP: |
2660 case GSF_AIRCRAFT: |
2686 case GSF_AIRCRAFT: |
2661 VehicleMapSpriteGroup(buf, feature, idcount, cidcount, wagover); |
2687 VehicleMapSpriteGroup(buf, feature, idcount, cidcount, wagover); |
|
2688 return; |
|
2689 |
|
2690 case GSF_CANAL: |
|
2691 CanalMapSpriteGroup(buf, idcount, cidcount); |
2662 return; |
2692 return; |
2663 |
2693 |
2664 case GSF_STATION: |
2694 case GSF_STATION: |
2665 StationMapSpriteGroup(buf, idcount, cidcount); |
2695 StationMapSpriteGroup(buf, idcount, cidcount); |
2666 return; |
2696 return; |
4312 ResetHouses(); |
4342 ResetHouses(); |
4313 |
4343 |
4314 /* Reset station classes */ |
4344 /* Reset station classes */ |
4315 ResetStationClasses(); |
4345 ResetStationClasses(); |
4316 ResetCustomStations(); |
4346 ResetCustomStations(); |
|
4347 |
|
4348 /* Reset canal sprite groups */ |
|
4349 memset(_canal_sg, 0, sizeof(_canal_sg)); |
4317 |
4350 |
4318 /* Reset the snowline table. */ |
4351 /* Reset the snowline table. */ |
4319 ClearSnowLine(); |
4352 ClearSnowLine(); |
4320 |
4353 |
4321 /* Reset NewGRF files */ |
4354 /* Reset NewGRF files */ |