diff --git a/games/openttd/Makefile b/games/openttd/Makefile index 7a61527202a4..12ef1dbac690 100644 --- a/games/openttd/Makefile +++ b/games/openttd/Makefile @@ -1,59 +1,56 @@ PORTNAME= openttd -DISTVERSION= 12.2 -PORTREVISION= 1 +DISTVERSION= 13.0 CATEGORIES= games MASTER_SITES= https://proxy.binaries.openttd.org/openttd-releases/${DISTVERSION}/ DISTNAME= ${PORTNAME}-${DISTVERSION}-source MAINTAINER= danfe@FreeBSD.org COMMENT= Open source clone of Microprose Transport Tycoon Deluxe WWW= https://www.openttd.org/ LICENSE= GPLv2 LIB_DEPENDS= libpng.so:graphics/png \ liblzo2.so:archivers/lzo2 USES= cmake compiler:c++17-lang cpe pkgconfig tar:xz CMAKE_ARGS= -DCMAKE_INSTALL_BINDIR:PATH=bin \ -DCMAKE_INSTALL_DATADIR:PATH=share WRKSRC= ${WRKDIR}/${PORTNAME}-${DISTVERSION} -SUB_FILES= pkg-message - OPTIONS_DEFINE= DOCS FLUIDSYNTH SAVE_PASSWORDS SERVER SERVER_PREVENTS= FLUIDSYNTH FLUIDSYNTH_LIB_DEPENDS= libfluidsynth.so:audio/fluidsynth FLUIDSYNTH_CMAKE_ON= -DWITH_FLUIDSYNTH:BOOL=ON SAVE_PASSWORDS_DESC= Save passwords between server restarts SAVE_PASSWORDS_EXTRA_PATCHES= ${FILESDIR}/extra-patch-save-passwords SERVER_DESC= Build dedicated server only (no GUI) SERVER_USES_OFF= gnome sdl SERVER_USE_OFF= SDL=${_SDL_VERSION} SERVER_CMAKE_ON= -DOPTION_DEDICATED:BOOL=ON SERVER_LIB_DEPENDS_OFF= libfontconfig.so:x11-fonts/fontconfig \ libfreetype.so:print/freetype2 \ libicui18n.so:devel/icu \ libicu-le-hb.so:devel/icu-le-hb \ libiculx.so:devel/icu-lx SERVER_VARS= USE_RC_SUBR=${PORTNAME} .include .if exists(${LOCALBASE}/lib/libSDL2.so) _SDL_VERSION= sdl2 .else _SDL_VERSION= sdl .endif post-install-SERVER-on: @${REINPLACE_CMD} -E '/\.desktop|icons|pixmaps/d' ${TMPPLIST} do-test: @cd ${TEST_WRKSRC} && ctest -C ${CMAKE_BUILD_TYPE} ${_MAKE_JOBS} .include diff --git a/games/openttd/distinfo b/games/openttd/distinfo index 11f80bca2a3d..2b588f925aa5 100644 --- a/games/openttd/distinfo +++ b/games/openttd/distinfo @@ -1,3 +1,3 @@ -TIMESTAMP = 1648897817 -SHA256 (openttd-12.2-source.tar.xz) = 81508f0de93a0c264b216ef56a05f8381fff7bffa6d010121a21490b4dace95c -SIZE (openttd-12.2-source.tar.xz) = 7377496 +TIMESTAMP = 1675619840 +SHA256 (openttd-13.0-source.tar.xz) = 339df8e0e0827087c83afe78f8efc6a73b0a3d8a950a0b53137ce6e8aad7ab67 +SIZE (openttd-13.0-source.tar.xz) = 7422316 diff --git a/games/openttd/files/extra-patch-save-passwords b/games/openttd/files/extra-patch-save-passwords index 37374d77683d..becd87ea8e82 100644 --- a/games/openttd/files/extra-patch-save-passwords +++ b/games/openttd/files/extra-patch-save-passwords @@ -1,134 +1,134 @@ --- src/network/network_func.h.orig 2021-10-17 09:31:25 UTC +++ src/network/network_func.h @@ -73,7 +73,8 @@ void NetworkServerShowStatusToConsole(); bool NetworkServerStart(); void NetworkServerNewCompany(const Company *company, NetworkClientInfo *ci); bool NetworkServerChangeClientName(ClientID client_id, const std::string &new_name); - +void NetworkSavePassword(); +void NetworkLoadPassword(); void NetworkServerDoMove(ClientID client_id, CompanyID company_id); void NetworkServerSendRcon(ClientID client_id, TextColour colour_code, const std::string &string); --- src/network/network_server.cpp.orig 2021-10-17 09:31:25 UTC +++ src/network/network_server.cpp @@ -32,6 +32,7 @@ #include #include +#include "../fileio_func.h" #include "../safeguards.h" @@ -439,6 +440,7 @@ NetworkRecvStatus ServerNetworkGameSocketHandler::Send /* Reset 'lag' counters */ this->last_frame = this->last_frame_server = _frame_counter; + Debug( net, 1, "requesting GAME password" ); Packet *p = new Packet(PACKET_SERVER_NEED_GAME_PASSWORD); this->SendPacket(p); return NETWORK_RECV_STATUS_OKAY; @@ -1563,6 +1565,9 @@ static void NetworkAutoCleanCompanies() IConsolePrint(CC_INFO, "Auto-removed protection from company #{}.", c->index + 1); _network_company_states[c->index].months_empty = 0; NetworkServerUpdateCompanyPassworded(c->index, false); + if (_settings_client.network.save_password) { + NetworkSavePassword( ); + } } /* 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) { @@ -1656,6 +1661,9 @@ void NetworkServerSetCompanyPassword(CompanyID company } NetworkServerUpdateCompanyPassworded(company_id, !_network_company_states[company_id].password.empty()); + if (_settings_client.network.save_password) { + NetworkSavePassword( ); + } } /** @@ -2022,6 +2030,49 @@ bool NetworkCompanyHasClients(CompanyID company) if (ci->client_playas == company) return true; } return false; +} + +void NetworkSavePassword( ) +{ + static FILE *file_pointer; + char password_file_name[80]; + + seprintf( password_file_name, lastof(password_file_name), "%u.pwd", _settings_game.game_creation.generation_seed ); + Debug( net, 0, "Saving companies password to %s", password_file_name ); + file_pointer = FioFOpenFile( password_file_name, "wb", SAVE_DIR ); + + if (file_pointer != NULL) { + for( CompanyID l_company = (CompanyID)0; l_company < MAX_COMPANIES; l_company++ ) { + if (NetworkCompanyIsPassworded(l_company)) { + fwrite(_network_company_states[l_company].password.c_str(), _network_company_states[l_company].password.size(), 1, file_pointer); + } + fwrite( "\n", 1, 1, file_pointer ); + } + fclose(file_pointer); + } +} + +void NetworkLoadPassword( ) +{ + static FILE *file_pointer; + char password[NETWORK_PASSWORD_LENGTH]; + char password_file_name[80]; + + seprintf( password_file_name, lastof(password_file_name), "%u.pwd", _settings_game.game_creation.generation_seed ); + file_pointer = FioFOpenFile( password_file_name, "rb", SAVE_DIR ); + if (file_pointer != NULL) { + Debug( net, 0, "Loading password from %s", password_file_name ); + for( CompanyID l_company = (CompanyID)0; l_company < MAX_COMPANIES; l_company++ ) { + fgets( password, sizeof( password), file_pointer); + if (strlen(password)>1) { + fseek( file_pointer, 1L, SEEK_CUR ); + _network_company_states[l_company].password = password; + NetworkServerUpdateCompanyPassworded(l_company, !_network_company_states[l_company].password.empty()); + } + } + } else { + Debug( net, 0, "Password file %s not found", password_file_name ); + } } --- src/openttd.cpp.orig 2021-10-17 09:31:25 UTC +++ src/openttd.cpp @@ -1046,6 +1046,10 @@ void SwitchToMode(SwitchMode new_mode) OnStartGame(_network_dedicated); /* Decrease pause counter (was increased from opening load dialog) */ - DoCommandP(0, PM_PAUSED_SAVELOAD, 0, CMD_PAUSE); + Command::Post(PM_PAUSED_SAVELOAD, false); + // Try to load password + if (_settings_client.network.save_password) { + NetworkLoadPassword( ); + } } break; } --- src/settings_type.h.orig 2021-10-17 09:31:25 UTC +++ src/settings_type.h @@ -296,6 +296,7 @@ struct NetworkSettings { std::string last_joined; ///< Last joined server bool no_http_content_downloads; ///< do not do content downloads over HTTP UseRelayService use_relay_service; ///< Use relay service? + bool save_password; ///< If password file is used }; /** Settings related to the creation of games. */ --- src/table/settings/network_settings.ini.orig 2021-10-17 09:31:25 UTC +++ src/table/settings/network_settings.ini @@ -265,3 +265,8 @@ str = STR_CONFIG_SETTING_USE_RELAY_SERVICE strhelp = STR_CONFIG_SETTING_USE_RELAY_SERVICE_HELPTEXT strval = STR_CONFIG_SETTING_USE_RELAY_SERVICE_NEVER cat = SC_BASIC + +[SDTC_BOOL] +var = network.save_password +flags = SF_NOT_IN_SAVE | SF_NO_NETWORK_SYNC +def = false diff --git a/games/openttd/files/pkg-message.in b/games/openttd/pkg-message similarity index 100% rename from games/openttd/files/pkg-message.in rename to games/openttd/pkg-message diff --git a/games/openttd/pkg-plist b/games/openttd/pkg-plist index 9c49e916c09b..1301465a3592 100644 --- a/games/openttd/pkg-plist +++ b/games/openttd/pkg-plist @@ -1,128 +1,130 @@ bin/openttd share/man/man6/openttd.6.gz %%PORTDOCS%%%%DOCSDIR%%/README.md %%PORTDOCS%%%%DOCSDIR%%/changelog.txt %%PORTDOCS%%%%DOCSDIR%%/known-bugs.txt %%PORTDOCS%%%%DOCSDIR%%/multiplayer.md %%DATADIR%%/ai/compat_0.7.nut %%DATADIR%%/ai/compat_1.0.nut %%DATADIR%%/ai/compat_1.1.nut %%DATADIR%%/ai/compat_1.2.nut %%DATADIR%%/ai/compat_1.3.nut %%DATADIR%%/ai/compat_1.4.nut %%DATADIR%%/ai/compat_1.5.nut %%DATADIR%%/ai/compat_1.6.nut %%DATADIR%%/ai/compat_1.7.nut %%DATADIR%%/ai/compat_1.8.nut %%DATADIR%%/ai/compat_1.9.nut %%DATADIR%%/ai/compat_1.10.nut %%DATADIR%%/ai/compat_1.11.nut %%DATADIR%%/ai/compat_12.nut +%%DATADIR%%/ai/compat_13.nut %%DATADIR%%/baseset/no_music.obm %%DATADIR%%/baseset/no_sound.obs %%DATADIR%%/baseset/openttd.32.bmp %%DATADIR%%/baseset/openttd.grf %%DATADIR%%/baseset/opntitle.dat %%DATADIR%%/baseset/orig_dos.obg %%DATADIR%%/baseset/orig_dos.obm %%DATADIR%%/baseset/orig_dos.obs %%DATADIR%%/baseset/orig_dos_de.obg %%DATADIR%%/baseset/orig_extra.grf %%DATADIR%%/baseset/orig_tto.obm %%DATADIR%%/baseset/orig_win.obg %%DATADIR%%/baseset/orig_win.obm %%DATADIR%%/baseset/orig_win.obs %%DATADIR%%/game/compat_1.2.nut %%DATADIR%%/game/compat_1.3.nut %%DATADIR%%/game/compat_1.4.nut %%DATADIR%%/game/compat_1.5.nut %%DATADIR%%/game/compat_1.6.nut %%DATADIR%%/game/compat_1.7.nut %%DATADIR%%/game/compat_1.8.nut %%DATADIR%%/game/compat_1.9.nut %%DATADIR%%/game/compat_1.10.nut %%DATADIR%%/game/compat_1.11.nut %%DATADIR%%/game/compat_12.nut +%%DATADIR%%/game/compat_13.nut %%DATADIR%%/lang/afrikaans.lng %%DATADIR%%/lang/arabic_egypt.lng %%DATADIR%%/lang/basque.lng %%DATADIR%%/lang/belarusian.lng %%DATADIR%%/lang/brazilian_portuguese.lng %%DATADIR%%/lang/bulgarian.lng %%DATADIR%%/lang/catalan.lng %%DATADIR%%/lang/chuvash.lng %%DATADIR%%/lang/croatian.lng %%DATADIR%%/lang/czech.lng %%DATADIR%%/lang/danish.lng %%DATADIR%%/lang/dutch.lng %%DATADIR%%/lang/english.lng %%DATADIR%%/lang/english_AU.lng %%DATADIR%%/lang/english_US.lng %%DATADIR%%/lang/esperanto.lng %%DATADIR%%/lang/estonian.lng %%DATADIR%%/lang/faroese.lng %%DATADIR%%/lang/finnish.lng %%DATADIR%%/lang/french.lng %%DATADIR%%/lang/frisian.lng %%DATADIR%%/lang/gaelic.lng %%DATADIR%%/lang/galician.lng %%DATADIR%%/lang/german.lng %%DATADIR%%/lang/greek.lng %%DATADIR%%/lang/hebrew.lng %%DATADIR%%/lang/hindi.lng %%DATADIR%%/lang/hungarian.lng %%DATADIR%%/lang/icelandic.lng %%DATADIR%%/lang/ido.lng %%DATADIR%%/lang/indonesian.lng %%DATADIR%%/lang/irish.lng %%DATADIR%%/lang/italian.lng %%DATADIR%%/lang/japanese.lng %%DATADIR%%/lang/korean.lng %%DATADIR%%/lang/latin.lng %%DATADIR%%/lang/latvian.lng %%DATADIR%%/lang/lithuanian.lng %%DATADIR%%/lang/luxembourgish.lng %%DATADIR%%/lang/macedonian.lng %%DATADIR%%/lang/malay.lng %%DATADIR%%/lang/maltese.lng %%DATADIR%%/lang/marathi.lng %%DATADIR%%/lang/norwegian_bokmal.lng %%DATADIR%%/lang/norwegian_nynorsk.lng %%DATADIR%%/lang/persian.lng %%DATADIR%%/lang/polish.lng %%DATADIR%%/lang/portuguese.lng %%DATADIR%%/lang/romanian.lng %%DATADIR%%/lang/russian.lng %%DATADIR%%/lang/serbian.lng %%DATADIR%%/lang/simplified_chinese.lng %%DATADIR%%/lang/slovak.lng %%DATADIR%%/lang/slovenian.lng %%DATADIR%%/lang/spanish.lng %%DATADIR%%/lang/spanish_MX.lng %%DATADIR%%/lang/swedish.lng %%DATADIR%%/lang/tamil.lng %%DATADIR%%/lang/thai.lng %%DATADIR%%/lang/traditional_chinese.lng %%DATADIR%%/lang/turkish.lng %%DATADIR%%/lang/ukrainian.lng %%DATADIR%%/lang/urdu.lng %%DATADIR%%/lang/vietnamese.lng %%DATADIR%%/lang/welsh.lng %%DATADIR%%/scripts/autoexec.scr.example %%DATADIR%%/scripts/game_start.scr.example %%DATADIR%%/scripts/on_client.scr.example %%DATADIR%%/scripts/on_dedicated.scr.example %%DATADIR%%/scripts/on_server.scr.example %%DATADIR%%/scripts/on_server_connect.scr.example %%DATADIR%%/scripts/pre_dedicated.scr.example %%DATADIR%%/scripts/pre_server.scr.example %%DATADIR%%/scripts/readme.txt share/applications/openttd.desktop share/icons/hicolor/16x16/apps/openttd.png share/icons/hicolor/32x32/apps/openttd.png share/icons/hicolor/48x48/apps/openttd.png share/icons/hicolor/64x64/apps/openttd.png share/icons/hicolor/128x128/apps/openttd.png share/icons/hicolor/256x256/apps/openttd.png share/pixmaps/openttd.32.xpm share/pixmaps/openttd.64.xpm