Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backport marked PRs to 1.9.1 #7487

Merged
merged 9 commits into from
Apr 8, 2019
2 changes: 1 addition & 1 deletion src/ai/ai_gui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1284,7 +1284,7 @@ struct AIDebugWindow : public Window {
case WID_AID_RELOAD_TOGGLE:
if (ai_debug_company == OWNER_DEITY) break;
/* First kill the company of the AI, then start a new one. This should start the current AI again */
DoCommandP(0, CCA_DELETE | ai_debug_company << 16, CRR_MANUAL, CMD_COMPANY_CTRL);
DoCommandP(0, CCA_DELETE | ai_debug_company << 16 | CRR_MANUAL << 24, 0, CMD_COMPANY_CTRL);
DoCommandP(0, CCA_NEW_AI | ai_debug_company << 16, 0, CMD_COMPANY_CTRL);
break;

Expand Down
9 changes: 4 additions & 5 deletions src/company_cmd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -805,10 +805,9 @@ void CompanyAdminRemove(CompanyID company_id, CompanyRemoveReason reason)
* @param flags operation to perform
* @param p1 various functionality
* - bits 0..15: CompanyCtrlAction
* - bits 16..24: CompanyID
* @param p2 various depending on CompanyCtrlAction
* - bits 0..31: ClientID (with CCA_NEW)
* - bits 0..1: CompanyRemoveReason (with CCA_DELETE)
* - bits 16..23: CompanyID
* - bits 24..31: CompanyRemoveReason (with CCA_DELETE)
* @param p2 ClientID
* @param text unused
* @return the cost of this operation or an error
*/
Expand Down Expand Up @@ -882,7 +881,7 @@ CommandCost CmdCompanyCtrl(TileIndex tile, DoCommandFlag flags, uint32 p1, uint3
}

case CCA_DELETE: { // Delete a company
CompanyRemoveReason reason = (CompanyRemoveReason)GB(p2, 0, 2);
CompanyRemoveReason reason = (CompanyRemoveReason)GB(p1, 24, 8);
if (reason >= CRR_END) return CMD_ERROR;

Company *c = Company::GetIfValid(company_id);
Expand Down
6 changes: 3 additions & 3 deletions src/console_cmds.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -836,7 +836,7 @@ DEF_CONSOLE_CMD(ConResetCompany)
}

/* It is safe to remove this company */
DoCommandP(0, CCA_DELETE | index << 16, CRR_MANUAL, CMD_COMPANY_CTRL);
DoCommandP(0, CCA_DELETE | index << 16 | CRR_MANUAL << 24, 0, CMD_COMPANY_CTRL);
IConsolePrint(CC_DEFAULT, "Company deleted.");

return true;
Expand Down Expand Up @@ -1213,7 +1213,7 @@ DEF_CONSOLE_CMD(ConReloadAI)
}

/* First kill the company of the AI, then start a new one. This should start the current AI again */
DoCommandP(0, CCA_DELETE | company_id << 16, CRR_MANUAL, CMD_COMPANY_CTRL);
DoCommandP(0, CCA_DELETE | company_id << 16 | CRR_MANUAL << 24, 0,CMD_COMPANY_CTRL);
DoCommandP(0, CCA_NEW_AI | company_id << 16, 0, CMD_COMPANY_CTRL);
IConsolePrint(CC_DEFAULT, "AI reloaded.");

Expand Down Expand Up @@ -1250,7 +1250,7 @@ DEF_CONSOLE_CMD(ConStopAI)
}

/* Now kill the company of the AI. */
DoCommandP(0, CCA_DELETE | company_id << 16, CRR_MANUAL, CMD_COMPANY_CTRL);
DoCommandP(0, CCA_DELETE | company_id << 16 | CRR_MANUAL << 24, 0, CMD_COMPANY_CTRL);
IConsolePrint(CC_DEFAULT, "AI stopped, company deleted.");

