Merge branch 'master' into jgrpp
# Conflicts: # .github/workflows/release-windows.yml # src/company_base.h # src/company_cmd.cpp # src/company_gui.cpp # src/console_cmds.cpp # src/economy.cpp # src/economy_cmd.h # src/fios.h # src/goal.cpp # src/group_gui.cpp # src/network/core/config.h # src/network/network_admin.cpp # src/newgrf_config.cpp # src/os/windows/win32.cpp # src/saveload/afterload.cpp # src/saveload/company_sl.cpp # src/saveload/saveload.cpp # src/saveload/saveload_error.hpp # src/settings_gui.cpp # src/ship_cmd.cpp # src/stdafx.h # src/story.cpp # src/story_base.h # src/string.cpp # src/table/settings/economy_settings.ini # src/tests/CMakeLists.txt # src/tests/math_func.cpp
This commit is contained in:
@@ -44,7 +44,7 @@ static const uint16 UDP_MTU_SHORT = 1400; ///< Numbe
|
||||
static const uint16 TCP_MTU = 32767; ///< Number of bytes we can pack in a single TCP packet
|
||||
static const uint16 COMPAT_MTU = 1460; ///< Number of bytes we can pack in a single packet for backward compatibility
|
||||
|
||||
static const byte NETWORK_GAME_ADMIN_VERSION = 1; ///< What version of the admin network do we use?
|
||||
static const byte NETWORK_GAME_ADMIN_VERSION = 3; ///< What version of the admin network do we use?
|
||||
static const byte NETWORK_GAME_INFO_VERSION = 6; ///< What version of game-info do we use?
|
||||
static const byte NETWORK_COORDINATOR_VERSION = 6; ///< What version of game-coordinator-protocol do we use?
|
||||
|
||||
|
@@ -332,10 +332,6 @@ NetworkRecvStatus ServerNetworkAdminSocketHandler::SendCompanyInfo(const Company
|
||||
p->Send_bool (c->is_ai);
|
||||
p->Send_uint8 (CeilDiv(c->months_of_bankruptcy, 3)); // send as quarters_of_bankruptcy
|
||||
|
||||
for (size_t i = 0; i < lengthof(c->share_owners); i++) {
|
||||
p->Send_uint8(c->share_owners[i]);
|
||||
}
|
||||
|
||||
this->SendPacket(p);
|
||||
|
||||
return NETWORK_RECV_STATUS_OKAY;
|
||||
@@ -359,10 +355,6 @@ NetworkRecvStatus ServerNetworkAdminSocketHandler::SendCompanyUpdate(const Compa
|
||||
p->Send_bool (NetworkCompanyIsPassworded(c->index));
|
||||
p->Send_uint8 (CeilDiv(c->months_of_bankruptcy, 3)); // send as quarters_of_bankruptcy
|
||||
|
||||
for (size_t i = 0; i < lengthof(c->share_owners); i++) {
|
||||
p->Send_uint8(c->share_owners[i]);
|
||||
}
|
||||
|
||||
this->SendPacket(p);
|
||||
|
||||
return NETWORK_RECV_STATUS_OKAY;
|
||||
@@ -630,10 +622,16 @@ NetworkRecvStatus ServerNetworkAdminSocketHandler::SendCmdLogging(ClientID clien
|
||||
p->Send_uint32(client_id);
|
||||
p->Send_uint8 (cp->company);
|
||||
p->Send_uint16(cp->cmd & CMD_ID_MASK);
|
||||
p->Send_uint32(cp->p1);
|
||||
p->Send_uint32(cp->p2);
|
||||
p->Send_uint32(cp->tile);
|
||||
p->Send_string(cp->text.c_str());
|
||||
|
||||
p->Send_uint16(4 + 4 + 8 + 4 + (uint16)cp->text.size() + 1);
|
||||
{
|
||||
p->Send_uint32(cp->p1);
|
||||
p->Send_uint32(cp->p2);
|
||||
p->Send_uint64(cp->p3);
|
||||
p->Send_uint32(cp->tile);
|
||||
p->Send_string(cp->text.c_str());
|
||||
}
|
||||
|
||||
p->Send_uint32(cp->frame);
|
||||
|
||||
this->SendPacket(p);
|
||||
|
@@ -422,7 +422,7 @@ struct NetworkChatWindow : public Window {
|
||||
}
|
||||
|
||||
len = strlen(cur_name);
|
||||
if (tb_len < len && strncasecmp(cur_name, tb_buf, tb_len) == 0) {
|
||||
if (tb_len < len && StrStartsWith(cur_name, tb_buf)) {
|
||||
/* Save the data it was before completion */
|
||||
if (!second_scan) seprintf(_chat_tab_completion_buf, lastof(_chat_tab_completion_buf), "%s", tb->buf);
|
||||
_chat_tab_completion_active = true;
|
||||
|
@@ -431,7 +431,7 @@ class NetworkContentListWindow : public Window, ContentCallback {
|
||||
/** Sort content by name. */
|
||||
static bool NameSorter(const ContentInfo * const &a, const ContentInfo * const &b)
|
||||
{
|
||||
return strnatcmp(a->name.c_str(), b->name.c_str(), true) < 0; // Sort by name (natural sorting).
|
||||
return StrNaturalCompare(a->name, b->name, true) < 0; // Sort by name (natural sorting).
|
||||
}
|
||||
|
||||
/** Sort content by type. */
|
||||
@@ -439,7 +439,7 @@ class NetworkContentListWindow : public Window, ContentCallback {
|
||||
{
|
||||
int r = 0;
|
||||
if (a->type != b->type) {
|
||||
r = strnatcmp(content_type_strs[a->type], content_type_strs[b->type]);
|
||||
r = StrNaturalCompare(content_type_strs[a->type], content_type_strs[b->type]);
|
||||
}
|
||||
if (r == 0) return NameSorter(a, b);
|
||||
return r < 0;
|
||||
@@ -466,9 +466,9 @@ class NetworkContentListWindow : public Window, ContentCallback {
|
||||
static bool TagNameFilter(const ContentInfo * const *a, ContentListFilterData &filter)
|
||||
{
|
||||
filter.string_filter.ResetState();
|
||||
for (auto &tag : (*a)->tags) filter.string_filter.AddLine(tag.c_str());
|
||||
for (auto &tag : (*a)->tags) filter.string_filter.AddLine(tag);
|
||||
|
||||
filter.string_filter.AddLine((*a)->name.c_str());
|
||||
filter.string_filter.AddLine((*a)->name);
|
||||
return filter.string_filter.GetState();
|
||||
}
|
||||
|
||||
|
@@ -305,7 +305,7 @@ protected:
|
||||
/** Sort servers by name. */
|
||||
static bool NGameNameSorter(NetworkGameList * const &a, NetworkGameList * const &b)
|
||||
{
|
||||
int r = strnatcmp(a->info.server_name.c_str(), b->info.server_name.c_str(), true); // Sort by name (natural sorting).
|
||||
int r = StrNaturalCompare(a->info.server_name, b->info.server_name, true); // Sort by name (natural sorting).
|
||||
if (r == 0) r = a->connection_string.compare(b->connection_string);
|
||||
|
||||
return r < 0;
|
||||
@@ -395,7 +395,7 @@ protected:
|
||||
assert((*item) != nullptr);
|
||||
|
||||
sf.ResetState();
|
||||
sf.AddLine((*item)->info.server_name.c_str());
|
||||
sf.AddLine((*item)->info.server_name);
|
||||
return sf.GetState();
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user