(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
This commit is contained in:
tron 2004-12-02 22:53:07 +00:00
parent 2c88f958ed
commit fdb447ac55
48 changed files with 658 additions and 662 deletions

View File

@ -66,11 +66,11 @@ void DrawAircraftEngine(int x, int y, int engine, uint32 image_ormod)
void DrawAircraftEngineInfo(int engine, int x, int y, int maxw)
{
SET_DPARAM32(0, ((_price.aircraft_base >> 3) * aircraft_vehinfo(engine).base_cost) >> 5);
SET_DPARAM16(1, aircraft_vehinfo(engine).max_speed << 3);
SET_DPARAM16(2, aircraft_vehinfo(engine).passanger_capacity);
SET_DPARAM16(3, aircraft_vehinfo(engine).mail_capacity);
SET_DPARAM32(4, aircraft_vehinfo(engine).running_cost * _price.aircraft_running >> 8);
SetDParam(0, ((_price.aircraft_base >> 3) * aircraft_vehinfo(engine).base_cost) >> 5);
SetDParam(1, aircraft_vehinfo(engine).max_speed << 3);
SetDParam(2, aircraft_vehinfo(engine).passanger_capacity);
SetDParam(3, aircraft_vehinfo(engine).mail_capacity);
SetDParam(4, aircraft_vehinfo(engine).running_cost * _price.aircraft_running >> 8);
DrawStringMultiCenter(x, y, STR_A02E_COST_MAX_SPEED_CAPACITY, maxw);
}
@ -1084,12 +1084,12 @@ static void MaybeCrashAirplane(Vehicle *v)
amt = 2;
if (v->cargo_type == CT_PASSENGERS) amt += v->cargo_count;
SET_DPARAM16(0, amt);
SetDParam(0, amt);
v->cargo_count = 0;
v->next->cargo_count = 0,
SET_DPARAM16(1, st->index);
SetDParam(1, st->index);
AddNewsItem(STR_A034_PLANE_CRASH_DIE_IN_FIREBALL,
NEWS_FLAGS(NM_THIN, NF_VIEWPORT|NF_VEHICLE, NT_ACCIDENT, 0),
v->index,
@ -1116,7 +1116,7 @@ static void AircraftEntersTerminal(Vehicle *v)
uint32 flags;
st->had_vehicle_of_type |= HVOT_AIRCRAFT;
SET_DPARAM16(0, st->index);
SetDParam(0, st->index);
// show newsitem of celebrating citizens
flags = (v->owner == _local_player) ? NEWS_FLAGS(NM_THIN, NF_VIEWPORT|NF_VEHICLE, NT_ARRIVAL_PLAYER, 0) : NEWS_FLAGS(NM_THIN, NF_VIEWPORT|NF_VEHICLE, NT_ARRIVAL_OTHER, 0);
AddNewsItem(
@ -1161,7 +1161,7 @@ static void AircraftEnterHangar(Vehicle *v)
v->vehstatus |= VS_STOPPED;
if (v->owner == _local_player) {
SET_DPARAM16(0, v->unitnumber);
SetDParam(0, v->unitnumber);
AddNewsItem(
STR_A014_AIRCRAFT_IS_WAITING_IN,
NEWS_FLAGS(NM_SMALL, NF_VIEWPORT|NF_VEHICLE, NT_ADVICE, 0),

View File

@ -90,17 +90,17 @@ static void NewAircraftWndProc(Window *w, WindowEvent *e)
if (selected_id != -1) {
Engine *e;
SET_DPARAM32(0, aircraft_vehinfo(selected_id).base_cost * (_price.aircraft_base>>3)>>5);
SET_DPARAM16(1, aircraft_vehinfo(selected_id).max_speed * 8);
SET_DPARAM16(2, aircraft_vehinfo(selected_id).passanger_capacity);
SET_DPARAM16(3, aircraft_vehinfo(selected_id).mail_capacity);
SET_DPARAM32(4, aircraft_vehinfo(selected_id).running_cost * _price.aircraft_running >> 8);
SetDParam(0, aircraft_vehinfo(selected_id).base_cost * (_price.aircraft_base>>3)>>5);
SetDParam(1, aircraft_vehinfo(selected_id).max_speed * 8);
SetDParam(2, aircraft_vehinfo(selected_id).passanger_capacity);
SetDParam(3, aircraft_vehinfo(selected_id).mail_capacity);
SetDParam(4, aircraft_vehinfo(selected_id).running_cost * _price.aircraft_running >> 8);
e = &_engines[selected_id];
SET_DPARAM16(6, e->lifelength);
SET_DPARAM8(7, e->reliability * 100 >> 16);
SetDParam(6, e->lifelength);
SetDParam(7, e->reliability * 100 >> 16);
ConvertDayToYMD(&ymd, e->intro_date);
SET_DPARAM16(5, ymd.year + 1920);
SetDParam(5, ymd.year + 1920);
DrawString(2, 111, STR_A007_COST_SPEED_CAPACITY_PASSENGERS, 0);
}
@ -208,8 +208,8 @@ static void AircraftRefitWndProc(Window *w, WindowEvent *e)
byte color;
int cargo;
SET_DPARAM16(0, v->string_id);
SET_DPARAM16(1, v->unitnumber);
SetDParam(0, v->string_id);
SetDParam(1, v->unitnumber);
DrawWindowWidgets(w);
DrawString(1, 15, STR_A040_SELECT_CARGO_TYPE_TO_CARRY, 0);
@ -259,9 +259,9 @@ static void AircraftRefitWndProc(Window *w, WindowEvent *e)
if (cargo != -1) {
int32 cost = DoCommandByTile(v->tile, v->index, cargo, DC_QUERY_COST, CMD_REFIT_AIRCRAFT);
if (cost != CMD_ERROR) {
SET_DPARAM32(2, cost);
SET_DPARAM16(0, _cargoc.names_long_p[cargo]);
SET_DPARAM16(1, _aircraft_refit_capacity);
SetDParam(2, cost);
SetDParam(0, _cargoc.names_long_p[cargo]);
SetDParam(1, _aircraft_refit_capacity);
DrawString(1, 137, STR_A041_NEW_CAPACITY_COST_OF_REFIT, 0);
}
}
@ -331,8 +331,8 @@ static void AircraftDetailsWndProc(Window *w, WindowEvent *e)
if (!_patches.servint_aircraft) // disable service-scroller when interval is set to disabled
w->disabled_state |= (1 << 5) | (1 << 6);
SET_DPARAM16(0, v->string_id);
SET_DPARAM16(1, v->unitnumber);
SetDParam(0, v->string_id);
SetDParam(1, v->unitnumber);
DrawWindowWidgets(w);
/* Draw running cost */
@ -340,7 +340,7 @@ static void AircraftDetailsWndProc(Window *w, WindowEvent *e)
int year = v->age / 366;
StringID str;
SET_DPARAM16(1, year);
SetDParam(1, year);
str = STR_0199_YEAR;
if (year != 1) {
@ -348,36 +348,36 @@ static void AircraftDetailsWndProc(Window *w, WindowEvent *e)
if (v->max_age - 366 < v->age)
str++;
}
SET_DPARAM16(0, str);
SET_DPARAM16(2, v->max_age / 366);
SET_DPARAM32(3, _price.aircraft_running * aircraft_vehinfo(v->engine_type).running_cost >> 8);
SetDParam(0, str);
SetDParam(2, v->max_age / 366);
SetDParam(3, _price.aircraft_running * aircraft_vehinfo(v->engine_type).running_cost >> 8);
DrawString(2, 15, STR_A00D_AGE_RUNNING_COST_YR, 0);
}
/* Draw max speed */
{
SET_DPARAM16(0, v->max_speed * 8);
SetDParam(0, v->max_speed * 8);
DrawString(2, 25, STR_A00E_MAX_SPEED, 0);
}
/* Draw profit */
{
SET_DPARAM32(0, v->profit_this_year);
SET_DPARAM32(1, v->profit_last_year);
SetDParam(0, v->profit_this_year);
SetDParam(1, v->profit_last_year);
DrawString(2, 35, STR_A00F_PROFIT_THIS_YEAR_LAST_YEAR, 0);
}
/* Draw breakdown & reliability */
{
SET_DPARAM8(0, v->reliability * 100 >> 16);
SET_DPARAM16(1, v->breakdowns_since_last_service);
SetDParam(0, v->reliability * 100 >> 16);
SetDParam(1, v->breakdowns_since_last_service);
DrawString(2, 45, STR_A010_RELIABILITY_BREAKDOWNS, 0);
}
/* Draw service interval text */
{
SET_DPARAM16(0, v->service_interval);
SET_DPARAM16(1, v->date_of_last_service);
SetDParam(0, v->service_interval);
SetDParam(1, v->date_of_last_service);
DrawString(13, 103, _patches.servint_ispercent?STR_SERVICING_INTERVAL_PERCENT:STR_883C_SERVICING_INTERVAL_DAYS, 0);
}
@ -388,17 +388,17 @@ static void AircraftDetailsWndProc(Window *w, WindowEvent *e)
do {
if (v->subtype <= 2) {
SET_DPARAM16(0, GetCustomEngineName(v->engine_type));
SET_DPARAM16(1, 1920 + v->build_year);
SET_DPARAM32(2, v->value);
SetDParam(0, GetCustomEngineName(v->engine_type));
SetDParam(1, 1920 + v->build_year);
SetDParam(2, v->value);
DrawString(60, y, STR_A011_BUILT_VALUE, 0);
y += 10;
SET_DPARAM16(0, _cargoc.names_long_p[v->cargo_type]);
SET_DPARAM16(1, v->cargo_cap);
SetDParam(0, _cargoc.names_long_p[v->cargo_type]);
SetDParam(1, v->cargo_cap);
u = v->next;
SET_DPARAM16(2, _cargoc.names_long_p[u->cargo_type]);
SET_DPARAM16(3, u->cargo_cap);
SetDParam(2, _cargoc.names_long_p[u->cargo_type]);
SetDParam(3, u->cargo_cap);
DrawString(60, y, STR_A019_CAPACITY + (u->cargo_cap == 0), 0);
y += 14;
}
@ -406,9 +406,9 @@ static void AircraftDetailsWndProc(Window *w, WindowEvent *e)
if (v->cargo_count != 0) {
/* Cargo names (fix pluralness) */
SET_DPARAM8(0, v->cargo_type);
SET_DPARAM16(1, v->cargo_count);
SET_DPARAM16(2, v->cargo_source);
SetDParam(0, v->cargo_type);
SetDParam(1, v->cargo_count);
SetDParam(2, v->cargo_source);
DrawString(60, y, STR_8813_FROM, 0);
y += 10;
@ -420,7 +420,7 @@ static void AircraftDetailsWndProc(Window *w, WindowEvent *e)
case WE_CLICK:
switch(e->click.widget) {
case 2: /* rename */
SET_DPARAM16(0, v->unitnumber);
SetDParam(0, v->unitnumber);
ShowQueryString(v->string_id, STR_A030_NAME_AIRCRAFT, 31, 150, w->window_class, w->window_number);
break;
@ -534,8 +534,8 @@ static void AircraftViewWndProc(Window *w, WindowEvent *e)
w->disabled_state = disabled;
/* draw widgets & caption */
SET_DPARAM16(0, v->string_id);
SET_DPARAM16(1, v->unitnumber);
SetDParam(0, v->string_id);
SetDParam(1, v->unitnumber);
DrawWindowWidgets(w);
/* draw the flag */
@ -548,14 +548,14 @@ static void AircraftViewWndProc(Window *w, WindowEvent *e)
} else {
switch(v->next_order & OT_MASK) {
case OT_GOTO_STATION: {
SET_DPARAM16(0, v->next_order_param);
SET_DPARAM16(1, v->cur_speed * 8);
SetDParam(0, v->next_order_param);
SetDParam(1, v->cur_speed * 8);
str = STR_HEADING_FOR_STATION + _patches.vehicle_speed;
} break;
case OT_GOTO_DEPOT: {
SET_DPARAM16(0, v->next_order_param);
SET_DPARAM16(1, v->cur_speed * 8);
SetDParam(0, v->next_order_param);
SetDParam(1, v->cur_speed * 8);
str = STR_HEADING_FOR_HANGAR + _patches.vehicle_speed;
} break;
@ -566,7 +566,7 @@ static void AircraftViewWndProc(Window *w, WindowEvent *e)
default:
if (v->num_orders == 0) {
str = STR_NO_ORDERS + _patches.vehicle_speed;
SET_DPARAM16(0, v->cur_speed * 8);
SetDParam(0, v->cur_speed * 8);
} else
str = STR_EMPTY;
break;
@ -651,7 +651,7 @@ static void DrawAircraftDepotWindow(Window *w)
}
SetVScrollCount(w, (num + 3) >> 2);
SET_DPARAM16(0, _map2[tile]);
SetDParam(0, _map2[tile]);
DrawWindowWidgets(w);
x = 2;
@ -667,7 +667,7 @@ static void DrawAircraftDepotWindow(Window *w)
DrawAircraftImage(v, x+12, y, WP(w,traindepot_d).sel);
SET_DPARAM16(0, v->unitnumber);
SetDParam(0, v->unitnumber);
DrawString(x, y+2, (uint16)(v->max_age-366) >= v->age ? STR_00E2 : STR_00E3, 0);
DrawSprite( (v->vehstatus & VS_STOPPED) ? 0xC12 : 0xC13, x, y+12);
@ -873,7 +873,7 @@ static void DrawSmallSchedule(Vehicle *v, int x, int y) {
sel--;
if ((ord & OT_MASK) == OT_GOTO_STATION) {
SET_DPARAM16(0, ord >> 8);
SetDParam(0, ord >> 8);
DrawString(x, y, STR_A036, 0);
y += 6;
@ -971,9 +971,9 @@ static void PlayerAircraftWndProc(Window *w, WindowEvent *e)
{
Player *p = DEREF_PLAYER(window_number);
/* Company Name -- (###) Aircraft */
SET_DPARAM16(0, p->name_1);
SET_DPARAM32(1, p->name_2);
SET_DPARAM16(2, w->vscroll.count);
SetDParam(0, p->name_1);
SetDParam(1, p->name_2);
SetDParam(2, w->vscroll.count);
DrawWindowWidgets(w);
}
/* draw sorting criteria string */
@ -998,7 +998,7 @@ static void PlayerAircraftWndProc(Window *w, WindowEvent *e)
DrawAircraftImage(v, x + 19, y + 6, INVALID_VEHICLE);
DrawVehicleProfitButton(v, x, y+13);
SET_DPARAM16(0, v->unitnumber);
SetDParam(0, v->unitnumber);
if (IsAircraftHangarTile(v->tile)) {
str = STR_021F;
} else {
@ -1007,12 +1007,12 @@ static void PlayerAircraftWndProc(Window *w, WindowEvent *e)
DrawString(x, y+2, str, 0);
SET_DPARAM32(0, v->profit_this_year);
SET_DPARAM32(1, v->profit_last_year);
SetDParam(0, v->profit_this_year);
SetDParam(1, v->profit_last_year);
DrawString(x+19, y + 28, STR_0198_PROFIT_THIS_YEAR_LAST_YEAR, 0);
if (v->string_id != STR_SV_AIRCRAFT_NAME) {
SET_DPARAM16(0, v->string_id);
SetDParam(0, v->string_id);
DrawString(x+19, y, STR_01AB, 0);
}

View File

@ -46,9 +46,9 @@ static void BuildBridgeWndProc(Window *w, WindowEvent *e)
for(i=0; i < 4 && i + w->vscroll.pos < _bridge.count; i++) {
int ind = _bridge.indexes[i + w->vscroll.pos];
SET_DPARAM32(2, _bridge.costs[i + w->vscroll.pos]);
SET_DPARAM16(1, (_bridge_speeds[ind] >> 4) * 10);
SET_DPARAM16(0, _bridge_material[ind]);
SetDParam(2, _bridge.costs[i + w->vscroll.pos]);
SetDParam(1, (_bridge_speeds[ind] >> 4) * 10);
SetDParam(0, _bridge_material[ind]);
DrawSprite(_bridge_sprites[ind], 3, 15 + i * 22);
DrawString(44, 15 + i*22 , STR_500D, 0);

View File

@ -493,7 +493,7 @@ bool DoCommandP(TileIndex tile, uint32 p1, uint32 p2, CommandCallback *callback,
if (res2 != 0)
ShowCostOrIncomeAnimation(x, y, GetSlopeZ(x, y), res2);
if (_additional_cash_required) {
SET_DPARAM32(0, _additional_cash_required);
SetDParam(0, _additional_cash_required);
ShowErrorMessage(STR_0003_NOT_ENOUGH_CASH_REQUIRES, _error_message_2, x,y);
if (res2 == 0) goto callb_err;
}

View File

@ -168,7 +168,7 @@ static void DisasterTick_Zeppeliner(Vehicle *v)
v->next_order = 1;
v->age = 0;
SET_DPARAM16(0, _map2[tile]);
SetDParam(0, _map2[tile]);
AddNewsItem(STR_B000_ZEPPELIN_DISASTER_AT,
NEWS_FLAGS(NM_THIN, NF_VIEWPORT|NF_VEHICLE, NT_ACCIDENT, 0),
v->index,
@ -372,7 +372,7 @@ static void DisasterTick_2(Vehicle *v)
i = DEREF_INDUSTRY(v->dest_tile);
DestructIndustry(i);
SET_DPARAM16(0, i->town->index);
SetDParam(0, i->town->index);
AddNewsItem(STR_B002_OIL_REFINERY_EXPLOSION, NEWS_FLAGS(NM_THIN,NF_VIEWPORT|NF_TILE,NT_ACCIDENT,0), i->xy, 0);
SndPlayTileFx(0x10, i->xy);
}
@ -442,7 +442,7 @@ static void DisasterTick_3(Vehicle *v)
i = DEREF_INDUSTRY(v->dest_tile);
DestructIndustry(i);
SET_DPARAM16(0, i->town->index);
SetDParam(0, i->town->index);
AddNewsItem(STR_B003_FACTORY_DESTROYED_IN_SUSPICIOUS, NEWS_FLAGS(NM_THIN,NF_VIEWPORT|NF_TILE,NT_ACCIDENT,0), i->xy, 0);
SndPlayTileFx(0x10, i->xy);
}
@ -525,7 +525,7 @@ static void DisasterTick_4(Vehicle *v)
}
t = ClosestTownFromTile(v->dest_tile, (uint)-1);
SET_DPARAM16(0, t->index);
SetDParam(0, t->index);
AddNewsItem(STR_B004_UFO_LANDS_NEAR,
NEWS_FLAGS(NM_THIN, NF_VIEWPORT|NF_TILE, NT_ACCIDENT, 0),
v->tile,
@ -894,7 +894,7 @@ static void Disaster7_Init()
for(i=_industries; i != endof(_industries); i++) {
if (i->xy != 0 && i->type == IT_COAL_MINE && --index < 0) {
SET_DPARAM16(0, i->town->index);
SetDParam(0, i->town->index);
AddNewsItem(STR_B005_COAL_MINE_SUBSIDENCE_LEAVES,
NEWS_FLAGS(NM_THIN,NF_VIEWPORT|NF_TILE,NT_ACCIDENT,0), i->xy + TILE_XY(1,1), 0);

View File

@ -381,8 +381,8 @@ year_4:
}
// Show bankrupt news
SET_DPARAM16(0, p->name_1);
SET_DPARAM32(1, p->name_2);
SetDParam(0, p->name_1);
SetDParam(1, p->name_2);
AddNewsItem( (StringID)(owner + 16*3), NEWS_FLAGS(NM_CALLBACK, 0, NT_COMPANY_INFO, DNC_BANKRUPCY),0,0);
if (IS_HUMAN_PLAYER(owner)) {
@ -406,8 +406,8 @@ void DrawNewsBankrupcy(Window *w)
DrawPlayerFace(p->face, p->player_color, 2, 23);
GfxFillRect(3, 23, 3+91, 23+118, 0x4323);
SET_DPARAM16(0, p->president_name_1);
SET_DPARAM32(1, p->president_name_2);
SetDParam(0, p->president_name_1);
SetDParam(1, p->president_name_2);
DrawStringMultiCenter(49, 148, STR_7058_PRESIDENT, 94);
@ -415,8 +415,8 @@ void DrawNewsBankrupcy(Window *w)
case 1:
DrawStringCentered(w->width>>1, 1, STR_7056_TRANSPORT_COMPANY_IN_TROUBLE, 0);
SET_DPARAM16(0, p->name_1);
SET_DPARAM32(1, p->name_2);
SetDParam(0, p->name_1);
SetDParam(1, p->name_2);
DrawStringMultiCenter(
((w->width - 101) >> 1) + 98,
@ -430,10 +430,10 @@ void DrawNewsBankrupcy(Window *w)
DrawStringCentered(w->width>>1, 1, STR_7059_TRANSPORT_COMPANY_MERGER, 0);
COPY_IN_DPARAM(0,WP(w,news_d).ni->params, 2);
SET_DPARAM16(2, p->name_1);
SET_DPARAM32(3, p->name_2);
SetDParam(2, p->name_1);
SetDParam(3, p->name_2);
price = WP(w,news_d).ni->params[2];
SET_DPARAM32(4, price);
SetDParam(4, price);
DrawStringMultiCenter(
((w->width - 101) >> 1) + 98,
90,
@ -454,8 +454,8 @@ void DrawNewsBankrupcy(Window *w)
case 4:
DrawStringCentered(w->width>>1, 1, STR_705E_NEW_TRANSPORT_COMPANY_LAUNCHED, 0);
SET_DPARAM16(0, p->name_1);
SET_DPARAM32(1, p->name_2);
SetDParam(0, p->name_1);
SetDParam(1, p->name_2);
COPY_IN_DPARAM(2,WP(w,news_d).ni->params, 2);
DrawStringMultiCenter(
((w->width - 101) >> 1) + 98,
@ -475,29 +475,29 @@ StringID GetNewsStringBankrupcy(NewsItem *ni)
switch(ni->string_id >> 4) {
case 1:
SET_DPARAM16(0, STR_7056_TRANSPORT_COMPANY_IN_TROUBLE);
SET_DPARAM16(1, STR_7057_WILL_BE_SOLD_OFF_OR_DECLARED);
SET_DPARAM16(2, p->name_1);
SET_DPARAM32(3, p->name_2);
SetDParam(0, STR_7056_TRANSPORT_COMPANY_IN_TROUBLE);
SetDParam(1, STR_7057_WILL_BE_SOLD_OFF_OR_DECLARED);
SetDParam(2, p->name_1);
SetDParam(3, p->name_2);
return STR_02B6;
case 2:
SET_DPARAM16(0, STR_7059_TRANSPORT_COMPANY_MERGER);
SET_DPARAM16(1, STR_705A_HAS_BEEN_SOLD_TO_FOR);
SetDParam(0, STR_7059_TRANSPORT_COMPANY_MERGER);
SetDParam(1, STR_705A_HAS_BEEN_SOLD_TO_FOR);
COPY_IN_DPARAM(2,ni->params, 2);
SET_DPARAM16(4, p->name_1);
SET_DPARAM32(5, p->name_2);
SetDParam(4, p->name_1);
SetDParam(5, p->name_2);
COPY_IN_DPARAM(6,ni->params + 2, 1);
return STR_02B6;
case 3:
SET_DPARAM16(0, STR_705C_BANKRUPT);
SET_DPARAM16(1, STR_705D_HAS_BEEN_CLOSED_DOWN_BY);
SetDParam(0, STR_705C_BANKRUPT);
SetDParam(1, STR_705D_HAS_BEEN_CLOSED_DOWN_BY);
COPY_IN_DPARAM(2,ni->params, 2);
return STR_02B6;
case 4:
SET_DPARAM16(0, STR_705E_NEW_TRANSPORT_COMPANY_LAUNCHED);
SET_DPARAM16(1, STR_705F_STARTS_CONSTRUCTION_NEAR);
SET_DPARAM16(2, p->name_1);
SET_DPARAM32(3, p->name_2);
SetDParam(0, STR_705E_NEW_TRANSPORT_COMPANY_LAUNCHED);
SetDParam(1, STR_705F_STARTS_CONSTRUCTION_NEAR);
SetDParam(2, p->name_1);
SetDParam(3, p->name_2);
COPY_IN_DPARAM(4,ni->params, 2);
return STR_02B6;
default:
@ -716,50 +716,50 @@ Pair SetupSubsidyDecodeParam(Subsidy *s, bool mode)
Pair tp;
/* if mode is false, convert into plural */
SET_DPARAM16(0, _cargoc.names_s[s->cargo_type] + (mode?0:32));
SetDParam(0, _cargoc.names_s[s->cargo_type] + (mode?0:32));
if (s->age < 12) {
if (!(s->cargo_type == CT_PASSENGERS || s->cargo_type == CT_MAIL)) {
SET_DPARAM16(1, STR_2029);
SetDParam(1, STR_2029);
i = DEREF_INDUSTRY(s->from);
tile = i->xy;
SET_DPARAM16(2, i->town->townnametype);
SET_DPARAM32(3, i->town->townnameparts);
SetDParam(2, i->town->townnametype);
SetDParam(3, i->town->townnameparts);
SET_DPARAM16(4, i->type + STR_4802_COAL_MINE);
SetDParam(4, i->type + STR_4802_COAL_MINE);
if (s->cargo_type != CT_GOODS && s->cargo_type != CT_FOOD) {
SET_DPARAM16(5, STR_2029);
SetDParam(5, STR_2029);
i = DEREF_INDUSTRY(s->to);
tile2 = i->xy;
SET_DPARAM16(8, i->type + STR_4802_COAL_MINE);
SET_DPARAM16(6, i->town->townnametype);
SET_DPARAM32(7, i->town->townnameparts);
SetDParam(8, i->type + STR_4802_COAL_MINE);
SetDParam(6, i->town->townnametype);
SetDParam(7, i->town->townnameparts);
} else {
t = DEREF_TOWN(s->to);
tile2 = t->xy;
SET_DPARAM16(5, t->townnametype);
SET_DPARAM32(6, t->townnameparts);
SetDParam(5, t->townnametype);
SetDParam(6, t->townnameparts);
}
} else {
t = DEREF_TOWN(s->from);
tile = t->xy;
SET_DPARAM16(1, t->townnametype);
SET_DPARAM32(2, t->townnameparts);
SetDParam(1, t->townnametype);
SetDParam(2, t->townnameparts);
t = DEREF_TOWN(s->to);
tile2 = t->xy;
SET_DPARAM16(3, t->townnametype);
SET_DPARAM32(4, t->townnameparts);
SetDParam(3, t->townnametype);
SetDParam(4, t->townnameparts);
}
} else {
st = DEREF_STATION(s->from);
tile = st->xy;
SET_DPARAM16(1, st->index);
SetDParam(1, st->index);
st = DEREF_STATION(s->to);
tile2 = st->xy;
SET_DPARAM16(2, st->index);
SetDParam(2, st->index);
}
tp.a = tile;
@ -1118,8 +1118,8 @@ static bool CheckSubsidised(Station *from, Station *to, byte cargo_type)
INJECT_DPARAM(2);
p = DEREF_PLAYER(_current_player);
SET_DPARAM16(0, p->name_1);
SET_DPARAM32(1, p->name_2);
SetDParam(0, p->name_1);
SetDParam(1, p->name_2);
AddNewsItem(
STR_2031_SERVICE_SUBSIDY_AWARDED + _opt.diff.subsidy_multiplier,
NEWS_FLAGS(NM_NORMAL, NF_TILE, NT_SUBSIDIES, 0),
@ -1416,9 +1416,9 @@ static void DoAcquireCompany(Player *p)
int i,pi;
int64 value;
SET_DPARAM16(0, p->name_1);
SET_DPARAM32(1, p->name_2);
SET_DPARAM32(2, p->bankrupt_value);
SetDParam(0, p->name_1);
SetDParam(1, p->name_2);
SetDParam(2, p->bankrupt_value);
AddNewsItem( (StringID)(_current_player + 16*2), NEWS_FLAGS(NM_CALLBACK, 0, NT_COMPANY_INFO, DNC_BANKRUPCY),0,0);
// original code does this a little bit differently

View File

@ -71,7 +71,7 @@ static void EnginePreviewWndProc(Window *w, WindowEvent *e)
DrawWindowWidgets(w);
engine = w->window_number;
SET_DPARAM16(0, GetEngineCategoryName(engine));
SetDParam(0, GetEngineCategoryName(engine));
DrawStringMultiCenter(150, 44, STR_8101_WE_HAVE_JUST_DESIGNED_A, 296);
DrawStringCentered(w->width >> 1, 80, GetCustomEngineName(engine), 0x10);
@ -123,12 +123,12 @@ void DrawNewsNewTrainAvail(Window *w)
DrawNewsBorder(w);
engine = WP(w,news_d).ni->string_id;
SET_DPARAM16(0, GetEngineCategoryName(engine));
SetDParam(0, GetEngineCategoryName(engine));
DrawStringMultiCenter(w->width >> 1, 20, STR_8859_NEW_NOW_AVAILABLE, w->width - 2);
GfxFillRect(25, 56, w->width - 25, w->height - 2, 10);
SET_DPARAM16(0, GetCustomEngineName(engine));
SetDParam(0, GetCustomEngineName(engine));
DrawStringMultiCenter(w->width >> 1, 57, STR_885A, w->width - 2);
DrawTrainEngine(w->width >> 1, 88, engine, 0);
@ -139,9 +139,9 @@ void DrawNewsNewTrainAvail(Window *w)
StringID GetNewsStringNewTrainAvail(NewsItem *ni)
{
int engine = ni->string_id;
SET_DPARAM16(0, STR_8859_NEW_NOW_AVAILABLE);
SET_DPARAM16(1, GetEngineCategoryName(engine));
SET_DPARAM16(2, GetCustomEngineName(engine));
SetDParam(0, STR_8859_NEW_NOW_AVAILABLE);
SetDParam(1, GetEngineCategoryName(engine));
SetDParam(2, GetCustomEngineName(engine));
return STR_02B6;
}
@ -156,7 +156,7 @@ void DrawNewsNewAircraftAvail(Window *w)
DrawStringMultiCenter(w->width >> 1, 20, STR_A02C_NEW_AIRCRAFT_NOW_AVAILABLE, w->width - 2);
GfxFillRect(25, 56, w->width - 25, w->height - 2, 10);
SET_DPARAM16(0, GetCustomEngineName(engine));
SetDParam(0, GetCustomEngineName(engine));
DrawStringMultiCenter(w->width >> 1, 57, STR_A02D, w->width - 2);
DrawAircraftEngine(w->width >> 1, 93, engine, 0);
@ -167,8 +167,8 @@ void DrawNewsNewAircraftAvail(Window *w)
StringID GetNewsStringNewAircraftAvail(NewsItem *ni)
{
int engine = ni->string_id;
SET_DPARAM16(0, STR_A02C_NEW_AIRCRAFT_NOW_AVAILABLE);
SET_DPARAM16(1, GetCustomEngineName(engine));
SetDParam(0, STR_A02C_NEW_AIRCRAFT_NOW_AVAILABLE);
SetDParam(1, GetCustomEngineName(engine));
return STR_02B6;
}
@ -182,7 +182,7 @@ void DrawNewsNewRoadVehAvail(Window *w)
DrawStringMultiCenter(w->width >> 1, 20, STR_9028_NEW_ROAD_VEHICLE_NOW_AVAILABLE, w->width - 2);
GfxFillRect(25, 56, w->width - 25, w->height - 2, 10);
SET_DPARAM16(0, GetCustomEngineName(engine));
SetDParam(0, GetCustomEngineName(engine));
DrawStringMultiCenter(w->width >> 1, 57, STR_9029, w->width - 2);
DrawRoadVehEngine(w->width >> 1, 88, engine, 0);
@ -193,8 +193,8 @@ void DrawNewsNewRoadVehAvail(Window *w)
StringID GetNewsStringNewRoadVehAvail(NewsItem *ni)
{
int engine = ni->string_id;
SET_DPARAM16(0, STR_9028_NEW_ROAD_VEHICLE_NOW_AVAILABLE);
SET_DPARAM16(1, GetCustomEngineName(engine));
SetDParam(0, STR_9028_NEW_ROAD_VEHICLE_NOW_AVAILABLE);
SetDParam(1, GetCustomEngineName(engine));
return STR_02B6;
}
@ -209,7 +209,7 @@ void DrawNewsNewShipAvail(Window *w)
DrawStringMultiCenter(w->width >> 1, 20, STR_982C_NEW_SHIP_NOW_AVAILABLE, w->width - 2);
GfxFillRect(25, 56, w->width - 25, w->height - 2, 10);
SET_DPARAM16(0, GetCustomEngineName(engine));
SetDParam(0, GetCustomEngineName(engine));
DrawStringMultiCenter(w->width >> 1, 57, STR_982D, w->width - 2);
DrawShipEngine(w->width >> 1, 93, engine, 0);
@ -220,7 +220,7 @@ void DrawNewsNewShipAvail(Window *w)
StringID GetNewsStringNewShipAvail(NewsItem *ni)
{
int engine = ni->string_id;
SET_DPARAM16(0, STR_982C_NEW_SHIP_NOW_AVAILABLE);
SET_DPARAM16(1, GetCustomEngineName(engine));
SetDParam(0, STR_982C_NEW_SHIP_NOW_AVAILABLE);
SetDParam(1, GetCustomEngineName(engine));
return STR_02B6;
}

View File

@ -130,8 +130,8 @@ static void DrawGraph(GraphDrawer *gw)
y = gw->top - 3;
i = 9;
do {
SET_DPARAM16(0, gw->format_str_y_axis);
SET_DPARAM64(1, (int64)tmp);
SetDParam(0, gw->format_str_y_axis);
SetDParam64(1, (int64)tmp);
tmp -= (value >> 3);
DrawStringRightAligned(x, y, STR_0170, gw->color_3);
y += gw->height >> 3;
@ -145,9 +145,9 @@ static void DrawGraph(GraphDrawer *gw)
k = gw->year + 1920;
i = gw->num_on_x_axis;assert(i>0);
do {
SET_DPARAM16(2, k);
SET_DPARAM16(0, j + STR_0162_JAN);
SET_DPARAM16(1, j + STR_0162_JAN + 2);
SetDParam(2, k);
SetDParam(0, j + STR_0162_JAN);
SetDParam(1, j + STR_0162_JAN + 2);
DrawString(x, y, j == 0 ? STR_016F : STR_016E, gw->color_3);
j += 3;
@ -163,7 +163,7 @@ static void DrawGraph(GraphDrawer *gw)
j = gw->unk61A;
i = gw->num_on_x_axis;assert(i>0);
do {
SET_DPARAM16(0, j);
SetDParam(0, j);
DrawString(x, y, STR_01CB, gw->color_3);
j += gw->unk61C;
x += 22;
@ -228,9 +228,9 @@ static void GraphLegendWndProc(Window *w, WindowEvent *e)
DrawPlayerIcon(p->index, 4, 18+p->index*12);
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));
DrawString(21,17+p->index*12,STR_7021,HASBIT(_legend_showbits, p->index) ? 0x10 : 0xC);
}
break;
@ -598,7 +598,7 @@ static void PerformanceRatingDetailWndProc(Window *w, WindowEvent *e)
DrawString(7, y, STR_PERFORMANCE_DETAIL_VEHICLES + i, 0);
// Draw the score
SET_DPARAM32(0, score);
SetDParam(0, score);
DrawStringRightAligned(107, y, SET_PERFORMANCE_DETAIL_INT, 0);
// Calculate the %-bar
@ -625,7 +625,7 @@ static void PerformanceRatingDetailWndProc(Window *w, WindowEvent *e)
x = 0;
// Draw it
SET_DPARAM32(0, x);
SetDParam(0, x);
DrawStringCentered(137, y, STR_PERFORMANCE_DETAIL_PERCENT, 0);
// SCORE_LOAN is inversed
@ -634,8 +634,8 @@ static void PerformanceRatingDetailWndProc(Window *w, WindowEvent *e)
// Draw the amount we have against what is needed
// For some of them it is in currency format
SET_DPARAM32(0, val);
SET_DPARAM32(1, needed);
SetDParam(0, val);
SetDParam(1, needed);
switch (i) {
case SCORE_MIN_PROFIT:
case SCORE_MIN_INCOME:
@ -924,7 +924,7 @@ static void CargoPaymentRatesWndProc(Window *w, WindowEvent *e)
for(i=0; i!=NUM_CARGO; i++) {
GfxFillRect(x, y, x+8, y+5, 0);
GfxFillRect(x+1, y+1, x+7, y+4, _cargo_legend_colors[i]);
SET_DPARAM16(0, _cargoc.names_s[i]);
SetDParam(0, _cargoc.names_s[i]);
DrawString(x+14, y, STR_7065, 0);
y += 8;
}
@ -1059,19 +1059,19 @@ static void CompanyLeagueWndProc(Window *w, WindowEvent *e)
i = 0;
do {
SET_DPARAM16(0, i + 1 + STR_01AB);
SetDParam(0, i + 1 + STR_01AB);
p = plist[i];
SET_DPARAM16(1, p->name_1);
SET_DPARAM32(2, p->name_2);
SetDParam(1, p->name_1);
SetDParam(2, p->name_2);
SET_DPARAM16(3, GetPlayerNameString(p->index, 4));
SetDParam(3, GetPlayerNameString(p->index, 4));
/* WARNING ugly hack!
GetPlayerNameString sets up (Player #) if the player is human in an extra DPARAM16
It seems that if player is non-human, nothing is set up, so param is 0. GetString doesn't like
that because there is another param after it.
So we'll just shift the rating one back if player is AI and all is fine
*/
SET_DPARAM16((IS_HUMAN_PLAYER(p->index) ? 5 : 4), GetPerformanceTitleFromValue(p->old_economy[1].performance_history));
SetDParam((IS_HUMAN_PLAYER(p->index) ? 5 : 4), GetPerformanceTitleFromValue(p->old_economy[1].performance_history));
DrawString(2, 15 + i * 10, i == 0 ? STR_7054 : STR_7055, 0);
DrawPlayerIcon(p->index, 27, 16 + i * 10);

View File

@ -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);
}
}

View File

@ -26,7 +26,7 @@ static void BuildIndustryWndProc(Window *w, WindowEvent *e)
if (_thd.place_mode == 1 && _thd.window_class == WC_BUILD_INDUSTRY) {
int ind_type = _build_industry_types[_opt.landscape][WP(w,def_d).data_1];
SET_DPARAM32(0, (_price.build_industry >> 5) * _industry_type_costs[ind_type]);
SetDParam(0, (_price.build_industry >> 5) * _industry_type_costs[ind_type]);
DrawStringCentered(85, w->height - 21, STR_482F_COST, 0);
}
break;
@ -275,18 +275,18 @@ static void IndustryViewWndProc(Window *w, WindowEvent *e)
// Destroy Industry button costing money removed per request of dominik
//w->disabled_state = (_patches.extra_dynamite && !_networking && _game_mode != GM_EDITOR) ? 0 : (1 << 6);
i = DEREF_INDUSTRY(w->window_number);
SET_DPARAM16(0, i->town->index);
SET_DPARAM16(1, i->type + STR_4802_COAL_MINE);
SetDParam(0, i->town->index);
SetDParam(1, i->type + STR_4802_COAL_MINE);
DrawWindowWidgets(w);
if (i->accepts_cargo[0] != 0xFF) {
SET_DPARAM16(0, _cargoc.names_s[i->accepts_cargo[0]]);
SetDParam(0, _cargoc.names_s[i->accepts_cargo[0]]);
str = STR_4827_REQUIRES;
if (i->accepts_cargo[1] != 0xFF) {
SET_DPARAM16(1, _cargoc.names_s[i->accepts_cargo[1]]);
SetDParam(1, _cargoc.names_s[i->accepts_cargo[1]]);
str++;
if (i->accepts_cargo[2] != 0xFF) {
SET_DPARAM16(2, _cargoc.names_s[i->accepts_cargo[2]]);
SetDParam(2, _cargoc.names_s[i->accepts_cargo[2]]);
str++;
}
}
@ -296,15 +296,15 @@ static void IndustryViewWndProc(Window *w, WindowEvent *e)
if (i->produced_cargo[0] != 0xFF) {
DrawString(2, 117, STR_482A_PRODUCTION_LAST_MONTH, 0);
SET_DPARAM16(1, i->total_production[0]);
SET_DPARAM16(0, _cargoc.names_long_s[i->produced_cargo[0]] + ((i->total_production[0]!=1)<<5));
SET_DPARAM16(2, i->pct_transported[0] * 100 >> 8);
SetDParam(1, i->total_production[0]);
SetDParam(0, _cargoc.names_long_s[i->produced_cargo[0]] + ((i->total_production[0]!=1)<<5));
SetDParam(2, i->pct_transported[0] * 100 >> 8);
DrawString(4, 127, STR_482B_TRANSPORTED, 0);
if (i->produced_cargo[1] != 0xFF) {
SET_DPARAM16(1, i->total_production[1]);
SET_DPARAM16(0, _cargoc.names_long_s[i->produced_cargo[1]] + ((i->total_production[1]!=1)<<5));
SET_DPARAM16(2, i->pct_transported[1] * 100 >> 8);
SetDParam(1, i->total_production[1]);
SetDParam(0, _cargoc.names_long_s[i->produced_cargo[1]] + ((i->total_production[1]!=1)<<5));
SetDParam(2, i->pct_transported[1] * 100 >> 8);
DrawString(4, 137, STR_482B_TRANSPORTED, 0);
}
}
@ -435,12 +435,12 @@ static int CDECL GeneralIndustrySorter(const void *a, const void *b)
// default to string sorting if they are otherwise equal
if (r == 0) {
SET_DPARAM32(0, i->town->townnameparts);
SetDParam(0, i->town->townnameparts);
GetString(buf1, i->town->townnametype);
if ( (val=*(const byte*)b) != _last_industry_idx) {
_last_industry_idx = val;
SET_DPARAM32(0, j->town->townnameparts);
SetDParam(0, j->town->townnameparts);
GetString(_bufcache, j->town->townnametype);
}
r = strcmp(buf1, _bufcache);
@ -492,20 +492,20 @@ static void IndustryDirectoryWndProc(Window *w, WindowEvent *e)
while (p < _num_industry_sort) {
i = DEREF_INDUSTRY(_industry_sort[p]);
SET_DPARAM16(0, i->town->index);
SET_DPARAM16(1, i->type + STR_4802_COAL_MINE);
SetDParam(0, i->town->index);
SetDParam(1, i->type + STR_4802_COAL_MINE);
if (i->produced_cargo[0] != 0xFF) {
SET_DPARAM16(3, i->total_production[0]);
SET_DPARAM16(2, _cargoc.names_long_s[i->produced_cargo[0]] + ((i->total_production[0]!=1)<<5));
SetDParam(3, i->total_production[0]);
SetDParam(2, _cargoc.names_long_s[i->produced_cargo[0]] + ((i->total_production[0]!=1)<<5));
if (i->produced_cargo[1] != 0xFF) {
SET_DPARAM16(5, i->total_production[1]);
SET_DPARAM16(4, _cargoc.names_long_s[i->produced_cargo[1]] + ((i->total_production[1]!=1)<<5));
SET_DPARAM16(6, i->pct_transported[0] * 100 >> 8);
SET_DPARAM16(7, i->pct_transported[1] * 100 >> 8);
SetDParam(5, i->total_production[1]);
SetDParam(4, _cargoc.names_long_s[i->produced_cargo[1]] + ((i->total_production[1]!=1)<<5));
SetDParam(6, i->pct_transported[0] * 100 >> 8);
SetDParam(7, i->pct_transported[1] * 100 >> 8);
DrawString(4, 28+n*10, STR_INDUSTRYDIR_ITEM_TWO, 0);
} else {
SET_DPARAM16(4, i->pct_transported[0] * 100 >> 8);
SetDParam(4, i->pct_transported[0] * 100 >> 8);
DrawString(4, 28+n*10, STR_INDUSTRYDIR_ITEM, 0);
}
} else {

View File

@ -44,7 +44,7 @@ static void SelectGameWndProc(Window *w, WindowEvent *e) {
case WE_PAINT:
w->click_state = (w->click_state & ~(0xC0) & ~(0xF << 12)) | (1 << (_new_opt.landscape+12)) | (!_networking?(1<<6):(1<<7));
w->disabled_state = _networking ? 0x30 : 0;
SET_DPARAM16(0, STR_6801_EASY + _new_opt.diff_level);
SetDParam(0, STR_6801_EASY + _new_opt.diff_level);
DrawWindowWidgets(w);
break;
@ -190,15 +190,15 @@ static void AskAbandonGameWndProc(Window *w, WindowEvent *e) {
case WE_PAINT:
DrawWindowWidgets(w);
#if defined(_WIN32)
SET_DPARAM16(0, STR_0133_WINDOWS);
SetDParam(0, STR_0133_WINDOWS);
#elif defined(__APPLE__)
SET_DPARAM16(0, STR_0135_OSX);
SetDParam(0, STR_0135_OSX);
#elif defined(__BEOS__)
SET_DPARAM16(0, STR_OSNAME_BEOS);
SetDParam(0, STR_OSNAME_BEOS);
#elif defined(__MORPHOS__)
SET_DPARAM16(0, STR_OSNAME_MORPHOS);
SetDParam(0, STR_OSNAME_MORPHOS);
#else
SET_DPARAM16(0, STR_0134_UNIX);
SetDParam(0, STR_0134_UNIX);
#endif
DrawStringMultiCenter(0x5A, 0x26, STR_00CA_ARE_YOU_SURE_YOU_WANT_TO, 178);
return;

View File

@ -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);
}
}

View File

@ -60,7 +60,7 @@ int32 CmdIncreaseLoan(int x, int y, uint32 flags, uint32 p1, uint32 p2)
p = DEREF_PLAYER(p1);
if (p->current_loan >= _economy.max_loan) {
SET_DPARAM32(0, _economy.max_loan);
SetDParam(0, _economy.max_loan);
return_cmd_error(STR_702B_MAXIMUM_PERMITTED_LOAN);
}
@ -106,7 +106,7 @@ int32 CmdDecreaseLoan(int x, int y, uint32 flags, uint32 p1, uint32 p2)
}
if (p->player_money < size) {
SET_DPARAM32(0, size);
SetDParam(0, size);
return_cmd_error(STR_702E_REQUIRED);
}
@ -174,7 +174,7 @@ int32 CmdChangePresidentName(int x, int y, uint32 flags, uint32 p1, uint32 p2)
static void UpdateSignVirtCoords(SignStruct *ss)
{
Point pt = RemapCoords(ss->x, ss->y, ss->z);
SET_DPARAM16(0, ss->str);
SetDParam(0, ss->str);
UpdateViewportSignPos(&ss->sign, pt.x, pt.y - 6, STR_2806);
}

View File

@ -29,45 +29,43 @@ static void LandInfoWndProc(Window *w, WindowEvent *e)
{
LandInfoData *lid;
StringID str;
uint32 *b;
if (e->event == WE_PAINT) {
int idx = 0;
int i;
DrawWindowWidgets(w);
lid = WP(w,void_d).data;
SET_DPARAM32(0, lid->td.dparam[0]);
SetDParam(0, lid->td.dparam[0]);
DrawStringCentered(140, 16, lid->td.str, 13);
SET_DPARAM16(0, STR_01A6_N_A);
SetDParam(0, STR_01A6_N_A);
if (lid->td.owner != OWNER_NONE && lid->td.owner != OWNER_WATER)
GetNameOfOwner(lid->td.owner, lid->tile);
DrawStringCentered(140, 27, STR_01A7_OWNER, 0);
str = STR_01A4_COST_TO_CLEAR_N_A;
if (lid->costclear != CMD_ERROR) {
SET_DPARAM32(0, lid->costclear);
SetDParam(0, lid->costclear);
str = STR_01A5_COST_TO_CLEAR;
}
DrawStringCentered(140, 38, str, 0);
snprintf(_userstring, USERSTRING_LEN, "%.4X", lid->tile);
SET_DPARAM16(0, GET_TILE_X(lid->tile));
SET_DPARAM16(1, GET_TILE_Y(lid->tile));
SET_DPARAM16(2, STR_SPEC_USERSTRING);
SetDParam(0, GET_TILE_X(lid->tile));
SetDParam(1, GET_TILE_Y(lid->tile));
SetDParam(2, STR_SPEC_USERSTRING);
DrawStringCentered(140, 49, STR_LANDINFO_COORDS, 0);
SET_DPARAM16(0, STR_01A9_NONE);
SetDParam(0, STR_01A9_NONE);
if (lid->town != NULL) {
SET_DPARAM16(0, lid->town->townnametype);
SET_DPARAM32(1, lid->town->townnameparts);
SetDParam(0, lid->town->townnametype);
SetDParam(1, lid->town->townnameparts);
}
DrawStringCentered(140,60, STR_01A8_LOCAL_AUTHORITY, 0);
b = &GET_DPARAM(0);
str = STR_01CE_CARGO_ACCEPTED - 1;
/* XXX if a tile accepts more cargo types than there are template strings
@ -75,12 +73,10 @@ static void LandInfoWndProc(Window *w, WindowEvent *e)
for (i = 0; i < NUM_CARGO; ++i) {
if (lid->ac[i] > 0) {
if (lid->ac[i] < 8) {
SET_DPARAMX16(b, 0, STR_01D1_8);
SET_DPARAMX8(b, 1, lid->ac[i]);
b += 2;
SetDParam(idx++, STR_01D1_8);
SetDParam(idx++, lid->ac[i]);
}
SET_DPARAMX16(b, 0, _cargoc.names_s[i]);
b++;
SetDParam(idx++, _cargoc.names_s[i]);
str++;
}
}
@ -89,7 +85,7 @@ static void LandInfoWndProc(Window *w, WindowEvent *e)
DrawStringMultiCenter(140, 76, str, 276);
if (lid->td.build_date != 0) {
SET_DPARAM16(0,lid->td.build_date);
SetDParam(0,lid->td.build_date);
DrawStringCentered(140,71, STR_BUILD_DATE, 0);
}
}
@ -413,7 +409,7 @@ static void ErrmsgWndProc(Window *w, WindowEvent *e)
_errmsg_message_1,
238);
} else {
Player *p = DEREF_PLAYER(GET_DPARAMX8(_errmsg_decode_params,2));
Player *p = DEREF_PLAYER(GetDParamX(_errmsg_decode_params,2));
DrawPlayerFace(p->face, p->player_color, 2, 16);
DrawStringMultiCenter(
@ -476,7 +472,7 @@ void ShowErrorMessage(StringID msg_1, StringID msg_2, int x, int y)
if (!_errmsg_duration)
return;
if (_errmsg_message_1 != STR_013B_OWNED_BY || GET_DPARAMX8(_errmsg_decode_params,2) >= 8) {
if (_errmsg_message_1 != STR_013B_OWNED_BY || GetDParamX(_errmsg_decode_params,2) >= 8) {
if ( (x|y) != 0) {
pt = RemapCoords2(x, y);
@ -522,7 +518,7 @@ void ShowEstimatedCostOrIncome(int32 cost, int x, int y)
cost = -cost;
msg = STR_0807_ESTIMATED_INCOME;
}
SET_DPARAM32(0, cost);
SetDParam(0, cost);
ShowErrorMessage(-1, msg, x, y);
}
@ -536,7 +532,7 @@ void ShowCostOrIncomeAnimation(int x, int y, int z, int32 cost)
cost = -cost;
msg = STR_0803_INCOME;
}
SET_DPARAM32(0, cost);
SetDParam(0, cost);
AddTextEffect(msg, pt.x, pt.y, 0x250);
}
@ -772,7 +768,7 @@ static void QueryStringWndProc(Window *w, WindowEvent *e)
case WE_PAINT: {
// int x;
SET_DPARAM16(0, WP(w,querystr_d).caption);
SetDParam(0, WP(w,querystr_d).caption);
DrawWindowWidgets(w);
DrawEditBox(w, 5);
@ -999,9 +995,9 @@ static void MakeSortedSaveGameList()
static void GenerateFileName(void)
{
const Player *p = DEREF_PLAYER(_local_player);
SET_DPARAM16(0, p->name_1);
SET_DPARAM32(1, p->name_2);
SET_DPARAM16(2, _date);
SetDParam(0, p->name_1);
SetDParam(1, p->name_2);
SetDParam(2, _date);
GetString(_edit_str_buf, STR_4004);
}
@ -1475,14 +1471,14 @@ static void CheatsWndProc(Window *w, WindowEvent *e)
if (ce->type == CE_BOOL) {
DrawFrameRect(x+20, y+1, x+30+9, y+9, (*(bool*)ce->variable)?6:4, (*(bool*)ce->variable)?0x20:0);
SET_DPARAM16(0, *(bool*)ce->variable ? STR_CONFIG_PATCHES_ON : STR_CONFIG_PATCHES_OFF);
SetDParam(0, *(bool*)ce->variable ? STR_CONFIG_PATCHES_ON : STR_CONFIG_PATCHES_OFF);
} else if (ce->type == CE_CLICK) {
DrawFrameRect(x+20, y+1, x+30+9, y+9, 0, (WP(w,def_d).data_1==i*2+1)?0x20:0x00);
if(i==0)
SET_DPARAM64(0, (int64) 10000000);
SetDParam64(0, (int64) 10000000);
else
SET_DPARAM16(0, false);
SetDParam(0, false);
} else {
DrawFrameRect(x+20, y+1, x+20+9, y+9, 3, clk == i*2+1 ? 0x20 : 0);
@ -1496,11 +1492,11 @@ static void CheatsWndProc(Window *w, WindowEvent *e)
if(ce->str==STR_CHEAT_SWITCH_CLIMATE)
val += STR_TEMPERATE_LANDSCAPE;
SET_DPARAM16(0, val);
SetDParam(0, val);
// display date for change date cheat
if(ce->str==STR_CHEAT_CHANGE_DATE)
SET_DPARAM16(0, _date);
SetDParam(0, _date);
// draw colored flag for change player cheat
if(ce->str==STR_CHEAT_CHANGE_PLAYER)

View File

@ -204,13 +204,13 @@ static void MusicTrackSelectionWndProc(Window *w, WindowEvent *e)
DrawStringCentered(92, 15, STR_01EE_TRACK_INDEX, 0);
SET_DPARAM16(0, STR_01D5_ALL + msf.playlist);
SetDParam(0, STR_01D5_ALL + msf.playlist);
DrawStringCentered(340, 15, STR_01EF_PROGRAM, 0);
for(i=1; (uint)i <= NUM_SONGS_AVAILABLE; i++) {
SET_DPARAM16(0, i);
SET_DPARAM16(2, i);
SET_DPARAM16(1, SPECSTR_SONGNAME);
SetDParam(0, i);
SetDParam(2, i);
SetDParam(1, SPECSTR_SONGNAME);
DrawString(4, 23+(i-1)*6, (i < 10) ? STR_01EC_0 : STR_01ED, 0);
}
@ -223,9 +223,9 @@ static void MusicTrackSelectionWndProc(Window *w, WindowEvent *e)
y = 23;
for(p = _playlists[msf.playlist],i=0; (i=*p) != 0; p++) {
SET_DPARAM16(0, i);
SET_DPARAM16(2, i);
SET_DPARAM16(1, SPECSTR_SONGNAME);
SetDParam(0, i);
SetDParam(2, i);
SetDParam(1, SPECSTR_SONGNAME);
DrawString(252, y, (i < 10) ? STR_01EC_0 : STR_01ED, 0);
y += 6;
}
@ -333,7 +333,7 @@ static void MusicWindowWndProc(Window *w, WindowEvent *e)
str = STR_01E3;
if (_song_is_active != 0 && _music_wnd_cursong != 0) {
str = STR_01E4_0;
SET_DPARAM8(0, _music_wnd_cursong);
SetDParam(0, _music_wnd_cursong);
if (_music_wnd_cursong >= 10)
str = STR_01E5;
}
@ -342,8 +342,8 @@ static void MusicWindowWndProc(Window *w, WindowEvent *e)
str = STR_01E6;
if (_song_is_active != 0 && _music_wnd_cursong != 0) {
str = STR_01E7;
SET_DPARAM16(0, SPECSTR_SONGNAME);
SET_DPARAM16(1, _music_wnd_cursong);
SetDParam(0, SPECSTR_SONGNAME);
SetDParam(1, _music_wnd_cursong);
}
DrawStringCentered(155, 46, str, 0);

View File

@ -1127,7 +1127,7 @@ bool NetworkCheckClientReady()
ready_all = ready_all && (cs->ready || cs->inactive || (cs->xmitpos>0));
if (!cs->ready) cs->timeout-=1;
if (cs->timeout == 0) {
SET_DPARAM16(0,count);
SetDParam(0,count);
ShowErrorMessage(-1,STR_NETWORK_ERR_TIMEOUT,0,0);
CloseClient(cs);
}

View File

@ -47,8 +47,8 @@ static void NetworkGameWindowWndProc(Window *w, WindowEvent *e)
switch(e->event) {
case WE_PAINT: {
SET_DPARAM16(0, 0x00);
SET_DPARAM16(2, STR_NETWORK_LAN + _network_connection);
SetDParam(0, 0x00);
SetDParam(2, STR_NETWORK_LAN + _network_connection);
DrawWindowWidgets(w);
DrawEditBox(w, 6);
@ -70,8 +70,8 @@ static void NetworkGameWindowWndProc(Window *w, WindowEvent *e)
DoDrawString(cur_item->item.server_name, 15, y, 16); // server name
SET_DPARAM8(0, cur_item->item.players_on);
SET_DPARAM8(1, cur_item->item.players_max);
SetDParam(0, cur_item->item.players_on);
SetDParam(1, cur_item->item.players_max);
DrawString(238, y, STR_NETWORK_PLAYERS_VAL, 2); // #/#
DoDrawString(cur_item->item.map_name, 288, y, 16); // map size
@ -268,7 +268,7 @@ static void NetworkStartServerWindowWndProc(Window *w, WindowEvent *e)
switch(e->event) {
case WE_PAINT: {
SET_DPARAM16(7, STR_NETWORK_2_PLAYERS + _players_max);
SetDParam(7, STR_NETWORK_2_PLAYERS + _players_max);
DrawWindowWidgets(w);
GfxFillRect(11, 63, 237, 168, 0xD7);
@ -389,7 +389,7 @@ static void NetworkLobbyWindowWndProc(Window *w, WindowEvent *e)
switch(e->event) {
case WE_PAINT: {
SET_DPARAM16(7, STR_NETWORK_2_PLAYERS + _opt_mod_ptr->road_side);
SetDParam(7, STR_NETWORK_2_PLAYERS + _opt_mod_ptr->road_side);
DrawWindowWidgets(w);
GfxFillRect( 11, 31, 239, 239, 0xD7);

View File

@ -108,7 +108,7 @@ static void NewsWindowProc(Window *w, WindowEvent *e)
DrawString(2, 1, STR_00C6, 0);
SET_DPARAM16(0, ni->date);
SetDParam(0, ni->date);
DrawStringRightAligned(428, 1, STR_01FF, 0);
if (!(ni->flags & NF_VIEWPORT)) {
@ -547,7 +547,7 @@ static void MessageHistoryWndProc(Window *w, WindowEvent *e)
// get news in correct order
ni = &_news_items[getNews(p)];
SET_DPARAM16(0, ni->date);
SetDParam(0, ni->date);
DrawString(4, y, STR_00AF, 16);
GetNewsString(ni, buffer);

View File

@ -406,7 +406,7 @@ int CheckOrders(Vehicle *v)
if ( (n_st < 2) && (problem_type == -1) ) problem_type = 0;
SET_DPARAM16(0, v->unitnumber);
SetDParam(0, v->unitnumber);
message = (STR_TRAIN_HAS_TOO_FEW_ORDERS) + (((v->type) - VEH_Train) << 2) + problem_type;

View File

@ -60,13 +60,13 @@ static void DrawOrdersWindow(Window *w)
sel = OrderGetSel(w);
SET_DPARAM16(2,STR_8827_FULL_LOAD);
SetDParam(2,STR_8827_FULL_LOAD);
switch(v->schedule_ptr[sel] & 0x1F) {
case OT_GOTO_STATION:
break;
case OT_GOTO_DEPOT:
SETBIT(w->disabled_state, 9); /* unload */
SET_DPARAM16(2,STR_SERVICE);
SetDParam(2,STR_SERVICE);
break;
default:
SETBIT(w->disabled_state, 6); /* nonstop */
@ -74,8 +74,8 @@ static void DrawOrdersWindow(Window *w)
SETBIT(w->disabled_state, 9); /* unload */
}
SET_DPARAM16(0, v->string_id);
SET_DPARAM16(1, v->unitnumber);
SetDParam(0, v->string_id);
SetDParam(1, v->unitnumber);
DrawWindowWidgets(w);
y = 15;
@ -91,18 +91,18 @@ static void DrawOrdersWindow(Window *w)
if (ord == 0) {
str = shared_schedule ? STR_END_OF_SHARED_ORDERS : STR_882A_END_OF_ORDERS;
} else {
SET_DPARAM16(1, 6);
SetDParam(1, 6);
if ( (ord & OT_MASK) == OT_GOTO_STATION) {
SET_DPARAM16(1, STR_8806_GO_TO + ((ord >> 5) & 7));
SET_DPARAM16(2, ord >> 8);
SetDParam(1, STR_8806_GO_TO + ((ord >> 5) & 7));
SetDParam(2, ord >> 8);
} else if ((ord & OT_MASK) == OT_GOTO_DEPOT) {
StringID s = STR_NULL;
if (v->type == VEH_Aircraft) {
s = STR_GO_TO_AIRPORT_HANGAR;
SET_DPARAM16(2, ord>>8);
SetDParam(2, ord>>8);
} else {
SET_DPARAM16(2, _depots[ord >> 8].town_index);
SetDParam(2, _depots[ord >> 8].town_index);
switch (v->type) {
case VEH_Train: s = STR_880E_GO_TO_TRAIN_DEPOT; break;
case VEH_Road: s = STR_9038_GO_TO_ROADVEH_DEPOT; break;
@ -111,20 +111,20 @@ static void DrawOrdersWindow(Window *w)
}
if (v->type == VEH_Train)
s += (ord>>6)&2;
SET_DPARAM16(1, s + ((ord>>6)&1) );
SetDParam(1, s + ((ord>>6)&1) );
} else if ((ord & OT_MASK) == OT_GOTO_WAYPOINT) {
SET_DPARAM16(2, ord >> 8);
SET_DPARAM16(1, STR_GO_TO_WAYPOINT);
SetDParam(2, ord >> 8);
SetDParam(1, STR_GO_TO_WAYPOINT);
}
}
{
byte color = (i == WP(w,order_d).sel) ? 0xC : 0x10;
SET_DPARAM(0, i+1);
SetDParam(0, i+1);
if ((ord & OT_MASK) != OT_DUMMY) {
DrawString(2, y, str, color);
} else {
SET_DPARAM16(1, STR_INVALID_ORDER);
SET_DPARAM16(2, ord >> 8);
SetDParam(1, STR_INVALID_ORDER);
SetDParam(2, ord >> 8);
DrawString(2, y, str, color);
}
}

View File

@ -33,7 +33,7 @@ static void DrawPlayerEconomyStats(Player *p, byte mode)
tbl = p->yearly_expenses + 2;
do {
if (year >= p->inaugurated_year) {
SET_DPARAM16(0, year + 1920);
SetDParam(0, year + 1920);
DrawStringCenterUnderline(x-17, 15, STR_7010, 0);
sum = 0;
for(i=0; i!=13; i++) {
@ -44,14 +44,14 @@ static void DrawPlayerEconomyStats(Player *p, byte mode)
str = STR_701E;
if (cost < 0) { cost = -cost; str++; }
SET_DPARAM64(0, cost);
SetDParam64(0, cost);
DrawStringRightAligned(x, 27+i*10, str, 0);
}
}
str = STR_701E;
if (sum < 0) { sum = -sum; str++; }
SET_DPARAM64(0, sum);
SetDParam64(0, sum);
DrawStringRightAligned(x, 27 + 13*10 + 2, str, 0);
GfxFillRect(x - 75, 27 + 10*13, x, 27 + 10*13, 215);
@ -64,27 +64,27 @@ static void DrawPlayerEconomyStats(Player *p, byte mode)
y = 171;
// draw max loan aligned to loan below (y += 10)
SET_DPARAM64(0, (uint64)_economy.max_loan);
SetDParam64(0, (uint64)_economy.max_loan);
DrawString(202, y+10, STR_MAX_LOAN, 0);
} else
y = 15;
DrawString(2, y, STR_7026_BANK_BALANCE, 0);
SET_DPARAM64(0, p->money64);
SetDParam64(0, p->money64);
DrawStringRightAligned(182, y, STR_7028, 0);
y += 10;
DrawString(2, y, STR_7027_LOAN, 0);
SET_DPARAM64(0, p->current_loan);
SetDParam64(0, p->current_loan);
DrawStringRightAligned(182, y, STR_7028, 0);
y += 12;
GfxFillRect(182 - 75, y-2, 182, y-2, 215);
SET_DPARAM64(0, p->money64 - p->current_loan);
SetDParam64(0, p->money64 - p->current_loan);
DrawStringRightAligned(182, y, STR_7028, 0);
}
@ -137,10 +137,10 @@ static void PlayerFinancesWndProc(Window *w, WindowEvent *e)
w->disabled_state = p->current_loan != 0 ? 0 : (1 << 6);
SET_DPARAM16(0, p->name_1);
SET_DPARAM32(1, p->name_2);
SET_DPARAM16(2, GetPlayerNameString((byte)w->window_number, 3));
SET_DPARAM32(4, 10000);
SetDParam(0, p->name_1);
SetDParam(1, p->name_2);
SetDParam(2, GetPlayerNameString((byte)w->window_number, 3));
SetDParam(4, 10000);
DrawWindowWidgets(w);
DrawPlayerEconomyStats(p, (byte)WP(w,def_d).data_1);
@ -419,25 +419,25 @@ static void DrawPlayerVehiclesAmount(int player)
DrawString(x+70, y, STR_7042_NONE, 0);
} else {
if (train != 0) {
SET_DPARAM16(0, train);
SetDParam(0, train);
DrawString(x + 70, y, train==1 ? STR_703A_TRAIN : STR_703B_TRAINS, 0);
y += 10;
}
if (road != 0) {
SET_DPARAM16(0, road);
SetDParam(0, road);
DrawString(x + 70, y, road==1 ? STR_703C_ROAD_VEHICLE : STR_703D_ROAD_VEHICLES, 0);
y += 10;
}
if (air != 0) {
SET_DPARAM16(0, air);
SetDParam(0, air);
DrawString(x + 70, y, air==1 ? STR_703E_AIRCRAFT : STR_703F_AIRCRAFT, 0);
y += 10;
}
if (ship != 0) {
SET_DPARAM16(0, ship);
SetDParam(0, ship);
DrawString(x + 70, y, ship==1 ? STR_7040_SHIP : STR_7041_SHIPS, 0);
}
}
@ -461,9 +461,9 @@ static void DrawCompanyOwnerText(Player *p)
if ((amt=GetAmountOwnedBy(p, p2->index)) != 0) {
num++;
SET_DPARAM16(num*3+0, amt*25);
SET_DPARAM16(num*3+1, p2->name_1);
SET_DPARAM32(num*3+2, p2->name_2);
SetDParam(num*3+0, amt*25);
SetDParam(num*3+1, p2->name_1);
SetDParam(num*3+2, p2->name_2);
if (num != 0)
break;
@ -484,9 +484,9 @@ static void PlayerCompanyWndProc(Window *w, WindowEvent *e)
if (w->widget != _other_player_company_widgets)
w->widget = (p->location_of_house != 0) ? _my_player_company_bh_widgets : _my_player_company_widgets;
SET_DPARAM16(0, p->name_1);
SET_DPARAM32(1, p->name_2);
SET_DPARAM16(2, GetPlayerNameString((byte)w->window_number, 3));
SetDParam(0, p->name_1);
SetDParam(1, p->name_2);
SetDParam(2, GetPlayerNameString((byte)w->window_number, 3));
dis = 0;
if (GetAmountOwnedBy(p, 0xFF) == 0) dis |= 1 << 9;
@ -495,7 +495,7 @@ static void PlayerCompanyWndProc(Window *w, WindowEvent *e)
w->disabled_state = dis;
DrawWindowWidgets(w);
SET_DPARAM16(0, p->inaugurated_year + 1920);
SetDParam(0, p->inaugurated_year + 1920);
DrawString(110, 25, STR_7038_INAUGURATED, 0);
DrawPlayerVehiclesAmount(w->window_number);
@ -505,11 +505,11 @@ static void PlayerCompanyWndProc(Window *w, WindowEvent *e)
DrawPlayerFace(p->face, p->player_color, 2, 16);
SET_DPARAM16(0, p->president_name_1);
SET_DPARAM32(1, p->president_name_2);
SetDParam(0, p->president_name_1);
SetDParam(1, p->president_name_2);
DrawStringMultiCenter(48, 141, STR_7037_PRESIDENT, 94);
SET_DPARAM64(0, CalculateCompanyValue(p));
SetDParam64(0, CalculateCompanyValue(p));
DrawString(110, 114, STR_7076_COMPANY_VALUE, 0);
DrawCompanyOwnerText(p);
@ -537,14 +537,14 @@ static void PlayerCompanyWndProc(Window *w, WindowEvent *e)
case 5: {/* change president name */
Player *p = DEREF_PLAYER(w->window_number);
WP(w,def_d).byte_1 = 0;
SET_DPARAM32(0, p->president_name_2);
SetDParam(0, p->president_name_2);
ShowQueryString(p->president_name_1, STR_700B_PRESIDENT_S_NAME, 31, 94, w->window_class, w->window_number);
} break;
case 6: {/* change company name */
Player *p = DEREF_PLAYER(w->window_number);
WP(w,def_d).byte_1 = 1;
SET_DPARAM32(0, p->name_2);
SetDParam(0, p->name_2);
ShowQueryString(p->name_1, STR_700A_COMPANY_NAME, 31, 150, w->window_class, w->window_number);
} break;
@ -641,15 +641,15 @@ static void BuyCompanyWndProc(Window *w, WindowEvent *e)
switch(e->event) {
case WE_PAINT: {
Player *p = DEREF_PLAYER(w->window_number);
SET_DPARAM16(0, p->name_1);
SET_DPARAM32(1, p->name_2);
SetDParam(0, p->name_1);
SetDParam(1, p->name_2);
DrawWindowWidgets(w);
DrawPlayerFace(p->face, p->player_color, 2, 16);
SET_DPARAM16(0, p->name_1);
SET_DPARAM32(1, p->name_2);
SET_DPARAM32(2, p->bankrupt_value);
SetDParam(0, p->name_1);
SetDParam(1, p->name_2);
SetDParam(2, p->bankrupt_value);
DrawStringMultiCenter(214, 65, STR_705B_WE_ARE_LOOKING_FOR_A_TRANSPORT, 238);
break;
}

View File

@ -188,7 +188,7 @@ bool CheckPlayerHasMoney(int32 cost)
if (cost > 0) {
uint pid = _current_player;
if (pid < MAX_PLAYERS && cost > DEREF_PLAYER(pid)->player_money) {
SET_DPARAM32(0, cost);
SetDParam(0, cost);
_error_message = STR_0003_NOT_ENOUGH_CASH_REQUIRES;
return false;
}
@ -243,20 +243,20 @@ void UpdatePlayerMoney32(Player *p)
void GetNameOfOwner(byte owner, uint tile)
{
SET_DPARAM8(2, owner);
SetDParam(2, owner);
if (owner != OWNER_TOWN) {
if (owner >= 8)
SET_DPARAM16(0, STR_0150_SOMEONE);
SetDParam(0, STR_0150_SOMEONE);
else {
Player *p = DEREF_PLAYER(owner);
SET_DPARAM16(0, p->name_1);
SET_DPARAM32(1, p->name_2);
SetDParam(0, p->name_1);
SetDParam(1, p->name_2);
}
} else {
Town *t = ClosestTownFromTile(tile, (uint)-1);
SET_DPARAM16(0, t->townnametype);
SET_DPARAM32(1, t->townnameparts);
SetDParam(0, t->townnametype);
SetDParam(1, t->townnameparts);
}
}
@ -326,7 +326,7 @@ set_name:;
MarkWholeScreenDirty();
if (!IS_HUMAN_PLAYER(p->index)) {
SET_DPARAM16(0, t->index);
SetDParam(0, t->index);
AddNewsItem(p->index + (4 << 4), NEWS_FLAGS(NM_CALLBACK, NF_TILE, NT_COMPANY_INFO, DNC_BANKRUPCY), p->last_build_coordinate, 0);
}
return;
@ -425,14 +425,14 @@ restart:;
p->president_name_2 = Random();
p->president_name_1 = SPECSTR_PRESIDENT_NAME;
SET_DPARAM32(0, p->president_name_2);
SetDParam(0, p->president_name_2);
GetString(buffer, p->president_name_1);
if (strlen(buffer) >= 32 || GetStringWidth(buffer) >= 94)
continue;
FOR_ALL_PLAYERS(pp) {
if (pp->is_active && p != pp) {
SET_DPARAM32(0, pp->president_name_2);
SetDParam(0, pp->president_name_2);
GetString(buffer2, pp->president_name_1);
if (str_eq(buffer2, buffer))
goto restart;
@ -567,7 +567,7 @@ void RunOtherPlayersLoop()
StringID GetPlayerNameString(byte player, byte index)
{
if (IS_HUMAN_PLAYER(player) && player < MAX_PLAYERS) {
SET_DPARAM16(index, player+1);
SetDParam(index, player+1);
return STR_7002_PLAYER;
}
return STR_EMPTY;

View File

@ -106,7 +106,7 @@ static bool CheckAllowRemoveRoad(uint tile, uint br, bool *edge_road)
return true;
t = ClosestTownFromTile(tile, (uint)-1);
SET_DPARAM16(0, t->index);
SetDParam(0, t->index);
_error_message = STR_2009_LOCAL_AUTHORITY_REFUSES;
return false;
}

View File

@ -87,12 +87,12 @@ void DrawRoadVehEngine(int x, int y, int engine, uint32 image_ormod)
void DrawRoadVehEngineInfo(int engine, int x, int y, int maxw)
{
SET_DPARAM32(0, ((_price.roadveh_base >> 3) * road_vehicle_info(engine)->base_cost) >> 5);
SET_DPARAM16(1, road_vehicle_info(engine)->max_speed * 10 >> 5);
SET_DPARAM32(2, road_vehicle_info(engine)->running_cost * _price.roadveh_running >> 8);
SetDParam(0, ((_price.roadveh_base >> 3) * road_vehicle_info(engine)->base_cost) >> 5);
SetDParam(1, road_vehicle_info(engine)->max_speed * 10 >> 5);
SetDParam(2, road_vehicle_info(engine)->running_cost * _price.roadveh_running >> 8);
SET_DPARAM16(4, road_vehicle_info(engine)->capacity);
SET_DPARAM16(3, _cargoc.names_long_p[road_vehicle_info(engine)->cargo_type]);
SetDParam(4, road_vehicle_info(engine)->capacity);
SetDParam(3, _cargoc.names_long_p[road_vehicle_info(engine)->cargo_type]);
DrawStringMultiCenter(x, y, STR_902A_COST_SPEED_RUNNING_COST, maxw);
}
@ -491,7 +491,7 @@ static void RoadVehCrash(Vehicle *v)
if (v->cargo_type == 0)
pass += v->cargo_count;
v->cargo_count = 0;
SET_DPARAM16(0, pass);
SetDParam(0, pass);
AddNewsItem(STR_9031_ROAD_VEHICLE_CRASH_DRIVER+(pass!=1),
NEWS_FLAGS(NM_THIN, NF_VIEWPORT|NF_VEHICLE, NT_ACCIDENT, 0),
@ -703,7 +703,7 @@ static void RoadVehArrivesAt(Vehicle *v, Station *st)
uint32 flags;
st->had_vehicle_of_type |= HVOT_BUS;
SET_DPARAM16(0, st->index);
SetDParam(0, st->index);
flags = (v->owner == _local_player) ? NEWS_FLAGS(NM_THIN, NF_VIEWPORT|NF_VEHICLE, NT_ARRIVAL_PLAYER, 0) : NEWS_FLAGS(NM_THIN, NF_VIEWPORT|NF_VEHICLE, NT_ARRIVAL_OTHER, 0);
AddNewsItem(
STR_902F_CITIZENS_CELEBRATE_FIRST,
@ -717,7 +717,7 @@ static void RoadVehArrivesAt(Vehicle *v, Station *st)
uint32 flags;
st->had_vehicle_of_type |= HVOT_TRUCK;
SET_DPARAM16(0, st->index);
SetDParam(0, st->index);
flags = (v->owner == _local_player) ? NEWS_FLAGS(NM_THIN, NF_VIEWPORT|NF_VEHICLE, NT_ARRIVAL_PLAYER, 0) : NEWS_FLAGS(NM_THIN, NF_VIEWPORT|NF_VEHICLE, NT_ARRIVAL_OTHER, 0);
AddNewsItem(
STR_9030_CITIZENS_CELEBRATE_FIRST,
@ -1381,7 +1381,7 @@ void RoadVehEnterDepot(Vehicle *v)
else if (t & OF_FULL_LOAD) {
v->vehstatus |= VS_STOPPED;
if (v->owner == _local_player) {
SET_DPARAM16(0, v->unitnumber);
SetDParam(0, v->unitnumber);
AddNewsItem(
STR_9016_ROAD_VEHICLE_IS_WAITING,
NEWS_FLAGS(NM_SMALL, NF_VIEWPORT|NF_VEHICLE, NT_ADVICE, 0),

View File

@ -35,8 +35,8 @@ static void RoadVehDetailsWndProc(Window *w, WindowEvent *e)
if (!_patches.servint_roadveh) // disable service-scroller when interval is set to disabled
w->disabled_state |= (1 << 5) | (1 << 6);
SET_DPARAM16(0, v->string_id);
SET_DPARAM16(1, v->unitnumber);
SetDParam(0, v->string_id);
SetDParam(1, v->unitnumber);
DrawWindowWidgets(w);
/* Draw running cost */
@ -44,7 +44,7 @@ static void RoadVehDetailsWndProc(Window *w, WindowEvent *e)
int year = v->age / 366;
StringID str;
SET_DPARAM16(1, year);
SetDParam(1, year);
str = STR_0199_YEAR;
if (year != 1) {
@ -52,55 +52,55 @@ static void RoadVehDetailsWndProc(Window *w, WindowEvent *e)
if (v->max_age - 366 < v->age)
str++;
}
SET_DPARAM16(0, str);
SET_DPARAM16(2, v->max_age / 366);
SET_DPARAM32(3, road_vehicle_info(v->engine_type)->running_cost * _price.roadveh_running >> 8);
SetDParam(0, str);
SetDParam(2, v->max_age / 366);
SetDParam(3, road_vehicle_info(v->engine_type)->running_cost * _price.roadveh_running >> 8);
DrawString(2, 15, STR_900D_AGE_RUNNING_COST_YR, 0);
}
/* Draw max speed */
{
SET_DPARAM16(0, v->max_speed * 10 >> 5);
SetDParam(0, v->max_speed * 10 >> 5);
DrawString(2, 25, STR_900E_MAX_SPEED, 0);
}
/* Draw profit */
{
SET_DPARAM32(0, v->profit_this_year);
SET_DPARAM32(1, v->profit_last_year);
SetDParam(0, v->profit_this_year);
SetDParam(1, v->profit_last_year);
DrawString(2, 35, STR_900F_PROFIT_THIS_YEAR_LAST_YEAR, 0);
}
/* Draw breakdown & reliability */
{
SET_DPARAM8(0, v->reliability * 100 >> 16);
SET_DPARAM16(1, v->breakdowns_since_last_service);
SetDParam(0, v->reliability * 100 >> 16);
SetDParam(1, v->breakdowns_since_last_service);
DrawString(2, 45, STR_9010_RELIABILITY_BREAKDOWNS, 0);
}
/* Draw service interval text */
{
SET_DPARAM16(0, v->service_interval);
SET_DPARAM16(1, v->date_of_last_service);
SetDParam(0, v->service_interval);
SetDParam(1, v->date_of_last_service);
DrawString(13, 90, _patches.servint_ispercent?STR_SERVICING_INTERVAL_PERCENT:STR_883C_SERVICING_INTERVAL_DAYS, 0);
}
DrawRoadVehImage(v, 3, 57, INVALID_VEHICLE);
SET_DPARAM16(0, GetCustomEngineName(v->engine_type));
SET_DPARAM16(1, 1920 + v->build_year);
SET_DPARAM32(2, v->value);
SetDParam(0, GetCustomEngineName(v->engine_type));
SetDParam(1, 1920 + v->build_year);
SetDParam(2, v->value);
DrawString(34, 57, STR_9011_BUILT_VALUE, 0);
SET_DPARAM16(0, _cargoc.names_long_p[v->cargo_type]);
SET_DPARAM16(1, v->cargo_cap);
SetDParam(0, _cargoc.names_long_p[v->cargo_type]);
SetDParam(1, v->cargo_cap);
DrawString(34, 67, STR_9012_CAPACITY, 0);
str = STR_8812_EMPTY;
if (v->cargo_count != 0) {
SET_DPARAM8(0, v->cargo_type);
SET_DPARAM16(1, v->cargo_count);
SET_DPARAM16(2, v->cargo_source);
SetDParam(0, v->cargo_type);
SetDParam(1, v->cargo_count);
SetDParam(2, v->cargo_source);
str = STR_8813_FROM;
}
DrawString(34, 78, str, 0);
@ -109,7 +109,7 @@ static void RoadVehDetailsWndProc(Window *w, WindowEvent *e)
case WE_CLICK:
switch(e->click.widget) {
case 2: /* rename */
SET_DPARAM16(0, v->unitnumber);
SetDParam(0, v->unitnumber);
ShowQueryString(v->string_id, STR_902C_NAME_ROAD_VEHICLE, 31, 150, w->window_class, w->window_number);
break;
@ -190,8 +190,8 @@ static void RoadVehViewWndProc(Window *w, WindowEvent *e)
w->disabled_state = (v->owner != _local_player) ? (1<<7 | 1<<6) : 0;
/* draw widgets & caption */
SET_DPARAM16(0, v->string_id);
SET_DPARAM16(1, v->unitnumber);
SetDParam(0, v->string_id);
SetDParam(1, v->unitnumber);
DrawWindowWidgets(w);
/* draw the flag */
@ -206,15 +206,15 @@ static void RoadVehViewWndProc(Window *w, WindowEvent *e)
} else {
switch(v->next_order & OT_MASK) {
case OT_GOTO_STATION: {
SET_DPARAM16(0, v->next_order_param);
SET_DPARAM16(1, v->cur_speed * 10 >> 5);
SetDParam(0, v->next_order_param);
SetDParam(1, v->cur_speed * 10 >> 5);
str = STR_HEADING_FOR_STATION + _patches.vehicle_speed;
} break;
case OT_GOTO_DEPOT: {
Depot *dep = &_depots[v->next_order_param];
SET_DPARAM16(0, dep->town_index);
SET_DPARAM16(1, v->cur_speed * 10 >> 5);
SetDParam(0, dep->town_index);
SetDParam(1, v->cur_speed * 10 >> 5);
str = STR_HEADING_FOR_ROAD_DEPOT + _patches.vehicle_speed;
} break;
@ -226,7 +226,7 @@ static void RoadVehViewWndProc(Window *w, WindowEvent *e)
default:
if (v->num_orders == 0) {
str = STR_NO_ORDERS + _patches.vehicle_speed;
SET_DPARAM16(0, v->cur_speed * 10 >> 5);
SetDParam(0, v->cur_speed * 10 >> 5);
} else
str = STR_EMPTY;
break;
@ -350,17 +350,17 @@ static void DrawNewRoadVehWindow(Window *w)
if (selected_id != -1) {
Engine *e;
SET_DPARAM32(0, road_vehicle_info(selected_id)->base_cost * (_price.roadveh_base>>3)>>5);
SET_DPARAM16(1, road_vehicle_info(selected_id)->max_speed * 10 >> 5);
SET_DPARAM32(2, road_vehicle_info(selected_id)->running_cost * _price.roadveh_running >> 8);
SET_DPARAM16(4, road_vehicle_info(selected_id)->capacity);
SET_DPARAM16(3, _cargoc.names_long_p[road_vehicle_info(selected_id)->cargo_type]);
SetDParam(0, road_vehicle_info(selected_id)->base_cost * (_price.roadveh_base>>3)>>5);
SetDParam(1, road_vehicle_info(selected_id)->max_speed * 10 >> 5);
SetDParam(2, road_vehicle_info(selected_id)->running_cost * _price.roadveh_running >> 8);
SetDParam(4, road_vehicle_info(selected_id)->capacity);
SetDParam(3, _cargoc.names_long_p[road_vehicle_info(selected_id)->cargo_type]);
e = &_engines[selected_id];
SET_DPARAM16(6, e->lifelength);
SET_DPARAM8(7, e->reliability * 100 >> 16);
SetDParam(6, e->lifelength);
SetDParam(7, e->reliability * 100 >> 16);
ConvertDayToYMD(&ymd, e->intro_date);
SET_DPARAM16(5, ymd.year + 1920);
SetDParam(5, ymd.year + 1920);
DrawString(2, 127, STR_9008_COST_SPEED_RUNNING_COST, 0);
}
@ -494,7 +494,7 @@ static void DrawRoadDepotWindow(Window *w)
/* locate the depot struct */
for(d=_depots; d->xy != (TileIndex)tile; d++) {}
SET_DPARAM16(0, d->town_index);
SetDParam(0, d->town_index);
DrawWindowWidgets(w);
x = 2;
@ -509,7 +509,7 @@ static void DrawRoadDepotWindow(Window *w)
DrawRoadVehImage(v, x+24, y, WP(w,traindepot_d).sel);
SET_DPARAM16(0, v->unitnumber);
SetDParam(0, v->unitnumber);
DrawString(x, y+2, (uint16)(v->max_age-366) >= v->age ? STR_00E2 : STR_00E3, 0);
DrawSprite( (v->vehstatus & VS_STOPPED) ? 0xC12 : 0xC13, x + 16, y);
@ -785,9 +785,9 @@ static void PlayerRoadVehWndProc(Window *w, WindowEvent *e)
{
Player *p = DEREF_PLAYER(window_number);
/* Company Name -- (###) Roadvehicles */
SET_DPARAM16(0, p->name_1);
SET_DPARAM32(1, p->name_2);
SET_DPARAM16(2, w->vscroll.count);
SetDParam(0, p->name_1);
SetDParam(1, p->name_2);
SetDParam(2, w->vscroll.count);
DrawWindowWidgets(w);
}
/* draw sorting criteria string */
@ -812,7 +812,7 @@ static void PlayerRoadVehWndProc(Window *w, WindowEvent *e)
DrawRoadVehImage(v, x + 22, y + 6, INVALID_VEHICLE);
DrawVehicleProfitButton(v, x, y+13);
SET_DPARAM16(0, v->unitnumber);
SetDParam(0, v->unitnumber);
if (IsRoadDepotTile(v->tile)) {
str = STR_021F;
} else {
@ -820,12 +820,12 @@ static void PlayerRoadVehWndProc(Window *w, WindowEvent *e)
}
DrawString(x, y+2, str, 0);
SET_DPARAM32(0, v->profit_this_year);
SET_DPARAM32(1, v->profit_last_year);
SetDParam(0, v->profit_this_year);
SetDParam(1, v->profit_last_year);
DrawString(x + 24, y + 18, STR_0198_PROFIT_THIS_YEAR_LAST_YEAR, 0);
if (v->string_id != STR_SV_ROADVEH_NAME) {
SET_DPARAM16(0, v->string_id);
SetDParam(0, v->string_id);
DrawString(x+24, y, STR_01AB, 0);
}

View File

@ -479,9 +479,9 @@ static char *MakeScreenshotName(const char *ext)
sprintf(_screenshot_name, "screenshot");
} else {
Player *p = &_players[_local_player];
SET_DPARAM16(0, p->name_1);
SET_DPARAM32(1, p->name_2);
SET_DPARAM16(2, _date);
SetDParam(0, p->name_1);
SetDParam(1, p->name_2);
SetDParam(2, _date);
GetString(_screenshot_name, STR_4004);
}

View File

@ -70,16 +70,16 @@ static void GameOptionsWndProc(Window *w, WindowEvent *e)
case WE_PAINT: {
StringID str = STR_02BE_DEFAULT;
w->disabled_state = (_vehicle_design_names & 1) ? (++str, 0) : (1 << 21);
SET_DPARAM16(0, str);
SET_DPARAM16(1, _currency_string_list[_opt_mod_ptr->currency]);
SET_DPARAM16(2, _opt_mod_ptr->kilometers + STR_0139_IMPERIAL_MILES);
SET_DPARAM16(3, STR_02E9_DRIVE_ON_LEFT + _opt_mod_ptr->road_side);
SET_DPARAM16(4, STR_TOWNNAME_ENGLISH + _opt_mod_ptr->town_name);
SET_DPARAM16(5, _autosave_dropdown[_opt_mod_ptr->autosave]);
SET_DPARAM16(6, SPECSTR_LANGUAGE_START + _dynlang.curr);
SetDParam(0, str);
SetDParam(1, _currency_string_list[_opt_mod_ptr->currency]);
SetDParam(2, _opt_mod_ptr->kilometers + STR_0139_IMPERIAL_MILES);
SetDParam(3, STR_02E9_DRIVE_ON_LEFT + _opt_mod_ptr->road_side);
SetDParam(4, STR_TOWNNAME_ENGLISH + _opt_mod_ptr->town_name);
SetDParam(5, _autosave_dropdown[_opt_mod_ptr->autosave]);
SetDParam(6, SPECSTR_LANGUAGE_START + _dynlang.curr);
i = GetCurRes();
SET_DPARAM16(7, i == _num_resolutions ? STR_RES_OTHER : SPECSTR_RESOLUTION_START + i);
SET_DPARAM16(8, SPECSTR_SCREENSHOT_START + _cur_screenshot_format);
SetDParam(7, i == _num_resolutions ? STR_RES_OTHER : SPECSTR_RESOLUTION_START + i);
SetDParam(8, SPECSTR_SCREENSHOT_START + _cur_screenshot_format);
(_fullscreen) ? SETBIT(w->click_state, 28) : CLRBIT(w->click_state, 28); // fullscreen button
DrawWindowWidgets(w);
@ -352,7 +352,7 @@ static void GameDifficultyWndProc(Window *w, WindowEvent *e)
value = _game_setting_info[i].str + ((int*)&_opt_mod_temp.diff)[i];
if (i == 4) value *= 1000; // handle currency option
SET_DPARAM32(0, value);
SetDParam(0, value);
DrawString(x+30, y+1, STR_6805_MAXIMUM_NO_COMPETITORS + i, 0);
y += 11;
@ -764,7 +764,7 @@ static void PatchesSelectionWndProc(Window *w, WindowEvent *e)
bool disabled = false;
if (pe->type == PE_BOOL) {
DrawFrameRect(x+5, y+1, x+15+9, y+9, (*(bool*)pe->variable)?6:4, (*(bool*)pe->variable)?0x20:0);
SET_DPARAM16(0, *(bool*)pe->variable ? STR_CONFIG_PATCHES_ON : STR_CONFIG_PATCHES_OFF);
SetDParam(0, *(bool*)pe->variable ? STR_CONFIG_PATCHES_ON : STR_CONFIG_PATCHES_OFF);
} else {
DrawFrameRect(x+5, y+1, x+5+9, y+9, 3, clk == i*2+1 ? 0x20 : 0);
DrawFrameRect(x+15, y+1, x+15+9, y+9, 3, clk == i*2+2 ? 0x20 : 0);
@ -776,16 +776,16 @@ static void PatchesSelectionWndProc(Window *w, WindowEvent *e)
val /= GetCurrentCurrencyRate();
disabled = ((val == 0) && (pe->flags & PF_0ISDIS));
if (disabled) {
SET_DPARAM16(0, STR_CONFIG_PATCHES_DISABLED);
SetDParam(0, STR_CONFIG_PATCHES_DISABLED);
} else {
SET_DPARAM32(1, val);
SetDParam(1, val);
if (pe->type == PE_CURRENCY)
SET_DPARAM16(0, STR_CONFIG_PATCHES_CURRENCY);
SetDParam(0, STR_CONFIG_PATCHES_CURRENCY);
else {
if (pe->flags & PF_MULTISTRING)
SET_DPARAM16(0, pe->str + val + 1);
SetDParam(0, pe->str + val + 1);
else
SET_DPARAM16(0, pe->flags & PF_NOCOMMA ? STR_CONFIG_PATCHES_INT32 : STR_7024);
SetDParam(0, pe->flags & PF_NOCOMMA ? STR_CONFIG_PATCHES_INT32 : STR_7024);
}
}
}
@ -868,7 +868,7 @@ static void PatchesSelectionWndProc(Window *w, WindowEvent *e)
} else {
if (pe->type != PE_BOOL && !(pe->flags & PF_MULTISTRING)) { // do not open editbox
WP(w,def_d).data_3 = btn;
SET_DPARAM32(0, ReadPE(pe));
SetDParam(0, ReadPE(pe));
ShowQueryString(STR_CONFIG_PATCHES_INT32, STR_CONFIG_PATCHES_QUERY_CAPT, 10, 100, WC_GAME_OPTIONS, 0);
}
}

View File

@ -39,11 +39,11 @@ void DrawShipEngine(int x, int y, int engine, uint32 image_ormod)
void DrawShipEngineInfo(int engine, int x, int y, int maxw)
{
ShipVehicleInfo *svi = &ship_vehicle_info(engine);
SET_DPARAM32(0, svi->base_cost * (_price.ship_base>>3)>>5);
SET_DPARAM16(1, svi->max_speed * 10 >> 5);
SET_DPARAM16(2, _cargoc.names_long_p[svi->cargo_type]);
SET_DPARAM16(3, svi->capacity);
SET_DPARAM32(4, svi->running_cost * _price.ship_running >> 8);
SetDParam(0, svi->base_cost * (_price.ship_base>>3)>>5);
SetDParam(1, svi->max_speed * 10 >> 5);
SetDParam(2, _cargoc.names_long_p[svi->cargo_type]);
SetDParam(3, svi->capacity);
SetDParam(4, svi->running_cost * _price.ship_running >> 8);
DrawStringMultiCenter(x, y, STR_982E_COST_MAX_SPEED_CAPACITY, maxw);
}
@ -406,7 +406,7 @@ static void ShipEnterDepot(Vehicle *v)
else if (t & 0x40) {
v->vehstatus |= VS_STOPPED;
if (v->owner == _local_player) {
SET_DPARAM16(0, v->unitnumber);
SetDParam(0, v->unitnumber);
AddNewsItem(
STR_981C_SHIP_IS_WAITING_IN_DEPOT,
NEWS_FLAGS(NM_SMALL, NF_VIEWPORT|NF_VEHICLE, NT_ADVICE, 0),
@ -423,7 +423,7 @@ static void ShipArrivesAt(Vehicle *v, Station *st)
if (!(st->had_vehicle_of_type & HVOT_SHIP)) {
uint32 flags;
st->had_vehicle_of_type |= HVOT_SHIP;
SET_DPARAM16(0, st->index);
SetDParam(0, st->index);
flags = (v->owner == _local_player) ? NEWS_FLAGS(NM_THIN, NF_VIEWPORT|NF_VEHICLE, NT_ARRIVAL_PLAYER, 0) : NEWS_FLAGS(NM_THIN, NF_VIEWPORT|NF_VEHICLE, NT_ARRIVAL_OTHER, 0);
AddNewsItem(
STR_9833_CITIZENS_CELEBRATE_FIRST,

View File

@ -33,8 +33,8 @@ static void ShipRefitWndProc(Window *w, WindowEvent *e)
byte color;
int cargo;
SET_DPARAM16(0, v->string_id);
SET_DPARAM16(1, v->unitnumber);
SetDParam(0, v->string_id);
SetDParam(1, v->unitnumber);
DrawWindowWidgets(w);
DrawString(1, 15, STR_983F_SELECT_CARGO_TYPE_TO_CARRY, 0);
@ -82,9 +82,9 @@ static void ShipRefitWndProc(Window *w, WindowEvent *e)
if (cargo != -1) {
int32 cost = DoCommandByTile(v->tile, v->index, cargo, 0, CMD_REFIT_SHIP);
if (cost != CMD_ERROR) {
SET_DPARAM32(2, cost);
SET_DPARAM16(0, _cargoc.names_long_p[cargo]);
SET_DPARAM16(1, v->cargo_cap);
SetDParam(2, cost);
SetDParam(0, _cargoc.names_long_p[cargo]);
SetDParam(1, v->cargo_cap);
DrawString(1, 137, STR_9840_NEW_CAPACITY_COST_OF_REFIT, 0);
}
}
@ -156,8 +156,8 @@ static void ShipDetailsWndProc(Window *w, WindowEvent *e)
if (!_patches.servint_ships) // disable service-scroller when interval is set to disabled
w->disabled_state |= (1 << 5) | (1 << 6);
SET_DPARAM16(0, v->string_id);
SET_DPARAM16(1, v->unitnumber);
SetDParam(0, v->string_id);
SetDParam(1, v->unitnumber);
DrawWindowWidgets(w);
/* Draw running cost */
@ -165,7 +165,7 @@ static void ShipDetailsWndProc(Window *w, WindowEvent *e)
int year = v->age / 366;
StringID str;
SET_DPARAM16(1, year);
SetDParam(1, year);
str = STR_0199_YEAR;
if (year != 1) {
@ -173,55 +173,55 @@ static void ShipDetailsWndProc(Window *w, WindowEvent *e)
if (v->max_age - 366 < v->age)
str++;
}
SET_DPARAM16(0, str);
SET_DPARAM16(2, v->max_age / 366);
SET_DPARAM32(3, ship_vehicle_info(v->engine_type).running_cost * _price.ship_running >> 8);
SetDParam(0, str);
SetDParam(2, v->max_age / 366);
SetDParam(3, ship_vehicle_info(v->engine_type).running_cost * _price.ship_running >> 8);
DrawString(2, 15, STR_9812_AGE_RUNNING_COST_YR, 0);
}
/* Draw max speed */
{
SET_DPARAM16(0, v->max_speed * 10 >> 5);
SetDParam(0, v->max_speed * 10 >> 5);
DrawString(2, 25, STR_9813_MAX_SPEED, 0);
}
/* Draw profit */
{
SET_DPARAM32(0, v->profit_this_year);
SET_DPARAM32(1, v->profit_last_year);
SetDParam(0, v->profit_this_year);
SetDParam(1, v->profit_last_year);
DrawString(2, 35, STR_9814_PROFIT_THIS_YEAR_LAST_YEAR, 0);
}
/* Draw breakdown & reliability */
{
SET_DPARAM8(0, v->reliability * 100 >> 16);
SET_DPARAM16(1, v->breakdowns_since_last_service);
SetDParam(0, v->reliability * 100 >> 16);
SetDParam(1, v->breakdowns_since_last_service);
DrawString(2, 45, STR_9815_RELIABILITY_BREAKDOWNS, 0);
}
/* Draw service interval text */
{
SET_DPARAM16(0, v->service_interval);
SET_DPARAM16(1, v->date_of_last_service);
SetDParam(0, v->service_interval);
SetDParam(1, v->date_of_last_service);
DrawString(13, 90, _patches.servint_ispercent?STR_SERVICING_INTERVAL_PERCENT:STR_883C_SERVICING_INTERVAL_DAYS, 0);
}
DrawShipImage(v, 3, 57, INVALID_VEHICLE);
SET_DPARAM16(1, 1920 + v->build_year);
SET_DPARAM16(0, GetCustomEngineName(v->engine_type));
SET_DPARAM32(2, v->value);
SetDParam(1, 1920 + v->build_year);
SetDParam(0, GetCustomEngineName(v->engine_type));
SetDParam(2, v->value);
DrawString(74, 57, STR_9816_BUILT_VALUE, 0);
SET_DPARAM16(0, _cargoc.names_long_p[v->cargo_type]);
SET_DPARAM16(1, v->cargo_cap);
SetDParam(0, _cargoc.names_long_p[v->cargo_type]);
SetDParam(1, v->cargo_cap);
DrawString(74, 67, STR_9817_CAPACITY, 0);
str = STR_8812_EMPTY;
if (v->cargo_count != 0) {
SET_DPARAM8(0, v->cargo_type);
SET_DPARAM16(1, v->cargo_count);
SET_DPARAM16(2, v->cargo_source);
SetDParam(0, v->cargo_type);
SetDParam(1, v->cargo_count);
SetDParam(2, v->cargo_source);
str = STR_8813_FROM;
}
DrawString(74, 78, str, 0);
@ -230,7 +230,7 @@ static void ShipDetailsWndProc(Window *w, WindowEvent *e)
case WE_CLICK:
switch(e->click.widget) {
case 2: /* rename */
SET_DPARAM16(0, v->unitnumber);
SetDParam(0, v->unitnumber);
ShowQueryString(v->string_id, STR_9831_NAME_SHIP, 31, 150, w->window_class, w->window_number);
break;
case 5: /* increase int */
@ -363,18 +363,18 @@ static void NewShipWndProc(Window *w, WindowEvent *e)
if (selected_id != -1) {
Engine *e;
SET_DPARAM32(0, ship_vehicle_info(selected_id).base_cost * (_price.ship_base>>3)>>5);
SET_DPARAM16(1, ship_vehicle_info(selected_id).max_speed * 10 >> 5);
SET_DPARAM16(2, _cargoc.names_long_p[ship_vehicle_info(selected_id).cargo_type]);
SET_DPARAM16(3, ship_vehicle_info(selected_id).capacity);
SET_DPARAM16(4, ship_vehicle_info(selected_id).refittable ? STR_9842_REFITTABLE : STR_EMPTY);
SET_DPARAM32(5, ship_vehicle_info(selected_id).running_cost * _price.ship_running >> 8);
SetDParam(0, ship_vehicle_info(selected_id).base_cost * (_price.ship_base>>3)>>5);
SetDParam(1, ship_vehicle_info(selected_id).max_speed * 10 >> 5);
SetDParam(2, _cargoc.names_long_p[ship_vehicle_info(selected_id).cargo_type]);
SetDParam(3, ship_vehicle_info(selected_id).capacity);
SetDParam(4, ship_vehicle_info(selected_id).refittable ? STR_9842_REFITTABLE : STR_EMPTY);
SetDParam(5, ship_vehicle_info(selected_id).running_cost * _price.ship_running >> 8);
e = &_engines[selected_id];
SET_DPARAM16(7, e->lifelength);
SET_DPARAM8(8, e->reliability * 100 >> 16);
SetDParam(7, e->lifelength);
SetDParam(8, e->reliability * 100 >> 16);
ConvertDayToYMD(&ymd, e->intro_date);
SET_DPARAM16(6, ymd.year + 1920);
SetDParam(6, ymd.year + 1920);
DrawString(2, 111, STR_980A_COST_SPEED_CAPACITY_RUNNING, 0);
}
@ -485,8 +485,8 @@ static void ShipViewWndProc(Window *w, WindowEvent *e) {
w->disabled_state = disabled;
/* draw widgets & caption */
SET_DPARAM16(0, v->string_id);
SET_DPARAM16(1, v->unitnumber);
SetDParam(0, v->string_id);
SetDParam(1, v->unitnumber);
DrawWindowWidgets(w);
/* draw the flag */
@ -499,15 +499,15 @@ static void ShipViewWndProc(Window *w, WindowEvent *e) {
} else {
switch(v->next_order & OT_MASK) {
case OT_GOTO_STATION: {
SET_DPARAM16(0, v->next_order_param);
SET_DPARAM16(1, v->cur_speed * 10 >> 5);
SetDParam(0, v->next_order_param);
SetDParam(1, v->cur_speed * 10 >> 5);
str = STR_HEADING_FOR_STATION + _patches.vehicle_speed;
} break;
case OT_GOTO_DEPOT: {
Depot *dep = &_depots[v->next_order_param];
SET_DPARAM16(0, dep->town_index);
SET_DPARAM16(1, v->cur_speed * 10 >> 5);
SetDParam(0, dep->town_index);
SetDParam(1, v->cur_speed * 10 >> 5);
str = STR_HEADING_FOR_SHIP_DEPOT + _patches.vehicle_speed;
} break;
@ -519,7 +519,7 @@ static void ShipViewWndProc(Window *w, WindowEvent *e) {
default:
if (v->num_orders == 0) {
str = STR_NO_ORDERS + _patches.vehicle_speed;
SET_DPARAM16(0, v->cur_speed * 10 >> 5);
SetDParam(0, v->cur_speed * 10 >> 5);
} else
str = STR_EMPTY;
break;
@ -632,7 +632,7 @@ static void DrawShipDepotWindow(Window *w)
/* locate the depot struct */
for(d=_depots; d->xy != (TileIndex)tile; d++) {}
SET_DPARAM16(0, d->town_index);
SetDParam(0, d->town_index);
DrawWindowWidgets(w);
x = 2;
@ -647,7 +647,7 @@ static void DrawShipDepotWindow(Window *w)
DrawShipImage(v, x+19, y, WP(w,traindepot_d).sel);
SET_DPARAM16(0, v->unitnumber);
SetDParam(0, v->unitnumber);
DrawString(x, y, (uint16)(v->max_age-366) >= v->age ? STR_00E2 : STR_00E3, 0);
DrawSprite( (v->vehstatus & VS_STOPPED) ? 0xC12 : 0xC13, x, y + 9);
@ -856,7 +856,7 @@ static void DrawSmallShipSchedule(Vehicle *v, int x, int y) {
st = DEREF_STATION(ord >> 8);
if (!(st->had_vehicle_of_type & HVOT_BUOY)) {
SET_DPARAM16(0, ord >> 8);
SetDParam(0, ord >> 8);
DrawString(x, y, STR_A036, 0);
y += 6;
@ -955,9 +955,9 @@ static void PlayerShipsWndProc(Window *w, WindowEvent *e)
{
Player *p = DEREF_PLAYER(window_number);
/* Company Name -- (###) Ships */
SET_DPARAM16(0, p->name_1);
SET_DPARAM32(1, p->name_2);
SET_DPARAM16(2, w->vscroll.count);
SetDParam(0, p->name_1);
SetDParam(1, p->name_2);
SetDParam(2, w->vscroll.count);
DrawWindowWidgets(w);
}
/* draw sorting criteria string */
@ -982,7 +982,7 @@ static void PlayerShipsWndProc(Window *w, WindowEvent *e)
DrawShipImage(v, x + 19, y + 6, INVALID_VEHICLE);
DrawVehicleProfitButton(v, x, y+13);
SET_DPARAM16(0, v->unitnumber);
SetDParam(0, v->unitnumber);
if (IsShipDepotTile(v->tile)) {
str = STR_021F;
} else {
@ -990,12 +990,12 @@ static void PlayerShipsWndProc(Window *w, WindowEvent *e)
}
DrawString(x, y+2, str, 0);
SET_DPARAM32(0, v->profit_this_year);
SET_DPARAM32(1, v->profit_last_year);
SetDParam(0, v->profit_this_year);
SetDParam(1, v->profit_last_year);
DrawString(x + 12, y + 28, STR_0198_PROFIT_THIS_YEAR_LAST_YEAR, 0);
if (v->string_id != STR_SV_SHIP_NAME) {
SET_DPARAM16(0, v->string_id);
SetDParam(0, v->string_id);
DrawString(x+12, y, STR_01AB, 0);
}

View File

@ -798,7 +798,7 @@ skip_column:
y + 6 > dpi->top &&
y < dpi->top + dpi->height) {
// And draw it.
SET_DPARAM16(0, t->index);
SetDParam(0, t->index);
DrawString(x, y, STR_2056, 12);
}
}
@ -846,7 +846,7 @@ static void SmallMapWindowProc(Window *w, WindowEvent *e)
/* draw the window */
SET_DPARAM16(0, STR_00E5_CONTOURS + _smallmap_type);
SetDParam(0, STR_00E5_CONTOURS + _smallmap_type);
DrawWindowWidgets(w);
/* draw the legend */
@ -1019,7 +1019,7 @@ static void ExtraViewPortWndProc(Window *w, WindowEvent *e)
switch(e->event) {
case WE_PAINT: {
// set the number in the title bar
SET_DPARAM16(0, (w->window_number+1));
SetDParam(0, (w->window_number+1));
DrawWindowWidgets(w);
DrawWindowViewport(w);

View File

@ -327,8 +327,8 @@ static void UpdateStationVirtCoord(Station *st)
pt.y -= 32;
if (st->facilities&FACIL_AIRPORT && st->airport_type==AT_OILRIG) pt.y -= 16;
SET_DPARAM16(0, st->index);
SET_DPARAM8(1, st->facilities);
SetDParam(0, st->index);
SetDParam(1, st->facilities);
UpdateViewportSignPos(&st->sign, pt.x, pt.y, STR_305C_0);
}
@ -368,9 +368,9 @@ static uint GetAcceptanceMask(Station *st)
static void ShowRejectOrAcceptNews(Station *st, uint32 items, StringID msg)
{
if (items) {
SET_DPARAM32(2, items >> 16);
SET_DPARAM32(1, items & 0xFFFF);
SET_DPARAM16(0, st->index);
SetDParam(2, items >> 16);
SetDParam(1, items & 0xFFFF);
SetDParam(0, st->index);
AddNewsItem(msg + ((items >> 16)?1:0), NEWS_FLAGS(NM_SMALL, NF_VIEWPORT|NF_TILE, NT_ACCEPTANCE, 0), st->xy, 0);
}
}
@ -1517,7 +1517,7 @@ int32 CmdBuildAirport(int x, int y, uint32 flags, uint32 p1, uint32 p2)
num++;
}
if (num >= 2) {
SET_DPARAM16(0, t->index);
SetDParam(0, t->index);
return_cmd_error(STR_2035_LOCAL_AUTHORITY_REFUSES);
}
}
@ -2622,7 +2622,7 @@ static int32 ClearTile_Station(uint tile, byte flags) {
if (m5 < 0x4B) return_cmd_error(STR_3046_MUST_DEMOLISH_BUS_STATION);
if (m5 == 0x52) return_cmd_error(STR_306A_BUOY_IN_THE_WAY);
if (m5 != 0x4B && m5 < 0x53) return_cmd_error(STR_304D_MUST_DEMOLISH_DOCK_FIRST);
SET_DPARAM16(0, STR_4807_OIL_RIG);
SetDParam(0, STR_4807_OIL_RIG);
return_cmd_error(STR_4800_IN_THE_WAY);
}

View File

@ -59,15 +59,15 @@ static int CDECL StationNameSorter(const void *a, const void *b)
const SortStruct *cmp2 = (const SortStruct*)b;
st = DEREF_STATION(cmp1->index);
SET_DPARAM16(0, st->town->townnametype);
SET_DPARAM32(1, st->town->townnameparts);
SetDParam(0, st->town->townnametype);
SetDParam(1, st->town->townnameparts);
GetString(buf1, st->string_id);
if ( cmp2->index != _last_station_idx) {
_last_station_idx = cmp2->index;
st = DEREF_STATION(cmp2->index);
SET_DPARAM16(0, st->town->townnametype);
SET_DPARAM32(1, st->town->townnameparts);
SetDParam(0, st->town->townnametype);
SetDParam(1, st->town->townnameparts);
GetString(_bufcache, st->string_id);
}
@ -149,9 +149,9 @@ static void PlayerStationsWndProc(Window *w, WindowEvent *e)
/* draw widgets, with player's name in the caption */
{
Player *p = DEREF_PLAYER(window_number);
SET_DPARAM16(0, p->name_1);
SET_DPARAM32(1, p->name_2);
SET_DPARAM16(2, w->vscroll.count);
SetDParam(0, p->name_1);
SetDParam(1, p->name_2);
SetDParam(2, w->vscroll.count);
DrawWindowWidgets(w);
}
@ -175,8 +175,8 @@ static void PlayerStationsWndProc(Window *w, WindowEvent *e)
assert(st->xy && st->owner == window_number);
SET_DPARAM16(0, st->index);
SET_DPARAM8(1, st->facilities);
SetDParam(0, st->index);
SetDParam(1, st->facilities);
x = DrawString(xb, y, STR_3049_0, 0) + 5;
// show cargo waiting and station ratings
@ -310,8 +310,8 @@ static void DrawStationViewWindow(Window *w)
SetVScrollCount(w, num);
w->disabled_state = st->owner == _local_player ? 0 : (1 << 8);
SET_DPARAM16(0, st->index);
SET_DPARAM8(1, st->facilities);
SetDParam(0, st->index);
SetDParam(1, st->facilities);
DrawWindowWidgets(w);
x = 2;
@ -323,7 +323,7 @@ static void DrawStationViewWindow(Window *w)
for(i=0; i!=NUM_CARGO; i++)
if (st->goods[i].waiting_acceptance & 0xFFF)
str = STR_EMPTY;
SET_DPARAM16(0, str);
SetDParam(0, str);
DrawString(x, y, STR_0008_WAITING, 0);
y += 10;
}
@ -346,22 +346,22 @@ static void DrawStationViewWindow(Window *w)
if ( st->goods[i].enroute_from == station_id) {
if (--pos < 0) {
SET_DPARAM16(1, waiting);
SET_DPARAM16(0, _cargoc.names_long_s[i] + (waiting==1 ? 0 : 32));
SetDParam(1, waiting);
SetDParam(0, _cargoc.names_long_s[i] + (waiting==1 ? 0 : 32));
DrawStringRightAligned(x + 234, y, STR_0009, 0);
y += 10;
}
} else {
/* enroute */
if (--pos < 0) {
SET_DPARAM16(1, waiting);
SET_DPARAM16(0, _cargoc.names_long_s[i] + (waiting==1 ? 0 : 32));
SetDParam(1, waiting);
SetDParam(0, _cargoc.names_long_s[i] + (waiting==1 ? 0 : 32));
DrawStringRightAligned(x + 234, y, STR_000A_EN_ROUTE_FROM, 0);
y += 10;
}
if (pos > -5 && --pos < 0) {
SET_DPARAM16(0, st->goods[i].enroute_from);
SetDParam(0, st->goods[i].enroute_from);
DrawStringRightAligned(x + 234, y, STR_000B, 0);
y += 10;
}
@ -403,9 +403,9 @@ static void DrawStationViewWindow(Window *w)
y = 77;
for(i=0; i!=NUM_CARGO; i++) {
if (st->goods[i].enroute_from != 0xFF) {
SET_DPARAM16(0, _cargoc.names_s[i]);
SET_DPARAM8(2, st->goods[i].rating * 101 >> 8);
SET_DPARAM16(1, STR_3035_APPALLING + (st->goods[i].rating >> 5));
SetDParam(0, _cargoc.names_s[i]);
SetDParam(2, st->goods[i].rating * 101 >> 8);
SetDParam(1, STR_3035_APPALLING + (st->goods[i].rating >> 5));
DrawString(8, y, STR_303D, 0);
y += 10;
}
@ -439,8 +439,8 @@ static void StationViewWndProc(Window *w, WindowEvent *e)
case 8: {
Station *st = DEREF_STATION(w->window_number);
SET_DPARAM16(0, st->town->townnametype);
SET_DPARAM32(1, st->town->townnameparts);
SetDParam(0, st->town->townnametype);
SetDParam(1, st->town->townnameparts);
ShowQueryString(st->string_id, STR_3030_RENAME_STATION_LOADING, 31, 180, w->window_class, w->window_number);
} break;
}

View File

@ -183,14 +183,14 @@ void InjectDparam(int amount)
int32 GetParamInt32()
{
int32 result = GET_DPARAM32(0);
int32 result = GetDParam(0);
memmove(&_decode_parameters[0], &_decode_parameters[1], sizeof(uint32) * (lengthof(_decode_parameters)-1));
return result;
}
static int64 GetParamInt64()
{
int64 result = GET_DPARAM32(0) + ((uint64)GET_DPARAM32(1) << 32);
int64 result = GetDParam(0) + ((uint64)GetDParam(1) << 32);
memmove(&_decode_parameters[0], &_decode_parameters[2], sizeof(uint32) * (lengthof(_decode_parameters)-2));
return result;
}
@ -198,21 +198,21 @@ static int64 GetParamInt64()
int GetParamInt16()
{
int result = (int16)GET_DPARAM16(0);
int result = (int16)GetDParam(0);
memmove(&_decode_parameters[0], &_decode_parameters[1], sizeof(uint32) * (lengthof(_decode_parameters)-1));
return result;
}
int GetParamInt8()
{
int result = (int8)GET_DPARAM8(0);
int result = (int8)GetDParam(0);
memmove(&_decode_parameters[0], &_decode_parameters[1], sizeof(uint32) * (lengthof(_decode_parameters)-1));
return result;
}
int GetParamUint16()
{
int result = GET_DPARAM16(0);
int result = GetDParam(0);
memmove(&_decode_parameters[0], &_decode_parameters[1], sizeof(uint32) * (lengthof(_decode_parameters)-1));
return result;
}
@ -493,7 +493,7 @@ static byte *DecodeString(byte *buff, const byte *str)
// 16-bit - cargo count
int cargo_str = _cargoc.names_long_s[GetParamInt8()];
// Now check if the cargo count is 1, if it is, increase string by 32.
if (GET_DPARAM16(0) != 1) cargo_str += 32;
if (GetDParam(0) != 1) cargo_str += 32;
buff = GetString(buff, cargo_str);
break;
}
@ -501,21 +501,21 @@ static byte *DecodeString(byte *buff, const byte *str)
case 0x9A: { // {STATION}
Station *st;
InjectDparam(1);
st = DEREF_STATION(GET_DPARAM16(1));
st = DEREF_STATION(GetDParam(1));
if (!st->xy) { // station doesn't exist anymore
buff = GetString(buff, STR_UNKNOWN_DESTINATION);
break;
}
SET_DPARAM16(0, st->town->townnametype);
SET_DPARAM32(1, st->town->townnameparts);
SetDParam(0, st->town->townnametype);
SetDParam(1, st->town->townnameparts);
buff = GetString(buff, st->string_id);
break;
}
case 0x9B: { // {TOWN}
Town *t;
t = DEREF_TOWN(GET_DPARAM16(0));
t = DEREF_TOWN(GetDParam(0));
assert(t->xy);
SET_DPARAM32(0, t->townnameparts);
SetDParam(0, t->townnameparts);
buff = GetString(buff, t->townnametype);
break;
}
@ -526,7 +526,7 @@ static byte *DecodeString(byte *buff, const byte *str)
}
case 0x9D: { // {WAYPOINT}
Waypoint *cp = &_waypoints[GET_DPARAM16(0)];
Waypoint *cp = &_waypoints[GetDParam(0)];
StringID str;
int idx;
if (~cp->town_or_string & 0xC000) {
@ -538,10 +538,10 @@ static byte *DecodeString(byte *buff, const byte *str)
str = STR_WAYPOINTNAME_CITY;
} else {
InjectDparam(1);
SET_DPARAM16(1, idx + 1);
SetDParam(1, idx + 1);
str = STR_WAYPOINTNAME_CITY_SERIAL;
}
SET_DPARAM16(0, cp->town_or_string & 0xFF);
SetDParam(0, cp->town_or_string & 0xFF);
}
buff = GetString(buff, str);

View File

@ -92,7 +92,7 @@ static void DrawSubsidiesWindow(Window *w)
SetupSubsidyDecodeParam(s, 1);
x2 = DrawString(x+2, y, STR_2027_FROM_TO, 0);
SET_DPARAM16(0, _date - ymd.day + 384 - s->age * 32);
SetDParam(0, _date - ymd.day + 384 - s->age * 32);
DrawString(x2, y, STR_2028_BY, 0);
y += 10;
num++;
@ -113,12 +113,12 @@ static void DrawSubsidiesWindow(Window *w)
SetupSubsidyDecodeParam(s, 1);
p = DEREF_PLAYER(DEREF_STATION(s->to)->owner);
SET_DPARAM16(3, p->name_1);
SET_DPARAM32(4, p->name_2);
SetDParam(3, p->name_1);
SetDParam(4, p->name_2);
xt = DrawString(x+2, y, STR_202C_FROM_TO, 0);
SET_DPARAM16(0, _date - ymd.day + 768 - s->age * 32);
SetDParam(0, _date - ymd.day + 768 - s->age * 32);
DrawString(xt, y, STR_202D_UNTIL, 0);
y += 10;
num++;

View File

@ -43,8 +43,8 @@ void AddTextEffect(StringID msg, int x, int y, uint16 duration)
te->duration = duration;
te->y = y - 5;
te->bottom = y + 5;
te->params_1 = GET_DPARAM32(0);
te->params_2 = GET_DPARAM32(4);
te->params_1 = GetDParam(0);
te->params_2 = GetDParam(4);
GetString(buffer, msg);
w = GetStringWidth(buffer);

View File

@ -291,7 +291,7 @@ static int32 ClearTile_Town(uint tile, byte flags)
if (_current_player < MAX_PLAYERS) {
if (rating > t->ratings[_current_player] && !(flags & DC_NO_TOWN_RATING) && !_cheats.magic_bulldozer.value) {
SET_DPARAM16(0, t->index);
SetDParam(0, t->index);
return_cmd_error(STR_2009_LOCAL_AUTHORITY_REFUSES);
}
}
@ -318,7 +318,7 @@ static void GetTileDesc_Town(uint tile, TileDesc *td)
{
td->str = _town_tile_names[_map2[tile]];
if ((_map3_lo[tile] & 0xC0) != 0xC0) {
SET_DPARAMX16(td->dparam, 0, td->str);
SetDParamX(td->dparam, 0, td->str);
td->str = STR_2058_UNDER_CONSTRUCTION;
}
@ -815,7 +815,7 @@ static void UpdateTownRadius(Town *t)
static void UpdateTownVirtCoord(Town *t)
{
Point pt = RemapCoords2(GET_TILE_X(t->xy)*16, GET_TILE_Y(t->xy)*16);
SET_DPARAM32(0, t->townnameparts);
SetDParam(0, t->townnameparts);
UpdateViewportSignPos(&t->sign, pt.x, pt.y - 24, t->townnametype);
}
@ -832,7 +832,7 @@ static void CreateTownName(Town *t1)
restart:
r = Random();
SET_DPARAM32(0, r);
SetDParam(0, r);
GetString(buf1, t1->townnametype);
// Check size and width
@ -841,7 +841,7 @@ restart:
FOR_ALL_TOWNS(t2) {
if (t2->xy != 0) {
SET_DPARAM32(0, t2->townnameparts);
SetDParam(0, t2->townnameparts);
GetString(buf2, t2->townnametype);
if (str_eq(buf1, buf2))
goto restart;
@ -1440,11 +1440,11 @@ static void TownActionRoadRebuild(Town *t, int action)
t->road_build_months = 6;
SET_DPARAM16(0, t->index);
SetDParam(0, t->index);
p = DEREF_PLAYER(_current_player);
SET_DPARAM16(1, p->name_1);
SET_DPARAM32(2, p->name_2);
SetDParam(1, p->name_1);
SetDParam(2, p->name_2);
AddNewsItem(STR_2055_TRAFFIC_CHAOS_IN_ROAD_REBUILDING,
NEWS_FLAGS(NM_NORMAL, NF_TILE, NT_GENERAL, 0), t->xy, 0);
@ -1704,7 +1704,7 @@ bool CheckIfAuthorityAllows(uint tile)
return true;
_error_message = STR_2009_LOCAL_AUTHORITY_REFUSES;
SET_DPARAM16(0, t->index);
SetDParam(0, t->index);
return false;
}
@ -1778,7 +1778,7 @@ bool CheckforTownRating(uint tile, uint32 flags, Town *t, byte type)
modemod = _default_rating_settings[_opt_mod_ptr->diff.town_council_tolerance][type];
if (t->ratings[_current_player] < 16 + modemod && !(flags & DC_NO_TOWN_RATING)) {
SET_DPARAM16(0, t->index);
SetDParam(0, t->index);
_error_message = STR_2009_LOCAL_AUTHORITY_REFUSES;
return false;
}

View File

@ -102,7 +102,7 @@ static void TownAuthorityWndProc(Window *w, WindowEvent *e)
int r;
StringID str;
SET_DPARAM16(0, w->window_number);
SetDParam(0, w->window_number);
DrawWindowWidgets(w);
DrawString(2, 15, STR_2023_TRANSPORT_COMPANY_RATINGS, 0);
@ -113,9 +113,9 @@ static void TownAuthorityWndProc(Window *w, WindowEvent *e)
if (p->is_active && (HASBIT(t->have_ratings, p->index) || t->exclusivity==p->index)) {
DrawPlayerIcon(p->index, 2, y);
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));
r = t->ratings[p->index];
(str = STR_3035_APPALLING, r <= -400) || // Apalling
@ -133,7 +133,7 @@ static void TownAuthorityWndProc(Window *w, WindowEvent *e)
that because there is another param after it.
So we'll just shift the rating one back if player is AI and all is fine
*/
SET_DPARAM16((IS_HUMAN_PLAYER(p->index) ? 4 : 3), str);
SetDParam((IS_HUMAN_PLAYER(p->index) ? 4 : 3), str);
if (t->exclusivity == p->index) // red icon for player with exclusive rights
DrawSprite((SPR_OPENTTD_BASE + 10) | 0x30b8000, 18, y);
@ -166,8 +166,8 @@ static void TownAuthorityWndProc(Window *w, WindowEvent *e)
{
int i;
if ((i=WP(w,def_d).data_1) != -1) {
SET_DPARAM32(1, (_price.build_industry >> 8) * _town_action_costs[i]);
SET_DPARAM16(0, STR_2046_SMALL_ADVERTISING_CAMPAIGN + i);
SetDParam(1, (_price.build_industry >> 8) * _town_action_costs[i]);
SetDParam(0, STR_2046_SMALL_ADVERTISING_CAMPAIGN + i);
DrawStringMultiLine(2, 159, STR_204D_INITIATE_A_SMALL_LOCAL + i, 313);
}
}
@ -227,19 +227,19 @@ static void TownViewWndProc(Window *w, WindowEvent *e)
switch(e->event) {
case WE_PAINT:
SET_DPARAM16(0, t->index);
SetDParam(0, t->index);
DrawWindowWidgets(w);
SET_DPARAM32(0, t->population);
SET_DPARAM32(1, t->num_houses);
SetDParam(0, t->population);
SetDParam(1, t->num_houses);
DrawString(2,107,STR_2006_POPULATION,0);
SET_DPARAM16(0, t->act_pass);
SET_DPARAM16(1, t->max_pass);
SetDParam(0, t->act_pass);
SetDParam(1, t->max_pass);
DrawString(2,117,STR_200D_PASSENGERS_LAST_MONTH_MAX,0);
SET_DPARAM16(0, t->act_mail);
SET_DPARAM16(1, t->max_mail);
SetDParam(0, t->act_mail);
SetDParam(1, t->max_mail);
DrawString(2,127,STR_200E_MAIL_LAST_MONTH_MAX,0);
DrawWindowViewport(w);
@ -254,7 +254,7 @@ static void TownViewWndProc(Window *w, WindowEvent *e)
ShowTownAuthorityWindow(w->window_number);
break;
case 7: /* rename */
SET_DPARAM32(0, t->townnameparts);
SetDParam(0, t->townnameparts);
ShowQueryString(t->townnametype, STR_2007_RENAME_TOWN, 31, 130, w->window_class, w->window_number);
break;
case 8: /* expand town */
@ -363,13 +363,13 @@ static int CDECL TownNameSorter(const void *a, const void *b)
int r;
t = DEREF_TOWN(*(const byte*)a);
SET_DPARAM32(0, t->townnameparts);
SetDParam(0, t->townnameparts);
GetString(buf1, t->townnametype);
if ( (val=*(const byte*)b) != _last_town_idx) {
_last_town_idx = val;
t = DEREF_TOWN(val);
SET_DPARAM32(0, t->townnameparts);
SetDParam(0, t->townnameparts);
GetString(_bufcache, t->townnametype);
}
@ -427,8 +427,8 @@ static void TownDirectoryWndProc(Window *w, WindowEvent *e)
assert(t->xy);
SET_DPARAM16(0, t->index);
SET_DPARAM32(1, t->population);
SetDParam(0, t->index);
SetDParam(1, t->population);
DrawString(2, y, STR_2057, 0);
y += 10;

View File

@ -203,18 +203,18 @@ void DrawTrainEngineInfo(int engine, int x, int y, int maxw)
int cap;
uint multihead = ((rvi->flags & RVI_MULTIHEAD) ? 1 : 0);
SET_DPARAM32(0, ((_price.build_railvehicle >> 3) * rvi->base_cost) >> 5);
SET_DPARAM16(2, rvi->max_speed * 10 >> 4);
SET_DPARAM16(3, rvi->power << multihead);
SET_DPARAM16(1, rvi->weight << multihead);
SetDParam(0, ((_price.build_railvehicle >> 3) * rvi->base_cost) >> 5);
SetDParam(2, rvi->max_speed * 10 >> 4);
SetDParam(3, rvi->power << multihead);
SetDParam(1, rvi->weight << multihead);
SET_DPARAM32(4, (rvi->running_cost_base * _price.running_rail[rvi->engclass] >> 8) << multihead);
SetDParam(4, (rvi->running_cost_base * _price.running_rail[rvi->engclass] >> 8) << multihead);
cap = rvi->capacity;
SET_DPARAM16(5, STR_8838_N_A);
SetDParam(5, STR_8838_N_A);
if (cap != 0) {
SET_DPARAM16(6, cap << multihead);
SET_DPARAM16(5, _cargoc.names_long_p[rvi->cargo_type]);
SetDParam(6, cap << multihead);
SetDParam(5, _cargoc.names_long_p[rvi->cargo_type]);
}
DrawStringMultiCenter(x, y, STR_885B_COST_WEIGHT_T_SPEED_POWER, maxw);
}
@ -1724,7 +1724,7 @@ static void TrainEnterStation(Vehicle *v, int station)
st = DEREF_STATION(station);
if (!(st->had_vehicle_of_type & HVOT_TRAIN)) {
st->had_vehicle_of_type |= HVOT_TRAIN;
SET_DPARAM16(0, st->index);
SetDParam(0, st->index);
flags = (v->owner == _local_player) ? NEWS_FLAGS(NM_THIN, NF_VIEWPORT|NF_VEHICLE, NT_ARRIVAL_PLAYER, 0) : NEWS_FLAGS(NM_THIN, NF_VIEWPORT|NF_VEHICLE, NT_ARRIVAL_OTHER, 0);
AddNewsItem(
STR_8801_CITIZENS_CELEBRATE_FIRST,
@ -1999,7 +1999,7 @@ static void CheckTrainCollision(Vehicle *v)
SetVehicleCrashed(coll);
SET_DPARAM16(0, num);
SetDParam(0, num);
AddNewsItem(STR_8868_TRAIN_CRASH_DIE_IN_FIREBALL,
NEWS_FLAGS(NM_THIN, NF_VIEWPORT|NF_VEHICLE, NT_ACCIDENT, 0),
@ -2558,7 +2558,7 @@ void TrainEnterDepot(Vehicle *v, uint tile)
else if (t & OF_FULL_LOAD) {
v->vehstatus |= VS_STOPPED;
if (v->owner == _local_player) {
SET_DPARAM16(0, v->unitnumber);
SetDParam(0, v->unitnumber);
AddNewsItem(
STR_8814_TRAIN_IS_WAITING_IN_DEPOT,
NEWS_FLAGS(NM_SMALL, NF_VIEWPORT|NF_VEHICLE, NT_ADVICE, 0),
@ -2645,7 +2645,7 @@ void OnNewDay_Train(Vehicle *v)
// check if train hasn't advanced in its order list for a set number of days
if (_patches.lost_train_days && v->num_orders && !(v->vehstatus & VS_STOPPED) && ++v->u.rail.days_since_order_progr >= _patches.lost_train_days && v->owner == _local_player) {
v->u.rail.days_since_order_progr = 0;
SET_DPARAM16(0, v->unitnumber);
SetDParam(0, v->unitnumber);
AddNewsItem(
STR_TRAIN_IS_LOST,
NEWS_FLAGS(NM_SMALL, NF_VIEWPORT|NF_VEHICLE, NT_ADVICE, 0),
@ -2684,8 +2684,8 @@ void TrainsYearlyLoop()
// show warning if train is not generating enough income last 2 years (corresponds to a red icon in the vehicle list)
if (_patches.train_income_warn && v->owner == _local_player && v->age >= 730 && v->profit_this_year < 0) {
SET_DPARAM32(1, v->profit_this_year);
SET_DPARAM16(0, v->unitnumber);
SetDParam(1, v->profit_this_year);
SetDParam(0, v->unitnumber);
AddNewsItem(
STR_TRAIN_IS_UNPROFITABLE,
NEWS_FLAGS(NM_SMALL, NF_VIEWPORT|NF_VEHICLE, NT_ADVICE, 0),

View File

@ -106,7 +106,7 @@ static void NewRailVehicleWndProc(Window *w, WindowEvent *e)
SetVScrollCount(w, count);
}
SET_DPARAM16(0, WP(w,buildtrain_d).railtype + STR_881C_NEW_RAIL_VEHICLES);
SetDParam(0, WP(w,buildtrain_d).railtype + STR_881C_NEW_RAIL_VEHICLES);
DrawWindowWidgets(w);
{
@ -136,36 +136,36 @@ static void NewRailVehicleWndProc(Window *w, WindowEvent *e)
/* it's an engine */
int multihead = (rvi->flags&RVI_MULTIHEAD?1:0);
SET_DPARAM32(0, rvi->base_cost * (_price.build_railvehicle >> 3) >> 5);
SET_DPARAM16(2, rvi->max_speed * 10 >> 4);
SET_DPARAM16(3, rvi->power << multihead);
SET_DPARAM16(1, rvi->weight << multihead);
SET_DPARAM32(4, (rvi->running_cost_base * _price.running_rail[rvi->engclass] >> 8) << multihead);
SetDParam(0, rvi->base_cost * (_price.build_railvehicle >> 3) >> 5);
SetDParam(2, rvi->max_speed * 10 >> 4);
SetDParam(3, rvi->power << multihead);
SetDParam(1, rvi->weight << multihead);
SetDParam(4, (rvi->running_cost_base * _price.running_rail[rvi->engclass] >> 8) << multihead);
SET_DPARAM16(5, STR_8838_N_A);
SetDParam(5, STR_8838_N_A);
if (rvi->capacity != 0) {
SET_DPARAM16(6, rvi->capacity << multihead);
SET_DPARAM16(5, _cargoc.names_long_p[rvi->cargo_type]);
SetDParam(6, rvi->capacity << multihead);
SetDParam(5, _cargoc.names_long_p[rvi->cargo_type]);
}
e = &_engines[selected_id];
SET_DPARAM16(8, e->lifelength);
SET_DPARAM8(9, e->reliability * 100 >> 16);
SetDParam(8, e->lifelength);
SetDParam(9, e->reliability * 100 >> 16);
ConvertDayToYMD(&ymd, e->intro_date);
SET_DPARAM16(7, ymd.year + 1920);
SetDParam(7, ymd.year + 1920);
DrawString(2, 0x7F, STR_8817_COST_WEIGHT_T_SPEED_POWER, 0);
} else {
/* it's a wagon */
SET_DPARAM32(0,
SetDParam(0,
DoCommandByTile(w->window_number, selected_id, 0, DC_QUERY_COST, CMD_BUILD_RAIL_VEHICLE)
);
SET_DPARAM16(4, rvi->capacity);
SET_DPARAM16(1, rvi->weight);
SET_DPARAM16(3, _cargoc.names_long_p[rvi->cargo_type]);
SET_DPARAM16(2, (_cargoc.weights[rvi->cargo_type] * rvi->capacity >> 4) + rvi->weight);
SetDParam(4, rvi->capacity);
SetDParam(1, rvi->weight);
SetDParam(3, _cargoc.names_long_p[rvi->cargo_type]);
SetDParam(2, (_cargoc.weights[rvi->cargo_type] * rvi->capacity >> 4) + rvi->weight);
DrawString(2, 0x7F, STR_8821_COST_WEIGHT_T_T_CAPACITY, 0);
}
}
@ -309,7 +309,7 @@ static void DrawTrainDepotWindow(Window *w)
/* locate the depot struct */
for(d=_depots; d->xy != (TileIndex)tile; d++) {}
SET_DPARAM16(0,d->town_index);
SetDParam(0,d->town_index);
DrawWindowWidgets(w);
x = 2;
@ -326,7 +326,7 @@ static void DrawTrainDepotWindow(Window *w)
DrawTrainImage(v, x+21, y, 10, w->hscroll.pos, WP(w,traindepot_d).sel);
/* Draw the train number */
SET_DPARAM16(0, v->unitnumber);
SetDParam(0, v->unitnumber);
DrawString(x, y, (v->max_age - 366 < v->age) ? STR_00E3 : STR_00E2, 0);
/* Draw the pretty flag */
DrawSprite(v->vehstatus&VS_STOPPED ? 0xC12 : 0xC13, x+15, y);
@ -622,8 +622,8 @@ static void RailVehicleRefitWndProc(Window *w, WindowEvent *e)
byte color;
int cargo;
SET_DPARAM16(0, v->string_id);
SET_DPARAM16(1, v->unitnumber);
SetDParam(0, v->string_id);
SetDParam(1, v->unitnumber);
DrawWindowWidgets(w);
DrawString(1, 15, STR_983F_SELECT_CARGO_TYPE_TO_CARRY, 0);
@ -671,9 +671,9 @@ static void RailVehicleRefitWndProc(Window *w, WindowEvent *e)
if (cargo != -1) {
int32 cost = DoCommandByTile(v->tile, v->index, cargo, 0, CMD_REFIT_RAIL_VEHICLE);
if (cost != CMD_ERROR) {
SET_DPARAM32(2, cost);
SET_DPARAM16(0, _cargoc.names_long_p[cargo]);
SET_DPARAM16(1, _returned_refit_amount);
SetDParam(2, cost);
SetDParam(0, _cargoc.names_long_p[cargo]);
SetDParam(1, _returned_refit_amount);
DrawString(1, 137, STR_9840_NEW_CAPACITY_COST_OF_REFIT, 0);
}
}
@ -759,8 +759,8 @@ static void TrainViewWndProc(Window *w, WindowEvent *e)
/* draw widgets & caption */
SET_DPARAM16(0, v->string_id);
SET_DPARAM16(1, v->unitnumber);
SetDParam(0, v->string_id);
SetDParam(1, v->unitnumber);
DrawWindowWidgets(w);
/* draw the flag */
@ -774,22 +774,22 @@ static void TrainViewWndProc(Window *w, WindowEvent *e)
if (v->u.rail.last_speed == 0) {
str = STR_8861_STOPPED;
} else {
SET_DPARAM16(0, v->u.rail.last_speed * 10 >> 4);
SetDParam(0, v->u.rail.last_speed * 10 >> 4);
str = STR_TRAIN_STOPPING + _patches.vehicle_speed;
}
} else {
switch(v->next_order & OT_MASK) {
case OT_GOTO_STATION: {
str = STR_HEADING_FOR_STATION + _patches.vehicle_speed;
SET_DPARAM16(0, v->next_order_param);
SET_DPARAM16(1, v->u.rail.last_speed * 10 >> 4);
SetDParam(0, v->next_order_param);
SetDParam(1, v->u.rail.last_speed * 10 >> 4);
} break;
case OT_GOTO_DEPOT: {
Depot *dep = &_depots[v->next_order_param];
SET_DPARAM16(0, dep->town_index);
SetDParam(0, dep->town_index);
str = STR_HEADING_FOR_TRAIN_DEPOT + _patches.vehicle_speed;
SET_DPARAM16(1, v->u.rail.last_speed * 10 >> 4);
SetDParam(1, v->u.rail.last_speed * 10 >> 4);
} break;
case OT_LOADING:
@ -798,16 +798,16 @@ static void TrainViewWndProc(Window *w, WindowEvent *e)
break;
case OT_GOTO_WAYPOINT: {
SET_DPARAM16(0, v->next_order_param);
SetDParam(0, v->next_order_param);
str = STR_HEADING_FOR_WAYPOINT + _patches.vehicle_speed;
SET_DPARAM16(1, v->u.rail.last_speed * 10 >> 4);
SetDParam(1, v->u.rail.last_speed * 10 >> 4);
break;
}
default:
if (v->num_orders == 0) {
str = STR_NO_ORDERS + _patches.vehicle_speed;
SET_DPARAM16(0, v->u.rail.last_speed * 10 >> 4);
SetDParam(0, v->u.rail.last_speed * 10 >> 4);
} else
str = STR_EMPTY;
break;
@ -901,9 +901,9 @@ static void TrainDetailsCargoTab(Vehicle *v, int x, int y)
num = v->cargo_count;
str = STR_8812_EMPTY;
if (num != 0) {
SET_DPARAM8(0, v->cargo_type);
SET_DPARAM16(1, num);
SET_DPARAM16(2, v->cargo_source);
SetDParam(0, v->cargo_type);
SetDParam(1, num);
SetDParam(2, v->cargo_source);
str = STR_8813_FROM;
}
DrawString(x, y, str, 0);
@ -917,13 +917,13 @@ static void TrainDetailsInfoTab(Vehicle *v, int x, int y)
rvi = &_rail_vehicle_info[v->engine_type];
if (!(rvi->flags & RVI_WAGON)) {
SET_DPARAM16(0, GetCustomEngineName(v->engine_type));
SET_DPARAM16(1, v->build_year + 1920);
SET_DPARAM32(2, v->value);
SetDParam(0, GetCustomEngineName(v->engine_type));
SetDParam(1, v->build_year + 1920);
SetDParam(2, v->value);
DrawString(x, y, STR_882C_BUILT_VALUE, 0x10);
} else {
SET_DPARAM16(0, GetCustomEngineName(v->engine_type));
SET_DPARAM32(1, v->value);
SetDParam(0, GetCustomEngineName(v->engine_type));
SetDParam(1, v->value);
DrawString(x, y, STR_882D_VALUE, 0x10);
}
}
@ -931,8 +931,8 @@ static void TrainDetailsInfoTab(Vehicle *v, int x, int y)
static void TrainDetailsCapacityTab(Vehicle *v, int x, int y)
{
if (v->cargo_cap != 0) {
SET_DPARAM16(1, v->cargo_cap);
SET_DPARAM16(0, _cargoc.names_long_p[v->cargo_type]);
SetDParam(1, v->cargo_cap);
SetDParam(0, _cargoc.names_long_p[v->cargo_type]);
DrawString(x, y, STR_013F_CAPACITY, 0);
}
}
@ -990,12 +990,12 @@ static void DrawTrainDetailsWindow(Window *w)
if (!_patches.servint_trains) // disable service-scroller when interval is set to disabled
w->disabled_state |= (1 << 6) | (1 << 7);
SET_DPARAM16(0, v->string_id);
SET_DPARAM16(1, v->unitnumber);
SetDParam(0, v->string_id);
SetDParam(1, v->unitnumber);
DrawWindowWidgets(w);
num = v->age / 366;
SET_DPARAM16(1, num);
SetDParam(1, num);
x = 2;
@ -1005,26 +1005,26 @@ static void DrawTrainDetailsWindow(Window *w)
if ((uint16)(v->max_age - 366) < v->age)
str += STR_019B_YEARS - STR_019A_YEARS;
}
SET_DPARAM16(0, str);
SET_DPARAM16(2, v->max_age / 366);
SET_DPARAM32(3, GetTrainRunningCost(v) >> 8);
SetDParam(0, str);
SetDParam(2, v->max_age / 366);
SetDParam(3, GetTrainRunningCost(v) >> 8);
DrawString(x, 15, STR_885D_AGE_RUNNING_COST_YR, 0);
SET_DPARAM16(2, v->max_speed * 10 >> 4);
SET_DPARAM32(1, v->u.rail.cached_power);
SET_DPARAM16(0, v->u.rail.cached_weight);
SetDParam(2, v->max_speed * 10 >> 4);
SetDParam(1, v->u.rail.cached_power);
SetDParam(0, v->u.rail.cached_weight);
DrawString(x, 25, STR_885E_WEIGHT_T_POWER_HP_MAX_SPEED, 0);
SET_DPARAM32(0, v->profit_this_year);
SET_DPARAM32(1, v->profit_last_year);
SetDParam(0, v->profit_this_year);
SetDParam(1, v->profit_last_year);
DrawString(x, 35, STR_885F_PROFIT_THIS_YEAR_LAST_YEAR, 0);
SET_DPARAM8(0, 100 * (v->reliability>>8) >> 8);
SET_DPARAM16(1, v->breakdowns_since_last_service);
SetDParam(0, 100 * (v->reliability>>8) >> 8);
SetDParam(1, v->breakdowns_since_last_service);
DrawString(x, 45, STR_8860_RELIABILITY_BREAKDOWNS, 0);
SET_DPARAM16(0, v->service_interval);
SET_DPARAM16(1, v->date_of_last_service);
SetDParam(0, v->service_interval);
SetDParam(1, v->date_of_last_service);
DrawString(x + 11, 141, _patches.servint_ispercent?STR_SERVICING_INTERVAL_PERCENT:STR_883C_SERVICING_INTERVAL_DAYS, 0);
x = 1;
@ -1050,10 +1050,10 @@ static void DrawTrainDetailsWindow(Window *w)
if (tot_cargo[i][1] > 0 && --sel < 0 && sel >= -5) {
y += 14;
// STR_013F_TOTAL_CAPACITY :{LTBLUE}- {CARGO} ({SHORTCARGO})
SET_DPARAM8(0, i); // {CARGO} #1
SET_DPARAM16(1, tot_cargo[i][0]); // {CARGO} #2
SET_DPARAM8(2, i); // {SHORTCARGO} #1
SET_DPARAM16(3, tot_cargo[i][1]); // {SHORTCARGO} #2
SetDParam(0, i); // {CARGO} #1
SetDParam(1, tot_cargo[i][0]); // {CARGO} #2
SetDParam(2, i); // {SHORTCARGO} #1
SetDParam(3, tot_cargo[i][1]); // {SHORTCARGO} #2
DrawString(x, y, STR_013F_TOTAL_CAPACITY, 0);
}
} while (++i != NUM_CARGO);
@ -1072,7 +1072,7 @@ static void TrainDetailsWndProc(Window *w, WindowEvent *e)
switch(e->click.widget) {
case 2: /* name train */
v = &_vehicles[w->window_number];
SET_DPARAM16(0, v->unitnumber);
SetDParam(0, v->unitnumber);
ShowQueryString(v->string_id, STR_8865_NAME_TRAIN, 31, 150, w->window_class, w->window_number);
break;
case 6: /* inc serv interval */
@ -1256,9 +1256,9 @@ static void PlayerTrainsWndProc(Window *w, WindowEvent *e)
{
Player *p = DEREF_PLAYER(window_number);
/* Company Name -- (###) Trains */
SET_DPARAM16(0, p->name_1);
SET_DPARAM32(1, p->name_2);
SET_DPARAM16(2, w->vscroll.count);
SetDParam(0, p->name_1);
SetDParam(1, p->name_2);
SetDParam(2, w->vscroll.count);
DrawWindowWidgets(w);
}
/* draw sorting criteria string */
@ -1283,7 +1283,7 @@ static void PlayerTrainsWndProc(Window *w, WindowEvent *e)
DrawTrainImage(v, x + 21, y + 6 + _traininfo_vehicle_pitch, 10, 0, INVALID_VEHICLE);
DrawVehicleProfitButton(v, x, y+13);
SET_DPARAM16(0, v->unitnumber);
SetDParam(0, v->unitnumber);
if (IsTrainDepotTile(v->tile)) {
str = STR_021F;
} else {
@ -1291,12 +1291,12 @@ static void PlayerTrainsWndProc(Window *w, WindowEvent *e)
}
DrawString(x, y+2, str, 0);
SET_DPARAM32(0, v->profit_this_year);
SET_DPARAM32(1, v->profit_last_year);
SetDParam(0, v->profit_this_year);
SetDParam(1, v->profit_last_year);
DrawString(x + 21, y + 18, STR_0198_PROFIT_THIS_YEAR_LAST_YEAR, 0);
if (v->string_id != STR_SV_TRAIN_NAME) {
SET_DPARAM16(0, v->string_id);
SetDParam(0, v->string_id);
DrawString(x+21, y, STR_01AB, 0);
}

8
ttd.c
View File

@ -630,7 +630,7 @@ int ttd_main(int argc, char* argv[])
static void ShowScreenshotResult(bool b)
{
if (b) {
SET_DPARAM16(0, STR_SPEC_SCREENSHOT_NAME);
SetDParam(0, STR_SPEC_SCREENSHOT_NAME);
ShowErrorMessage(INVALID_STRING_ID, STR_031B_SCREENSHOT_SUCCESSFULLY, 0, 0);
} else {
ShowErrorMessage(INVALID_STRING_ID, STR_031C_SCREENSHOT_FAILED, 0, 0);
@ -934,9 +934,9 @@ static void DoAutosave()
char *s;
sprintf(buf, "%s%s", _path.autosave_dir, PATHSEP);
p = DEREF_PLAYER(_local_player);
SET_DPARAM16(0, p->name_1);
SET_DPARAM32(1, p->name_2);
SET_DPARAM16(2, _date);
SetDParam(0, p->name_1);
SetDParam(1, p->name_2);
SetDParam(2, _date);
s= (char*)GetString(buf + strlen(_path.autosave_dir) + strlen(PATHSEP) - 1, STR_4004);
strcpy(s, ".sav");
} else {

View File

@ -626,7 +626,7 @@ static int32 DoClearTunnel(uint tile, uint32 flags)
// removal allowal depends on difficulty settings
if(_map_owner[tile] == OWNER_TOWN && _game_mode != GM_EDITOR ) {
if (!CheckforTownRating(tile, flags, t, TUNNELBRIDGE_REMOVE)) {
SET_DPARAM16(0, t->index);
SetDParam(0, t->index);
return_cmd_error(STR_2009_LOCAL_AUTHORITY_REFUSES);
}
}

4
unix.c
View File

@ -299,14 +299,14 @@ StringID FiosGetDescText(const char **path)
if (statvfs(*path, &s) == 0)
{
uint64 tot = (uint64)s.f_bsize * s.f_bavail;
SET_DPARAM32(0, (uint32)(tot >> 20));
SetDParam(0, (uint32)(tot >> 20));
return STR_4005_BYTES_FREE;
}
else
return STR_4006_UNABLE_TO_READ_DRIVE;
}
#else
SET_DPARAM32(0, 0);
SetDParam(0, 0);
return STR_4005_BYTES_FREE;
#endif
}

View File

@ -367,36 +367,36 @@ VARDEF CargoConst _cargoc;
typedef byte TownNameGenerator(byte *buf, uint32 seed);
extern TownNameGenerator * const _town_name_generators[];
#define SET_DPARAM32(n, v) (_decode_parameters[n] = (v))
#define SET_DPARAMX32(s, n, v) ((s)[n] = (v))
#define GET_DPARAM32(n) (_decode_parameters[n])
#define SET_DPARAM(n, v) (_decode_parameters[n] = (v))
#define SET_DPARAMX(s, n, v) ((s)[n] = (v))
#define GET_DPARAM(n) (_decode_parameters[n])
static void FORCEINLINE SET_DPARAM64(int n, int64 v)
static inline void SetDParamX(uint32 *s, uint n, uint32 v)
{
_decode_parameters[n] = (uint32)v;
_decode_parameters[n+1] = (uint32)((uint64)v >> 32);
s[n] = v;
}
#if defined(TTD_LITTLE_ENDIAN)
#define SET_DPARAMX16(s, n, v) ( ((uint16*)(s+n))[0] = (v))
#define SET_DPARAMX8(s, n, v) ( ((uint8*)(s+n))[0] = (v))
#define GET_DPARAMX16(s, n) ( ((uint16*)(s+n))[0])
#define GET_DPARAMX8(s, n) ( ((uint8*)(s+n))[0])
#elif defined(TTD_BIG_ENDIAN)
#define SET_DPARAMX16(s, n, v) ( ((uint16*)(s+n))[1] = (v))
#define SET_DPARAMX8(s, n, v) ( ((uint8*)(s+n))[3] = (v))
#define GET_DPARAMX16(s, n) ( ((uint16*)(s+n))[1])
#define GET_DPARAMX8(s, n) ( ((uint8*)(s+n))[3])
#endif
static inline uint32 GetDParamX(const uint32 *s, uint n)
{
return s[n];
}
static inline void SetDParam(uint n, uint32 v)
{
assert(n < lengthof(_decode_parameters));
_decode_parameters[n] = v;
}
static inline void SetDParam64(uint n, uint64 v)
{
assert(n + 1 < lengthof(_decode_parameters));
_decode_parameters[n + 0] = v & 0xffffffff;
_decode_parameters[n + 1] = v >> 32;
}
static inline uint32 GetDParam(uint n)
{
assert(n < lengthof(_decode_parameters));
return _decode_parameters[n];
}
#define SET_DPARAM16(n, v) SET_DPARAMX16(_decode_parameters, n, v)
#define SET_DPARAM8(n, v) SET_DPARAMX8(_decode_parameters, n, v)
#define GET_DPARAM16(n) GET_DPARAMX16(_decode_parameters, n)
#define GET_DPARAM8(n) GET_DPARAMX8(_decode_parameters, 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))

View File

@ -112,7 +112,7 @@ void VehiclePositionChanged(Vehicle *v)
void UpdateWaypointSign(Waypoint *cp)
{
Point pt = RemapCoords2(GET_TILE_X(cp->xy)*16, GET_TILE_Y(cp->xy)*16);
SET_DPARAM16(0, cp - _waypoints);
SetDParam(0, cp - _waypoints);
UpdateViewportSignPos(&cp->sign, pt.x, pt.y - 0x20, STR_WAYPOINT_VIEWPORT);
}
@ -1309,8 +1309,8 @@ static void ShowVehicleGettingOld(Vehicle *v, StringID msg)
if (_patches.autorenew)
return;
SET_DPARAM16(0, _vehicle_type_names[v->type - 0x10]);
SET_DPARAM16(1, v->unitnumber);
SetDParam(0, _vehicle_type_names[v->type - 0x10]);
SetDParam(1, v->unitnumber);
AddNewsItem(msg, NEWS_FLAGS(NM_SMALL, NF_VIEWPORT|NF_VEHICLE, NT_ADVICE, 0), v->index, 0);
}
@ -1350,7 +1350,7 @@ void MaybeRenewVehicle(Vehicle *v, int32 build_cost)
if (DEREF_PLAYER(v->owner)->money64 < _patches.autorenew_money + build_cost - v->value) {
if (v->owner == _local_player) {
int message;
SET_DPARAM16(0, v->unitnumber);
SetDParam(0, v->unitnumber);
switch (v->type) {
case VEH_Train: message = STR_TRAIN_AUTORENEW_FAILED; break;
case VEH_Road: message = STR_ROADVEHICLE_AUTORENEW_FAILED; break;

View File

@ -95,7 +95,7 @@ int CDECL VehicleNameSorter(const void *a, const void *b)
int r;
if (va->string_id != _internal_name_sorter_id) {
SET_DPARAM16(0, va->string_id);
SetDParam(0, va->string_id);
GetString(buf1, STR_0315);
}
@ -103,7 +103,7 @@ int CDECL VehicleNameSorter(const void *a, const void *b)
_last_vehicle_idx = cmp2->index;
_bufcache[0] = '\0';
if (vb->string_id != _internal_name_sorter_id) {
SET_DPARAM16(0, vb->string_id);
SetDParam(0, vb->string_id);
GetString(_bufcache, STR_0315);
}
}

View File

@ -1108,8 +1108,8 @@ static void ViewportDrawStrings(DrawPixelInfo *dpi, StringSpriteToDraw *ss)
DrawFrameRect(x,y, x+w, bottom, ss->color, (_display_opt & DO_TRANS_BUILDINGS) ? 0x9 : 0);
}
SET_DPARAM32(0, ss->params[0]);
SET_DPARAM32(1, ss->params[1]);
SetDParam(0, ss->params[0]);
SetDParam(1, ss->params[1]);
if (_display_opt & DO_TRANS_BUILDINGS && ss->width != 0) {
/* This is such a frustrating mess - I need to convert
* from real color codes to string color codes and guess

View File

@ -558,7 +558,7 @@ static void FloodVehicle(Vehicle *v)
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, 4);
InvalidateWindow(WC_VEHICLE_DEPOT, v->tile);
SET_DPARAM16(0, pass);
SetDParam(0, pass);
AddNewsItem(STR_B006_FLOOD_VEHICLE_DESTROYED,
NEWS_FLAGS(NM_THIN, NF_VIEWPORT|NF_VEHICLE, NT_ACCIDENT, 0),
v->index,

View File

@ -1761,7 +1761,7 @@ StringID FiosGetDescText(const char **path)
root[3] = 0;
if (GetDiskFreeSpace(root, &spc, &bps, &nfc, &tnc)) {
uint32 tot = ((spc*bps)*(uint64)nfc) >> 20;
SET_DPARAM32(0, tot);
SetDParam(0, tot);
return STR_4005_BYTES_FREE;
} else {
return STR_4006_UNABLE_TO_READ_DRIVE;