return true;
Expand Down
2 changes: 1 addition & 1 deletion src/economy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -642,7 +642,7 @@ static void CompanyCheckBankrupt(Company *c)
* that changing the current company is okay. In case of single
* player we are sure (the above check) that we are not the local
* company and thus we won't be moved. */
if (!_networking || _network_server) DoCommandP(0, CCA_DELETE | (c->index << 16), CRR_BANKRUPT, CMD_COMPANY_CTRL);
if (!_networking || _network_server) DoCommandP(0, CCA_DELETE | (c->index << 16) | (CRR_BANKRUPT << 24), 0, CMD_COMPANY_CTRL);
break;
}
}
Expand Down
8 changes: 4 additions & 4 deletions src/lang/croatian.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3120,7 +3120,7 @@ STR_NEWGRF_LIST_MISSING :{RED}Nedostaju
STR_NEWGRF_BROKEN :{WHITE}Ponašanje NewGRF '{0:STRING}' će vjerojatno uzrokovati deharmonizaciju i/ili rušenje igre
STR_NEWGRF_BROKEN_POWERED_WAGON :{WHITE}Promijenjen status motoriziranog vagona za '{1:ENGINE}' kad vozilo nije u spremištu.
STR_NEWGRF_BROKEN_VEHICLE_LENGTH :{WHITE}Ovo mijenja dužinu vozila za '{1:ENGINE}' kada vozilo nije unutar spremišta
STR_NEWGRF_BROKEN_CAPACITY :{WHITE}Promijenilo je kapacitet vozila za '{1:ENGINE}' kada nije u spremšta ili se remontira
STR_NEWGRF_BROKEN_CAPACITY :{WHITE}Promijenilo je kapacitet vozila za '{1:ENGINE}' kada nije u spremištu ili se prenamjenjuje
STR_BROKEN_VEHICLE_LENGTH :{WHITE}Vlak'{VEHICLE}' koji pripada tvrtci '{COMPANY}' neispravne je dužine. Uzrok problema je vjerojatno u NewGRF datotekama. Igra će se možda deharmonizirati ili srušiti

STR_NEWGRF_BUGGY :{WHITE}NewGRF '{0:STRING}' daje netočne informacije
Expand Down Expand Up @@ -3903,9 +3903,9 @@ STR_VEHICLE_DETAILS_TRAIN_ARTICULATED_RV_CAPACITY :{BLACK}Nosivost
STR_REFIT_CAPTION :{WHITE}{VEHICLE} (Prenamijeni)
STR_REFIT_TITLE :{GOLD}Odaberi vrstu tereta za prijevoz:
STR_REFIT_NEW_CAPACITY_COST_OF_REFIT :{BLACK}Nova nosivost: {GOLD}{CARGO_LONG}{}{BLACK}Cijena prenamjene: {RED}{CURRENCY_LONG}
STR_REFIT_NEW_CAPACITY_INCOME_FROM_REFIT :{BLACK}Novi kapacitet: {GOLD}{CARGO_LONG}{}{BLACK}Prihod od remonta: {GREEN}{CURRENCY_LONG}
STR_REFIT_NEW_CAPACITY_COST_OF_AIRCRAFT_REFIT :{BLACK}Novi kapacitet: {GOLD}{CARGO_LONG}, {GOLD}{CARGO_LONG}{}{BLACK}Trošak remonta: {RED}{CURRENCY_LONG}
STR_REFIT_NEW_CAPACITY_INCOME_FROM_AIRCRAFT_REFIT :{BLACK}Novi kapacitet: {GOLD}{CARGO_LONG}, {GOLD}{CARGO_LONG}{}{BLACK}Prihod od remonta: {GREEN}{CURRENCY_LONG}
STR_REFIT_NEW_CAPACITY_INCOME_FROM_REFIT :{BLACK}Novi kapacitet: {GOLD}{CARGO_LONG}{}{BLACK}Prihod od prenamjene: {GREEN}{CURRENCY_LONG}
STR_REFIT_NEW_CAPACITY_COST_OF_AIRCRAFT_REFIT :{BLACK}Novi kapacitet: {GOLD}{CARGO_LONG}, {GOLD}{CARGO_LONG}{}{BLACK}Cijena prenamjene: {RED}{CURRENCY_LONG}
STR_REFIT_NEW_CAPACITY_INCOME_FROM_AIRCRAFT_REFIT :{BLACK}Novi kapacitet: {GOLD}{CARGO_LONG}, {GOLD}{CARGO_LONG}{}{BLACK}Prihod od prenamjene: {GREEN}{CURRENCY_LONG}
STR_REFIT_SELECT_VEHICLES_TOOLTIP :{BLACK}Odaberi vozila za remont. Povlačenje mišem dopušta odabir više vozila. Klik na prazninu će označiti cijelo vozilo. Ctrl+Klik će označiti vozilo i niz koji slijedi.

