diff --git a/games/openttd/Makefile b/games/openttd/Makefile index 2c8767d76450..651beb326053 100644 --- a/games/openttd/Makefile +++ b/games/openttd/Makefile @@ -1,53 +1,53 @@ PORTNAME= openttd -DISTVERSION= 13.4 +DISTVERSION= 14.1 CATEGORIES= games MASTER_SITES= https://cdn.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 +LIB_DEPENDS= libcurl.so:ftp/curl \ + liblzo2.so:archivers/lzo2 \ + libpng.so:graphics/png 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} OPTIONS_DEFINE= DOCS FLUIDSYNTH SAVE_PASSWORDS SDL1 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 SDL1_DESC= Use SDL v1.2 instead of v2 for GUI SDL1_VARS= _SDL_VERSION=sdl SDL1_CMAKE_OFF= -DWITH_SDL2:BOOL=ON SDL1_VARS_OFF= _SDL_VERSION=sdl2 SERVER_DESC= Build dedicated server only (no GUI) -SERVER_USES_OFF= gnome sdl +SERVER_USES_OFF= 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 + libharfbuzz.so:print/harfbuzz \ + libicui18n.so:devel/icu SERVER_VARS= USE_RC_SUBR=${PORTNAME} 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 c3828606cb3b..583c68d53a31 100644 --- a/games/openttd/distinfo +++ b/games/openttd/distinfo @@ -1,3 +1,3 @@ -TIMESTAMP = 1708509717 -SHA256 (openttd-13.4-source.tar.xz) = 2a1deba01bfe58e2188879f450c3fa4f3819271ab49bf348dd66545f040d146f -SIZE (openttd-13.4-source.tar.xz) = 7428012 +TIMESTAMP = 1715229396 +SHA256 (openttd-14.1-source.tar.xz) = 2c14c8f01f44148c4f2c88c169a30abcdb002eb128a92b9adb76baa76b013494 +SIZE (openttd-14.1-source.tar.xz) = 8015032 diff --git a/games/openttd/files/extra-patch-save-passwords b/games/openttd/files/extra-patch-save-passwords index becd87ea8e82..ac4fa72b2e5e 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); + auto p = std::make_unique(PACKET_SERVER_NEED_GAME_PASSWORD); + this->SendPacket(std::move(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]; ++ std::string password_file_name; + -+ seprintf( password_file_name, lastof(password_file_name), "%u.pwd", _settings_game.game_creation.generation_seed ); ++ password_file_name = fmt::format("{}.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]; ++ std::string password_file_name; + -+ seprintf( password_file_name, lastof(password_file_name), "%u.pwd", _settings_game.game_creation.generation_seed ); ++ password_file_name = fmt::format("{}.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) */ 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? + UseRelayService use_relay_service; ///< Use relay service? + ParticipateSurvey participate_survey; ///< Participate in the automated survey + 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 + flags = SF_NOT_IN_SAVE | SF_NO_NETWORK_SYNC | SF_NETWORK_ONLY + def = false + cat = SC_EXPERT + +[SDTC_BOOL] +var = network.save_password +flags = SF_NOT_IN_SAVE | SF_NO_NETWORK_SYNC +def = false diff --git a/games/openttd/files/patch-CMakeLists.txt b/games/openttd/files/patch-CMakeLists.txt index d6e569721c72..6ad87864e4c0 100644 --- a/games/openttd/files/patch-CMakeLists.txt +++ b/games/openttd/files/patch-CMakeLists.txt @@ -1,28 +1,33 @@ ---- CMakeLists.txt.orig 2023-07-29 23:01:44 UTC +--- CMakeLists.txt.orig 2024-04-13 12:55:23 UTC +++ CMakeLists.txt -@@ -129,11 +129,14 @@ if(NOT OPTION_DEDICATED) +@@ -143,11 +143,14 @@ if(NOT OPTION_DEDICATED) find_package(Allegro) if(NOT APPLE) find_package(Freetype) +if(WITH_SDL2) find_package(SDL2) - if(NOT SDL2_FOUND) +else() find_package(SDL) endif() +if(WITH_FLUIDSYNTH) find_package(Fluidsynth) +endif() - find_package(Fontconfig) - find_package(ICU OPTIONAL_COMPONENTS i18n lx) - endif() -@@ -260,7 +263,9 @@ link_package(LIBLZMA TARGET LibLZMA::LibLZMA ENCOURAGE - link_package(LZO) + if(Freetype_FOUND) + find_package(Fontconfig) + endif() +@@ -323,9 +326,14 @@ if(NOT EMSCRIPTEN) + endif() if(NOT OPTION_DEDICATED) + if(WITH_FLUIDSYNTH) link_package(Fluidsynth) + endif() ++ if(NOT WITH_SDL2) link_package(SDL) ++ else() link_package(SDL2 TARGET SDL2::SDL2) ++ endif() link_package(Allegro) + link_package(FREETYPE TARGET Freetype::Freetype) + link_package(Fontconfig TARGET Fontconfig::Fontconfig) diff --git a/games/openttd/files/patch-cmake_InstallAndPackage.cmake b/games/openttd/files/patch-cmake_InstallAndPackage.cmake index 270b498a63db..e313ef9e824a 100644 --- a/games/openttd/files/patch-cmake_InstallAndPackage.cmake +++ b/games/openttd/files/patch-cmake_InstallAndPackage.cmake @@ -1,19 +1,19 @@ --- cmake/InstallAndPackage.cmake.orig 2021-04-01 12:33:44 UTC +++ cmake/InstallAndPackage.cmake @@ -33,7 +33,6 @@ install(DIRECTORY COMPONENT language_files) install(FILES - ${CMAKE_SOURCE_DIR}/COPYING.md ${CMAKE_SOURCE_DIR}/README.md ${CMAKE_SOURCE_DIR}/changelog.txt ${CMAKE_SOURCE_DIR}/docs/multiplayer.md @@ -58,7 +57,7 @@ if(OPTION_INSTALL_FHS) COMPONENT manual) endif() --if(UNIX AND NOT APPLE) -+if(UNIX AND NOT APPLE AND NOT OPTION_DEDICATED) +-if(UNIX AND NOT APPLE AND NOT EMSCRIPTEN) ++if(UNIX AND NOT APPLE AND NOT EMSCRIPTEN AND NOT OPTION_DEDICATED) install(DIRECTORY ${CMAKE_BINARY_DIR}/media/icons ${CMAKE_BINARY_DIR}/media/pixmaps diff --git a/games/openttd/pkg-plist b/games/openttd/pkg-plist index 1301465a3592..63a33f92e99b 100644 --- a/games/openttd/pkg-plist +++ b/games/openttd/pkg-plist @@ -1,130 +1,151 @@ bin/openttd share/man/man6/openttd.6.gz +%%PORTDOCS%%%%DOCSDIR%%/CONTRIBUTING.md +%%PORTDOCS%%%%DOCSDIR%%/CREDITS.md %%PORTDOCS%%%%DOCSDIR%%/README.md %%PORTDOCS%%%%DOCSDIR%%/changelog.txt %%PORTDOCS%%%%DOCSDIR%%/known-bugs.txt -%%PORTDOCS%%%%DOCSDIR%%/multiplayer.md +%%PORTDOCS%%%%DOCSDIR%%/docs/admin_network.md +%%PORTDOCS%%%%DOCSDIR%%/docs/debugging_desyncs.md +%%PORTDOCS%%%%DOCSDIR%%/docs/desync.md +%%PORTDOCS%%%%DOCSDIR%%/docs/directory_structure.md +%%PORTDOCS%%%%DOCSDIR%%/docs/eints.md +%%PORTDOCS%%%%DOCSDIR%%/docs/game_coordinator.md +%%PORTDOCS%%%%DOCSDIR%%/docs/linkgraph.md +%%PORTDOCS%%%%DOCSDIR%%/docs/logging_and_performance_metrics.md +%%PORTDOCS%%%%DOCSDIR%%/docs/multiplayer.md +%%PORTDOCS%%%%DOCSDIR%%/docs/obg_format.txt +%%PORTDOCS%%%%DOCSDIR%%/docs/obm_format.txt +%%PORTDOCS%%%%DOCSDIR%%/docs/obs_format.txt +%%PORTDOCS%%%%DOCSDIR%%/docs/savegame_format.md +%%PORTDOCS%%%%DOCSDIR%%/docs/symbol_server.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%%/ai/compat_14.nut +%%DATADIR%%/game/compat_14.nut +%%DATADIR%%/baseset/OpenTTD-Mono.ttf +%%DATADIR%%/baseset/OpenTTD-Sans.ttf +%%DATADIR%%/baseset/OpenTTD-Serif.ttf +%%DATADIR%%/baseset/OpenTTD-Small.ttf %%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