diff options
author | tron <tron@openttd.org> | 2004-12-02 22:53:07 +0000 |
---|---|---|
committer | tron <tron@openttd.org> | 2004-12-02 22:53:07 +0000 |
commit | fdb447ac55fc7faffe6b7477a4ecfa7733b9a03d (patch) | |
tree | 822a14c0bf1d92e45c85d4ce62bc58b7b6cef6c7 /main_gui.c | |
parent | 2c88f958edc2ad87c92ac23b727e27e2ddbe710b (diff) | |
download | openttd-fdb447ac55fc7faffe6b7477a4ecfa7733b9a03d.tar.xz |
(svn r901) Small step in the process to clean up the DPARAM mess:
- reduce to 2 sizes (*DParam64 for 64bit values, *DParam for the rest)
- use inline functions instead of macros
- add assert()s to check for buffer overruns
Diffstat (limited to 'main_gui.c')
-rw-r--r-- | main_gui.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/main_gui.c b/main_gui.c index 92874db04..0fec015fe 100644 --- a/main_gui.c +++ b/main_gui.c @@ -282,7 +282,7 @@ void ShowRenameWaypointWindow(Waypoint *cp) int id = cp - _waypoints; _rename_id = id; _rename_what = 1; - SET_DPARAM16(0, id); + SetDParam(0, id); ShowQueryString(STR_WAYPOINT_RAW, STR_EDIT_WAYPOINT_NAME, 30, 180, 1, 0); } @@ -517,9 +517,9 @@ static void PlayerMenuWndProc(Window *w, WindowEvent *e) } DrawSprite( ((p->player_color + 0x307)<<16)+0x82EB, x+2, y+1); - SET_DPARAM16(0, p->name_1); - SET_DPARAM32(1, p->name_2); - SET_DPARAM16(2, GetPlayerNameString(p->index, 3)); + SetDParam(0, p->name_1); + SetDParam(1, p->name_2); + SetDParam(2, GetPlayerNameString(p->index, 3)); color = (byte)((p->index==sel) ? 0xC : 0x10); if (chk&1) color = 14; @@ -1525,7 +1525,7 @@ static void ScenEditIndustryWndProc(Window *w, WindowEvent *e) // Show error if no town exists at all type = _industry_type_to_place; if (!AnyTownExists()) { - SET_DPARAM16(0, type + STR_4802_COAL_MINE); + SetDParam(0, type + STR_4802_COAL_MINE); ShowErrorMessage(STR_0286_MUST_BUILD_TOWN_FIRST,STR_0285_CAN_T_BUILD_HERE,e->place.pt.x, e->place.pt.y); return; } @@ -1534,7 +1534,7 @@ static void ScenEditIndustryWndProc(Window *w, WindowEvent *e) _generating_world = true; _ignore_restrictions = true; if (!TryBuildIndustry(e->place.tile,type)) { - SET_DPARAM16(0, type + STR_4802_COAL_MINE); + SetDParam(0, type + STR_4802_COAL_MINE); ShowErrorMessage(_error_message, STR_0285_CAN_T_BUILD_HERE,e->place.pt.x, e->place.pt.y); } _ignore_restrictions = false; @@ -1888,10 +1888,10 @@ static void ScenEditToolbarWndProc(Window *w, WindowEvent *e) DrawWindowWidgets(w); - SET_DPARAM16(0, _date); + SetDParam(0, _date); DrawStringCentered(298, 6, STR_00AF, 0); - SET_DPARAM16(0, _date); + SetDParam(0, _date); DrawStringCentered(161, 1, STR_0221_OPENTTD, 0); DrawStringCentered(161, 11,STR_0222_SCENARIO_EDITOR, 0); @@ -2011,14 +2011,14 @@ static void StatusBarWndProc(Window *w, WindowEvent *e) switch(e->event) { case WE_PAINT: DrawWindowWidgets(w); - SET_DPARAM16(0, _date); + SetDParam(0, _date); DrawStringCentered(70, 1, ((_pause||_patches.status_long_date)?STR_00AF:STR_00AE), 0); p = _local_player == OWNER_SPECTATOR ? NULL : DEREF_PLAYER(_local_player); if (p) { // Draw player money - SET_DPARAM64(0, p->money64); + SetDParam64(0, p->money64); DrawStringCentered(570, 1, p->player_money >= 0 ? STR_0004 : STR_0005, 0); } @@ -2034,8 +2034,8 @@ static void StatusBarWndProc(Window *w, WindowEvent *e) } else { if (p) { // This is the default text - SET_DPARAM16(0, p->name_1); - SET_DPARAM32(1, p->name_2); + SetDParam(0, p->name_1); + SetDParam(1, p->name_2); DrawStringCentered(320, 1, STR_02BA, 0); } } |