mirror of https://github.com/OpenTTD/OpenTTD.git
Fix: make script goals work with the whole range of ClientIDs
This commit is contained in:
parent
67e1d1ad89
commit
31869501ee
|
@ -224,9 +224,11 @@ CommandCost CmdSetGoalCompleted(DoCommandFlag flags, GoalID goal, bool completed
|
|||
* @param text Text of the question.
|
||||
* @return the cost of this operation or an error
|
||||
*/
|
||||
CommandCost CmdGoalQuestion(DoCommandFlag flags, uint16 uniqueid, uint16 target, bool is_client, uint32 button_mask, GoalQuestionType type, const std::string &text)
|
||||
CommandCost CmdGoalQuestion(DoCommandFlag flags, uint16 uniqueid, uint32 target, bool is_client, uint32 button_mask, GoalQuestionType type, const std::string &text)
|
||||
{
|
||||
static_assert(sizeof(uint32) >= sizeof(CompanyID));
|
||||
CompanyID company = (CompanyID)target;
|
||||
static_assert(sizeof(uint32) >= sizeof(ClientID));
|
||||
ClientID client = (ClientID)target;
|
||||
|
||||
static_assert(GOAL_QUESTION_BUTTON_COUNT < 29);
|
||||
|
|
|
@ -18,7 +18,7 @@ CommandCost CmdRemoveGoal(DoCommandFlag flags, GoalID goal);
|
|||
CommandCost CmdSetGoalText(DoCommandFlag flags, GoalID goal, const std::string &text);
|
||||
CommandCost CmdSetGoalProgress(DoCommandFlag flags, GoalID goal, const std::string &text);
|
||||
CommandCost CmdSetGoalCompleted(DoCommandFlag flags, GoalID goal, bool completed);
|
||||
CommandCost CmdGoalQuestion(DoCommandFlag flags, uint16 uniqueid, uint16 target, bool is_client, uint32 button_mask, GoalQuestionType type, const std::string &text);
|
||||
CommandCost CmdGoalQuestion(DoCommandFlag flags, uint16 uniqueid, uint32 target, bool is_client, uint32 button_mask, GoalQuestionType type, const std::string &text);
|
||||
CommandCost CmdGoalQuestionAnswer(DoCommandFlag flags, uint16 uniqueid, uint8 button);
|
||||
|
||||
DEF_CMD_TRAIT(CMD_CREATE_GOAL, CmdCreateGoal, CMD_DEITY | CMD_STR_CTRL, CMDT_OTHER_MANAGEMENT)
|
||||
|
|
|
@ -137,8 +137,6 @@
|
|||
{
|
||||
EnforcePrecondition(false, ScriptGame::IsMultiplayer());
|
||||
EnforcePrecondition(false, ScriptClient::ResolveClientID(client) != ScriptClient::CLIENT_INVALID);
|
||||
/* Can only send 16 bits of client_id before proper fix is implemented */
|
||||
EnforcePrecondition(false, client < (1 << 16));
|
||||
return DoQuestion(uniqueid, client, true, question, type, buttons);
|
||||
}
|
||||
|
||||
|
|
|
@ -170,7 +170,7 @@ public:
|
|||
* @pre question != null && len(question) != 0.
|
||||
* @pre company == COMPANY_INVALID || ResolveCompanyID(company) != COMPANY_INVALID.
|
||||
* @pre CountBits(buttons) >= 1 && CountBits(buttons) <= 3.
|
||||
* @note Replies to the question are given by you via the event ScriptEvent_GoalQuestionAnswer.
|
||||
* @note Replies to the question are given by you via the event ScriptEventGoalQuestionAnswer.
|
||||
* @note There is no guarantee you ever get a reply on your question.
|
||||
*/
|
||||
static bool Question(uint16 uniqueid, ScriptCompany::CompanyID company, Text *question, QuestionType type, int buttons);
|
||||
|
@ -188,7 +188,7 @@ public:
|
|||
* @pre question != null && len(question) != 0.
|
||||
* @pre ResolveClientID(client) != CLIENT_INVALID.
|
||||
* @pre CountBits(buttons) >= 1 && CountBits(buttons) <= 3.
|
||||
* @note Replies to the question are given by you via the event ScriptEvent_GoalQuestionAnswer.
|
||||
* @note Replies to the question are given by you via the event ScriptEventGoalQuestionAnswer.
|
||||
* @note There is no guarantee you ever get a reply on your question.
|
||||
*/
|
||||
static bool QuestionClient(uint16 uniqueid, ScriptClient::ClientID client, Text *question, QuestionType type, int buttons);
|
||||
|
|
Loading…
Reference in New Issue