diff options
Diffstat (limited to 'src/script')
-rw-r--r-- | src/script/api/script_goal.cpp | 9 | ||||
-rw-r--r-- | src/script/api/script_goal.hpp | 2 |
2 files changed, 6 insertions, 5 deletions
diff --git a/src/script/api/script_goal.cpp b/src/script/api/script_goal.cpp index b5f6ccef2..461911d3c 100644 --- a/src/script/api/script_goal.cpp +++ b/src/script/api/script_goal.cpp @@ -109,7 +109,7 @@ return g != nullptr && g->completed; } -/* static */ bool ScriptGoal::DoQuestion(uint16 uniqueid, uint8 target, bool is_client, Text *question, QuestionType type, int buttons) +/* static */ bool ScriptGoal::DoQuestion(uint16 uniqueid, uint32 target, bool is_client, Text *question, QuestionType type, uint32 buttons) { CCountedPtr<Text> counter(question); @@ -121,7 +121,7 @@ EnforcePrecondition(false, buttons < (1 << ::GOAL_QUESTION_BUTTON_COUNT)); EnforcePrecondition(false, (int)type < ::GOAL_QUESTION_TYPE_COUNT); - return ScriptObject::DoCommand(0, uniqueid | (target << 16) | (type << 24) | (is_client ? (1 << 31) : 0), buttons, CMD_GOAL_QUESTION, text); + return ScriptObject::DoCommand(0, uniqueid | (target << 16), buttons | (type << 29) | (is_client ? (1 << 31) : 0), CMD_GOAL_QUESTION, text); } /* static */ bool ScriptGoal::Question(uint16 uniqueid, ScriptCompany::CompanyID company, Text *question, QuestionType type, int buttons) @@ -137,8 +137,9 @@ { EnforcePrecondition(false, ScriptGame::IsMultiplayer()); EnforcePrecondition(false, ScriptClient::ResolveClientID(client) != ScriptClient::CLIENT_INVALID); - ClientIndex c = NetworkClientInfo::GetByClientID((::ClientID)client)->index; - return DoQuestion(uniqueid, c, true, question, type, buttons); + /* 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); } /* static */ bool ScriptGoal::CloseQuestion(uint16 uniqueid) diff --git a/src/script/api/script_goal.hpp b/src/script/api/script_goal.hpp index b8c0873a2..30f7df125 100644 --- a/src/script/api/script_goal.hpp +++ b/src/script/api/script_goal.hpp @@ -211,7 +211,7 @@ protected: /** * Does common checks and asks the question. */ - static bool DoQuestion(uint16 uniqueid, uint8 target, bool is_client, Text *question, QuestionType type, int buttons); + static bool DoQuestion(uint16 uniqueid, uint32 target, bool is_client, Text *question, QuestionType type, uint32 buttons); }; #endif /* SCRIPT_GOAL_HPP */ |