diff --git a/os/win32/installer/install.nsi b/os/win32/installer/install.nsi index cd8794d9dd..ccf76777b5 100644 --- a/os/win32/installer/install.nsi +++ b/os/win32/installer/install.nsi @@ -5,7 +5,7 @@ !include ${VERSION_INCLUDE} !define APPURLLINK "http://www.openttd.org" -!define APPNAMEANDVERSION "${APPNAME} ${APPVERSION_FULL}" +!define APPNAMEANDVERSION "${APPNAME} ${APPVERSION}" !define MUI_ICON "..\..\..\media\openttd.ico" !define MUI_UNICON "..\..\..\media\openttd.ico" @@ -112,13 +112,6 @@ Section "!OpenTTD" Section1 File ${PATH_ROOT}bin\data\*.grf File ${PATH_ROOT}bin\data\*.obg File ${PATH_ROOT}bin\data\opntitle.dat - ; Copy scenario files (don't choke if they don't exist) - SetOutPath "$INSTDIR\scenario\" - File /nonfatal ${PATH_ROOT}bin\scenario\*.scn - - ; Copy heightmap files (don't choke if they don't exist) - SetOutPath "$INSTDIR\scenario\heightmap\" - File /nonfatal ${PATH_ROOT}bin\scenario\heightmap\*.* ; Copy the scripts SetOutPath "$INSTDIR\scripts\" diff --git a/src/company_cmd.cpp b/src/company_cmd.cpp index 6cc5b633fb..e8d3040c1b 100644 --- a/src/company_cmd.cpp +++ b/src/company_cmd.cpp @@ -445,13 +445,6 @@ Company *DoStartupNewCompany(bool is_ai) c->inaugurated_year = _cur_year; RandomCompanyManagerFaceBits(c->face, (GenderEthnicity)Random(), false); // create a random company manager face - /* Engine renewal settings */ - c->engine_renew_list = NULL; - c->renew_keep_length = false; - c->engine_renew = _settings_client.gui.autorenew; - c->engine_renew_months = _settings_client.gui.autorenew_months; - c->engine_renew_money = _settings_client.gui.autorenew_money; - GeneratePresidentName(c); InvalidateWindow(WC_GRAPH_LEGEND, 0); @@ -756,6 +749,9 @@ CommandCost CmdCompanyCtrl(TileIndex tile, DoCommandFlag flags, uint32 p1, uint3 /* This is the client (or non-dedicated server) who wants a new company */ if (cid == _network_own_client_id) { + /* Create p1 and p2 here because SetLocalCompany resets the gui.autorenew* settings. */ + uint32 p1 = (_settings_client.gui.autorenew << 15 ) | (_settings_client.gui.autorenew_months << 16) | 4; + uint32 p2 = _settings_client.gui.autorenew_money; assert(_local_company == COMPANY_SPECTATOR); SetLocalCompany(c->index); if (!StrEmpty(_settings_client.network.default_company_pass)) { @@ -767,13 +763,7 @@ CommandCost CmdCompanyCtrl(TileIndex tile, DoCommandFlag flags, uint32 p1, uint3 /* Now that we have a new company, broadcast our autorenew settings to * all clients so everything is in sync */ - NetworkSend_Command(0, - (_settings_client.gui.autorenew << 15 ) | (_settings_client.gui.autorenew_months << 16) | 4, - _settings_client.gui.autorenew_money, - CMD_SET_AUTOREPLACE, - NULL, - NULL - ); + NetworkSend_Command(0, p1, p2, CMD_SET_AUTOREPLACE, NULL, NULL); MarkWholeScreenDirty(); } diff --git a/src/newgrf.cpp b/src/newgrf.cpp index 427c044fd8..f8afcda323 100644 --- a/src/newgrf.cpp +++ b/src/newgrf.cpp @@ -5834,10 +5834,25 @@ static void FinaliseHouseArray() for (int i = 0; i < HOUSE_MAX; i++) { HouseSpec *hs = file->housespec[i]; - if (hs != NULL) { - _house_mngr.SetEntitySpec(hs); - if (hs->min_year < min_year) min_year = hs->min_year; + + if (hs == NULL) continue; + + const HouseSpec *next1 = (i + 1 < HOUSE_MAX ? file->housespec[i + 1] : NULL); + const HouseSpec *next2 = (i + 2 < HOUSE_MAX ? file->housespec[i + 2] : NULL); + const HouseSpec *next3 = (i + 3 < HOUSE_MAX ? file->housespec[i + 3] : NULL); + + if (((hs->building_flags & BUILDING_HAS_2_TILES) != 0 && + (next1 == NULL || !next1->enabled || (next1->building_flags & BUILDING_HAS_1_TILE) != 0)) || + ((hs->building_flags & BUILDING_HAS_4_TILES) != 0 && + (next2 == NULL || !next2->enabled || (next2->building_flags & BUILDING_HAS_1_TILE) != 0 || + next3 == NULL || !next3->enabled || (next3->building_flags & BUILDING_HAS_1_TILE) != 0))) { + hs->enabled = false; + DEBUG(grf, 1, "FinaliseHouseArray: %s defines house %d as multitile, but no suitable tiles follow. Disabling house.", file->filename, hs->local_id); + continue; } + + _house_mngr.SetEntitySpec(hs); + if (hs->min_year < min_year) min_year = hs->min_year; } } diff --git a/src/openttd.cpp b/src/openttd.cpp index 3552af646b..2dc2e48dd5 100644 --- a/src/openttd.cpp +++ b/src/openttd.cpp @@ -745,6 +745,11 @@ static void MakeNewGameDone() /* Create a single company */ DoStartupNewCompany(false); + Company *c = GetCompany(COMPANY_FIRST); + c->engine_renew = _settings_client.gui.autorenew; + c->engine_renew_months = _settings_client.gui.autorenew_months; + c->engine_renew_money = _settings_client.gui.autorenew_money; + IConsoleCmdExec("exec scripts/game_start.scr 0"); SetLocalCompany(COMPANY_FIRST); diff --git a/src/terraform_gui.cpp b/src/terraform_gui.cpp index 3635ae3c49..4074aa1e4f 100644 --- a/src/terraform_gui.cpp +++ b/src/terraform_gui.cpp @@ -22,9 +22,11 @@ #include "textbuf_gui.h" #include "genworld.h" #include "tree_map.h" +#include "station_map.h" #include "landscape_type.h" #include "tilehighlight_func.h" #include "settings_type.h" +#include "waypoint.h" #include "table/sprites.h" #include "table/strings.h" @@ -572,24 +574,34 @@ static OnButtonClick * const _editor_terraform_button_proc[] = { static void ResetLandscapeConfirmationCallback(Window *w, bool confirmed) { if (confirmed) { - Company *c; - /* Set generating_world to true to get instant-green grass after removing * company property. */ _generating_world = true; - /* Delete all stations owned by a company */ - Station *st; - FOR_ALL_STATIONS(st) { - if (IsValidCompanyID(st->owner)) delete st; - } - /* Delete all companies */ + Company *c; FOR_ALL_COMPANIES(c) { ChangeOwnershipOfCompanyItems(c->index, INVALID_OWNER); delete c; } + _generating_world = false; + + /* Delete all station signs */ + Station *st; + FOR_ALL_STATIONS(st) { + /* There can be buoys, remove them */ + if (IsBuoyTile(st->xy)) DoCommand(st->xy, 0, 0, DC_EXEC, CMD_LANDSCAPE_CLEAR); + delete st; + } + + /* The same for waypoints */ + Waypoint *wp; + FOR_ALL_WAYPOINTS(wp) { + delete wp; + } + + MarkWholeScreenDirty(); } } diff --git a/src/town.h b/src/town.h index 9c87b1c447..384ff9b3a2 100644 --- a/src/town.h +++ b/src/town.h @@ -43,6 +43,7 @@ enum BuildingFlags { BUILDING_IS_CHURCH = 1U << 6, BUILDING_IS_STADIUM = 1U << 7, BUILDING_HAS_1_TILE = TILE_SIZE_1x1 | TILE_SIZE_2x1 | TILE_SIZE_1x2 | TILE_SIZE_2x2, + BUILDING_HAS_2_TILES = TILE_SIZE_2x1 | TILE_SIZE_1x2 | TILE_SIZE_2x2, BUILDING_2_TILES_X = TILE_SIZE_2x1 | TILE_SIZE_2x2, BUILDING_2_TILES_Y = TILE_SIZE_1x2 | TILE_SIZE_2x2, BUILDING_HAS_4_TILES = TILE_SIZE_2x2, diff --git a/src/win32.cpp b/src/win32.cpp index 471801e93a..8e1b343461 100644 --- a/src/win32.cpp +++ b/src/win32.cpp @@ -1219,7 +1219,7 @@ const char *FS2OTTD(const TCHAR *name) wchar_t w; int len = MultiByteToWideChar(_codepage, 0, name, 1, &w, 1); if (len != 1) { - DEBUG(misc, 0, "[utf8] M2W error converting '%c'. Errno %d", *name, GetLastError()); + DEBUG(misc, 0, "[utf8] M2W error converting '%c'. Errno %lu", *name, GetLastError()); continue; } @@ -1258,7 +1258,7 @@ const TCHAR *OTTD2FS(const char *name) char mb; int len = WideCharToMultiByte(_codepage, 0, (wchar_t*)&c, 1, &mb, 1, NULL, NULL); if (len != 1) { - DEBUG(misc, 0, "[utf8] W2M error converting '0x%X'. Errno %d", c, GetLastError()); + DEBUG(misc, 0, "[utf8] W2M error converting '0x%X'. Errno %lu", c, GetLastError()); continue; }