equal
deleted
inserted
replaced
14 #include "station.h" |
14 #include "station.h" |
15 #include "sprite.h" |
15 #include "sprite.h" |
16 #include "newgrf.h" |
16 #include "newgrf.h" |
17 #include "variables.h" |
17 #include "variables.h" |
18 #include "bridge.h" |
18 #include "bridge.h" |
|
19 #include "economy.h" |
19 |
20 |
20 /* TTDPatch extended GRF format codec |
21 /* TTDPatch extended GRF format codec |
21 * (c) Petr Baudis 2004 (GPL'd) |
22 * (c) Petr Baudis 2004 (GPL'd) |
22 * Changes by Florian octo Forster are (c) by the OpenTTD development team. |
23 * Changes by Florian octo Forster are (c) by the OpenTTD development team. |
23 * |
24 * |
49 GSF_AIRCRAFT, |
50 GSF_AIRCRAFT, |
50 GSF_STATION, |
51 GSF_STATION, |
51 GSF_CANAL, |
52 GSF_CANAL, |
52 GSF_BRIDGE, |
53 GSF_BRIDGE, |
53 GSF_TOWNHOUSE, |
54 GSF_TOWNHOUSE, |
|
55 GSF_GLOBALVAR, |
54 } grfspec_feature; |
56 } grfspec_feature; |
55 |
57 |
56 |
58 |
57 typedef void (*SpecialSpriteHandler)(byte *buf, int len); |
59 typedef void (*SpecialSpriteHandler)(byte *buf, int len); |
58 |
60 |
1056 |
1058 |
1057 *bufp = buf; |
1059 *bufp = buf; |
1058 return ret; |
1060 return ret; |
1059 } |
1061 } |
1060 |
1062 |
|
1063 static bool GlobalVarChangeInfo(uint gvid, int numinfo, int prop, byte **bufp, int len) |
|
1064 { |
|
1065 byte *buf = *bufp; |
|
1066 int i; |
|
1067 bool ret = false; |
|
1068 |
|
1069 switch (prop) { |
|
1070 case 0x08: { /* Cost base factor */ |
|
1071 FOR_EACH_OBJECT { |
|
1072 byte factor = grf_load_byte(&buf); |
|
1073 |
|
1074 SetPriceBaseMultiplier(gvid + i, factor); |
|
1075 } |
|
1076 } break; |
|
1077 default: |
|
1078 ret = true; |
|
1079 } |
|
1080 *bufp = buf; |
|
1081 return ret; |
|
1082 } |
|
1083 |
1061 /* Action 0x00 */ |
1084 /* Action 0x00 */ |
1062 static void VehicleChangeInfo(byte *buf, int len) |
1085 static void VehicleChangeInfo(byte *buf, int len) |
1063 { |
1086 { |
1064 byte *bufend = buf + len; |
1087 byte *bufend = buf + len; |
1065 int i; |
1088 int i; |
1084 /* GSF_AIRCRAFT */ AircraftVehicleChangeInfo, |
1107 /* GSF_AIRCRAFT */ AircraftVehicleChangeInfo, |
1085 /* GSF_STATION */ StationChangeInfo, |
1108 /* GSF_STATION */ StationChangeInfo, |
1086 /* GSF_CANAL */ NULL, |
1109 /* GSF_CANAL */ NULL, |
1087 /* GSF_BRIDGE */ BridgeChangeInfo, |
1110 /* GSF_BRIDGE */ BridgeChangeInfo, |
1088 /* GSF_TOWNHOUSE */NULL, |
1111 /* GSF_TOWNHOUSE */NULL, |
|
1112 /* GSF_GLOBALVAR */GlobalVarChangeInfo, |
1089 }; |
1113 }; |
1090 |
1114 |
1091 uint8 feature; |
1115 uint8 feature; |
1092 uint8 numprops; |
1116 uint8 numprops; |
1093 uint8 numinfo; |
1117 uint8 numinfo; |
2352 memcpy(&_bridge, &orig_bridge, sizeof(_bridge)); |
2376 memcpy(&_bridge, &orig_bridge, sizeof(_bridge)); |
2353 |
2377 |
2354 // Unload sprite group data |
2378 // Unload sprite group data |
2355 UnloadWagonOverrides(); |
2379 UnloadWagonOverrides(); |
2356 UnloadCustomEngineSprites(); |
2380 UnloadCustomEngineSprites(); |
|
2381 |
|
2382 // Reset price base data |
|
2383 ResetPriceBaseMultipliers(); |
2357 } |
2384 } |
2358 |
2385 |
2359 static void InitNewGRFFile(const char* filename, int sprite_offset) |
2386 static void InitNewGRFFile(const char* filename, int sprite_offset) |
2360 { |
2387 { |
2361 GRFFile *newfile; |
2388 GRFFile *newfile; |