diff --git a/os/windows/installer/install.nsi b/os/windows/installer/install.nsi index 5684b64b1d..9e2e250707 100644 --- a/os/windows/installer/install.nsi +++ b/os/windows/installer/install.nsi @@ -560,12 +560,12 @@ Function CheckWindowsVersion StrCmp $R0 "win9x" 0 WinNT ClearErrors StrCmp ${APPARCH} "win9x" Done 0 - MessageBox MB_OKCANCEL|MB_ICONSTOP "You are trying to install the Windows 2000, XP and Vista version on Windows 95, 98 or ME. This is will not work. Please download the correct version. Do you really want to continue?" IDOK Done IDCANCEL Abort + MessageBox MB_OKCANCEL|MB_ICONSTOP "You are trying to install the Windows 2000, XP, Vista and 7 version on Windows 95, 98 or ME. This is will not work. Please download the correct version. Do you really want to continue?" IDOK Done IDCANCEL Abort GoTo Done WinNT: ClearErrors StrCmp ${APPARCH} "win9x" 0 Done - MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION "You are trying to install the Windows 95, 98 and ME version on Windows 2000, XP or Vista. This is not advised, but will work with reduced capabilities. We suggest that you download the correct version. Do you really want to continue?" IDOK Done IDCANCEL Abort + MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION "You are trying to install the Windows 95, 98 and ME version on Windows 2000, XP, Vista or 7. This is not advised, but will work with reduced capabilities. We suggest that you download the correct version. Do you really want to continue?" IDOK Done IDCANCEL Abort Abort: Quit Done: diff --git a/src/engine.cpp b/src/engine.cpp index 8774b0b3ea..3d97ee21ac 100644 --- a/src/engine.cpp +++ b/src/engine.cpp @@ -91,6 +91,8 @@ Engine::Engine(VehicleType type, EngineID base) this->info.base_life = 0xFF; /* Set road vehicle tractive effort to the default value */ if (type == VEH_ROAD) this->u.road.tractive_effort = 0x4C; + /* Aircraft must have CT_INVALID as default, as there is no property */ + if (type == VEH_AIRCRAFT) this->info.cargo_type = CT_INVALID; /* Set visual effect to the default value */ switch (type) { case VEH_TRAIN: this->u.rail.visual_effect = VE_DEFAULT; break; diff --git a/src/misc.cpp b/src/misc.cpp index 40fd7e0d85..5d5dd9c296 100644 --- a/src/misc.cpp +++ b/src/misc.cpp @@ -14,6 +14,7 @@ #include "news_func.h" #include "ai/ai.hpp" #include "ai/ai_gui.hpp" +#include "newgrf.h" #include "newgrf_house.h" #include "group.h" #include "economy_func.h" @@ -77,6 +78,8 @@ void InitializeGame(uint size_x, uint size_y, bool reset_date, bool reset_settin InitializeOldNames(); } + ResetPersistentNewGRFData(); + InitializeSound(); InitializeMusic(); diff --git a/src/network/core/address.cpp b/src/network/core/address.cpp index cb93e66b38..371f534033 100644 --- a/src/network/core/address.cpp +++ b/src/network/core/address.cpp @@ -132,6 +132,7 @@ const sockaddr_storage *NetworkAddress::GetAddress() * that means "don't care whether it is SOCK_STREAM or SOCK_DGRAM". */ this->Resolve(this->address.ss_family, SOCK_STREAM, AI_ADDRCONFIG, NULL, ResolveLoopProc); + this->resolved = true; } return &this->address; } diff --git a/src/network/core/address.h b/src/network/core/address.h index 3a23703ceb..d74fb09791 100644 --- a/src/network/core/address.h +++ b/src/network/core/address.h @@ -33,6 +33,7 @@ private: char hostname[NETWORK_HOSTNAME_LENGTH]; ///< The hostname int address_length; ///< The length of the resolved address sockaddr_storage address; ///< The resolved address + bool resolved; ///< Whether the address has been (tried to be) resolved /** * Helper function to resolve something to a socket. @@ -49,7 +50,8 @@ public: */ NetworkAddress(struct sockaddr_storage &address, int address_length) : address_length(address_length), - address(address) + address(address), + resolved(address_length != 0) { *this->hostname = '\0'; } @@ -59,7 +61,8 @@ public: * @param address the IP address with port */ NetworkAddress(sockaddr *address, int address_length) : - address_length(address_length) + address_length(address_length), + resolved(address_length != 0) { *this->hostname = '\0'; memset(&this->address, 0, sizeof(this->address)); @@ -73,7 +76,8 @@ public: * @param family the address family */ NetworkAddress(const char *hostname = "", uint16 port = 0, int family = AF_UNSPEC) : - address_length(0) + address_length(0), + resolved(false) { /* Also handle IPv6 bracket enclosed hostnames */ if (StrEmpty(hostname)) hostname = ""; @@ -121,7 +125,7 @@ public: */ bool IsResolved() const { - return this->address_length != 0; + return this->resolved; } bool IsFamily(int family); diff --git a/src/network/network.cpp b/src/network/network.cpp index 8b5245622c..1392d79a58 100644 --- a/src/network/network.cpp +++ b/src/network/network.cpp @@ -832,7 +832,6 @@ void NetworkUDPGameLoop() } else { _udp_client_socket->ReceivePackets(); if (_network_udp_broadcast > 0) _network_udp_broadcast--; - NetworkGameListRequery(); } } diff --git a/src/network/network_gui.cpp b/src/network/network_gui.cpp index 3c4013e97d..ec428ebc7d 100644 --- a/src/network/network_gui.cpp +++ b/src/network/network_gui.cpp @@ -890,6 +890,11 @@ public: this->vscroll->SetCapacityFromWidget(this, NGWW_MATRIX); this->GetWidget(NGWW_MATRIX)->widget_data = (this->vscroll->GetCapacity() << MAT_ROW_START) + (1 << MAT_COL_START); } + + virtual void OnTick() + { + NetworkGameListRequery(); + } }; Listing NetworkGameWindow::last_sorting = {false, 5}; diff --git a/src/network/network_udp.cpp b/src/network/network_udp.cpp index 8a4a6f945a..7f602e0831 100644 --- a/src/network/network_udp.cpp +++ b/src/network/network_udp.cpp @@ -473,9 +473,9 @@ static void NetworkUDPQueryServerThread(void *pntr) /* Clear item in gamelist */ NetworkGameList *item = CallocT(1); - item->address = *info; info->GetAddressAsString(item->info.server_name, lastof(item->info.server_name)); strecpy(item->info.hostname, info->GetHostname(), lastof(item->info.hostname)); + item->address = *info; item->manually = info->manually; NetworkGameListAddItemDelayed(item); diff --git a/src/newgrf.cpp b/src/newgrf.cpp index ddc90243c6..c92b1a4ebb 100644 --- a/src/newgrf.cpp +++ b/src/newgrf.cpp @@ -7326,6 +7326,20 @@ void ResetNewGRFData() _spritegroup_pool.CleanPool(); } +/** + * Reset NewGRF data which is stored persistently in savegames. + */ +void ResetPersistentNewGRFData() +{ + /* Reset override managers */ + _engine_mngr.ResetToDefaultMapping(); + _house_mngr.ResetMapping(); + _industry_mngr.ResetMapping(); + _industile_mngr.ResetMapping(); + _airport_mngr.ResetMapping(); + _airporttile_mngr.ResetMapping(); +} + static void BuildCargoTranslationMap() { memset(_cur_grffile->cargo_map, 0xFF, sizeof(_cur_grffile->cargo_map)); diff --git a/src/newgrf.h b/src/newgrf.h index 4e7ef3f06e..014280fc36 100644 --- a/src/newgrf.h +++ b/src/newgrf.h @@ -163,6 +163,7 @@ void LoadNewGRFFile(struct GRFConfig *config, uint file_index, GrfLoadingStage s void LoadNewGRF(uint load_index, uint file_index); void ReloadNewGRFData(); // in saveload/afterload.cpp void ResetNewGRFData(); +void ResetPersistentNewGRFData(); void CDECL grfmsg(int severity, const char *str, ...) WARN_FORMAT(2, 3); diff --git a/src/openttd.cpp b/src/openttd.cpp index 7af80a8c69..4041cf8c7f 100644 --- a/src/openttd.cpp +++ b/src/openttd.cpp @@ -300,17 +300,6 @@ static void ParseResolution(Dimension *res, const char *s) res->height = max(strtoul(t + 1, NULL, 0), 64UL); } -static void InitializeDynamicVariables() -{ - /* Dynamic stuff needs to be initialized somewhere... */ - _engine_mngr.ResetToDefaultMapping(); - _house_mngr.ResetMapping(); - _industry_mngr.ResetMapping(); - _industile_mngr.ResetMapping(); - _airport_mngr.ResetMapping(); - _airporttile_mngr.ResetMapping(); -} - /** * Unitializes drivers, frees allocated memory, cleans pools, ... @@ -610,9 +599,6 @@ int ttd_main(int argc, char *argv[]) /* initialize screenshot formats */ InitializeScreenshotFormats(); - /* initialize all variables that are allocated dynamically */ - InitializeDynamicVariables(); - /* Initialize FreeType */ InitFreeType(); @@ -837,7 +823,6 @@ static void MakeNewGame(bool from_heightmap, bool reset_settings) _game_mode = GM_NORMAL; ResetGRFConfig(true); - InitializeDynamicVariables(); GenerateWorldSetCallback(&MakeNewGameDone); GenerateWorld(from_heightmap ? GWM_HEIGHTMAP : GWM_NEWGAME, 1 << _settings_game.game_creation.map_x, 1 << _settings_game.game_creation.map_y, reset_settings); diff --git a/src/saveload/saveload.cpp b/src/saveload/saveload.cpp index 22ee511fbe..85eb01b441 100644 --- a/src/saveload/saveload.cpp +++ b/src/saveload/saveload.cpp @@ -2548,8 +2548,6 @@ static SaveOrLoadResult DoLoad(LoadFilter *reader, bool load_check) _next_offs = 0; if (!load_check) { - _engine_mngr.ResetToDefaultMapping(); - /* Old maps were hardcoded to 256x256 and thus did not contain * any mapsize information. Pre-initialize to 256x256 to not to * confuse old games */ @@ -2653,7 +2651,6 @@ SaveOrLoadResult SaveOrLoad(const char *filename, int mode, Subdirectory sb, boo /* Load a TTDLX or TTDPatch game */ if (mode == SL_OLD_LOAD) { - _engine_mngr.ResetToDefaultMapping(); InitializeGame(256, 256, true, true); // set a mapsize of 256x256 for TTDPatch games or it might get confused /* TTD/TTO savegames have no NewGRFs, TTDP savegame have them