diff --git a/economy.c b/economy.c index c42fdfaa2a..66aaff6f24 100644 --- a/economy.c +++ b/economy.c @@ -1,5 +1,6 @@ #include "stdafx.h" #include "ttd.h" +#include "strings.h" // XXX InjectDParam() #include "table/strings.h" #include "map.h" #include "news.h" @@ -1191,7 +1192,7 @@ static bool CheckSubsidised(Station *from, Station *to, byte cargo_type) /* Add a news item */ pair = SetupSubsidyDecodeParam(s, 0); - INJECT_DPARAM(2); + InjectDParam(2); p = DEREF_PLAYER(_current_player); SetDParam(0, p->name_1); diff --git a/functions.h b/functions.h index 9808f7ccb9..2659b4bf43 100644 --- a/functions.h +++ b/functions.h @@ -47,15 +47,6 @@ static inline Point RemapCoords2(int x, int y) return RemapCoords(x, y, GetSlopeZ(x, y)); } -/* game.c */ -byte *GetString(byte *buffr, uint16 string); -void InjectDparam(int amount); - -int32 GetParamInt32(void); -int GetParamInt16(void); -int GetParamInt8(void); -int GetParamUint16(void); - /* clear_land.c */ void DrawHillyLandTile(TileInfo *ti); diff --git a/gfx.c b/gfx.c index bc9c6eea19..5c6e1751e7 100644 --- a/gfx.c +++ b/gfx.c @@ -1,5 +1,6 @@ #include "stdafx.h" #include "ttd.h" +#include "strings.h" #include "gfx.h" #include "table/palettes.h" #include "hal.h" diff --git a/industry_gui.c b/industry_gui.c index b503f1f573..579100a263 100644 --- a/industry_gui.c +++ b/industry_gui.c @@ -1,6 +1,7 @@ #include "stdafx.h" #include "ttd.h" #include "debug.h" +#include "strings.h" #include "table/strings.h" #include "map.h" //#include "gui.h" diff --git a/main_gui.c b/main_gui.c index 3a754e69b3..680e04f415 100644 --- a/main_gui.c +++ b/main_gui.c @@ -1,5 +1,6 @@ #include "stdafx.h" #include "ttd.h" +#include "strings.h" #include "table/strings.h" #include "map.h" #include "tile.h" @@ -45,8 +46,6 @@ extern void GenerateWorld(int mode, uint log_x, uint log_y); extern void GenerateIndustries(void); extern void GenerateTowns(void); -extern uint GetCurrentCurrencyRate(void); - extern void CcTerraform(bool success, uint tile, uint32 p1, uint32 p2); void HandleOnEditTextCancel(void) diff --git a/misc.c b/misc.c index c4e0a8df19..546aeeaa87 100644 --- a/misc.c +++ b/misc.c @@ -1,5 +1,6 @@ #include "stdafx.h" #include "ttd.h" +#include "strings.h" // XXX GetParam* #include "table/strings.h" #include "map.h" #include "vehicle.h" diff --git a/misc_gui.c b/misc_gui.c index 6dcb30c653..882e21d5ca 100644 --- a/misc_gui.c +++ b/misc_gui.c @@ -1,6 +1,7 @@ #include "stdafx.h" #include "ttd.h" #include "debug.h" +#include "strings.h" #include "table/strings.h" #include "map.h" #include "window.h" diff --git a/network.c b/network.c index 5b6a46427c..2a72de7719 100644 --- a/network.c +++ b/network.c @@ -1,5 +1,6 @@ #include "stdafx.h" #include "debug.h" +#include "strings.h" #include "map.h" #include "network_data.h" @@ -44,7 +45,6 @@ static uint16 _network_client_index = NETWORK_SERVER_INDEX + 1; /* Some externs / forwards */ extern void ShowJoinStatusWindow(void); extern void StateGameLoop(void); -extern uint GetCurrentCurrencyRate(void); // Function that looks up the CI for a given client-index NetworkClientInfo *NetworkFindClientInfoFromIndex(uint16 client_index) diff --git a/network_client.c b/network_client.c index 8deec2fd3c..6a42b75d07 100644 --- a/network_client.c +++ b/network_client.c @@ -1,5 +1,6 @@ #include "stdafx.h" #include "debug.h" +#include "strings.h" #include "network_data.h" #ifdef ENABLE_NETWORK diff --git a/network_gui.c b/network_gui.c index f5aea33e34..95b4707e04 100644 --- a/network_gui.c +++ b/network_gui.c @@ -1,5 +1,6 @@ #include "stdafx.h" #include "ttd.h" +#include "strings.h" #include "network.h" #include "saveload.h" diff --git a/network_server.c b/network_server.c index 0fee527797..594f7856aa 100644 --- a/network_server.c +++ b/network_server.c @@ -1,5 +1,6 @@ #include "stdafx.h" #include "debug.h" +#include "strings.h" #include "network_data.h" #ifdef ENABLE_NETWORK diff --git a/news_gui.c b/news_gui.c index a17946c906..b8931a36c3 100644 --- a/news_gui.c +++ b/news_gui.c @@ -1,5 +1,6 @@ #include "stdafx.h" #include "ttd.h" +#include "strings.h" #include "table/strings.h" #include "window.h" #include "gui.h" diff --git a/players.c b/players.c index a33307cc26..a48b4ac7cf 100644 --- a/players.c +++ b/players.c @@ -1,5 +1,6 @@ #include "stdafx.h" #include "ttd.h" +#include "strings.h" #include "table/strings.h" #include "map.h" #include "player.h" diff --git a/screenshot.c b/screenshot.c index d0e0107d33..b7129a4a9c 100644 --- a/screenshot.c +++ b/screenshot.c @@ -1,6 +1,7 @@ #include "stdafx.h" #include "ttd.h" #include "debug.h" +#include "strings.h" #include "table/strings.h" #include "gfx.h" #include "viewport.h" diff --git a/settings_gui.c b/settings_gui.c index af394b3ae0..e1e0512a66 100644 --- a/settings_gui.c +++ b/settings_gui.c @@ -1,5 +1,6 @@ #include "stdafx.h" #include "ttd.h" +#include "strings.h" // XXX GetCurrentCurrencyRate() #include "table/strings.h" #include "window.h" #include "gui.h" @@ -726,7 +727,6 @@ static const PatchPage _patches_page[] = { {_patches_ai, lengthof(_patches_ai) }, }; -extern uint GetCurrentCurrencyRate(void); static int32 ReadPE(const PatchEntry*pe) { diff --git a/station_gui.c b/station_gui.c index 8453c555f0..d628211df2 100644 --- a/station_gui.c +++ b/station_gui.c @@ -1,6 +1,7 @@ #include "stdafx.h" #include "ttd.h" #include "debug.h" +#include "strings.h" #include "table/strings.h" #include "window.h" #include "gui.h" diff --git a/strings.c b/strings.c index 4925bbf5b5..a089aa4a3d 100644 --- a/strings.c +++ b/strings.c @@ -1,5 +1,6 @@ #include "stdafx.h" #include "ttd.h" +#include "strings.h" #include "table/strings.h" #include "namegen.h" #include "station.h" @@ -109,7 +110,7 @@ byte *GetString(byte *buffr, uint16 string) return DecodeString(buffr, GetStringPtr(string)); } -void InjectDparam(int amount) +void InjectDParam(int amount) { memmove(_decode_parameters + amount, _decode_parameters, sizeof(_decode_parameters) - amount * sizeof(uint32)); } @@ -443,7 +444,7 @@ static byte *DecodeString(byte *buff, const byte *str) case 0x9A: { // {STATION} Station *st; - InjectDparam(1); + InjectDParam(1); st = GetStation(GetDParam(1)); if (!st->xy) { // station doesn't exist anymore buff = GetString(buff, STR_UNKNOWN_DESTINATION); @@ -480,7 +481,7 @@ static byte *DecodeString(byte *buff, const byte *str) if (idx == 0) { str = STR_WAYPOINTNAME_CITY; } else { - InjectDparam(1); + InjectDParam(1); SetDParam(1, idx + 1); str = STR_WAYPOINTNAME_CITY_SERIAL; } diff --git a/strings.h b/strings.h new file mode 100644 index 0000000000..bff978c929 --- /dev/null +++ b/strings.h @@ -0,0 +1,15 @@ +#ifndef STRINGS_H +#define STRINGS_H + +byte *GetString(byte *buffr, uint16 string); + +void InjectDParam(int amount); + +int32 GetParamInt32(void); +int GetParamInt16(void); +int GetParamInt8(void); +int GetParamUint16(void); + +uint GetCurrentCurrencyRate(void); + +#endif diff --git a/texteff.c b/texteff.c index 3e5f6fc896..73789bd069 100644 --- a/texteff.c +++ b/texteff.c @@ -1,5 +1,6 @@ #include "stdafx.h" #include "ttd.h" +#include "strings.h" #include "gfx.h" #include "viewport.h" #include "saveload.h" diff --git a/town_cmd.c b/town_cmd.c index ad7dd4847d..7c9737a05c 100644 --- a/town_cmd.c +++ b/town_cmd.c @@ -1,5 +1,6 @@ #include "stdafx.h" #include "ttd.h" +#include "strings.h" #include "table/strings.h" #include "map.h" #include "tile.h" diff --git a/town_gui.c b/town_gui.c index 84b5a319c6..a5441bbb47 100644 --- a/town_gui.c +++ b/town_gui.c @@ -1,6 +1,7 @@ #include "stdafx.h" #include "ttd.h" #include "debug.h" +#include "strings.h" #include "table/strings.h" #include "town.h" #include "window.h" diff --git a/ttd.c b/ttd.c index 7dbf115e4e..46e9b2d100 100644 --- a/ttd.c +++ b/ttd.c @@ -1,6 +1,7 @@ #include "stdafx.h" #include "table/strings.h" #include "debug.h" +#include "strings.h" #include "map.h" #include "tile.h" diff --git a/variables.h b/variables.h index 895ca3aaa4..9ac5800efa 100644 --- a/variables.h +++ b/variables.h @@ -412,7 +412,6 @@ static inline uint32 GetDParam(uint n) #define COPY_IN_DPARAM(offs,src,num) memcpy(_decode_parameters + offs, src, sizeof(uint32) * (num)) #define COPY_OUT_DPARAM(dst,offs,num) memcpy(dst,_decode_parameters + offs, sizeof(uint32) * (num)) -#define INJECT_DPARAM(n) InjectDparam(n); #define SET_EXPENSES_TYPE(x) _yearly_expenses_type = x; diff --git a/vehicle_gui.c b/vehicle_gui.c index 9344fc2b93..2a932380d0 100644 --- a/vehicle_gui.c +++ b/vehicle_gui.c @@ -1,6 +1,7 @@ #include "stdafx.h" #include "ttd.h" #include "debug.h" +#include "strings.h" #include "table/strings.h" #include "vehicle.h" #include "window.h" diff --git a/viewport.c b/viewport.c index 737a5c3505..4718a8c466 100644 --- a/viewport.c +++ b/viewport.c @@ -1,6 +1,7 @@ #include "stdafx.h" #include "ttd.h" #include "debug.h" +#include "strings.h" #include "table/strings.h" #include "map.h" #include "viewport.h"