Merge branch 'openttd'

This commit is contained in:
dP
2024-03-17 01:02:31 +07:00
164 changed files with 9303 additions and 5998 deletions
+1 -1
View File
@@ -48,7 +48,7 @@ static const size_t COMPAT_MTU = 1460; ///< Number of bytes we can pack in a sin
static const byte NETWORK_GAME_ADMIN_VERSION = 3; ///< What version of the admin network do we use?
static const byte NETWORK_GAME_INFO_VERSION = 7; ///< What version of game-info do we use?
static const byte NETWORK_COORDINATOR_VERSION = 6; ///< What version of game-coordinator-protocol do we use?
static const byte NETWORK_SURVEY_VERSION = 1; ///< What version of the survey do we use?
static const byte NETWORK_SURVEY_VERSION = 2; ///< What version of the survey do we use?
static const uint NETWORK_NAME_LENGTH = 80; ///< The maximum length of the server name and map name, in bytes including '\0'
static const uint NETWORK_COMPANY_NAME_LENGTH = 128; ///< The maximum length of the company name, in bytes including '\0'
+2 -1
View File
@@ -883,7 +883,8 @@ NetworkRecvStatus ClientNetworkGameSocketHandler::Receive_SERVER_MAP_DONE(Packet
SendMapOk();
/* As we skipped switch-mode, update the time we "switched". */
_switch_mode_time = std::chrono::steady_clock::now();
_game_session_stats.start_time = std::chrono::steady_clock::now();
_game_session_stats.savegame_size = std::nullopt;
ShowClientList();
+3 -3
View File
@@ -327,15 +327,15 @@ static void DistributeQueue(CommandQueue &queue, const NetworkClientSocket *owne
/* Not technically the most performant way, but consider clients rarely click more than once per tick. */
for (auto cp = queue.begin(); cp != queue.end(); /* removing some items */) {
/* Limit the number of commands per client per tick. */
if (--to_go < 0) break;
/* Do not distribute commands when paused and the command is not allowed while paused. */
if (_pause_mode != PM_UNPAUSED && !IsCommandAllowedWhilePaused(cp->cmd)) {
++cp;
continue;
}
/* Limit the number of commands per client per tick. */
if (--to_go < 0) break;
DistributeCommandPacket(*cp, owner);
NetworkAdminCmdLogging(owner, *cp);
cp = queue.erase(cp);
+4 -1
View File
@@ -466,6 +466,8 @@ class NetworkContentListWindow : public Window, ContentCallback {
/** Filter content by tags/name */
static bool CDECL TagNameFilter(const ContentInfo * const *a, ContentListFilterData &filter)
{
if ((*a)->state == ContentInfo::SELECTED || (*a)->state == ContentInfo::AUTOSELECTED) return true;
filter.string_filter.ResetState();
for (auto &tag : (*a)->tags) filter.string_filter.AddLine(tag);
@@ -811,6 +813,7 @@ public:
if (click_count > 1 || IsInsideBS(pt.x, checkbox->pos_x, checkbox->current_x)) {
_network_content_client.ToggleSelectedState(this->selected);
this->content.ForceResort();
this->content.ForceRebuild();
}
if (this->filter_data.types.any()) {
@@ -997,7 +1000,7 @@ public:
this->SetWidgetDisabledState(WID_NCL_DOWNLOAD, this->filesize_sum == 0 || (FindWindowById(WC_NETWORK_STATUS_WINDOW, WN_NETWORK_STATUS_WINDOW_CONTENT_DOWNLOAD) != nullptr && data != 2));
this->SetWidgetDisabledState(WID_NCL_UNSELECT, this->filesize_sum == 0);
this->SetWidgetDisabledState(WID_NCL_SELECT_ALL, !show_select_all);
this->SetWidgetDisabledState(WID_NCL_SELECT_UPDATE, !show_select_upgrade);
this->SetWidgetDisabledState(WID_NCL_SELECT_UPDATE, !show_select_upgrade || !this->filter_data.string_filter.IsEmpty());
this->SetWidgetDisabledState(WID_NCL_OPEN_URL, this->selected == nullptr || this->selected->url.empty());
for (TextfileType tft = TFT_CONTENT_BEGIN; tft < TFT_CONTENT_END; tft++) {
this->SetWidgetDisabledState(WID_NCL_TEXTFILE + tft, this->selected == nullptr || this->selected->state != ContentInfo::ALREADY_HERE || !this->selected->GetTextfile(tft).has_value());
+2 -3
View File
@@ -19,8 +19,6 @@
#include "../safeguards.h"
extern std::string _savegame_id;
NetworkSurveyHandler _survey = {};
NLOHMANN_JSON_SERIALIZE_ENUM(NetworkSurveyHandler::Reason, {
@@ -43,7 +41,6 @@ std::string NetworkSurveyHandler::CreatePayload(Reason reason, bool for_preview)
survey["schema"] = NETWORK_SURVEY_VERSION;
survey["reason"] = reason;
survey["id"] = _savegame_id;
survey["date"] = fmt::format("{:%Y-%m-%d %H:%M:%S} (UTC)", fmt::gmtime(time(nullptr)));
#ifdef SURVEY_KEY
@@ -53,6 +50,8 @@ std::string NetworkSurveyHandler::CreatePayload(Reason reason, bool for_preview)
survey["key"] = "";
#endif
SurveyGameSession(survey["session"]);
{
auto &info = survey["info"];
SurveyOS(info["os"]);