aboutsummaryrefslogtreecommitdiff
path: root/engines/wintermute/base/scriptables
diff options
context:
space:
mode:
Diffstat (limited to 'engines/wintermute/base/scriptables')
-rw-r--r--engines/wintermute/base/scriptables/script.cpp110
-rw-r--r--engines/wintermute/base/scriptables/script_engine.cpp34
-rw-r--r--engines/wintermute/base/scriptables/script_engine.h4
-rw-r--r--engines/wintermute/base/scriptables/script_ext_array.cpp2
-rw-r--r--engines/wintermute/base/scriptables/script_ext_file.cpp16
-rw-r--r--engines/wintermute/base/scriptables/script_ext_mem_buffer.cpp8
-rw-r--r--engines/wintermute/base/scriptables/script_ext_string.cpp8
-rw-r--r--engines/wintermute/base/scriptables/script_stack.cpp6
-rw-r--r--engines/wintermute/base/scriptables/script_value.cpp64
9 files changed, 126 insertions, 126 deletions
diff --git a/engines/wintermute/base/scriptables/script.cpp b/engines/wintermute/base/scriptables/script.cpp
index 9bb7fedf38..23c452b73c 100644
--- a/engines/wintermute/base/scriptables/script.cpp
+++ b/engines/wintermute/base/scriptables/script.cpp
@@ -39,58 +39,58 @@ IMPLEMENT_PERSISTENT(ScScript, false)
//////////////////////////////////////////////////////////////////////////
ScScript::ScScript(BaseGame *inGame, ScEngine *engine) : BaseClass(inGame) {
- _buffer = NULL;
+ _buffer = nullptr;
_bufferSize = _iP = 0;
- _scriptStream = NULL;
- _filename = NULL;
+ _scriptStream = nullptr;
+ _filename = nullptr;
_currentLine = 0;
- _symbols = NULL;
+ _symbols = nullptr;
_numSymbols = 0;
_engine = engine;
- _globals = NULL;
+ _globals = nullptr;
- _scopeStack = NULL;
- _callStack = NULL;
- _thisStack = NULL;
- _stack = NULL;
+ _scopeStack = nullptr;
+ _callStack = nullptr;
+ _thisStack = nullptr;
+ _stack = nullptr;
- _operand = NULL;
- _reg1 = NULL;
+ _operand = nullptr;
+ _reg1 = nullptr;
- _functions = NULL;
+ _functions = nullptr;
_numFunctions = 0;
- _methods = NULL;
+ _methods = nullptr;
_numMethods = 0;
- _events = NULL;
+ _events = nullptr;
_numEvents = 0;
- _externals = NULL;
+ _externals = nullptr;
_numExternals = 0;
_state = SCRIPT_FINISHED;
_origState = SCRIPT_FINISHED;
- _waitObject = NULL;
+ _waitObject = nullptr;
_waitTime = 0;
_waitFrozen = false;
- _waitScript = NULL;
+ _waitScript = nullptr;
_timeSlice = 0;
_thread = false;
_methodThread = false;
- _threadEvent = NULL;
+ _threadEvent = nullptr;
_freezable = true;
- _owner = NULL;
+ _owner = nullptr;
_unbreakable = false;
- _parentScript = NULL;
+ _parentScript = nullptr;
_tracingMode = false;
}
@@ -242,7 +242,7 @@ bool ScScript::create(const char *filename, byte *buffer, uint32 size, BaseScrip
_methodThread = false;
delete[] _threadEvent;
- _threadEvent = NULL;
+ _threadEvent = nullptr;
_filename = new char[strlen(filename) + 1];
if (_filename) {
@@ -383,52 +383,52 @@ void ScScript::cleanup() {
if (_buffer) {
delete[] _buffer;
}
- _buffer = NULL;
+ _buffer = nullptr;
if (_filename) {
delete[] _filename;
}
- _filename = NULL;
+ _filename = nullptr;
if (_symbols) {
delete[] _symbols;
}
- _symbols = NULL;
+ _symbols = nullptr;
_numSymbols = 0;
if (_globals && !_thread) {
delete _globals;
}
- _globals = NULL;
+ _globals = nullptr;
delete _scopeStack;
- _scopeStack = NULL;
+ _scopeStack = nullptr;
delete _callStack;
- _callStack = NULL;
+ _callStack = nullptr;
delete _thisStack;
- _thisStack = NULL;
+ _thisStack = nullptr;
delete _stack;
- _stack = NULL;
+ _stack = nullptr;
if (_functions) {
delete[] _functions;
}
- _functions = NULL;
+ _functions = nullptr;
_numFunctions = 0;
if (_methods) {
delete[] _methods;
}
- _methods = NULL;
+ _methods = nullptr;
_numMethods = 0;
if (_events) {
delete[] _events;
}
- _events = NULL;
+ _events = nullptr;
_numEvents = 0;
@@ -440,25 +440,25 @@ void ScScript::cleanup() {
}
delete[] _externals;
}
- _externals = NULL;
+ _externals = nullptr;
_numExternals = 0;
delete _operand;
delete _reg1;
- _operand = NULL;
- _reg1 = NULL;
+ _operand = nullptr;
+ _reg1 = nullptr;
delete[] _threadEvent;
- _threadEvent = NULL;
+ _threadEvent = nullptr;
_state = SCRIPT_FINISHED;
- _waitObject = NULL;
+ _waitObject = nullptr;
_waitTime = 0;
_waitFrozen = false;
- _waitScript = NULL;
+ _waitScript = nullptr;
- _parentScript = NULL; // ref only
+ _parentScript = nullptr; // ref only
delete _scriptStream;
}
@@ -511,7 +511,7 @@ bool ScScript::executeInstruction() {
bool ret = STATUS_OK;
uint32 dw;
- const char *str = NULL;
+ const char *str = nullptr;
//ScValue* op = new ScValue(_gameRef);
_operand->cleanup();
@@ -787,7 +787,7 @@ bool ScScript::executeInstruction() {
ScValue *var = _stack->pop();
ScValue *val = _stack->pop();
- if (val == NULL) {
+ if (val == nullptr) {
runtimeError("Script stack corruption detected. Please report this script at WME bug reports forum.");
var->setNULL();
} else {
@@ -928,7 +928,7 @@ bool ScScript::executeInstruction() {
case II_AND:
op2 = _stack->pop();
op1 = _stack->pop();
- if (op1 == NULL || op2 == NULL) {
+ if (op1 == nullptr || op2 == nullptr) {
runtimeError("Script corruption detected. Did you use '=' instead of '==' for comparison?");
_operand->setBool(false);
} else {
@@ -940,7 +940,7 @@ bool ScScript::executeInstruction() {
case II_OR:
op2 = _stack->pop();
op1 = _stack->pop();
- if (op1 == NULL || op2 == NULL) {
+ if (op1 == nullptr || op2 == nullptr) {
runtimeError("Script corruption detected. Did you use '=' instead of '==' for comparison?");
_operand->setBool(false);
} else {
@@ -1120,7 +1120,7 @@ uint32 ScScript::getMethodPos(const Common::String &name) const {
//////////////////////////////////////////////////////////////////////////
ScValue *ScScript::getVar(char *name) {
- ScValue *ret = NULL;
+ ScValue *ret = nullptr;
// scope locals
if (_scopeStack->_sP >= 0) {
@@ -1130,20 +1130,20 @@ ScValue *ScScript::getVar(char *name) {
}
// script globals
- if (ret == NULL) {
+ if (ret == nullptr) {
if (_globals->propExists(name)) {
ret = _globals->getProp(name);
}
}
// engine globals
- if (ret == NULL) {
+ if (ret == nullptr) {
if (_engine->_globals->propExists(name)) {
ret = _engine->_globals->getProp(name);
}
}
- if (ret == NULL) {
+ if (ret == nullptr) {
//RuntimeError("Variable '%s' is inaccessible in the current block. Consider changing the script.", name);
_gameRef->LOG(0, "Warning: variable '%s' is inaccessible in the current block. Consider changing the script (script:%s, line:%d)", name, _filename, _currentLine);
ScValue *val = new ScValue(_gameRef);
@@ -1263,8 +1263,8 @@ bool ScScript::persist(BasePersistenceManager *persistMgr) {
_scriptStream = new Common::MemoryReadStream(_buffer, _bufferSize);
initTables();
} else {
- _buffer = NULL;
- _scriptStream = NULL;
+ _buffer = nullptr;
+ _scriptStream = nullptr;
}
}
@@ -1306,11 +1306,11 @@ bool ScScript::persist(BasePersistenceManager *persistMgr) {
//////////////////////////////////////////////////////////////////////////
ScScript *ScScript::invokeEventHandler(const Common::String &eventName, bool unbreakable) {
- //if (_state!=SCRIPT_PERSISTENT) return NULL;
+ //if (_state!=SCRIPT_PERSISTENT) return nullptr;
uint32 pos = getEventPos(eventName);
if (!pos) {
- return NULL;
+ return nullptr;
}
ScScript *thread = new ScScript(_gameRef, _engine);
@@ -1322,10 +1322,10 @@ ScScript *ScScript::invokeEventHandler(const Common::String &eventName, bool unb
return thread;
} else {
delete thread;
- return NULL;
+ return nullptr;
}
} else {
- return NULL;
+ return nullptr;
}
}
@@ -1390,7 +1390,7 @@ ScScript::TExternalFunction *ScScript::getExternal(char *name) {
return &_externals[i];
}
}
- return NULL;
+ return nullptr;
}
@@ -1446,7 +1446,7 @@ const char *ScScript::dbgGetFilename() {
//////////////////////////////////////////////////////////////////////////
void ScScript::afterLoad() {
- if (_buffer == NULL) {
+ if (_buffer == nullptr) {
byte *buffer = _engine->getCompiledScript(_filename, &_bufferSize);
if (!buffer) {
_gameRef->LOG(0, "Error reinitializing script '%s' after load. Script will be terminated.", _filename);
diff --git a/engines/wintermute/base/scriptables/script_engine.cpp b/engines/wintermute/base/scriptables/script_engine.cpp
index e8be0f0bd5..d5c5797a39 100644
--- a/engines/wintermute/base/scriptables/script_engine.cpp
+++ b/engines/wintermute/base/scriptables/script_engine.cpp
@@ -69,10 +69,10 @@ ScEngine::ScEngine(BaseGame *inGame) : BaseClass(inGame) {
// prepare script cache
for (int i = 0; i < MAX_CACHED_SCRIPTS; i++) {
- _cachedScripts[i] = NULL;
+ _cachedScripts[i] = nullptr;
}
- _currentScript = NULL;
+ _currentScript = nullptr;
_isProfiling = false;
_profilingStartTime = 0;
@@ -105,11 +105,11 @@ bool ScEngine::cleanup() {
_scripts.clear();
delete _globals;
- _globals = NULL;
+ _globals = nullptr;
emptyScriptCache();
- _currentScript = NULL; // ref only
+ _currentScript = nullptr; // ref only
return STATUS_OK;
}
@@ -140,7 +140,7 @@ ScScript *ScEngine::runScript(const char *filename, BaseScriptHolder *owner) {
// get script from cache
compBuffer = getCompiledScript(filename, &compSize);
if (!compBuffer) {
- return NULL;
+ return nullptr;
}
// add new script
@@ -149,7 +149,7 @@ ScScript *ScEngine::runScript(const char *filename, BaseScriptHolder *owner) {
if (DID_FAIL(ret)) {
_gameRef->LOG(ret, "Error running script '%s'...", filename);
delete script;
- return NULL;
+ return nullptr;
} else {
// publish the "self" pseudo-variable
ScValue val(_gameRef);
@@ -191,7 +191,7 @@ byte *ScEngine::getCompiledScript(const char *filename, uint32 *outSize, bool ig
byte *buffer = BaseEngine::instance().getFileManager()->readWholeFile(filename, &size);
if (!buffer) {
_gameRef->LOG(0, "ScEngine::GetCompiledScript - error opening script '%s'", filename);
- return NULL;
+ return nullptr;
}
// needs to be compiled?
@@ -202,14 +202,14 @@ byte *ScEngine::getCompiledScript(const char *filename, uint32 *outSize, bool ig
if (!_compilerAvailable) {
_gameRef->LOG(0, "ScEngine::GetCompiledScript - script '%s' needs to be compiled but compiler is not available", filename);
delete[] buffer;
- return NULL;
+ return nullptr;
}
// This code will never be called, since _compilerAvailable is const false.
// It's only here in the event someone would want to reinclude the compiler.
error("Script needs compilation, ScummVM does not contain a WME compiler");
}
- byte *ret = NULL;
+ byte *ret = nullptr;
// add script to cache
CScCachedScript *cachedScript = new CScCachedScript(filename, compBuffer, compSize);
@@ -217,7 +217,7 @@ byte *ScEngine::getCompiledScript(const char *filename, uint32 *outSize, bool ig
int index = 0;
uint32 minTime = g_system->getMillis();
for (int i = 0; i < MAX_CACHED_SCRIPTS; i++) {
- if (_cachedScripts[i] == NULL) {
+ if (_cachedScripts[i] == nullptr) {
index = i;
break;
} else if (_cachedScripts[i]->_timestamp <= minTime) {
@@ -226,7 +226,7 @@ byte *ScEngine::getCompiledScript(const char *filename, uint32 *outSize, bool ig
}
}
- if (_cachedScripts[index] != NULL) {
+ if (_cachedScripts[index] != nullptr) {
delete _cachedScripts[index];
}
_cachedScripts[index] = cachedScript;
@@ -296,7 +296,7 @@ bool ScEngine::tick() {
if (!isValidScript(_scripts[i]->_waitScript) || _scripts[i]->_waitScript->_state == SCRIPT_ERROR) {
// fake return value
_scripts[i]->_stack->pushNULL();
- _scripts[i]->_waitScript = NULL;
+ _scripts[i]->_waitScript = nullptr;
_scripts[i]->run();
} else {
if (_scripts[i]->_waitScript->_state == SCRIPT_THREAD_FINISHED) {
@@ -304,7 +304,7 @@ bool ScEngine::tick() {
_scripts[i]->_stack->push(_scripts[i]->_waitScript->_stack->pop());
_scripts[i]->run();
_scripts[i]->_waitScript->finish();
- _scripts[i]->_waitScript = NULL;
+ _scripts[i]->_waitScript = nullptr;
}
}
break;
@@ -351,7 +351,7 @@ bool ScEngine::tick() {
addScriptTime(_scripts[i]->_filename, g_system->getMillis() - startTime);
}
}
- _currentScript = NULL;
+ _currentScript = nullptr;
}
removeFinishedScripts();
@@ -373,7 +373,7 @@ bool ScEngine::tickUnbreakable() {
_scripts[i]->executeInstruction();
}
_scripts[i]->finish();
- _currentScript = NULL;
+ _currentScript = nullptr;
}
removeFinishedScripts();
@@ -444,7 +444,7 @@ bool ScEngine::emptyScriptCache() {
for (int i = 0; i < MAX_CACHED_SCRIPTS; i++) {
if (_cachedScripts[i]) {
delete _cachedScripts[i];
- _cachedScripts[i] = NULL;
+ _cachedScripts[i] = nullptr;
}
}
return STATUS_OK;
@@ -496,7 +496,7 @@ bool ScEngine::persist(BasePersistenceManager *persistMgr) {
//////////////////////////////////////////////////////////////////////////
void ScEngine::editorCleanup() {
for (uint32 i = 0; i < _scripts.size(); i++) {
- if (_scripts[i]->_owner == NULL && (_scripts[i]->_state == SCRIPT_FINISHED || _scripts[i]->_state == SCRIPT_ERROR)) {
+ if (_scripts[i]->_owner == nullptr && (_scripts[i]->_state == SCRIPT_FINISHED || _scripts[i]->_state == SCRIPT_ERROR)) {
delete _scripts[i];
_scripts.remove_at(i);
i--;
diff --git a/engines/wintermute/base/scriptables/script_engine.h b/engines/wintermute/base/scriptables/script_engine.h
index 1a023326eb..639875ffb6 100644
--- a/engines/wintermute/base/scriptables/script_engine.h
+++ b/engines/wintermute/base/scriptables/script_engine.h
@@ -96,10 +96,10 @@ public:
byte *getCompiledScript(const char *filename, uint32 *outSize, bool ignoreCache = false);
DECLARE_PERSISTENT(ScEngine, BaseClass)
bool cleanup();
- int getNumScripts(int *running = NULL, int *waiting = NULL, int *persistent = NULL);
+ int getNumScripts(int *running = nullptr, int *waiting = nullptr, int *persistent = nullptr);
bool tick();
ScValue *_globals;
- ScScript *runScript(const char *filename, BaseScriptHolder *owner = NULL);
+ ScScript *runScript(const char *filename, BaseScriptHolder *owner = nullptr);
static const bool _compilerAvailable = false;
ScEngine(BaseGame *inGame);
diff --git a/engines/wintermute/base/scriptables/script_ext_array.cpp b/engines/wintermute/base/scriptables/script_ext_array.cpp
index 613cbd0758..892d0674ff 100644
--- a/engines/wintermute/base/scriptables/script_ext_array.cpp
+++ b/engines/wintermute/base/scriptables/script_ext_array.cpp
@@ -69,7 +69,7 @@ SXArray::SXArray(BaseGame *inGame) : BaseScriptable(inGame) {
//////////////////////////////////////////////////////////////////////////
SXArray::~SXArray() {
delete _values;
- _values = NULL;
+ _values = nullptr;
}
diff --git a/engines/wintermute/base/scriptables/script_ext_file.cpp b/engines/wintermute/base/scriptables/script_ext_file.cpp
index 08ecc8d7db..29e032a759 100644
--- a/engines/wintermute/base/scriptables/script_ext_file.cpp
+++ b/engines/wintermute/base/scriptables/script_ext_file.cpp
@@ -52,13 +52,13 @@ SXFile::SXFile(BaseGame *inGame, ScStack *stack) : BaseScriptable(inGame) {
stack->correctParams(1);
ScValue *val = stack->pop();
- _filename = NULL;
+ _filename = nullptr;
if (!val->isNULL()) {
BaseUtils::setString(&_filename, val->getString());
}
- _readFile = NULL;
- _writeFile = NULL;
+ _readFile = nullptr;
+ _writeFile = nullptr;
_mode = 0;
_textMode = false;
@@ -73,7 +73,7 @@ SXFile::~SXFile() {
//////////////////////////////////////////////////////////////////////////
void SXFile::cleanup() {
delete[] _filename;
- _filename = NULL;
+ _filename = nullptr;
close();
}
@@ -82,12 +82,12 @@ void SXFile::cleanup() {
void SXFile::close() {
if (_readFile) {
BaseFileManager::getEngineInstance()->closeFile(_readFile);
- _readFile = NULL;
+ _readFile = nullptr;
}
if (_writeFile) {
_writeFile->finalize();
delete _writeFile;
- _writeFile = NULL;
+ _writeFile = nullptr;
}
_mode = 0;
_textMode = false;
@@ -778,8 +778,8 @@ bool SXFile::persist(BasePersistenceManager *persistMgr) {
persistMgr->transfer(TMEMBER(pos));
// try to re-open file if needed
- _writeFile = NULL;
- _readFile = NULL;
+ _writeFile = nullptr;
+ _readFile = nullptr;
if (_mode != 0) {
// open for reading
diff --git a/engines/wintermute/base/scriptables/script_ext_mem_buffer.cpp b/engines/wintermute/base/scriptables/script_ext_mem_buffer.cpp
index 42c5cfb20e..9de9905fea 100644
--- a/engines/wintermute/base/scriptables/script_ext_mem_buffer.cpp
+++ b/engines/wintermute/base/scriptables/script_ext_mem_buffer.cpp
@@ -44,7 +44,7 @@ BaseScriptable *makeSXMemBuffer(BaseGame *inGame, ScStack *stack) {
//////////////////////////////////////////////////////////////////////////
SXMemBuffer::SXMemBuffer(BaseGame *inGame, ScStack *stack) : BaseScriptable(inGame) {
stack->correctParams(1);
- _buffer = NULL;
+ _buffer = nullptr;
_size = 0;
int newSize = stack->pop()->getInt();
@@ -73,7 +73,7 @@ void SXMemBuffer::cleanup() {
if (_size) {
free(_buffer);
}
- _buffer = NULL;
+ _buffer = nullptr;
_size = 0;
}
@@ -109,7 +109,7 @@ bool SXMemBuffer::resize(int newSize) {
//////////////////////////////////////////////////////////////////////////
bool SXMemBuffer::checkBounds(ScScript *script, int start, int length) {
- if (_buffer == NULL) {
+ if (_buffer == nullptr) {
script->runtimeError("Cannot use Set/Get methods on an uninitialized memory buffer");
return false;
}
@@ -509,7 +509,7 @@ bool SXMemBuffer::persist(BasePersistenceManager *persistMgr) {
_buffer = malloc(_size);
persistMgr->getBytes((byte *)_buffer, _size);
} else {
- _buffer = NULL;
+ _buffer = nullptr;
}
}
diff --git a/engines/wintermute/base/scriptables/script_ext_string.cpp b/engines/wintermute/base/scriptables/script_ext_string.cpp
index 5f7da1c2dd..6b4a615509 100644
--- a/engines/wintermute/base/scriptables/script_ext_string.cpp
+++ b/engines/wintermute/base/scriptables/script_ext_string.cpp
@@ -45,7 +45,7 @@ BaseScriptable *makeSXString(BaseGame *inGame, ScStack *stack) {
//////////////////////////////////////////////////////////////////////////
SXString::SXString(BaseGame *inGame, ScStack *stack) : BaseScriptable(inGame) {
- _string = NULL;
+ _string = nullptr;
_capacity = 0;
stack->correctParams(1);
@@ -81,7 +81,7 @@ void SXString::setStringVal(const char *val) {
if (len >= _capacity) {
_capacity = len + 1;
delete[] _string;
- _string = NULL;
+ _string = nullptr;
_string = new char[_capacity];
memset(_string, 0, _capacity);
}
@@ -331,7 +331,7 @@ bool SXString::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack
array->push(val);
delete val;
- val = NULL;
+ val = nullptr;
}
stack->pushNative(array, false);
@@ -420,7 +420,7 @@ bool SXString::persist(BasePersistenceManager *persistMgr) {
_string = new char[_capacity];
persistMgr->getBytes((byte *)_string, _capacity);
} else {
- _string = NULL;
+ _string = nullptr;
}
}
diff --git a/engines/wintermute/base/scriptables/script_stack.cpp b/engines/wintermute/base/scriptables/script_stack.cpp
index 194c5f4f35..3239decae8 100644
--- a/engines/wintermute/base/scriptables/script_stack.cpp
+++ b/engines/wintermute/base/scriptables/script_stack.cpp
@@ -58,7 +58,7 @@ ScStack::~ScStack() {
ScValue *ScStack::pop() {
if (_sP < 0) {
_gameRef->LOG(0, "Fatal: Stack underflow");
- return NULL;
+ return nullptr;
}
return _values[_sP--];
@@ -97,7 +97,7 @@ ScValue *ScStack::getPushValue() {
//////////////////////////////////////////////////////////////////////////
ScValue *ScStack::getTop() {
if (_sP < 0 || _sP >= (int32)_values.size()) {
- return NULL;
+ return nullptr;
} else {
return _values[_sP];
}
@@ -108,7 +108,7 @@ ScValue *ScStack::getTop() {
ScValue *ScStack::getAt(int index) {
index = _sP - index;
if (index < 0 || index >= (int32)_values.size()) {
- return NULL;
+ return nullptr;
} else {
return _values[index];
}
diff --git a/engines/wintermute/base/scriptables/script_value.cpp b/engines/wintermute/base/scriptables/script_value.cpp
index ad8ab26e09..08b8ddd418 100644
--- a/engines/wintermute/base/scriptables/script_value.cpp
+++ b/engines/wintermute/base/scriptables/script_value.cpp
@@ -49,9 +49,9 @@ ScValue::ScValue(BaseGame *inGame) : BaseClass(inGame) {
_valBool = false;
_valInt = 0;
_valFloat = 0.0f;
- _valNative = NULL;
- _valString = NULL;
- _valRef = NULL;
+ _valNative = nullptr;
+ _valString = nullptr;
+ _valRef = nullptr;
_persistent = false;
_isConstVar = false;
}
@@ -64,9 +64,9 @@ ScValue::ScValue(BaseGame *inGame, bool val) : BaseClass(inGame) {
_valInt = 0;
_valFloat = 0.0f;
- _valNative = NULL;
- _valString = NULL;
- _valRef = NULL;
+ _valNative = nullptr;
+ _valString = nullptr;
+ _valRef = nullptr;
_persistent = false;
_isConstVar = false;
}
@@ -79,9 +79,9 @@ ScValue::ScValue(BaseGame *inGame, int val) : BaseClass(inGame) {
_valFloat = 0.0f;
_valBool = false;
- _valNative = NULL;
- _valString = NULL;
- _valRef = NULL;
+ _valNative = nullptr;
+ _valString = nullptr;
+ _valRef = nullptr;
_persistent = false;
_isConstVar = false;
}
@@ -94,9 +94,9 @@ ScValue::ScValue(BaseGame *inGame, double val) : BaseClass(inGame) {
_valInt = 0;
_valBool = false;
- _valNative = NULL;
- _valString = NULL;
- _valRef = NULL;
+ _valNative = nullptr;
+ _valString = nullptr;
+ _valRef = nullptr;
_persistent = false;
_isConstVar = false;
}
@@ -105,14 +105,14 @@ ScValue::ScValue(BaseGame *inGame, double val) : BaseClass(inGame) {
//////////////////////////////////////////////////////////////////////////
ScValue::ScValue(BaseGame *inGame, const char *val) : BaseClass(inGame) {
_type = VAL_STRING;
- _valString = NULL;
+ _valString = nullptr;
setStringVal(val);
_valBool = false;
_valInt = 0;
_valFloat = 0.0f;
- _valNative = NULL;
- _valRef = NULL;
+ _valNative = nullptr;
+ _valRef = nullptr;
_persistent = false;
_isConstVar = false;
}
@@ -131,7 +131,7 @@ void ScValue::cleanup(bool ignoreNatives) {
_valNative->_refCount--;
if (_valNative->_refCount <= 0) {
delete _valNative;
- _valNative = NULL;
+ _valNative = nullptr;
}
}
}
@@ -142,9 +142,9 @@ void ScValue::cleanup(bool ignoreNatives) {
_valBool = false;
_valInt = 0;
_valFloat = 0.0f;
- _valNative = NULL;
- _valString = NULL;
- _valRef = NULL;
+ _valNative = nullptr;
+ _valString = nullptr;
+ _valRef = nullptr;
_persistent = false;
_isConstVar = false;
}
@@ -176,13 +176,13 @@ ScValue *ScValue::getProp(const char *name) {
return _gameRef->_scValue;
}
- ScValue *ret = NULL;
+ ScValue *ret = nullptr;
if (_type == VAL_NATIVE && _valNative) {
ret = _valNative->scGetProperty(name);
}
- if (ret == NULL) {
+ if (ret == nullptr) {
_valIter = _valObject.find(name);
if (_valIter != _valObject.end()) {
ret = _valIter->_value;
@@ -200,7 +200,7 @@ bool ScValue::deleteProp(const char *name) {
_valIter = _valObject.find(name);
if (_valIter != _valObject.end()) {
delete _valIter->_value;
- _valIter->_value = NULL;
+ _valIter->_value = nullptr;
}
return STATUS_OK;
@@ -220,7 +220,7 @@ bool ScValue::setProp(const char *name, ScValue *val, bool copyWhole, bool setAs
}
if (DID_FAIL(ret)) {
- ScValue *newVal = NULL;
+ ScValue *newVal = nullptr;
_valIter = _valObject.find(name);
if (_valIter != _valObject.end()) {
@@ -244,7 +244,7 @@ bool ScValue::setProp(const char *name, ScValue *val, bool copyWhole, bool setAs
_valIter = _valObject.find(Name);
if (_valIter != _valObject.end()) {
delete _valIter->_value;
- _valIter->_value = NULL;
+ _valIter->_value = nullptr;
}
ScValue* val = new ScValue(_gameRef);
val->Copy(Val, CopyWhole);
@@ -451,11 +451,11 @@ void ScValue::setString(const Common::String &val) {
void ScValue::setStringVal(const char *val) {
if (_valString) {
delete[] _valString;
- _valString = NULL;
+ _valString = nullptr;
}
- if (val == NULL) {
- _valString = NULL;
+ if (val == nullptr) {
+ _valString = nullptr;
return;
}
@@ -479,7 +479,7 @@ void ScValue::setNULL() {
delete _valNative;
}
}
- _valNative = NULL;
+ _valNative = nullptr;
deleteProps();
_type = VAL_NULL;
@@ -493,7 +493,7 @@ void ScValue::setNative(BaseScriptable *val, bool persistent) {
return;
}
- if (val == NULL) {
+ if (val == nullptr) {
setNULL();
} else {
if (_valNative && !_persistent) {
@@ -502,7 +502,7 @@ void ScValue::setNative(BaseScriptable *val, bool persistent) {
if (_valNative != val) {
delete _valNative;
}
- _valNative = NULL;
+ _valNative = nullptr;
}
}
@@ -693,7 +693,7 @@ BaseScriptable *ScValue::getNative() {
if (_type == VAL_NATIVE) {
return _valNative;
} else {
- return NULL;
+ return nullptr;
}
}
@@ -714,7 +714,7 @@ void ScValue::copy(ScValue *orig, bool copyWhole) {
if (_valNative != orig->_valNative) {
delete _valNative;
}
- _valNative = NULL;
+ _valNative = nullptr;
}
}