From 265ac671831f4ba9f79a69e94e0dd527d9a7a132 Mon Sep 17 00:00:00 2001 From: tron Date: Thu, 2 Dec 2004 22:53:07 +0000 Subject: (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 --- industry_cmd.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'industry_cmd.c') diff --git a/industry_cmd.c b/industry_cmd.c index d1af5e81d..edcef12f1 100644 --- a/industry_cmd.c +++ b/industry_cmd.c @@ -362,7 +362,7 @@ static void GetTileDesc_Industry(uint tile, TileDesc *td) td->owner = i->owner; td->str = STR_4802_COAL_MINE + i->type; if ((_map_owner[tile] & 0x80) == 0) { - SET_DPARAMX16(td->dparam, 0, td->str); + SetDParamX(td->dparam, 0, td->str); td->str = STR_2058_UNDER_CONSTRUCTION; } } @@ -379,7 +379,7 @@ static int32 ClearTile_Industry(uint tile, byte flags) if ((_current_player != OWNER_WATER && _game_mode != GM_EDITOR && !_cheats.magic_bulldozer.value) || (_current_player == OWNER_WATER && i->type == IT_OIL_RIG) ) { - SET_DPARAM16(0, STR_4802_COAL_MINE + i->type); + SetDParam(0, STR_4802_COAL_MINE + i->type); return_cmd_error(STR_4800_IN_THE_WAY); } @@ -1643,10 +1643,10 @@ static void ExtChangeIndustryProduction(Industry *i) mag = abs(percent); if (mag >= 10) { - SET_DPARAM16(3, mag); - SET_DPARAM16(0,_cargoc.names_s[i->produced_cargo[j]]); - SET_DPARAM16(1, i->town->index); - SET_DPARAM16(2, i->type + STR_4802_COAL_MINE); + SetDParam(3, mag); + SetDParam(0,_cargoc.names_s[i->produced_cargo[j]]); + SetDParam(1, i->town->index); + SetDParam(2, i->type + STR_4802_COAL_MINE); AddNewsItem(percent>=0 ? STR_INDUSTRY_PROD_GOUP : STR_INDUSTRY_PROD_GODOWN, NEWS_FLAGS(NM_THIN, NF_VIEWPORT|NF_TILE, NT_ECONOMY, 0), i->xy + TILE_XY(1,1), 0); @@ -1656,8 +1656,8 @@ static void ExtChangeIndustryProduction(Industry *i) if (closeit) { i->prod_level = 0; - SET_DPARAM16(1, i->type + STR_4802_COAL_MINE); - SET_DPARAM16(0, i->town->index); + SetDParam(1, i->type + STR_4802_COAL_MINE); + SetDParam(0, i->town->index); AddNewsItem(_industry_close_strings[i->type], NEWS_FLAGS(NM_THIN, NF_VIEWPORT|NF_TILE, NT_ECONOMY, 0), i->xy + TILE_XY(1,1), 0); } } @@ -1736,8 +1736,8 @@ static void MaybeNewIndustry(uint32 r) return; } - SET_DPARAM16(0, type + STR_4802_COAL_MINE); - SET_DPARAM16(1, i->town->index); + SetDParam(0, type + STR_4802_COAL_MINE); + SetDParam(1, i->town->index); AddNewsItem( STR_482D_NEW_UNDER_CONSTRUCTION + (type == IT_FOREST), NEWS_FLAGS(NM_THIN,NF_VIEWPORT|NF_TILE,NT_ECONOMY,0), i->xy, 0); } @@ -1789,8 +1789,8 @@ close_industry: i->prod_level = 0; str = _industry_close_strings[type]; add_news: - SET_DPARAM16(1, type + STR_4802_COAL_MINE); - SET_DPARAM16(0, i->town->index); + SetDParam(1, type + STR_4802_COAL_MINE); + SetDParam(0, i->town->index); AddNewsItem(str, NEWS_FLAGS(NM_THIN, NF_VIEWPORT|NF_TILE, NT_ECONOMY, 0), i->xy + TILE_XY(1,1), 0); } } -- cgit v1.2.3-54-g00ecf