Update to 1.10.0-beta1
This commit is contained in:
@@ -37,9 +37,9 @@ static ScriptStorage *GetStorage()
|
||||
}
|
||||
|
||||
|
||||
/* static */ ScriptInstance *ScriptObject::ActiveInstance::active = NULL;
|
||||
/* static */ ScriptInstance *ScriptObject::ActiveInstance::active = nullptr;
|
||||
|
||||
ScriptObject::ActiveInstance::ActiveInstance(ScriptInstance *instance)
|
||||
ScriptObject::ActiveInstance::ActiveInstance(ScriptInstance *instance) : alc_scope(instance->engine)
|
||||
{
|
||||
this->last_active = ScriptObject::ActiveInstance::active;
|
||||
ScriptObject::ActiveInstance::active = instance;
|
||||
@@ -52,7 +52,7 @@ ScriptObject::ActiveInstance::~ActiveInstance()
|
||||
|
||||
/* static */ ScriptInstance *ScriptObject::GetActiveInstance()
|
||||
{
|
||||
assert(ScriptObject::ActiveInstance::active != NULL);
|
||||
assert(ScriptObject::ActiveInstance::active != nullptr);
|
||||
return ScriptObject::ActiveInstance::active;
|
||||
}
|
||||
|
||||
@@ -318,21 +318,19 @@ ScriptObject::ActiveInstance::~ActiveInstance()
|
||||
}
|
||||
|
||||
/* Set the default callback to return a true/false result of the DoCommand */
|
||||
if (callback == NULL) callback = &ScriptInstance::DoCommandReturn;
|
||||
if (callback == nullptr) callback = &ScriptInstance::DoCommandReturn;
|
||||
|
||||
/* Are we only interested in the estimate costs? */
|
||||
bool estimate_only = GetDoCommandMode() != NULL && !GetDoCommandMode()();
|
||||
bool estimate_only = GetDoCommandMode() != nullptr && !GetDoCommandMode()();
|
||||
|
||||
#ifdef ENABLE_NETWORK
|
||||
/* Only set p2 when the command does not come from the network. */
|
||||
if (GetCommandFlags(cmd) & CMD_CLIENT_ID && p2 == 0) p2 = UINT32_MAX;
|
||||
#endif
|
||||
|
||||
/* Store the command for command callback validation. */
|
||||
if (!estimate_only && _networking && !_generating_world) SetLastCommand(tile, p1, p2, cmd);
|
||||
|
||||
/* Try to perform the command. */
|
||||
CommandCost res = ::DoCommandPInternal(tile, p1, p2, cmd, (_networking && !_generating_world) ? ScriptObject::GetActiveInstance()->GetDoCommandCallback() : NULL, text, false, estimate_only);
|
||||
CommandCost res = ::DoCommandPInternal(tile, p1, p2, cmd, (_networking && !_generating_world) ? ScriptObject::GetActiveInstance()->GetDoCommandCallback() : nullptr, text, false, estimate_only);
|
||||
|
||||
/* We failed; set the error and bail out */
|
||||
if (res.Failed()) {
|
||||
@@ -355,7 +353,7 @@ ScriptObject::ActiveInstance::~ActiveInstance()
|
||||
|
||||
if (_generating_world) {
|
||||
IncreaseDoCommandCosts(res.GetCost());
|
||||
if (callback != NULL) {
|
||||
if (callback != nullptr) {
|
||||
/* Insert return value into to stack and throw a control code that
|
||||
* the return value in the stack should be used. */
|
||||
callback(GetActiveInstance());
|
||||
|
||||
Reference in New Issue
Block a user