1
0
Fork 0

(svn r10587) -Codechange: move the string/dparam related stuff from variables.h to strings.h

release/0.6
rubidium 2007-07-16 09:16:58 +00:00
parent 4896d437b1
commit efc7fdf2fd
39 changed files with 125 additions and 83 deletions

View File

@ -10,6 +10,7 @@
#include "functions.h" #include "functions.h"
#include "landscape.h" #include "landscape.h"
#include "station_map.h" #include "station_map.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

@ -9,6 +9,7 @@
#include "functions.h" #include "functions.h"
#include "table/sprites.h" #include "table/sprites.h"
#include "table/strings.h" #include "table/strings.h"
#include "strings.h"
#include "map.h" #include "map.h"
#include "window.h" #include "window.h"
#include "gui.h" #include "gui.h"

View File

@ -8,6 +8,7 @@
#include "functions.h" #include "functions.h"
#include "table/sprites.h" #include "table/sprites.h"
#include "table/strings.h" #include "table/strings.h"
#include "strings.h"
#include "window.h" #include "window.h"
#include "gui.h" #include "gui.h"
#include "command.h" #include "command.h"

View File

@ -5,6 +5,7 @@
#include "stdafx.h" #include "stdafx.h"
#include "openttd.h" #include "openttd.h"
#include "table/strings.h" #include "table/strings.h"
#include "strings.h"
#include "functions.h" #include "functions.h"
#include "map.h" #include "map.h"
#include "window.h" #include "window.h"

View File

@ -5,6 +5,7 @@
#include "stdafx.h" #include "stdafx.h"
#include "openttd.h" #include "openttd.h"
#include "table/strings.h" #include "table/strings.h"
#include "strings.h"
#include "functions.h" #include "functions.h"
#include "landscape.h" #include "landscape.h"
#include "map.h" #include "map.h"

View File

@ -10,6 +10,7 @@
#include "ship.h" #include "ship.h"
#include "aircraft.h" #include "aircraft.h"
#include "table/strings.h" #include "table/strings.h"
#include "strings.h"
#include "table/sprites.h" #include "table/sprites.h"
#include "gui.h" #include "gui.h"
#include "gfx.h" #include "gfx.h"

View File

@ -23,6 +23,7 @@
#include "industry_map.h" #include "industry_map.h"
#include "station_map.h" #include "station_map.h"
#include "table/strings.h" #include "table/strings.h"
#include "strings.h"
#include "map.h" #include "map.h"
#include "tile.h" #include "tile.h"
#include "vehicle.h" #include "vehicle.h"

View File

