aboutsummaryrefslogtreecommitdiff
path: root/engines/wintermute/base/scriptables
diff options
context:
space:
mode:
authorEinar Johan Trøan Sømåen2012-08-31 18:25:24 +0200
committerEinar Johan Trøan Sømåen2012-08-31 19:23:41 +0200
commit2fd38f47e04430b8684502e625f87a04dd968def (patch)
treec08bc59102689714bc82de3dde924e5bacd08558 /engines/wintermute/base/scriptables
parent969f4d5947b6a36d66c12c510b8fe623e1782bbd (diff)
downloadscummvm-rg350-2fd38f47e04430b8684502e625f87a04dd968def.tar.gz
scummvm-rg350-2fd38f47e04430b8684502e625f87a04dd968def.tar.bz2
scummvm-rg350-2fd38f47e04430b8684502e625f87a04dd968def.zip
WINTERMUTE: Replace col_templ's getSize with Common::Array::size()
Diffstat (limited to 'engines/wintermute/base/scriptables')
-rw-r--r--engines/wintermute/base/scriptables/script.cpp2
-rw-r--r--engines/wintermute/base/scriptables/script_engine.cpp28
-rw-r--r--engines/wintermute/base/scriptables/script_stack.cpp18
3 files changed, 24 insertions, 24 deletions
diff --git a/engines/wintermute/base/scriptables/script.cpp b/engines/wintermute/base/scriptables/script.cpp
index 6c8a88adb0..beef4ee9d2 100644
--- a/engines/wintermute/base/scriptables/script.cpp
+++ b/engines/wintermute/base/scriptables/script.cpp
@@ -1423,7 +1423,7 @@ bool ScScript::copyParameters(ScStack *stack) {
//////////////////////////////////////////////////////////////////////////
bool ScScript::finishThreads() {
- for (int i = 0; i < _engine->_scripts.getSize(); i++) {
+ for (uint32 i = 0; i < _engine->_scripts.size(); i++) {
ScScript *scr = _engine->_scripts[i];
if (scr->_thread && scr->_state != SCRIPT_FINISHED && scr->_owner == _owner && scumm_stricmp(scr->_filename, _filename) == 0) {
scr->finish(true);
diff --git a/engines/wintermute/base/scriptables/script_engine.cpp b/engines/wintermute/base/scriptables/script_engine.cpp
index 575e24a3a3..d518be579f 100644
--- a/engines/wintermute/base/scriptables/script_engine.cpp
+++ b/engines/wintermute/base/scriptables/script_engine.cpp
@@ -95,7 +95,7 @@ ScEngine::~ScEngine() {
//////////////////////////////////////////////////////////////////////////
bool ScEngine::cleanup() {
- for (int i = 0; i < _scripts.getSize(); i++) {
+ for (uint32 i = 0; i < _scripts.size(); i++) {
if (!_scripts[i]->_thread && _scripts[i]->_owner) {
_scripts[i]->_owner->removeScript(_scripts[i]);
}
@@ -248,19 +248,19 @@ byte *ScEngine::getCompiledScript(const char *filename, uint32 *outSize, bool ig
//////////////////////////////////////////////////////////////////////////
bool ScEngine::tick() {
- if (_scripts.getSize() == 0) {
+ if (_scripts.size() == 0) {
return STATUS_OK;
}
// resolve waiting scripts
- for (int i = 0; i < _scripts.getSize(); i++) {
+ for (uint32 i = 0; i < _scripts.size(); i++) {
switch (_scripts[i]->_state) {
case SCRIPT_WAITING: {
/*
bool obj_found=false;
- for(int j=0; j<_gameRef->_regObjects.getSize(); j++)
+ for(int j=0; j<_gameRef->_regObjects.size(); j++)
{
if (_gameRef->_regObjects[j] == _scripts[i]->_waitObject)
{
@@ -318,7 +318,7 @@ bool ScEngine::tick() {
// execute scripts
- for (int i = 0; i < _scripts.getSize(); i++) {
+ for (uint32 i = 0; i < _scripts.size(); i++) {
// skip paused scripts
if (_scripts[i]->_state == SCRIPT_PAUSED) {
@@ -365,7 +365,7 @@ bool ScEngine::tick() {
//////////////////////////////////////////////////////////////////////////
bool ScEngine::tickUnbreakable() {
// execute unbreakable scripts
- for (int i = 0; i < _scripts.getSize(); i++) {
+ for (uint32 i = 0; i < _scripts.size(); i++) {
if (!_scripts[i]->_unbreakable) {
continue;
}
@@ -386,7 +386,7 @@ bool ScEngine::tickUnbreakable() {
//////////////////////////////////////////////////////////////////////////
bool ScEngine::removeFinishedScripts() {
// remove finished scripts
- for (int i = 0; i < _scripts.getSize(); i++) {
+ for (uint32 i = 0; i < _scripts.size(); i++) {
if (_scripts[i]->_state == SCRIPT_FINISHED || _scripts[i]->_state == SCRIPT_ERROR) {
if (!_scripts[i]->_thread && _scripts[i]->_owner) {
_scripts[i]->_owner->removeScript(_scripts[i]);
@@ -405,7 +405,7 @@ bool ScEngine::removeFinishedScripts() {
int ScEngine::getNumScripts(int *running, int *waiting, int *persistent) {
int numRunning = 0, numWaiting = 0, numPersistent = 0, numTotal = 0;
- for (int i = 0; i < _scripts.getSize(); i++) {
+ for (uint32 i = 0; i < _scripts.size(); i++) {
if (_scripts[i]->_state == SCRIPT_FINISHED) {
continue;
}
@@ -456,7 +456,7 @@ bool ScEngine::emptyScriptCache() {
//////////////////////////////////////////////////////////////////////////
bool ScEngine::resetObject(BaseObject *Object) {
// terminate all scripts waiting for this object
- for (int i = 0; i < _scripts.getSize(); i++) {
+ for (uint32 i = 0; i < _scripts.size(); i++) {
if (_scripts[i]->_state == SCRIPT_WAITING && _scripts[i]->_waitObject == Object) {
if (!_gameRef->_compatKillMethodThreads) {
resetScript(_scripts[i]);
@@ -472,7 +472,7 @@ bool ScEngine::resetObject(BaseObject *Object) {
//////////////////////////////////////////////////////////////////////////
bool ScEngine::resetScript(ScScript *script) {
// terminate all scripts waiting for this script
- for (int i = 0; i < _scripts.getSize(); i++) {
+ for (uint32 i = 0; i < _scripts.size(); i++) {
if (_scripts[i]->_state == SCRIPT_WAITING_SCRIPT && _scripts[i]->_waitScript == script) {
_scripts[i]->finish();
}
@@ -497,7 +497,7 @@ bool ScEngine::persist(BasePersistenceManager *persistMgr) {
//////////////////////////////////////////////////////////////////////////
void ScEngine::editorCleanup() {
- for (int i = 0; i < _scripts.getSize(); i++) {
+ for (uint32 i = 0; i < _scripts.size(); i++) {
if (_scripts[i]->_owner == NULL && (_scripts[i]->_state == SCRIPT_FINISHED || _scripts[i]->_state == SCRIPT_ERROR)) {
delete _scripts[i];
_scripts.remove_at(i);
@@ -509,7 +509,7 @@ void ScEngine::editorCleanup() {
//////////////////////////////////////////////////////////////////////////
bool ScEngine::pauseAll() {
- for (int i = 0; i < _scripts.getSize(); i++) {
+ for (uint32 i = 0; i < _scripts.size(); i++) {
if (_scripts[i] != _currentScript) {
_scripts[i]->pause();
}
@@ -521,7 +521,7 @@ bool ScEngine::pauseAll() {
//////////////////////////////////////////////////////////////////////////
bool ScEngine::resumeAll() {
- for (int i = 0; i < _scripts.getSize(); i++) {
+ for (uint32 i = 0; i < _scripts.size(); i++) {
_scripts[i]->resume();
}
@@ -531,7 +531,7 @@ bool ScEngine::resumeAll() {
//////////////////////////////////////////////////////////////////////////
bool ScEngine::isValidScript(ScScript *script) {
- for (int i = 0; i < _scripts.getSize(); i++) {
+ for (uint32 i = 0; i < _scripts.size(); i++) {
if (_scripts[i] == script) {
return true;
}
diff --git a/engines/wintermute/base/scriptables/script_stack.cpp b/engines/wintermute/base/scriptables/script_stack.cpp
index 7e81cdaf17..d27748abe6 100644
--- a/engines/wintermute/base/scriptables/script_stack.cpp
+++ b/engines/wintermute/base/scriptables/script_stack.cpp
@@ -44,10 +44,10 @@ ScStack::ScStack(BaseGame *inGame) : BaseClass(inGame) {
ScStack::~ScStack() {
#if _DEBUG
- //_gameRef->LOG(0, "STAT: Stack size: %d, SP=%d", _values.getSize(), _sP);
+ //_gameRef->LOG(0, "STAT: Stack size: %d, SP=%d", _values.size(), _sP);
#endif
- for (int i = 0; i < _values.getSize(); i++) {
+ for (uint32 i = 0; i < _values.size(); i++) {
delete _values[i];
}
_values.clear();
@@ -69,7 +69,7 @@ ScValue *ScStack::pop() {
void ScStack::push(ScValue *val) {
_sP++;
- if (_sP < _values.getSize()) {
+ if (_sP < (int32)_values.size()) {
_values[_sP]->cleanup();
_values[_sP]->copy(val);
} else {
@@ -84,7 +84,7 @@ void ScStack::push(ScValue *val) {
ScValue *ScStack::getPushValue() {
_sP++;
- if (_sP >= _values.getSize()) {
+ if (_sP >= (int32)_values.size()) {
ScValue *val = new ScValue(_gameRef);
_values.add(val);
}
@@ -96,7 +96,7 @@ ScValue *ScStack::getPushValue() {
//////////////////////////////////////////////////////////////////////////
ScValue *ScStack::getTop() {
- if (_sP < 0 || _sP >= _values.getSize()) {
+ if (_sP < 0 || _sP >= (int32)_values.size()) {
return NULL;
} else {
return _values[_sP];
@@ -107,7 +107,7 @@ ScValue *ScStack::getTop() {
//////////////////////////////////////////////////////////////////////////
ScValue *ScStack::getAt(int index) {
index = _sP - index;
- if (index < 0 || index >= _values.getSize()) {
+ if (index < 0 || index >= (int32)_values.size()) {
return NULL;
} else {
return _values[index];
@@ -136,9 +136,9 @@ void ScStack::correctParams(uint32 expectedParams) {
nuParams++;
_sP++;
- if (_values.getSize() > _sP + 1) {
- delete _values[_values.getSize() - 1];
- _values.remove_at(_values.getSize() - 1);
+ if ((int32)_values.size() > _sP + 1) {
+ delete _values[_values.size() - 1];
+ _values.remove_at(_values.size() - 1);
}
}
}