Update to 1.9.2

This commit is contained in:
Pavel Stupnikov
2019-07-12 02:46:41 +03:00
83 changed files with 407 additions and 317 deletions

View File

@@ -109,7 +109,7 @@
return g != NULL && 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)
@@ -138,8 +138,9 @@
EnforcePrecondition(false, ScriptGame::IsMultiplayer());
EnforcePrecondition(false, ScriptClient::ResolveClientID(client) != ScriptClient::CLIENT_INVALID);
#ifdef ENABLE_NETWORK
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);
#else
return false;
#endif

View File

@@ -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 */

View File

@@ -16,6 +16,7 @@
#include "script_station.hpp"
#include "../../depot_map.h"
#include "../../vehicle_base.h"
#include "../../train.h"
#include "../../safeguards.h"
@@ -23,7 +24,7 @@ ScriptVehicleList::ScriptVehicleList()
{
const Vehicle *v;
FOR_ALL_VEHICLES(v) {
if ((v->owner == ScriptObject::GetCompany() || ScriptObject::GetCompany() == OWNER_DEITY) && v->IsPrimaryVehicle()) this->AddItem(v->index);
if ((v->owner == ScriptObject::GetCompany() || ScriptObject::GetCompany() == OWNER_DEITY) && (v->IsPrimaryVehicle() || (v->type == VEH_TRAIN && ::Train::From(v)->IsFreeWagon()))) this->AddItem(v->index);
}
}