@ -538,7 +538,7 @@ void DrawNewsBankrupcy(Window *w)
int32 price; int32 price;
DrawStringCentered(w->width>>1, 1, STR_7059_TRANSPORT_COMPANY_MERGER, 0); DrawStringCentered(w->width>>1, 1, STR_7059_TRANSPORT_COMPANY_MERGER, 0);
COPY_IN_DPARAM(0,WP(w,news_d).ni->params, 2); CopyInDParam(0,WP(w,news_d).ni->params, 2);
SetDParam(2, p->index); SetDParam(2, p->index);
price = WP(w,news_d).ni->params[2]; price = WP(w,news_d).ni->params[2];
SetDParam(3, price); SetDParam(3, price);
@ -552,7 +552,7 @@ void DrawNewsBankrupcy(Window *w)
case NB_BBANKRUPT: case NB_BBANKRUPT:
DrawStringCentered(w->width>>1, 1, STR_705C_BANKRUPT, 0); DrawStringCentered(w->width>>1, 1, STR_705C_BANKRUPT, 0);
COPY_IN_DPARAM(0,WP(w,news_d).ni->params, 2); CopyInDParam(0,WP(w,news_d).ni->params, 2);
DrawStringMultiCenter( DrawStringMultiCenter(
((w->width - 101) >> 1) + 98, ((w->width - 101) >> 1) + 98,
90, 90,
@ -563,7 +563,7 @@ void DrawNewsBankrupcy(Window *w)
case NB_BNEWCOMPANY: case NB_BNEWCOMPANY:
DrawStringCentered(w->width>>1, 1, STR_705E_NEW_TRANSPORT_COMPANY_LAUNCHED, 0); DrawStringCentered(w->width>>1, 1, STR_705E_NEW_TRANSPORT_COMPANY_LAUNCHED, 0);
SetDParam(0, p->index); SetDParam(0, p->index);
COPY_IN_DPARAM(1,WP(w,news_d).ni->params, 2); CopyInDParam(1,WP(w,news_d).ni->params, 2);
DrawStringMultiCenter( DrawStringMultiCenter(
((w->width - 101) >> 1) + 98, ((w->width - 101) >> 1) + 98,
90, 90,
@ -589,20 +589,20 @@ StringID GetNewsStringBankrupcy(const NewsItem *ni)
case NB_BMERGER: case NB_BMERGER:
SetDParam(0, STR_7059_TRANSPORT_COMPANY_MERGER); SetDParam(0, STR_7059_TRANSPORT_COMPANY_MERGER);
SetDParam(1, STR_705A_HAS_BEEN_SOLD_TO_FOR); SetDParam(1, STR_705A_HAS_BEEN_SOLD_TO_FOR);
COPY_IN_DPARAM(2,ni->params, 2); CopyInDParam(2,ni->params, 2);
SetDParam(4, p->index); SetDParam(4, p->index);
COPY_IN_DPARAM(5,ni->params + 2, 1); CopyInDParam(5,ni->params + 2, 1);
return STR_02B6; return STR_02B6;
case NB_BBANKRUPT: case NB_BBANKRUPT:
SetDParam(0, STR_705C_BANKRUPT); SetDParam(0, STR_705C_BANKRUPT);
SetDParam(1, STR_705D_HAS_BEEN_CLOSED_DOWN_BY); SetDParam(1, STR_705D_HAS_BEEN_CLOSED_DOWN_BY);
COPY_IN_DPARAM(2,ni->params, 2); CopyInDParam(2,ni->params, 2);
return STR_02B6; return STR_02B6;
case NB_BNEWCOMPANY: case NB_BNEWCOMPANY:
SetDParam(0, STR_705E_NEW_TRANSPORT_COMPANY_LAUNCHED); SetDParam(0, STR_705E_NEW_TRANSPORT_COMPANY_LAUNCHED);
SetDParam(1, STR_705F_STARTS_CONSTRUCTION_NEAR); SetDParam(1, STR_705F_STARTS_CONSTRUCTION_NEAR);
SetDParam(2, p->index); SetDParam(2, p->index);
COPY_IN_DPARAM(3,ni->params, 2); CopyInDParam(3,ni->params, 2);
return STR_02B6; return STR_02B6;
default: default:
NOT_REACHED(); NOT_REACHED();

View File

@ -5,6 +5,7 @@
#include "stdafx.h" #include "stdafx.h"
#include "openttd.h" #include "openttd.h"
#include "table/strings.h" #include "table/strings.h"
#include "strings.h"
#include "table/sprites.h" #include "table/sprites.h"
#include "functions.h" #include "functions.h"
#include "window.h" #include "window.h"

View File

@ -5,6 +5,7 @@
#include "stdafx.h" #include "stdafx.h"
#include "openttd.h" #include "openttd.h"
#include "table/strings.h" #include "table/strings.h"
#include "strings.h"
#include "table/sprites.h" #include "table/sprites.h"
#include "functions.h" #include "functions.h"
#include "window.h" #include "window.h"

View File

@ -9,6 +9,7 @@
#include "industry_map.h" #include "industry_map.h"
#include "station_map.h" #include "station_map.h"
#include "table/strings.h" #include "table/strings.h"
#include "strings.h"
#include "table/sprites.h" #include "table/sprites.h"
#include "map.h" #include "map.h"
#include "tile.h" #include "tile.h"

View File

@ -5,6 +5,7 @@
#include "stdafx.h" #include "stdafx.h"
#include "openttd.h" #include "openttd.h"
#include "table/strings.h" #include "table/strings.h"
#include "strings.h"
#include "table/sprites.h" #include "table/sprites.h"
#include "functions.h" #include "functions.h"
#include "window.h" #include "window.h"

View File

@ -1917,7 +1917,7 @@ static bool DrawScrollingStatusText(const NewsItem *ni, int pos)
if (ni->display_mode == 3) { if (ni->display_mode == 3) {
str = _get_news_string_callback[ni->callback](ni); str = _get_news_string_callback[ni->callback](ni);
} else { } else {
COPY_IN_DPARAM(0, ni->params, lengthof(ni->params)); CopyInDParam(0, ni->params, lengthof(ni->params));
str = ni->string_id; str = ni->string_id;
} }

View File

@ -13,6 +13,7 @@
#include "strings.h" #include "strings.h"
#include "table/sprites.h" #include "table/sprites.h"
#include "table/strings.h" #include "table/strings.h"
#include "strings.h"
#include "table/tree_land.h" #include "table/tree_land.h"
#include "map.h" #include "map.h"
#include "window.h" #include "window.h"
@ -500,9 +501,9 @@ static void ErrmsgWndProc(Window *w, WindowEvent *e)
{ {
switch (e->event) { switch (e->event) {
case WE_PAINT: case WE_PAINT:
COPY_IN_DPARAM(0, _errmsg_decode_params, lengthof(_errmsg_decode_params)); CopyInDParam(0, _errmsg_decode_params, lengthof(_errmsg_decode_params));
DrawWindowWidgets(w); DrawWindowWidgets(w);
COPY_IN_DPARAM(0, _errmsg_decode_params, lengthof(_errmsg_decode_params)); CopyInDParam(0, _errmsg_decode_params, lengthof(_errmsg_decode_params));
if (!IsWindowOfPrototype(w, _errmsg_face_widgets)) { if (!IsWindowOfPrototype(w, _errmsg_face_widgets)) {
DrawStringMultiCenter( DrawStringMultiCenter(
120, 120,
@ -569,7 +570,7 @@ void ShowErrorMessage(StringID msg_1, StringID msg_2, int x, int y)
_errmsg_message_1 = msg_1; _errmsg_message_1 = msg_1;
_errmsg_message_2 = msg_2; _errmsg_message_2 = msg_2;
COPY_OUT_DPARAM(_errmsg_decode_params, 0, lengthof(_errmsg_decode_params)); CopyOutDParam(_errmsg_decode_params, 0, lengthof(_errmsg_decode_params));
_errmsg_duration = _patches.errmsg_duration; _errmsg_duration = _patches.errmsg_duration;
if (!_errmsg_duration) return; if (!_errmsg_duration) return;
@ -1235,9 +1236,9 @@ static void QueryWndProc(Window *w, WindowEvent *e)
switch (e->event) { switch (e->event) {
case WE_PAINT: case WE_PAINT:
COPY_IN_DPARAM(0, q->params, lengthof(q->params)); CopyInDParam(0, q->params, lengthof(q->params));
DrawWindowWidgets(w); DrawWindowWidgets(w);
COPY_IN_DPARAM(0, q->params, lengthof(q->params)); CopyInDParam(0, q->params, lengthof(q->params));
DrawStringMultiCenter(w->width / 2, (w->height / 2) - 10, q->message, w->width - 2); DrawStringMultiCenter(w->width / 2, (w->height / 2) - 10, q->message, w->width - 2);
break; break;
@ -1315,7 +1316,7 @@ void ShowQuery(StringID caption, StringID message, Window *parent, void (*callba
/* Create a backup of the variadic arguments to strings because it will be /* Create a backup of the variadic arguments to strings because it will be
* overridden pretty often. We will copy these back for drawing */ * overridden pretty often. We will copy these back for drawing */
COPY_OUT_DPARAM(WP(w, query_d).params, 0, lengthof(WP(w, query_d).params)); CopyOutDParam(WP(w, query_d).params, 0, lengthof(WP(w, query_d).params));
w->widget[QUERY_WIDGET_CAPTION].data = caption; w->widget[QUERY_WIDGET_CAPTION].data = caption;
WP(w, query_d).message = message; WP(w, query_d).message = message;
WP(w, query_d).proc = callback; WP(w, query_d).proc = callback;

View File

@ -6,6 +6,7 @@
#include "openttd.h" #include "openttd.h"
#include "table/strings.h" #include "table/strings.h"
#include "table/sprites.h" #include "table/sprites.h"
#include "strings.h"
#include "functions.h" #include "functions.h"
#include "fileio.h" #include "fileio.h"
#include "window.h" #include "window.h"

View File

@ -5,6 +5,7 @@
#include "../stdafx.h" #include "../stdafx.h"
#include "../debug.h" #include "../debug.h"
#include "../string.h" #include "../string.h"
#include "../openttd.h"
#include "../strings.h" #include "../strings.h"
#include "network_data.h" #include "network_data.h"
#include "core/tcp.h" #include "core/tcp.h"

View File

@ -124,7 +124,7 @@ static void NewsWindowProc(Window *w, WindowEvent *e)
DrawStringRightAligned(428, 1, STR_01FF, 0); DrawStringRightAligned(428, 1, STR_01FF, 0);
if (!(ni->flags & NF_VIEWPORT)) { if (!(ni->flags & NF_VIEWPORT)) {
COPY_IN_DPARAM(0, ni->params, lengthof(ni->params)); CopyInDParam(0, ni->params, lengthof(ni->params));
DrawStringMultiCenter(215, ni->display_mode == NM_NORMAL ? 76 : 56, DrawStringMultiCenter(215, ni->display_mode == NM_NORMAL ? 76 : 56,
ni->string_id, w->width - 4); ni->string_id, w->width - 4);
} else { } else {
@ -141,7 +141,7 @@ static void NewsWindowProc(Window *w, WindowEvent *e)
(ni->flags & NF_INCOLOR ? PALETTE_TO_TRANSPARENT : PALETTE_TO_STRUCT_GREY) | (1 << USE_COLORTABLE) (ni->flags & NF_INCOLOR ? PALETTE_TO_TRANSPARENT : PALETTE_TO_STRUCT_GREY) | (1 << USE_COLORTABLE)
); );
COPY_IN_DPARAM(0, ni->params, lengthof(ni->params)); CopyInDParam(0, ni->params, lengthof(ni->params));
DrawStringMultiCenter(w->width / 2, 20, ni->string_id, w->width - 4); DrawStringMultiCenter(w->width / 2, 20, ni->string_id, w->width - 4);
} }
break; break;
@ -155,11 +155,11 @@ static void NewsWindowProc(Window *w, WindowEvent *e)
default: { default: {
DrawWindowWidgets(w); DrawWindowWidgets(w);
if (!(ni->flags & NF_VIEWPORT)) { if (!(ni->flags & NF_VIEWPORT)) {
COPY_IN_DPARAM(0, ni->params, lengthof(ni->params)); CopyInDParam(0, ni->params, lengthof(ni->params));
DrawStringMultiCenter(140, 38, ni->string_id, 276); DrawStringMultiCenter(140, 38, ni->string_id, 276);
} else { } else {
DrawWindowViewport(w); DrawWindowViewport(w);
COPY_IN_DPARAM(0, ni->params, lengthof(ni->params)); CopyInDParam(0, ni->params, lengthof(ni->params));
DrawStringMultiCenter(w->width / 2, w->height - 16, ni->string_id, w->width - 4); DrawStringMultiCenter(w->width / 2, w->height - 16, ni->string_id, w->width - 4);
} }
break; break;
@ -300,7 +300,7 @@ void AddNewsItem(StringID string, uint32 flags, uint data_a, uint data_b)
ni->data_a = data_a; ni->data_a = data_a;
ni->data_b = data_b; ni->data_b = data_b;
ni->date = _date; ni->date = _date;
COPY_OUT_DPARAM(ni->params, 0, lengthof(ni->params)); CopyOutDParam(ni->params, 0, lengthof(ni->params));
w = FindWindowById(WC_MESSAGE_HISTORY, 0); w = FindWindowById(WC_MESSAGE_HISTORY, 0);
if (w == NULL) return; if (w == NULL) return;
@ -611,7 +611,7 @@ static void DrawNewsString(int x, int y, uint16 color, const NewsItem *ni, uint
if (ni->display_mode == 3) { if (ni->display_mode == 3) {
str = _get_news_string_callback[ni->callback](ni); str = _get_news_string_callback[ni->callback](ni);
} else { } else {
COPY_IN_DPARAM(0, ni->params, lengthof(ni->params)); CopyInDParam(0, ni->params, lengthof(ni->params));
str = ni->string_id; str = ni->string_id;
} }

View File

@ -9,13 +9,13 @@
#include "debug.h" #include "debug.h"
#include "driver.h" #include "driver.h"
#include "saveload.h" #include "saveload.h"
#include "strings.h"
#include "map.h" #include "map.h"
#include "tile.h" #include "tile.h"
#include "void_map.h" #include "void_map.h"
#include "helpers.hpp" #include "helpers.hpp"
#include "openttd.h" #include "openttd.h"
#include "strings.h"
#include "bridge_map.h" #include "bridge_map.h"
#include "functions.h" #include "functions.h"
#include "mixer.h" #include "mixer.h"

View File

@ -8,6 +8,7 @@
#include "station_map.h" #include "station_map.h"
#include "table/sprites.h" #include "table/sprites.h"
#include "table/strings.h" #include "table/strings.h"
#include "strings.h"
#include "functions.h" #include "functions.h"
#include "map.h" #include "map.h"
#include "tile.h" #include "tile.h"

View File

@ -6,6 +6,7 @@
#include "openttd.h" #include "openttd.h"
#include "table/sprites.h" #include "table/sprites.h"
#include "table/strings.h" #include "table/strings.h"
#include "strings.h"
#include "functions.h" #include "functions.h"
#include "window.h" #include "window.h"
#include "gui.h" #include "gui.h"

View File

@ -6,6 +6,7 @@
#include "openttd.h" #include "openttd.h"
#include "table/sprites.h" #include "table/sprites.h"
#include "table/strings.h" #include "table/strings.h"
#include "strings.h"
#include "functions.h" #include "functions.h"
#include "landscape.h" #include "landscape.h"
#include "date.h" #include "date.h"

View File

@ -12,6 +12,7 @@
#include "sprite.h" #include "sprite.h"
#include "table/sprites.h" #include "table/sprites.h"
#include "table/strings.h" #include "table/strings.h"
#include "strings.h"
#include "functions.h" #include "functions.h"
#include "window.h" #include "window.h"
#include "map.h" #include "map.h"

View File

@ -6,6 +6,7 @@
#include "openttd.h" #include "openttd.h"
#include "table/sprites.h" #include "table/sprites.h"
#include "table/strings.h" #include "table/strings.h"
#include "strings.h"
#include "functions.h" #include "functions.h"
#include "map.h" #include "map.h"
#include "tile.h" #include "tile.h"

View File

@ -11,6 +11,7 @@
#include "roadveh.h" #include "roadveh.h"
#include "station_map.h" #include "station_map.h"
#include "table/strings.h" #include "table/strings.h"
#include "strings.h"
#include "map.h" #include "map.h"
#include "tile.h" #include "tile.h"
#include "vehicle.h" #include "vehicle.h"

View File

@ -29,6 +29,7 @@
#include "string.h" #include "string.h"
#include "variables.h" #include "variables.h"
#include "network/network.h" #include "network/network.h"
#include "strings.h"
#include "settings.h" #include "settings.h"
#include "command.h" #include "command.h"
#include "console.h" #include "console.h"

View File

@ -6,6 +6,7 @@
#include "openttd.h" #include "openttd.h"
#include "ship.h" #include "ship.h"
#include "table/strings.h" #include "table/strings.h"
#include "strings.h"
#include "functions.h" #include "functions.h"
#include "landscape.h" #include "landscape.h"
#include "map.h" #include "map.h"

View File

@ -8,6 +8,7 @@
#include "functions.h" #include "functions.h"
#include "ship.h" #include "ship.h"
#include "table/strings.h" #include "table/strings.h"
#include "strings.h"
#include "table/sprites.h" #include "table/sprites.h"
#include "gui.h" #include "gui.h"
#include "vehicle.h" #include "vehicle.h"

View File

@ -5,6 +5,7 @@
#include "stdafx.h" #include "stdafx.h"
#include "openttd.h" #include "openttd.h"
#include "table/strings.h" #include "table/strings.h"
#include "strings.h"
#include "functions.h" #include "functions.h"
#include "landscape.h" #include "landscape.h"
#include "player.h" #include "player.h"

View File

@ -10,6 +10,7 @@
#include "industry_map.h" #include "industry_map.h"
#include "station_map.h" #include "station_map.h"
#include "table/strings.h" #include "table/strings.h"
#include "strings.h"
#include "table/sprites.h" #include "table/sprites.h"
#include "landscape.h" #include "landscape.h"
#include "map.h" #include "map.h"

View File

@ -349,4 +349,8 @@ CDECL error(const char *str, ...);
#define _stricmp stricmp #define _stricmp stricmp
#endif /* !defined(MORHPOS) */ #endif /* !defined(MORHPOS) */
#if !defined(MAX_PATH)
# define MAX_PATH 260
#endif
#endif /* STDAFX_H */ #endif /* STDAFX_H */

View File

@ -38,6 +38,7 @@
DynamicLanguages _dynlang; DynamicLanguages _dynlang;
char _userstring[128]; char _userstring[128];
uint64 _decode_parameters[20];
static char *StationGetSpecialString(char *buff, int x, const char* last); static char *StationGetSpecialString(char *buff, int x, const char* last);
static char *GetSpecialTownNameString(char *buff, int ind, uint32 seed, const char* last); static char *GetSpecialTownNameString(char *buff, int ind, uint32 seed, const char* last);

View File

@ -5,13 +5,78 @@
#ifndef STRINGS_H #ifndef STRINGS_H
#define STRINGS_H #define STRINGS_H
char *InlineString(char *buf, uint16 string); char *InlineString(char *buf, StringID string);
char *GetString(char *buffr, uint16 string, const char* last); char *GetString(char *buffr, StringID string, const char* last);
extern char _userstring[128]; extern char _userstring[128];
void InjectDParam(int amount); void InjectDParam(int amount);
int32 GetParamInt32();
static inline void SetDParamX(uint64 *s, uint n, uint64 v)
{
s[n] = v;
}
static inline void SetDParam(uint n, uint64 v)
{
extern uint64 _decode_parameters[20];
assert(n < lengthof(_decode_parameters));
_decode_parameters[n] = v;
}
/* Used to bind a C string name to a dparam number.
* NOTE: This has a short lifetime. You can't
* use this string much later or it will be gone. */
void SetDParamStr(uint n, const char *str);
/** This function takes a C-string and allocates a temporary string ID.
* The duration of the bound string is valid only until the next call to GetString,
* so be careful. */
StringID BindCString(const char *str);
static inline uint64 GetDParamX(const uint64 *s, uint n)
{
return s[n];
}
static inline uint64 GetDParam(uint n)
{
extern uint64 _decode_parameters[20];
assert(n < lengthof(_decode_parameters));
return _decode_parameters[n];
}
static inline void CopyInDParam(int offs, const uint64 *src, int num)
{
extern uint64 _decode_parameters[20];
memcpy(_decode_parameters + offs, src, sizeof(uint64) * (num));
}
static inline void CopyOutDParam(uint64 *dst, int offs, int num)
{
extern uint64 _decode_parameters[20];
memcpy(dst, _decode_parameters + offs, sizeof(uint64) * (num));
}
/** Information about a language */
struct Language {
char *name; ///< The internal name of the language
char *file; ///< The name of the language as it appears on disk
};
/** Used for dynamic language support */
struct DynamicLanguages {
int num; ///< Number of languages
int curr; ///< Currently selected language index
char curr_file[MAX_PATH]; ///< Currently selected language file name without path (needed for saving the filename of the loaded language).
StringID dropdown[MAX_LANG + 1]; ///< List of languages in the settings gui
Language ent[MAX_LANG]; ///< Information about the languages
};
extern DynamicLanguages _dynlang; // defined in strings.cpp
bool ReadLanguagePack(int index); bool ReadLanguagePack(int index);
void InitializeLanguagePacks(); void InitializeLanguagePacks();

View File

@ -5,6 +5,7 @@
#include "stdafx.h" #include "stdafx.h"
#include "openttd.h" #include "openttd.h"
#include "table/strings.h" #include "table/strings.h"
#include "strings.h"
#include "functions.h" #include "functions.h"
#include "window.h" #include "window.h"
#include "station.h" #include "station.h"

View File

@ -7,6 +7,7 @@
#include "functions.h" #include "functions.h"
#include "variables.h" #include "variables.h"
#include "table/strings.h" #include "table/strings.h"
#include "strings.h"
#include "command.h" #include "command.h"
#include "date.h" #include "date.h"
#include "engine.h" #include "engine.h"

View File

@ -11,6 +11,7 @@
#include "gui.h" #include "gui.h"
#include "station_map.h" #include "station_map.h"
#include "table/strings.h" #include "table/strings.h"
#include "strings.h"
#include "map.h" #include "map.h"
#include "tile.h" #include "tile.h"
#include "tunnel_map.h" #include "tunnel_map.h"

View File

@ -8,6 +8,7 @@
#include "functions.h" #include "functions.h"
#include "table/sprites.h" #include "table/sprites.h"
#include "table/strings.h" #include "table/strings.h"
#include "strings.h"
#include "window.h" #include "window.h"
#include "gui.h" #include "gui.h"
#include "vehicle.h" #include "vehicle.h"

View File

@ -12,6 +12,7 @@
#include "road_map.h" #include "road_map.h"
#include "table/sprites.h" #include "table/sprites.h"
#include "table/strings.h" #include "table/strings.h"
#include "strings.h"
#include "functions.h" #include "functions.h"
#include "map.h" #include "map.h"
#include "landscape.h" #include "landscape.h"

View File

@ -8,9 +8,6 @@
#include "yapf/yapf_settings.h" #include "yapf/yapf_settings.h"
/* ********* START OF SAVE REGION */ /* ********* START OF SAVE REGION */
#if !defined(MAX_PATH)
# define MAX_PATH 260
#endif
#include "gfx.h" #include "gfx.h"
@ -292,8 +289,6 @@ VARDEF bool _news_ticker_sound;
VARDEF StringID _error_message; VARDEF StringID _error_message;
VARDEF Money _additional_cash_required; VARDEF Money _additional_cash_required;
VARDEF uint64 _decode_parameters[20];
VARDEF bool _rightclick_emulate; VARDEF bool _rightclick_emulate;
/* IN/OUT parameters to commands */ /* IN/OUT parameters to commands */
@ -320,23 +315,6 @@ VARDEF Vehicle *_place_clicked_vehicle;
VARDEF char _ini_videodriver[32], _ini_musicdriver[32], _ini_sounddriver[32]; VARDEF char _ini_videodriver[32], _ini_musicdriver[32], _ini_sounddriver[32];
/** Information about a language */
struct Language {
char *name; ///< The internal name of the language
char *file; ///< The name of the language as it appears on disk
};
/** Used for dynamic language support */
struct DynamicLanguages {
int num; ///< Number of languages
int curr; ///< Currently selected language index
char curr_file[MAX_PATH]; ///< Currently selected language file name without path (needed for saving the filename of the loaded language).
StringID dropdown[MAX_LANG + 1]; ///< List of languages in the settings gui
Language ent[MAX_LANG]; ///< Information about the languages
};
extern DynamicLanguages _dynlang; // defined in strings.cpp
VARDEF int _num_resolutions; VARDEF int _num_resolutions;
VARDEF uint16 _resolutions[32][2]; VARDEF uint16 _resolutions[32][2];
VARDEF uint16 _cur_resolution[2]; VARDEF uint16 _cur_resolution[2];
@ -348,43 +326,6 @@ VARDEF char *_highscore_file;
VARDEF char *_log_file; VARDEF char *_log_file;
static inline void SetDParamX(uint64 *s, uint n, uint64 v)
{
s[n] = v;
}
static inline uint64 GetDParamX(const uint64 *s, uint n)
{
return s[n];
}
static inline void SetDParam(uint n, uint64 v)
{
assert(n < lengthof(_decode_parameters));
_decode_parameters[n] = v;
}
static inline uint64 GetDParam(uint n)
{
assert(n < lengthof(_decode_parameters));
return _decode_parameters[n];
}
/* Used to bind a C string name to a dparam number.
* NOTE: This has a short lifetime. You can't
* use this string much later or it will be gone. */
void SetDParamStr(uint n, const char *str);
/** This function takes a C-string and allocates a temporary string ID.
* The duration of the bound string is valid only until the next acll to GetString,
* so be careful. */
StringID BindCString(const char *str);
#define COPY_IN_DPARAM(offs, src, num) memcpy(_decode_parameters + offs, src, sizeof(uint64) * (num))
#define COPY_OUT_DPARAM(dst, offs, num) memcpy(dst, _decode_parameters + offs, sizeof(uint64) * (num))
#define SET_EXPENSES_TYPE(x) _yearly_expenses_type = x; #define SET_EXPENSES_TYPE(x) _yearly_expenses_type = x;
/* landscape.cpp */ /* landscape.cpp */

View File

@ -10,6 +10,7 @@
#include "station_map.h" #include "station_map.h"
#include "table/sprites.h" #include "table/sprites.h"
#include "table/strings.h" #include "table/strings.h"
#include "strings.h"
#include "functions.h" #include "functions.h"
#include "landscape.h" #include "landscape.h"
#include "map.h" #include "map.h"