1
0
Fork 0

Compare commits

...

8 Commits

Author SHA1 Message Date
Muxy 4b5b40a092 Merge branch 'master' of https://github.com/MuxyDuGoulp/OpenTTD 2024-05-10 09:47:26 +02:00
Muxy 31b90308d5 Fix: [AdminPort] #12411 Send Network Welcome Packet to admin port after game creation completed
Welcome moved into OnGameStart
2024-05-10 09:46:18 +02:00
Muxy a45bcfcd82 Fix: Send Network Welcome Packet to admin port after game creation completed 2024-05-10 09:46:18 +02:00
MuxyDuGoulp ea9c0dede5
Merge branch 'OpenTTD:master' into master 2024-05-10 09:34:08 +02:00
translators a5c2543efc Update: Translations from eints
chinese (simplified): 7 changes by WenSimEHRP, 4 changes by ahyangyi
2024-05-10 04:40:29 +00:00
Rubidium cef9417c9f Fix: always allow setting company settings, company/president name/face
There is a nice feature that synchronises the client settings upon setting up the company. Before
this, those commands would not be executed when no-actions-while-paused is set. This means that,
silently and depending on the server configuration, your wished for configuration might not be
there.

Similarly there is the president's face that's being set while creating a new company and setting
of the president/company name upon creation, when no-actions-while-paused is set.

So, just allow these operations also while paused to get a uniform experience when joining. To
keep the UI somewhat consistent, apply this "freedom" also to the other bits set from the company
UI; specifically company name and company colour.
2024-05-09 21:51:26 +02:00
Rubidium a313676189 Doc: reason for using ::SendNet over ::Post in few cases 2024-05-09 21:51:26 +02:00
Rubidium ed888c617b Codechange: just use ::Post over ::SendNet for creating new companies 2024-05-09 21:51:26 +02:00
8 changed files with 36 additions and 13 deletions

View File

@ -151,7 +151,7 @@ bool IsCommandAllowedWhilePaused(Commands cmd)
CMDPL_NO_CONSTRUCTION, ///< CMDT_VEHICLE_MANAGEMENT
CMDPL_NO_CONSTRUCTION, ///< CMDT_ROUTE_MANAGEMENT
CMDPL_NO_CONSTRUCTION, ///< CMDT_OTHER_MANAGEMENT
CMDPL_NO_CONSTRUCTION, ///< CMDT_COMPANY_SETTING
CMDPL_NO_ACTIONS, ///< CMDT_COMPANY_SETTING
CMDPL_NO_ACTIONS, ///< CMDT_SERVER_SETTING
CMDPL_NO_ACTIONS, ///< CMDT_CHEAT
};

View File