STR_REFIT_TRAIN_LIST_TOOLTIP :{BLACK}Odaberi vrstu tereta koju će vlak prevoziti
Expand Down
4 changes: 2 additions & 2 deletions src/lang/dutch.txt
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ STR_QUANTITY_NOTHING :
STR_QUANTITY_PASSENGERS :{COMMA}{NBSP}passagier{P "" s}
STR_QUANTITY_COAL :{WEIGHT_LONG} kolen
STR_QUANTITY_MAIL :{COMMA}{NBSP}zak{P "" ken} post
STR_QUANTITY_OIL :{VOLUME_LONG} Vaten olie
STR_QUANTITY_OIL :{VOLUME_LONG} vaten olie
STR_QUANTITY_LIVESTOCK :{COMMA}{NBSP}stuk{P "" s} vee
STR_QUANTITY_GOODS :{COMMA}{NBSP}krat{P "" ten} goederen
STR_QUANTITY_GRAIN :{WEIGHT_LONG} graan
Expand Down Expand Up @@ -2856,7 +2856,7 @@ STR_SE_MAPGEN_FLAT_WORLD_HEIGHT_QUERY_CAPT :{WHITE}Verander
# Map generation progress
STR_GENERATION_WORLD :{WHITE}Bezig met wereldontwikkeling...
STR_GENERATION_ABORT :{BLACK}Stop
STR_GENERATION_ABORT_CAPTION :{WHITE}Stop Wereldontwikkeling
STR_GENERATION_ABORT_CAPTION :{WHITE}Wereldontwikkeling stoppen
STR_GENERATION_ABORT_MESSAGE :{YELLOW}Weet je zeker dat je de actie wilt stoppen?
STR_GENERATION_PROGRESS :{WHITE}{NUM}% compleet
STR_GENERATION_PROGRESS_NUM :{BLACK}{NUM} / {NUM}
Expand Down
5 changes: 3 additions & 2 deletions src/lang/french.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3025,13 +3025,14 @@ STR_NEWGRF_LIST_MISSING :{RED}Modules ma
STR_NEWGRF_BROKEN :{WHITE}Le comportement du NewGRF "{0:STRING}" peut provoquer des erreurs de synchronisation et/ou des plantages
STR_NEWGRF_BROKEN_POWERED_WAGON :{WHITE}Il a modifié l'état de wagon motorisé pour "{1:ENGINE}" en dehors du dépôt
STR_NEWGRF_BROKEN_VEHICLE_LENGTH :{WHITE}Il a modifié la longueur de véhicule pour "{1:ENGINE}" en dehors du dépôt
STR_NEWGRF_BROKEN_CAPACITY :{WHITE}Il a changé la capacité pour '{1:ENGINE}' hors d'un dépôt ou d'un réaménagement
STR_NEWGRF_BROKEN_CAPACITY :{WHITE}Il a changé la capacité pour "{1:ENGINE}" hors d'un dépôt ou d'un réaménagement
STR_BROKEN_VEHICLE_LENGTH :{WHITE}Le train "{VEHICLE}" appartenant à "{COMPANY}" a une longueur invalide. Cela est probablement dû à des problèmes avec des NewGRFs, et peut provoquer des erreurs de synchronisation ou planter le jeu.

STR_NEWGRF_BUGGY :{WHITE}Le module NewGRF "{0:STRING}" fournit une information incorrecte
STR_NEWGRF_BUGGY_ARTICULATED_CARGO :{WHITE}Les informations de cargaison/réaménagement pour "{1:ENGINE}" après sa construction sont différentes de celles de la liste d'achat. Cela peut causer un échec de réaménagement lors de l'auto-renouvellement/remplacement.
STR_NEWGRF_BUGGY_ENDLESS_PRODUCTION_CALLBACK :{WHITE}"{1:STRING}" a causé une boucle infinie dans la fonction de rappel de production
STR_NEWGRF_BUGGY_UNKNOWN_CALLBACK_RESULT :{WHITE}Callback {1:HEX} a retourné un résultat invalide {2:HEX}
STR_NEWGRF_BUGGY_UNKNOWN_CALLBACK_RESULT :{WHITE}La fonction de rappel {1:HEX} a retourné un résultat invalide {2:HEX}
STR_NEWGRF_BUGGY_INVALID_CARGO_PRODUCTION_CALLBACK :{WHITE}"{1:STRING}" a renvoyé un type de cargaison invalide dans la fonction de rappel de production à {2:HEX}

