mirror of https://github.com/OpenTTD/OpenTTD.git
(svn r10323) -Codechange: reference company name, number and player (president) name
by index
This commit is contained in:
parent
0e59b4dc57
commit
eb6594caa8
|
@ -478,8 +478,7 @@ static void PlayersCheckBankrupt(Player *p)
|
|||
DeletePlayerWindows(owner);
|
||||
|
||||
/* Show bankrupt news */
|
||||
SetDParam(0, p->name_1);
|
||||
SetDParam(1, p->name_2);
|
||||
SetDParam(0, p->index);
|
||||
AddNewsItem( (StringID)(owner | NB_BBANKRUPT), NEWS_FLAGS(NM_CALLBACK, 0, NT_COMPANY_INFO, DNC_BANKRUPCY),0,0);
|
||||
|
||||
if (IsHumanPlayer(owner)) {
|
||||
|
@ -516,8 +515,7 @@ void DrawNewsBankrupcy(Window *w)
|
|||
DrawPlayerFace(p->face, p->player_color, 2, 23);
|
||||
GfxFillRect(3, 23, 3 + 91, 23 + 118, PALETTE_TO_STRUCT_GREY | (1 << USE_COLORTABLE));
|
||||
|
||||
SetDParam(0, p->president_name_1);
|
||||
SetDParam(1, p->president_name_2);
|
||||
SetDParam(0, p->index);
|
||||
|
||||
DrawStringMultiCenter(49, 148, STR_7058_PRESIDENT, 94);
|
||||
|
||||
|
@ -525,8 +523,7 @@ void DrawNewsBankrupcy(Window *w)
|
|||
case NB_BTROUBLE:
|
||||
DrawStringCentered(w->width>>1, 1, STR_7056_TRANSPORT_COMPANY_IN_TROUBLE, 0);
|
||||
|
||||
SetDParam(0, p->name_1);
|
||||
SetDParam(1, p->name_2);
|
||||
SetDParam(0, p->index);
|
||||
|
||||
DrawStringMultiCenter(
|
||||
((w->width - 101) >> 1) + 98,
|
||||
|
@ -540,10 +537,9 @@ 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);
|
||||
SetDParam(2, p->name_1);
|
||||
SetDParam(3, p->name_2);
|
||||
SetDParam(2, p->index);
|
||||
price = WP(w,news_d).ni->params[2];
|
||||
SetDParam(4, price);
|
||||
SetDParam(3, price);
|
||||
DrawStringMultiCenter(
|
||||
((w->width - 101) >> 1) + 98,
|
||||
90,
|
||||
|
@ -564,9 +560,8 @@ void DrawNewsBankrupcy(Window *w)
|
|||
|
||||
case NB_BNEWCOMPANY:
|
||||
DrawStringCentered(w->width>>1, 1, STR_705E_NEW_TRANSPORT_COMPANY_LAUNCHED, 0);
|
||||
SetDParam(0, p->name_1);
|
||||
SetDParam(1, p->name_2);
|
||||
COPY_IN_DPARAM(2,WP(w,news_d).ni->params, 2);
|
||||
SetDParam(0, p->index);
|
||||
COPY_IN_DPARAM(1,WP(w,news_d).ni->params, 2);
|
||||
DrawStringMultiCenter(
|
||||
((w->width - 101) >> 1) + 98,
|
||||
90,
|
||||
|
@ -587,16 +582,14 @@ StringID GetNewsStringBankrupcy(const NewsItem *ni)
|
|||
case NB_BTROUBLE:
|
||||
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);
|
||||
SetDParam(2, p->index);
|
||||
return STR_02B6;
|
||||
case NB_BMERGER:
|
||||
SetDParam(0, STR_7059_TRANSPORT_COMPANY_MERGER);
|
||||
SetDParam(1, STR_705A_HAS_BEEN_SOLD_TO_FOR);
|
||||
COPY_IN_DPARAM(2,ni->params, 2);
|
||||
SetDParam(4, p->name_1);
|
||||
SetDParam(5, p->name_2);
|
||||
COPY_IN_DPARAM(6,ni->params + 2, 1);
|
||||
SetDParam(4, p->index);
|
||||
COPY_IN_DPARAM(5,ni->params + 2, 1);
|
||||
return STR_02B6;
|
||||
case NB_BBANKRUPT:
|
||||
SetDParam(0, STR_705C_BANKRUPT);
|
||||
|
@ -606,9 +599,8 @@ StringID GetNewsStringBankrupcy(const NewsItem *ni)
|
|||
case NB_BNEWCOMPANY:
|
||||
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);
|
||||
SetDParam(2, p->index);
|
||||
COPY_IN_DPARAM(3,ni->params, 2);
|
||||
return STR_02B6;
|
||||
default:
|
||||
NOT_REACHED();
|
||||
|
@ -1302,8 +1294,7 @@ static bool CheckSubsidised(Station *from, Station *to, CargoID cargo_type)
|
|||
InjectDParam(2);
|
||||
|
||||
p = GetPlayer(_current_player);
|
||||
SetDParam(0, p->name_1);
|
||||
SetDParam(1, p->name_2);
|
||||
SetDParam(0, p->index);
|
||||
AddNewsItem(
|
||||
STR_2031_SERVICE_SUBSIDY_AWARDED + _opt.diff.subsidy_multiplier,
|
||||
NEWS_FLAGS(NM_NORMAL, NF_TILE, NT_SUBSIDIES, 0),
|
||||
|
@ -1731,9 +1722,8 @@ static void DoAcquireCompany(Player *p)
|
|||
int i;
|
||||
Money value;
|
||||
|
||||
SetDParam(0, p->name_1);
|
||||
SetDParam(1, p->name_2);
|
||||
SetDParam(2, p->bankrupt_value);
|
||||
SetDParam(0, p->index);
|
||||
SetDParam(1, p->bankrupt_value);
|
||||
AddNewsItem( (StringID)(_current_player | NB_BMERGER), NEWS_FLAGS(NM_CALLBACK, 0, NT_COMPANY_INFO, DNC_BANKRUPCY),0,0);
|
||||
|
||||
/* original code does this a little bit differently */
|
||||
|
|
|
@ -25,7 +25,6 @@ void SubtractMoneyFromPlayer(CommandCost cost);
|
|||
void SubtractMoneyFromPlayerFract(PlayerID player, CommandCost cost);
|
||||
bool CheckOwnership(Owner owner);
|
||||
bool CheckTileOwnership(TileIndex tile);
|
||||
StringID GetPlayerNameString(PlayerID player, uint index);
|
||||
|
||||
/* standard */
|
||||
void ShowInfo(const char *str);
|
||||
|
|
|
@ -270,9 +270,8 @@ static void GraphLegendWndProc(Window *w, WindowEvent *e)
|
|||
|
||||
DrawPlayerIcon(p->index, 4, 18 + p->index * 12);
|
||||
|
||||
SetDParam(0, p->name_1);
|
||||
SetDParam(1, p->name_2);
|
||||
SetDParam(2, GetPlayerNameString(p->index, 3));
|
||||
SetDParam(0, p->index);
|
||||
SetDParam(1, p->index);
|
||||
DrawString(21, 17 + p->index * 12, STR_7021, HASBIT(_legend_excluded_players, p->index) ? 0x10 : 0xC);
|
||||
}
|
||||
break;
|
||||
|
@ -875,10 +874,9 @@ static void CompanyLeagueWndProc(Window *w, WindowEvent *e)
|
|||
for (uint i = 0; i != pl_num; i++) {
|
||||
p = plist[i];
|
||||
SetDParam(0, i + STR_01AC_1ST);
|
||||
SetDParam(1, p->name_1);
|
||||
SetDParam(2, p->name_2);
|
||||
SetDParam(3, GetPlayerNameString(p->index, 4));
|
||||
SetDParam(5, GetPerformanceTitleFromValue(p->old_economy[1].performance_history));
|
||||
SetDParam(1, p->index);
|
||||
SetDParam(2, p->index);
|
||||
SetDParam(3, 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);
|
||||
|
|
|
@ -344,9 +344,8 @@ static void GroupWndProc(Window *w, WindowEvent *e)
|
|||
/* If selected_group == DEFAULT_GROUP, draw the standard caption
|
||||
We list all vehicles */
|
||||
if (IsDefaultGroupID(gv->group_sel)) {
|
||||
SetDParam(0, p->name_1);
|
||||
SetDParam(1, p->name_2);
|
||||
SetDParam(2, gv->l.list_length);
|
||||
SetDParam(0, p->index);
|
||||
SetDParam(1, gv->l.list_length);
|
||||
|
||||
switch (gv->vehicle_type) {
|
||||
case VEH_TRAIN:
|
||||
|
|
|
@ -1714,7 +1714,7 @@ STR_2020_LOCAL_AUTHORITY :{BLACK}Local au
|
|||
STR_2021_SHOW_INFORMATION_ON_LOCAL :{BLACK}Show information on local authority
|
||||
STR_2022_LOCAL_AUTHORITY :{WHITE}{TOWN} local authority
|
||||
STR_2023_TRANSPORT_COMPANY_RATINGS :{BLACK}Transport company ratings:
|
||||
STR_2024 :{YELLOW}{COMPANY}{PLAYERNAME}: {ORANGE}{STRING}
|
||||
STR_2024 :{YELLOW}{COMPANY}{COMPANYNUM}: {ORANGE}{STRING}
|
||||
STR_2025_SUBSIDIES :{WHITE}Subsidies
|
||||
STR_2026_SUBSIDIES_ON_OFFER_FOR :{BLACK}Subsidies on offer for services taking:
|
||||
STR_2027_FROM_TO :{ORANGE}{STRING} from {STRING2} to {STRING2}
|
||||
|
@ -2162,7 +2162,7 @@ STR_683B_HOSTILE :Hostile
|
|||
|
||||
##id 0x7000
|
||||
STR_7000 :
|
||||
STR_7001 :{WHITE}{COMPANY} {BLACK}{PLAYERNAME}
|
||||
STR_7001 :{WHITE}{COMPANY} {BLACK}{COMPANYNUM}
|
||||
STR_7002_PLAYER :(Player {COMMA})
|
||||
STR_7004_NEW_FACE :{BLACK}New Face
|
||||
STR_7005_COLOR_SCHEME :{BLACK}Colour Scheme
|
||||
|
@ -2174,7 +2174,7 @@ STR_700A_COMPANY_NAME :Company Name
|
|||
STR_700B_PRESIDENT_S_NAME :Manager's Name
|
||||
STR_700C_CAN_T_CHANGE_COMPANY_NAME :{WHITE}Can't change company name...
|
||||
STR_700D_CAN_T_CHANGE_PRESIDENT :{WHITE}Can't change manager's name...
|
||||
STR_700E_FINANCES :{WHITE}{COMPANY} Finances {BLACK}{PLAYERNAME}
|
||||
STR_700E_FINANCES :{WHITE}{COMPANY} Finances {BLACK}{COMPANYNUM}
|
||||
STR_700F_EXPENDITURE_INCOME :{WHITE}Expenditure/Income
|
||||
STR_7010 :{WHITE}{NUM}
|
||||
STR_7011_CONSTRUCTION :{GOLD}Construction
|
||||
|
@ -2193,7 +2193,7 @@ STR_701D_OTHER :{GOLD}Other
|
|||
STR_701E :{BLACK}-{CURRENCY}
|
||||
STR_701F :{BLACK}+{CURRENCY}
|
||||
STR_7020_TOTAL :{WHITE}Total:
|
||||
STR_7021 :{COMPANY}{PLAYERNAME}
|
||||
STR_7021 :{COMPANY}{COMPANYNUM}
|
||||
STR_7022_INCOME_GRAPH :{WHITE}Income Graph
|
||||
STR_CURRCOMPACT :{CURRCOMPACT}
|
||||
STR_7024 :{COMMA}
|
||||
|
@ -2242,8 +2242,8 @@ STR_7050_UNITS_OF_CARGO_DELIVERED :{WHITE}Units of
|
|||
STR_7051_COMPANY_PERFORMANCE_RATINGS :{WHITE}Company performance ratings (maximum rating=1000)
|
||||
STR_7052_COMPANY_VALUES :{WHITE}Company values
|
||||
STR_7053_COMPANY_LEAGUE_TABLE :{WHITE}Company League Table
|
||||
STR_7054 :{WHITE}{STRING}{SETX 45}{ORANGE}{COMPANY} {BLACK}{PLAYERNAME} '{STRING}'
|
||||
STR_7055 :{YELLOW}{STRING}{SETX 45}{ORANGE}{COMPANY} {BLACK}{PLAYERNAME} '{STRING}'
|
||||
STR_7054 :{WHITE}{STRING}{SETX 45}{ORANGE}{COMPANY} {BLACK}{COMPANYNUM} '{STRING}'
|
||||
STR_7055 :{YELLOW}{STRING}{SETX 45}{ORANGE}{COMPANY} {BLACK}{COMPANYNUM} '{STRING}'
|
||||
STR_7056_TRANSPORT_COMPANY_IN_TROUBLE :{BLACK}{BIGFONT}Transport company in trouble!
|
||||
STR_7057_WILL_BE_SOLD_OFF_OR_DECLARED :{BLACK}{BIGFONT}{COMPANY} will be sold off or declared bankrupt unless performance increases soon!
|
||||
STR_7058_PRESIDENT :{BLACK}{PLAYERNAME}{}(Manager)
|
||||
|
@ -3339,7 +3339,9 @@ STR_PROFIT_BAD_THIS_YEAR_GOOD_LAST_YEAR :{TINYFONT}{BLAC
|
|||
STR_PROFIT_GOOD_THIS_YEAR_BAD_LAST_YEAR :{TINYFONT}{BLACK}Profit this year: {GREEN}{CURRENCY} {BLACK}(last year: {RED}{CURRENCY}{BLACK})
|
||||
STR_PROFIT_BAD_THIS_YEAR_BAD_LAST_YEAR :{TINYFONT}{BLACK}Profit this year: {RED}{CURRENCY} {BLACK}(last year: {RED}{CURRENCY}{BLACK})
|
||||
|
||||
STR_COMPANY_NAME :{COMPANY}
|
||||
STR_GROUP_NAME :{GROUP}
|
||||
STR_PLAYER_NAME :{PLAYERNAME}
|
||||
STR_SIGN_NAME :{SIGN}
|
||||
STR_VEHICLE_NAME :{VEHICLE}
|
||||
|
||||
|
|
|
@ -605,9 +605,8 @@ static void PlayerMenuWndProc(Window *w, WindowEvent *e)
|
|||
|
||||
DrawPlayerIcon(p->index, x + 2, y + 1);
|
||||
|
||||
SetDParam(0, p->name_1);
|
||||
SetDParam(1, p->name_2);
|
||||
SetDParam(2, GetPlayerNameString(p->index, 3));
|
||||
SetDParam(0, p->index);
|
||||
SetDParam(1, p->index);
|
||||
|
||||
color = (p->index == sel) ? 0xC : 0x10;
|
||||
if (chk&1) color = 14;
|
||||
|
@ -2227,8 +2226,7 @@ static void StatusBarWndProc(Window *w, WindowEvent *e)
|
|||
} else {
|
||||
if (p != NULL) {
|
||||
/* This is the default text */
|
||||
SetDParam(0, p->name_1);
|
||||
SetDParam(1, p->name_2);
|
||||
SetDParam(0, p->index);
|
||||
DrawStringCentered(320, 1, STR_02BA, 0);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1416,9 +1416,8 @@ static void GenerateFileName()
|
|||
Let's use the name of player #0 for now. */
|
||||
const Player *p = GetPlayer(IsValidPlayer(_local_player) ? _local_player : PLAYER_FIRST);
|
||||
|
||||
SetDParam(0, p->name_1);
|
||||
SetDParam(1, p->name_2);
|
||||
SetDParam(2, _date);
|
||||
SetDParam(0, p->index);
|
||||
SetDParam(1, _date);
|
||||
GetString(_edit_str_buf, STR_4004, lastof(_edit_str_buf));
|
||||
SanitizeFilename(_edit_str_buf);
|
||||
}
|
||||
|
|
|
@ -1012,11 +1012,8 @@ static void DoAutosave()
|
|||
#endif /* PSP */
|
||||
|
||||
if (_patches.keep_all_autosave && _local_player != PLAYER_SPECTATOR) {
|
||||
const Player *p = GetPlayer(_local_player);
|
||||
|
||||
SetDParam(0, p->name_1);
|
||||
SetDParam(1, p->name_2);
|
||||
SetDParam(2, _date);
|
||||
SetDParam(0, _local_player);
|
||||
SetDParam(1, _date);
|
||||
GetString(buf, STR_4004, lastof(buf));
|
||||
ttd_strlcpy(buf, ".sav", sizeof(buf));
|
||||
} else {
|
||||
|
|
|
@ -165,10 +165,9 @@ static void PlayerFinancesWndProc(Window *w, WindowEvent *e)
|
|||
SetWindowWidgetDisabledState(w, 7, p->current_loan == 0);
|
||||
}
|
||||
|
||||
SetDParam(0, p->name_1);
|
||||
SetDParam(1, p->name_2);
|
||||
SetDParam(2, GetPlayerNameString(player, 3));
|
||||
SetDParam(4, LOAN_INTERVAL);
|
||||
SetDParam(0, p->index);
|
||||
SetDParam(1, p->index);
|
||||
SetDParam(2, LOAN_INTERVAL);
|
||||
DrawWindowWidgets(w);
|
||||
|
||||
DrawPlayerEconomyStats(p, (byte)WP(w, def_d).data_1);
|
||||
|
@ -708,9 +707,8 @@ static void DrawCompanyOwnerText(const Player *p)
|
|||
if (amt != 0) {
|
||||
num++;
|
||||
|
||||
SetDParam(num * 3 + 0, amt * 25);
|
||||
SetDParam(num * 3 + 1, p2->name_1);
|
||||
SetDParam(num * 3 + 2, p2->name_2);
|
||||
SetDParam(num * 2 + 0, amt * 25);
|
||||
SetDParam(num * 2 + 1, p2->index);
|
||||
|
||||
if (num != 0) break;
|
||||
}
|
||||
|
@ -757,9 +755,8 @@ static void PlayerCompanyWndProc(Window *w, WindowEvent *e)
|
|||
}
|
||||
}
|
||||
|
||||
SetDParam(0, p->name_1);
|
||||
SetDParam(1, p->name_2);
|
||||
SetDParam(2, GetPlayerNameString((PlayerID)w->window_number, 3));
|
||||
SetDParam(0, p->index);
|
||||
SetDParam(1, p->index);
|
||||
|
||||
DrawWindowWidgets(w);
|
||||
|
||||
|
@ -774,8 +771,7 @@ static void PlayerCompanyWndProc(Window *w, WindowEvent *e)
|
|||
|
||||
DrawPlayerFace(p->face, p->player_color, 2, 16);
|
||||
|
||||
SetDParam(0, p->president_name_1);
|
||||
SetDParam(1, p->president_name_2);
|
||||
SetDParam(0, p->index);
|
||||
DrawStringMultiCenter(48, 141, STR_7037_PRESIDENT, 94);
|
||||
|
||||
SetDParam(0, CalculateCompanyValue(p));
|
||||
|
@ -812,16 +808,16 @@ static void PlayerCompanyWndProc(Window *w, WindowEvent *e)
|
|||
case PCW_WIDGET_PRESIDENT_NAME: {
|
||||
const Player *p = GetPlayer((PlayerID)w->window_number);
|
||||
WP(w, def_d).byte_1 = 0;
|
||||
SetDParam(0, p->president_name_2);
|
||||
ShowQueryString(p->president_name_1, STR_700B_PRESIDENT_S_NAME, 31, 94, w, CS_ALPHANUMERAL);
|
||||
SetDParam(0, p->index);
|
||||
ShowQueryString(STR_PLAYER_NAME, STR_700B_PRESIDENT_S_NAME, 31, 94, w, CS_ALPHANUMERAL);
|
||||
break;
|
||||
}
|
||||
|
||||
case PCW_WIDGET_COMPANY_NAME: {
|
||||
Player *p = GetPlayer((PlayerID)w->window_number);
|
||||
WP(w, def_d).byte_1 = 1;
|
||||
SetDParam(0, p->name_2);
|
||||
ShowQueryString(p->name_1, STR_700A_COMPANY_NAME, 31, 150, w, CS_ALPHANUMERAL);
|
||||
SetDParam(0, p->index);
|
||||
ShowQueryString(STR_COMPANY_NAME, STR_700A_COMPANY_NAME, 31, 150, w, CS_ALPHANUMERAL);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -939,15 +935,13 @@ static void BuyCompanyWndProc(Window *w, WindowEvent *e)
|
|||
switch (e->event) {
|
||||
case WE_PAINT: {
|
||||
Player *p = GetPlayer((PlayerID)w->window_number);
|
||||
SetDParam(0, p->name_1);
|
||||
SetDParam(1, p->name_2);
|
||||
SetDParam(0, p->index);
|
||||
DrawWindowWidgets(w);
|
||||
|
||||
DrawPlayerFace(p->face, p->player_color, 2, 16);
|
||||
|
||||
SetDParam(0, p->name_1);
|
||||
SetDParam(1, p->name_2);
|
||||
SetDParam(2, p->bankrupt_value);
|
||||
SetDParam(0, p->index);
|
||||
SetDParam(1, p->bankrupt_value);
|
||||
DrawStringMultiCenter(214, 65, STR_705B_WE_ARE_LOOKING_FOR_A_TRANSPORT, 238);
|
||||
break;
|
||||
}
|
||||
|
@ -1028,16 +1022,13 @@ static void EndGameWndProc(Window *w, WindowEvent *e)
|
|||
/* We need to get performance from last year because the image is shown
|
||||
* at the start of the new year when these things have already been copied */
|
||||
if (WP(w, highscore_d).background_img == SPR_TYCOON_IMG2_BEGIN) { // Tycoon of the century \o/
|
||||
SetDParam(0, p->president_name_1);
|
||||
SetDParam(1, p->president_name_2);
|
||||
SetDParam(2, p->name_1);
|
||||
SetDParam(3, p->name_2);
|
||||
SetDParam(4, EndGameGetPerformanceTitleFromValue(p->old_economy[0].performance_history));
|
||||
SetDParam(0, p->index);
|
||||
SetDParam(1, p->index);
|
||||
SetDParam(2, EndGameGetPerformanceTitleFromValue(p->old_economy[0].performance_history));
|
||||
DrawStringMultiCenter(x + (640 / 2), y + 107, STR_021C_OF_ACHIEVES_STATUS, 640);
|
||||
} else {
|
||||
SetDParam(0, p->name_1);
|
||||
SetDParam(1, p->name_2);
|
||||
SetDParam(2, EndGameGetPerformanceTitleFromValue(p->old_economy[0].performance_history));
|
||||
SetDParam(0, p->index);
|
||||
SetDParam(1, EndGameGetPerformanceTitleFromValue(p->old_economy[0].performance_history));
|
||||
DrawStringMultiCenter(x + (640 / 2), y + 157, STR_021B_ACHIEVES_STATUS, 640);
|
||||
}
|
||||
} break;
|
||||
|
|
|
@ -246,8 +246,8 @@ void GetNameOfOwner(Owner owner, TileIndex tile)
|
|||
} else {
|
||||
const Player* p = GetPlayer(owner);
|
||||
|
||||
SetDParam(0, p->name_1);
|
||||
SetDParam(1, p->name_2);
|
||||
SetDParam(0, STR_COMPANY_NAME);
|
||||
SetDParam(1, p->index);
|
||||
}
|
||||
} else {
|
||||
const Town* t = ClosestTownFromTile(tile, (uint)-1);
|
||||
|
@ -414,15 +414,15 @@ restart:;
|
|||
p->president_name_2 = Random();
|
||||
p->president_name_1 = SPECSTR_PRESIDENT_NAME;
|
||||
|
||||
SetDParam(0, p->president_name_2);
|
||||
GetString(buffer, p->president_name_1, lastof(buffer));
|
||||
SetDParam(0, p->index);
|
||||
GetString(buffer, STR_PLAYER_NAME, lastof(buffer));
|
||||
if (strlen(buffer) >= 32 || GetStringBoundingBox(buffer).width >= 94)
|
||||
continue;
|
||||
|
||||
FOR_ALL_PLAYERS(pp) {
|
||||
if (pp->is_active && p != pp) {
|
||||
SetDParam(0, pp->president_name_2);
|
||||
GetString(buffer2, pp->president_name_1, lastof(buffer2));
|
||||
SetDParam(0, pp->index);
|
||||
GetString(buffer2, STR_PLAYER_NAME, lastof(buffer2));
|
||||
if (strcmp(buffer2, buffer) == 0)
|
||||
goto restart;
|
||||
}
|
||||
|
@ -555,16 +555,6 @@ void OnTick_Players()
|
|||
MaybeStartNewPlayer();
|
||||
}
|
||||
|
||||
/** index is the next parameter in _decode_parameters to set up */
|
||||
StringID GetPlayerNameString(PlayerID player, uint index)
|
||||
{
|
||||
if (IsHumanPlayer(player) && IsValidPlayer(player)) {
|
||||
SetDParam(index, player+1);
|
||||
return STR_7002_PLAYER;
|
||||
}
|
||||
return STR_EMPTY;
|
||||
}
|
||||
|
||||
extern void ShowPlayerFinances(PlayerID player);
|
||||
|
||||
void PlayersYearlyLoop()
|
||||
|
@ -917,8 +907,7 @@ CommandCost CmdPlayerCtrl(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
|
|||
DeletePlayerWindows(p->index);
|
||||
|
||||
/* Show the bankrupt news */
|
||||
SetDParam(0, p->name_1);
|
||||
SetDParam(1, p->name_2);
|
||||
SetDParam(0, p->index);
|
||||
AddNewsItem( (StringID)(p->index | NB_BBANKRUPT), NEWS_FLAGS(NM_CALLBACK, 0, NT_COMPANY_INFO, DNC_BANKRUPCY),0,0);
|
||||
|
||||
/* Remove the company */
|
||||
|
@ -1002,10 +991,8 @@ int8 SaveHighScoreValue(const Player *p)
|
|||
if (hs[i].score <= score) {
|
||||
/* move all elements one down starting from the replaced one */
|
||||
memmove(&hs[i + 1], &hs[i], sizeof(HighScore) * (lengthof(_highscore_table[0]) - i - 1));
|
||||
SetDParam(0, p->president_name_1);
|
||||
SetDParam(1, p->president_name_2);
|
||||
SetDParam(2, p->name_1);
|
||||
SetDParam(3, p->name_2);
|
||||
SetDParam(0, p->index);
|
||||
SetDParam(1, p->index);
|
||||
GetString(hs[i].company, STR_HIGHSCORE_NAME, lastof(hs[i].company)); // get manager/company name string
|
||||
hs[i].score = score;
|
||||
hs[i].title = EndGameGetPerformanceTitleFromValue(score);
|
||||
|
@ -1047,10 +1034,8 @@ int8 SaveHighScoreValueNetwork()
|
|||
for (i = 0; i < lengthof(_highscore_table[LAST_HS_ITEM]) && i < count; i++) {
|
||||
HighScore* hs = &_highscore_table[LAST_HS_ITEM][i];
|
||||
|
||||
SetDParam(0, pl[i]->president_name_1);
|
||||
SetDParam(1, pl[i]->president_name_2);
|
||||
SetDParam(2, pl[i]->name_1);
|
||||
SetDParam(3, pl[i]->name_2);
|
||||
SetDParam(0, pl[i]->index);
|
||||
SetDParam(1, pl[i]->index);
|
||||
GetString(hs->company, STR_HIGHSCORE_NAME, lastof(hs->company)); // get manager/company name string
|
||||
hs->score = pl[i]->old_economy[0].performance_history;
|
||||
hs->title = EndGameGetPerformanceTitleFromValue(hs->score);
|
||||
|
|
|
@ -531,10 +531,8 @@ static char *MakeScreenshotName(const char *ext)
|
|||
if (_game_mode == GM_EDITOR || _game_mode == GM_MENU || _local_player == PLAYER_SPECTATOR) {
|
||||
ttd_strlcpy(_screenshot_name, "screenshot", lengthof(_screenshot_name));
|
||||
} else {
|
||||
const Player* p = GetPlayer(_local_player);
|
||||
SetDParam(0, p->name_1);
|
||||
SetDParam(1, p->name_2);
|
||||
SetDParam(2, _date);
|
||||
SetDParam(0, _local_player);
|
||||
SetDParam(1, _date);
|
||||
GetString(_screenshot_name, STR_4004, lastof(_screenshot_name));
|
||||
}
|
||||
|
||||
|
|
|
@ -309,10 +309,8 @@ static void PlayerStationsWndProc(Window *w, WindowEvent *e)
|
|||
SetVScrollCount(w, sl->list_length);
|
||||
|
||||
/* draw widgets, with player's name in the caption */
|
||||
const Player* p = GetPlayer(owner);
|
||||
SetDParam(0, p->name_1);
|
||||
SetDParam(1, p->name_2);
|
||||
SetDParam(2, w->vscroll.count);
|
||||
SetDParam(0, owner);
|
||||
SetDParam(1, w->vscroll.count);
|
||||
DrawWindowWidgets(w);
|
||||
|
||||
/* draw sorting criteria string */
|
||||
|
|
|
@ -461,11 +461,6 @@ static const CmdStruct _cmd_structs[] = {
|
|||
{"REV", EmitSingleChar, SCC_REVISION, 0, 0}, // openttd revision string
|
||||
{"SHORTCARGO", EmitSingleChar, SCC_CARGO_SHORT, 2, 0}, // short cargo description, only ### tons, or ### litres
|
||||
|
||||
// These are special versions of {STRING1}
|
||||
// The first string includes the second string.
|
||||
{"COMPANY", EmitSingleChar, SCC_STRING1, 2, 0},
|
||||
{"PLAYERNAME", EmitSingleChar, SCC_STRING1, 1, 0},
|
||||
|
||||
{"STRING1", EmitSingleChar, SCC_STRING1, 1, C_CASE}, // included string that consumes ONE argument
|
||||
{"STRING2", EmitSingleChar, SCC_STRING2, 2, C_CASE}, // included string that consumes TWO arguments
|
||||
{"STRING3", EmitSingleChar, SCC_STRING3, 3, C_CASE}, // included string that consumes THREE arguments
|
||||
|
@ -506,6 +501,9 @@ static const CmdStruct _cmd_structs[] = {
|
|||
{"GROUP", EmitSingleChar, SCC_GROUP_NAME, 1, 0},
|
||||
{"SIGN", EmitSingleChar, SCC_SIGN_NAME, 1, 0},
|
||||
{"VEHICLE", EmitSingleChar, SCC_VEHICLE_NAME, 1, 0},
|
||||
{"COMPANY", EmitSingleChar, SCC_COMPANY_NAME, 1, 0},
|
||||
{"COMPANYNUM", EmitSingleChar, SCC_COMPANY_NUM, 1, 0},
|
||||
{"PLAYERNAME", EmitSingleChar, SCC_PLAYER_NAME, 1, 0},
|
||||
|
||||
// 0x9D is used for the pseudo command SETCASE
|
||||
// 0x9E is used for case switching
|
||||
|
|
|
@ -880,6 +880,34 @@ static char* FormatString(char* buff, const char* str, const int64* argv, uint c
|
|||
break;
|
||||
}
|
||||
|
||||
case SCC_COMPANY_NAME: { // {COMPANY}
|
||||
const Player *p = GetPlayer((PlayerID)GetInt32(&argv));
|
||||
int64 args[1];
|
||||
args[0] = p->name_2;
|
||||
buff = GetStringWithArgs(buff, p->name_1, args, last);
|
||||
break;
|
||||
}
|
||||
|
||||
case SCC_COMPANY_NUM: { // {COMPANYNUM}
|
||||
PlayerID player = (PlayerID)GetInt32(&argv);
|
||||
|
||||
/* Nothing is added for AI or inactive players */
|
||||
if (IsHumanPlayer(player) && IsValidPlayer(player)) {
|
||||
int64 args[1];
|
||||
args[0] = player + 1;
|
||||
buff = GetStringWithArgs(buff, STR_7002_PLAYER, args, last);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case SCC_PLAYER_NAME: { // {PLAYERNAME}
|
||||
const Player *p = GetPlayer((PlayerID)GetInt32(&argv));
|
||||
int64 args[1];
|
||||
args[0] = p->president_name_2;
|
||||
buff = GetStringWithArgs(buff, p->president_name_1, args, last);
|
||||
break;
|
||||
}
|
||||
|
||||
case SCC_SETCASE: { // {SETCASE}
|
||||
/* This is a pseudo command, it's outputted when someone does {STRING.ack}
|
||||
* The modifier is added to all subsequent GetStringWithArgs that accept the modifier. */
|
||||
|
|
|
@ -122,14 +122,12 @@ static void DrawSubsidiesWindow(const Window *w)
|
|||
|
||||
for (s = _subsidies; s != endof(_subsidies); s++) {
|
||||
if (s->cargo_type != CT_INVALID && s->age >= 12) {
|
||||
const Player *p;
|
||||
int xt;
|
||||
|
||||
SetupSubsidyDecodeParam(s, 1);
|
||||
|
||||
p = GetPlayer(GetStation(s->to)->owner);
|
||||
SetDParam(3, p->name_1);
|
||||
SetDParam(4, p->name_2);
|
||||
PlayerID player = GetStation(s->to)->owner;
|
||||
SetDParam(3, player);
|
||||
|
||||
xt = DrawString(x + 2, y, STR_202C_FROM_TO, 0);
|
||||
|
||||
|
|
|
@ -29,6 +29,9 @@ enum {
|
|||
SCC_GROUP_NAME,
|
||||
SCC_VEHICLE_NAME,
|
||||
SCC_SIGN_NAME,
|
||||
SCC_COMPANY_NAME,
|
||||
SCC_COMPANY_NUM,
|
||||
SCC_PLAYER_NAME,
|
||||
|
||||
SCC_CURRENCY_COMPACT,
|
||||
SCC_CURRENCY,
|
||||
|
|
|
@ -1934,15 +1934,10 @@ static void TownActionAdvertiseLarge(Town* t)
|
|||
|
||||
static void TownActionRoadRebuild(Town* t)
|
||||
{
|
||||
const Player* p;
|
||||
|
||||
t->road_build_months = 6;
|
||||
|
||||
SetDParam(0, t->index);
|
||||
|
||||
p = GetPlayer(_current_player);
|
||||
SetDParam(1, p->name_1);
|
||||
SetDParam(2, p->name_2);
|
||||
SetDParam(1, _current_player);
|
||||
|
||||
AddNewsItem(STR_2055_TRAFFIC_CHAOS_IN_ROAD_REBUILDING,
|
||||
NEWS_FLAGS(NM_NORMAL, NF_TILE, NT_GENERAL, 0), t->xy, 0);
|
||||
|
|
|
@ -127,9 +127,8 @@ 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);
|
||||
|
||||
SetDParam(0, p->name_1);
|
||||
SetDParam(1, p->name_2);
|
||||
SetDParam(2, GetPlayerNameString(p->index, 3));
|
||||
SetDParam(0, p->index);
|
||||
SetDParam(1, p->index);
|
||||
|
||||
r = t->ratings[p->index];
|
||||
(str = STR_3035_APPALLING, r <= RATING_APPALLING) || // Apalling
|
||||
|
@ -141,7 +140,7 @@ static void TownAuthorityWndProc(Window *w, WindowEvent *e)
|
|||
(str++, r <= RATING_EXCELLENT) || // Excellent
|
||||
(str++, true); // Outstanding
|
||||
|
||||
SetDParam(4, str);
|
||||
SetDParam(2, str);
|
||||
if (t->exclusivity == p->index) { // red icon for player with exclusive rights
|
||||
DrawSprite(SPR_BLOT, PALETTE_TO_RED, 18, y);
|
||||
}
|
||||
|
|
|
@ -957,9 +957,8 @@ static void DrawVehicleListWindow(Window *w)
|
|||
break;
|
||||
|
||||
case VLW_STANDARD: /* Company Name */
|
||||
SetDParam(0, p->name_1);
|
||||
SetDParam(1, p->name_2);
|
||||
SetDParam(2, w->vscroll.count);
|
||||
SetDParam(0, p->index);
|
||||
SetDParam(1, w->vscroll.count);
|
||||
break;
|
||||
|
||||
case VLW_STATION_LIST: /* Station Name */
|
||||
|
|
Loading…
Reference in New Issue