1
0
Fork 0

(svn r1813) Declare functions implemented in strings.c in their own shiny new header (though i think some of these function don't belong into strings.c)

release/0.4.5
tron 2005-02-06 08:18:00 +00:00
parent 0b8876e946
commit 0381073e56
25 changed files with 41 additions and 18 deletions

View File

@ -1,5 +1,6 @@
#include "stdafx.h" #include "stdafx.h"
#include "ttd.h" #include "ttd.h"
#include "strings.h" // XXX InjectDParam()
#include "table/strings.h" #include "table/strings.h"
#include "map.h" #include "map.h"
#include "news.h" #include "news.h"
@ -1191,7 +1192,7 @@ static bool CheckSubsidised(Station *from, Station *to, byte cargo_type)
/* Add a news item */ /* Add a news item */
pair = SetupSubsidyDecodeParam(s, 0); pair = SetupSubsidyDecodeParam(s, 0);
INJECT_DPARAM(2); InjectDParam(2);
p = DEREF_PLAYER(_current_player); p = DEREF_PLAYER(_current_player);
SetDParam(0, p->name_1); SetDParam(0, p->name_1);

View File

@ -47,15 +47,6 @@ static inline Point RemapCoords2(int x, int y)
return RemapCoords(x, y, GetSlopeZ(x, 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 */ /* clear_land.c */
void DrawHillyLandTile(TileInfo *ti); void DrawHillyLandTile(TileInfo *ti);

1
gfx.c
View File

@ -1,5 +1,6 @@
#include "stdafx.h" #include "stdafx.h"
#include "ttd.h" #include "ttd.h"
#include "strings.h"
#include "gfx.h" #include "gfx.h"
#include "table/palettes.h" #include "table/palettes.h"
#include "hal.h" #include "hal.h"

View File

@ -1,6 +1,7 @@
#include "stdafx.h" #include "stdafx.h"
#include "ttd.h" #include "ttd.h"
#include "debug.h" #include "debug.h"
#include "strings.h"
#include "table/strings.h" #include "table/strings.h"
#include "map.h" #include "map.h"
//#include "gui.h" //#include "gui.h"

View File

@ -1,5 +1,6 @@
#include "stdafx.h" #include "stdafx.h"
#include "ttd.h" #include "ttd.h"
#include "strings.h"
#include "table/strings.h" #include "table/strings.h"
#include "map.h" #include "map.h"
#include "tile.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 GenerateIndustries(void);
extern void GenerateTowns(void); extern void GenerateTowns(void);
extern uint GetCurrentCurrencyRate(void);
extern void CcTerraform(bool success, uint tile, uint32 p1, uint32 p2); extern void CcTerraform(bool success, uint tile, uint32 p1, uint32 p2);
void HandleOnEditTextCancel(void) void HandleOnEditTextCancel(void)

1
misc.c
View File

@ -1,5 +1,6 @@
#include "stdafx.h" #include "stdafx.h"
#include "ttd.h" #include "ttd.h"
#include "strings.h" // XXX GetParam*
#include "table/strings.h" #include "table/strings.h"
#include "map.h" #include "map.h"
#include "vehicle.h" #include "vehicle.h"

View File

@ -1,6 +1,7 @@
#include "stdafx.h" #include "stdafx.h"
#include "ttd.h" #include "ttd.h"
#include "debug.h" #include "debug.h"
#include "strings.h"
#include "table/strings.h" #include "table/strings.h"
#include "map.h" #include "map.h"
#include "window.h" #include "window.h"

View File

@ -1,5 +1,6 @@
#include "stdafx.h" #include "stdafx.h"
#include "debug.h" #include "debug.h"
#include "strings.h"
#include "map.h" #include "map.h"
#include "network_data.h" #include "network_data.h"
@ -44,7 +45,6 @@ static uint16 _network_client_index = NETWORK_SERVER_INDEX + 1;
/* Some externs / forwards */ /* Some externs / forwards */
extern void ShowJoinStatusWindow(void); extern void ShowJoinStatusWindow(void);
extern void StateGameLoop(void); extern void StateGameLoop(void);
extern uint GetCurrentCurrencyRate(void);
// Function that looks up the CI for a given client-index // Function that looks up the CI for a given client-index
NetworkClientInfo *NetworkFindClientInfoFromIndex(uint16 client_index) NetworkClientInfo *NetworkFindClientInfoFromIndex(uint16 client_index)

View File

@ -1,5 +1,6 @@
#include "stdafx.h" #include "stdafx.h"
#include "debug.h" #include "debug.h"
#include "strings.h"
#include "network_data.h" #include "network_data.h"
#ifdef ENABLE_NETWORK #ifdef ENABLE_NETWORK

View File

@ -1,5 +1,6 @@
#include "stdafx.h" #include "stdafx.h"
#include "ttd.h" #include "ttd.h"
#include "strings.h"
#include "network.h" #include "network.h"
#include "saveload.h" #include "saveload.h"

View File

@ -1,5 +1,6 @@
#include "stdafx.h" #include "stdafx.h"
#include "debug.h" #include "debug.h"
#include "strings.h"
#include "network_data.h" #include "network_data.h"
#ifdef ENABLE_NETWORK #ifdef ENABLE_NETWORK

View File

@ -1,5 +1,6 @@
#include "stdafx.h" #include "stdafx.h"
#include "ttd.h" #include "ttd.h"
#include "strings.h"
#include "table/strings.h" #include "table/strings.h"
#include "window.h" #include "window.h"
#include "gui.h" #include "gui.h"

View File

@ -1,5 +1,6 @@
#include "stdafx.h" #include "stdafx.h"
#include "ttd.h" #include "ttd.h"
#include "strings.h"
#include "table/strings.h" #include "table/strings.h"
#include "map.h" #include "map.h"
#include "player.h" #include "player.h"

View File

@ -1,6 +1,7 @@
#include "stdafx.h" #include "stdafx.h"
#include "ttd.h" #include "ttd.h"
#include "debug.h" #include "debug.h"
#include "strings.h"
#include "table/strings.h" #include "table/strings.h"
#include "gfx.h" #include "gfx.h"
#include "viewport.h" #include "viewport.h"

View File

@ -1,5 +1,6 @@
#include "stdafx.h" #include "stdafx.h"
#include "ttd.h" #include "ttd.h"
#include "strings.h" // XXX GetCurrentCurrencyRate()
#include "table/strings.h" #include "table/strings.h"
#include "window.h" #include "window.h"
#include "gui.h" #include "gui.h"
@ -726,7 +727,6 @@ static const PatchPage _patches_page[] = {
{_patches_ai, lengthof(_patches_ai) }, {_patches_ai, lengthof(_patches_ai) },
}; };
extern uint GetCurrentCurrencyRate(void);
static int32 ReadPE(const PatchEntry*pe) static int32 ReadPE(const PatchEntry*pe)
{ {

View File

@ -1,6 +1,7 @@
#include "stdafx.h" #include "stdafx.h"
#include "ttd.h" #include "ttd.h"
#include "debug.h" #include "debug.h"
#include "strings.h"
#include "table/strings.h" #include "table/strings.h"
#include "window.h" #include "window.h"
#include "gui.h" #include "gui.h"

View File

@ -1,5 +1,6 @@
#include "stdafx.h" #include "stdafx.h"
#include "ttd.h" #include "ttd.h"
#include "strings.h"
#include "table/strings.h" #include "table/strings.h"
#include "namegen.h" #include "namegen.h"
#include "station.h" #include "station.h"
@ -109,7 +110,7 @@ byte *GetString(byte *buffr, uint16 string)
return DecodeString(buffr, GetStringPtr(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)); 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} case 0x9A: { // {STATION}
Station *st; Station *st;
InjectDparam(1); InjectDParam(1);
st = GetStation(GetDParam(1)); st = GetStation(GetDParam(1));
if (!st->xy) { // station doesn't exist anymore if (!st->xy) { // station doesn't exist anymore
buff = GetString(buff, STR_UNKNOWN_DESTINATION); buff = GetString(buff, STR_UNKNOWN_DESTINATION);
@ -480,7 +481,7 @@ static byte *DecodeString(byte *buff, const byte *str)
if (idx == 0) { if (idx == 0) {
str = STR_WAYPOINTNAME_CITY; str = STR_WAYPOINTNAME_CITY;
} else { } else {
InjectDparam(1); InjectDParam(1);
SetDParam(1, idx + 1); SetDParam(1, idx + 1);
str = STR_WAYPOINTNAME_CITY_SERIAL; str = STR_WAYPOINTNAME_CITY_SERIAL;
} }

15
strings.h 100644
View File

@ -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

View File

@ -1,5 +1,6 @@
#include "stdafx.h" #include "stdafx.h"
#include "ttd.h" #include "ttd.h"
#include "strings.h"
#include "gfx.h" #include "gfx.h"
#include "viewport.h" #include "viewport.h"
#include "saveload.h" #include "saveload.h"

View File

@ -1,5 +1,6 @@
#include "stdafx.h" #include "stdafx.h"
#include "ttd.h" #include "ttd.h"
#include "strings.h"
#include "table/strings.h" #include "table/strings.h"
#include "map.h" #include "map.h"
#include "tile.h" #include "tile.h"

View File

@ -1,6 +1,7 @@
#include "stdafx.h" #include "stdafx.h"
#include "ttd.h" #include "ttd.h"
#include "debug.h" #include "debug.h"
#include "strings.h"
#include "table/strings.h" #include "table/strings.h"
#include "town.h" #include "town.h"
#include "window.h" #include "window.h"

1
ttd.c
View File

@ -1,6 +1,7 @@
#include "stdafx.h" #include "stdafx.h"
#include "table/strings.h" #include "table/strings.h"
#include "debug.h" #include "debug.h"
#include "strings.h"
#include "map.h" #include "map.h"
#include "tile.h" #include "tile.h"

View File

@ -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_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 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; #define SET_EXPENSES_TYPE(x) _yearly_expenses_type = x;

View File

@ -1,6 +1,7 @@
#include "stdafx.h" #include "stdafx.h"
#include "ttd.h" #include "ttd.h"
#include "debug.h" #include "debug.h"
#include "strings.h"
#include "table/strings.h" #include "table/strings.h"
#include "vehicle.h" #include "vehicle.h"
#include "window.h" #include "window.h"

View File

@ -1,6 +1,7 @@
#include "stdafx.h" #include "stdafx.h"
#include "ttd.h" #include "ttd.h"
#include "debug.h" #include "debug.h"
#include "strings.h"
#include "table/strings.h" #include "table/strings.h"
#include "map.h" #include "map.h"
#include "viewport.h" #include "viewport.h"