# 'User removed essential NewGRFs'-placeholders for stuff without specs
STR_NEWGRF_INVALID_CARGO :<marchandise invalide>
Expand Down
4 changes: 2 additions & 2 deletions src/network/network_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1675,7 +1675,7 @@ static void NetworkAutoCleanCompanies()
/* Is the company empty for autoclean_unprotected-months, and is there no protection? */
if (_settings_client.network.autoclean_unprotected != 0 && _network_company_states[c->index].months_empty > _settings_client.network.autoclean_unprotected && StrEmpty(_network_company_states[c->index].password)) {
/* Shut the company down */
DoCommandP(0, CCA_DELETE | c->index << 16, CRR_AUTOCLEAN, CMD_COMPANY_CTRL);
DoCommandP(0, CCA_DELETE | c->index << 16 | CRR_AUTOCLEAN << 24, 0, CMD_COMPANY_CTRL);
IConsolePrintF(CC_DEFAULT, "Auto-cleaned company #%d with no password", c->index + 1);
}
/* Is the company empty for autoclean_protected-months, and there is a protection? */
Expand All @@ -1689,7 +1689,7 @@ static void NetworkAutoCleanCompanies()
/* Is the company empty for autoclean_novehicles-months, and has no vehicles? */
if (_settings_client.network.autoclean_novehicles != 0 && _network_company_states[c->index].months_empty > _settings_client.network.autoclean_novehicles && vehicles_in_company[c->index] == 0) {
/* Shut the company down */
DoCommandP(0, CCA_DELETE | c->index << 16, CRR_AUTOCLEAN, CMD_COMPANY_CTRL);
DoCommandP(0, CCA_DELETE | c->index << 16 | CRR_AUTOCLEAN << 24, 0, CMD_COMPANY_CTRL);
IConsolePrintF(CC_DEFAULT, "Auto-cleaned company #%d with no vehicles", c->index + 1);
}
} else {
Expand Down
2 changes: 1 addition & 1 deletion src/newgrf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5688,7 +5688,7 @@ static void FeatureNewName(ByteReader *buf)
bool new_scheme = _cur.grffile->grf_version >= 7;

uint8 feature = buf->ReadByte();
if (feature >= GSF_END) {
if (feature >= GSF_END && feature != 0x48) {
grfmsg(1, "FeatureNewName: Unsupported feature 0x%02X, skipping", feature);
return;
}
Expand Down
1 change: 1 addition & 0 deletions src/newgrf_airport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ AirportSpec AirportSpec::specs[NUM_AIRPORTS]; ///< Airport specifications.
assert(type < lengthof(AirportSpec::specs));
const AirportSpec *as = &AirportSpec::specs[type];
if (type >= NEW_AIRPORT_OFFSET && !as->enabled) {
if (_airport_mngr.GetGRFID(type) == 0) return as;
byte subst_id = _airport_mngr.GetSubstituteID(type);
if (subst_id == AT_INVALID) return as;
as = &AirportSpec::specs[subst_id];
Expand Down
5 changes: 3 additions & 2 deletions src/object_cmd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -772,9 +772,10 @@ static void ChangeTileOwner_Object(TileIndex tile, Owner old_owner, Owner new_ow

bool do_clear = false;

if (IsObjectType(tile, OBJECT_OWNED_LAND) && new_owner != INVALID_OWNER) {
ObjectType type = GetObjectType(tile);
if ((type == OBJECT_OWNED_LAND || type >= NEW_OBJECT_OFFSET) && new_owner != INVALID_OWNER) {
SetTileOwner(tile, new_owner);
} else if (IsObjectType(tile, OBJECT_STATUE)) {
} else if (type == OBJECT_STATUE) {
Town *t = Object::GetByTile(tile)->town;
ClrBit(t->statues, old_owner);
if (new_owner != INVALID_OWNER && !HasBit(t->statues, new_owner)) {
Expand Down
2 changes: 1 addition & 1 deletion src/os/windows/win32.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ bool LoadLibraryList(Function proc[], const char *dll)
void ShowOSErrorBox(const char *buf, bool system)
{
MyShowCursor(true);
MessageBox(GetActiveWindow(), OTTD2FS(buf), _T("Error!"), MB_ICONSTOP);
MessageBox(GetActiveWindow(), OTTD2FS(buf), _T("Error!"), MB_ICONSTOP | MB_TASKMODAL);
}

void OSOpenBrowser(const char *url)
Expand Down
1 change: 0 additions & 1 deletion src/script/api/ai_changelog.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
*
* \b 1.9.0
*
* 1.9.0 is not yet released. The following changes are not set in stone yet.
* API additions:
* \li AIAirport::GetMonthlyMaintenanceCost
* \li AIGroup::SetParent
Expand Down
1 change: 0 additions & 1 deletion src/script/api/game_changelog.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
*
* \b 1.9.0
*
* 1.9.0 is not yet released. The following changes are not set in stone yet.
* API additions:
* \li GSAirport::GetMonthlyMaintenanceCost
* \li GSClient
Expand Down
8 changes: 8 additions & 0 deletions src/station_cmd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2639,21 +2639,29 @@ bool SplitGroundSpriteForOverlay(const TileInfo *ti, SpriteID *ground, RailTrack
bool snow_desert;
switch (*ground) {
case SPR_RAIL_TRACK_X:
case SPR_MONO_TRACK_X:
case SPR_MGLV_TRACK_X:
snow_desert = false;
*overlay_offset = RTO_X;
break;

case SPR_RAIL_TRACK_Y:
case SPR_MONO_TRACK_Y:
case SPR_MGLV_TRACK_Y:
snow_desert = false;
*overlay_offset = RTO_Y;
break;

case SPR_RAIL_TRACK_X_SNOW:
case SPR_MONO_TRACK_X_SNOW:
case SPR_MGLV_TRACK_X_SNOW:
snow_desert = true;
*overlay_offset = RTO_X;
break;

case SPR_RAIL_TRACK_Y_SNOW:
case SPR_MONO_TRACK_Y_SNOW:
case SPR_MGLV_TRACK_Y_SNOW:
snow_desert = true;
*overlay_offset = RTO_Y;
break;
Expand Down
10 changes: 7 additions & 3 deletions src/strings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,10 @@ int64 StringParameters::GetInt64(WChar type)
return 0;
}
if (this->type != NULL) {
assert(this->type[this->offset] == 0 || this->type[this->offset] == type);
if (this->type[this->offset] != 0 && this->type[this->offset] != type) {
DEBUG(misc, 0, "Trying to read string parameter with wrong type");
return 0;
}
this->type[this->offset] = type;
}
return this->data[this->offset++];
Expand Down Expand Up @@ -1416,8 +1419,9 @@ static char *FormatString(char *buff, const char *str_arg, StringParameters *arg
}
}

int64 args_array[] = {STR_TOWN_NAME, st->town->index, st->index};
StringParameters tmp_params(args_array);
uint64 args_array[] = {STR_TOWN_NAME, st->town->index, st->index};
WChar types_array[] = {0, SCC_TOWN_NAME, SCC_NUM};
StringParameters tmp_params(args_array, 3, types_array);
buff = GetStringWithArgs(buff, str, &tmp_params, last);
}
break;
Expand Down
6 changes: 6 additions & 0 deletions src/table/sprites.h
Original file line number Diff line number Diff line change
Expand Up @@ -402,16 +402,22 @@ static const SpriteID SPR_MONO_SINGLE_SOUTH = 1090;
static const SpriteID SPR_MONO_SINGLE_EAST = 1091;
static const SpriteID SPR_MONO_SINGLE_WEST = 1092;
static const SpriteID SPR_MONO_TRACK_Y = 1093;
static const SpriteID SPR_MONO_TRACK_X = 1094;
static const SpriteID SPR_MONO_TRACK_BASE = 1100;
static const SpriteID SPR_MONO_TRACK_N_S = 1117;
static const SpriteID SPR_MONO_TRACK_Y_SNOW = 1119;
static const SpriteID SPR_MONO_TRACK_X_SNOW = 1120;
static const SpriteID SPR_MGLV_SINGLE_X = 1169;
static const SpriteID SPR_MGLV_SINGLE_Y = 1170;
static const SpriteID SPR_MGLV_SINGLE_NORTH = 1171;
static const SpriteID SPR_MGLV_SINGLE_SOUTH = 1172;
static const SpriteID SPR_MGLV_SINGLE_EAST = 1173;
static const SpriteID SPR_MGLV_SINGLE_WEST = 1174;
static const SpriteID SPR_MGLV_TRACK_Y = 1175;
static const SpriteID SPR_MGLV_TRACK_X = 1176;
static const SpriteID SPR_MGLV_TRACK_BASE = 1182;
static const SpriteID SPR_MGLV_TRACK_Y_SNOW = 1184;
static const SpriteID SPR_MGLV_TRACK_X_SNOW = 1185;
static const SpriteID SPR_MGLV_TRACK_N_S = 1199;
static const SpriteID SPR_WAYPOINT_X_1 = SPR_OPENTTD_BASE + 78;
static const SpriteID SPR_WAYPOINT_X_2 = SPR_OPENTTD_BASE + 79;
Expand Down