@ -898,8 +898,12 @@ CommandCost CmdCompanyCtrl(DoCommandFlag flags, CompanyCtrlAction cca, CompanyID
assert(_local_company == COMPANY_SPECTATOR);
SetLocalCompany(c->index);
/* In network games, we need to try setting the company manager face here to sync it to all clients.
* If a favorite company manager face is selected, choose it. Otherwise, use a random face. */
/*
* If a favorite company manager face is selected, choose it. Otherwise, use a random face.
* Because this needs to be synchronised over the network, only the client knows
* its configuration and we are currently in the execution of a command, we have
* to circumvent the normal ::Post logic for commands and just send the command.
*/
if (_company_manager_face != 0) Command<CMD_SET_COMPANY_MANAGER_FACE>::SendNet(STR_NULL, c->index, _company_manager_face);
/* Now that we have a new company, broadcast our company settings to

View File

@ -28,9 +28,9 @@ CommandCost CmdSetCompanyColour(DoCommandFlag flags, LiveryScheme scheme, bool p
DEF_CMD_TRAIT(CMD_COMPANY_CTRL, CmdCompanyCtrl, CMD_SPECTATOR | CMD_CLIENT_ID | CMD_NO_EST, CMDT_SERVER_SETTING)
DEF_CMD_TRAIT(CMD_COMPANY_ADD_ALLOW_LIST, CmdCompanyAddAllowList, CMD_NO_EST, CMDT_SERVER_SETTING)
DEF_CMD_TRAIT(CMD_GIVE_MONEY, CmdGiveMoney, 0, CMDT_MONEY_MANAGEMENT)
DEF_CMD_TRAIT(CMD_RENAME_COMPANY, CmdRenameCompany, 0, CMDT_OTHER_MANAGEMENT)
DEF_CMD_TRAIT(CMD_RENAME_PRESIDENT, CmdRenamePresident, 0, CMDT_OTHER_MANAGEMENT)
DEF_CMD_TRAIT(CMD_SET_COMPANY_MANAGER_FACE, CmdSetCompanyManagerFace, 0, CMDT_OTHER_MANAGEMENT)
DEF_CMD_TRAIT(CMD_SET_COMPANY_COLOUR, CmdSetCompanyColour, 0, CMDT_OTHER_MANAGEMENT)
DEF_CMD_TRAIT(CMD_RENAME_COMPANY, CmdRenameCompany, 0, CMDT_COMPANY_SETTING)
DEF_CMD_TRAIT(CMD_RENAME_PRESIDENT, CmdRenamePresident, 0, CMDT_COMPANY_SETTING)
DEF_CMD_TRAIT(CMD_SET_COMPANY_MANAGER_FACE, CmdSetCompanyManagerFace, 0, CMDT_COMPANY_SETTING)
DEF_CMD_TRAIT(CMD_SET_COMPANY_COLOUR, CmdSetCompanyColour, 0, CMDT_COMPANY_SETTING)
#endif /* COMPANY_CMD_H */

View File

@ -955,6 +955,7 @@ STR_GAME_OPTIONS_VOLUME :音量
STR_GAME_OPTIONS_SFX_VOLUME :音效
STR_GAME_OPTIONS_MUSIC_VOLUME :音乐
STR_GAME_OPTIONS_VOLUME_MARK :{NUM}%
STR_GAME_OPTIONS_CURRENCY_UNITS_FRAME :{BLACK}货币单位
STR_GAME_OPTIONS_CURRENCY_UNITS_DROPDOWN_TOOLTIP :{BLACK}货币单位选择
@ -1052,6 +1053,7 @@ STR_GAME_OPTIONS_GUI_FONT_SPRITE_TOOLTIP :{BLACK}如果
STR_GAME_OPTIONS_GUI_FONT_AA :字体抗锯齿
STR_GAME_OPTIONS_GUI_FONT_AA_TOOLTIP :{BLACK}勾选此框以对游戏字体应用抗锯齿
STR_GAME_OPTIONS_GUI_SCALE_MARK :{DECIMAL}x
STR_GAME_OPTIONS_PARTICIPATE_SURVEY_FRAME :{BLACK}自动体验调查
STR_GAME_OPTIONS_PARTICIPATE_SURVEY :{BLACK}参与自动体验调查
@ -1080,6 +1082,8 @@ STR_GAME_OPTIONS_BASE_MUSIC :{BLACK}基础
STR_GAME_OPTIONS_BASE_MUSIC_TOOLTIP :{BLACK}选择要使用的基础音乐组
STR_GAME_OPTIONS_BASE_MUSIC_DESCRIPTION_TOOLTIP :{BLACK}有关基础音乐组的附加信息
STR_GAME_OPTIONS_ONLINE_CONTENT :获取内容
STR_GAME_OPTIONS_ONLINE_CONTENT_TOOLTIP :查询并下载最新内容
STR_GAME_OPTIONS_SOCIAL_PLUGINS_NONE :{LTBLUE}(未安装社交平台插件)
@ -1823,6 +1827,9 @@ STR_CONFIG_SETTING_SERVINT_AIRCRAFT_HELPTEXT :如果没有为
STR_CONFIG_SETTING_SERVINT_SHIPS :船只默认保养周期:{STRING}
STR_CONFIG_SETTING_SERVINT_SHIPS_HELPTEXT :如果没有为船只设定保养周期,按照这里设定的默认保养周期执行
###length 3
STR_CONFIG_SETTING_SERVINT_VALUE_DAYS :{COMMA}{NBSP}日
STR_CONFIG_SETTING_SERVINT_VALUE_MINUTES :{COMMA}{NBSP}分
STR_CONFIG_SETTING_SERVINT_VALUE_PERCENTAGE :{COMMA}{NBSP}%
###setting-zero-is-special
STR_CONFIG_SETTING_SERVINT_DISABLED :关闭
@ -2478,6 +2485,7 @@ STR_NETWORK_CLIENT_LIST_PLAYER_NAME_QUERY_CAPTION :你的玩家名
STR_NETWORK_CLIENT_LIST_ADMIN_CLIENT_TOOLTIP :{BLACK}要在此客户端执行的管理命令
STR_NETWORK_CLIENT_LIST_ADMIN_COMPANY_TOOLTIP :{BLACK}要在此公司执行的管理命令
STR_NETWORK_CLIENT_LIST_JOIN_TOOLTIP :{BLACK}加入该公司
STR_NETWORK_CLIENT_LIST_COMPANY_AUTHORIZE_TOOLTIP :{BLACK}授权此客户端加入你的公司
STR_NETWORK_CLIENT_LIST_CHAT_CLIENT_TOOLTIP :{BLACK}给这位玩家发消息
STR_NETWORK_CLIENT_LIST_CHAT_COMPANY_TOOLTIP :{BLACK}给公司中的所有玩家发消息
STR_NETWORK_CLIENT_LIST_CHAT_SPECTATOR_TOOLTIP :{BLACK}给所有旁观者发消息
@ -3469,7 +3477,9 @@ STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT_ROAD_TYPE :道路类型
STR_NEWGRF_INSPECT_QUERY_CAPTION :{WHITE}NewGRF variable 60+x 参数 (十六进制)
# Sprite aligner window
STR_SPRITE_ALIGNER_CAPTION_NO_ACTION :{WHITE}对齐中的 Sprite({STRING}:{NUM})
STR_SPRITE_ALIGNER_CAPTION_ACTIONA :{WHITE}对齐中的 SpriteAction 0xA, {COMMA} ({STRING}:{NUM})
STR_SPRITE_ALIGNER_CAPTION_ACTION5 :{WHITE}对齐中的 SpriteAction 0x5, 类别 {HEX}, {COMMA} ({STRING}:{NUM})
STR_SPRITE_ALIGNER_NEXT_BUTTON :{BLACK}下一个 sprite
STR_SPRITE_ALIGNER_NEXT_TOOLTIP :{BLACK}继续处理下个正常的图形元素,略过任何虚位/重新着色/文字字型相关的图形元素;并且在处理到最后的图形元素后,返回第一个图形元素继续处理。
STR_SPRITE_ALIGNER_GOTO_BUTTON :{BLACK}前往 sprite
@ -3478,6 +3488,7 @@ STR_SPRITE_ALIGNER_PREVIOUS_BUTTON :{BLACK}上一
STR_SPRITE_ALIGNER_PREVIOUS_TOOLTIP :{BLACK}继续处理上一个正常的图形元素,略过任何虚位/重新着色/文字字型相关的图形元素;并且在处理到第一个图形元素后,返回最后的图形元素继续处理。
STR_SPRITE_ALIGNER_SPRITE_TOOLTIP :{BLACK}显示目前选取的 sprite。当 sprite 正在描绘时会忽略其定位。
STR_SPRITE_ALIGNER_MOVE_TOOLTIP :{BLACK}从 X 及 Y 座标方向移动图形元素。如按住 Ctrl 键再点击,可一次移动 8 个单位
STR_SPRITE_ALIGNER_SPRITE :{STRING}:{NUM}
###length 2
STR_SPRITE_ALIGNER_CENTRE_OFFSET :{BLACK}偏移居中

View File

@ -886,7 +886,7 @@ NetworkRecvStatus ClientNetworkGameSocketHandler::Receive_SERVER_MAP_DONE(Packet
Debug(net, 9, "Client::join_status = REGISTERING");
_network_join_status = NETWORK_JOIN_STATUS_REGISTERING;
ShowJoinStatusWindow();
Command<CMD_COMPANY_CTRL>::SendNet(STR_NULL, _local_company, CCA_NEW, INVALID_COMPANY, CRR_NONE, INVALID_CLIENT_ID);
Command<CMD_COMPANY_CTRL>::Post(CCA_NEW, INVALID_COMPANY, CRR_NONE, _network_own_client_id);
}
} else {
/* take control over an existing company */

View File

@ -1460,11 +1460,7 @@ private:
*/
static void OnClickCompanyNew([[maybe_unused]] NetworkClientListWindow *w, [[maybe_unused]] Point pt, CompanyID)
{
if (_network_server) {
Command<CMD_COMPANY_CTRL>::Post(CCA_NEW, INVALID_COMPANY, CRR_NONE, _network_own_client_id);
} else {
Command<CMD_COMPANY_CTRL>::SendNet(STR_NULL, _local_company, CCA_NEW, INVALID_COMPANY, CRR_NONE, INVALID_CLIENT_ID);
}
Command<CMD_COMPANY_CTRL>::Post(CCA_NEW, INVALID_COMPANY, CRR_NONE, _network_own_client_id);
}
/**

View File

@ -2157,6 +2157,13 @@ void NetworkServerNewCompany(const Company *c, NetworkClientInfo *ci)
/* ci is nullptr when replaying, or for AIs. In neither case there is a client. */
ci->client_playas = c->index;
NetworkUpdateClientInfo(ci->client_id);
/*
* This function is called from a command, but is only called for the server.
* The client information is managed out-of-band from the commands, so to not have a
* different state/president/company name in the different clients, we need to
* circumvent the normal ::Post logic and go directly to sending the command.
*/
Command<CMD_COMPANY_ADD_ALLOW_LIST>::SendNet(STR_NULL, c->index, ci->public_key);
Command<CMD_RENAME_PRESIDENT>::SendNet(STR_NULL, c->index, ci->client_name);

View File

@ -1790,6 +1790,11 @@ void SyncCompanySettings()
const SettingDesc *sd = GetSettingDesc(desc);
uint32_t old_value = (uint32_t)sd->AsIntSetting()->Read(old_object);
uint32_t new_value = (uint32_t)sd->AsIntSetting()->Read(new_object);
/*
* This is called from a command, and since it contains local configuration information
* that the rest of the clients do not know about, we need to circumvent the normal ::Post
* local command validation and immediately send the command to the server.
*/
if (old_value != new_value) Command<CMD_CHANGE_COMPANY_SETTING>::SendNet(STR_NULL, _local_company, sd->GetName(), new_value);
}
}