diff options
| author | johndoe123 | 2014-08-01 23:43:37 +0200 |
|---|---|---|
| committer | Eugene Sandulenko | 2018-07-20 06:43:33 +0000 |
| commit | 50d340de00ac23c0a75ad613ad3aa64f0f28fb57 (patch) | |
| tree | f76ca782f48d33da375f76f71e80e157435b2982 /engines/illusions/scriptstack.cpp | |
| parent | 297996a0900acca177ecfd3ffa51907ad8d284fa (diff) | |
| download | scummvm-rg350-50d340de00ac23c0a75ad613ad3aa64f0f28fb57.tar.gz scummvm-rg350-50d340de00ac23c0a75ad613ad3aa64f0f28fb57.tar.bz2 scummvm-rg350-50d340de00ac23c0a75ad613ad3aa64f0f28fb57.zip | |
ILLUSIONS: Rename file scriptman,* to scriptstack.* and remove unneccessary includes of it
Diffstat (limited to 'engines/illusions/scriptstack.cpp')
| -rw-r--r-- | engines/illusions/scriptstack.cpp | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/engines/illusions/scriptstack.cpp b/engines/illusions/scriptstack.cpp new file mode 100644 index 0000000000..36cd3cb8e5 --- /dev/null +++ b/engines/illusions/scriptstack.cpp @@ -0,0 +1,67 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "illusions/illusions.h" +#include "illusions/scriptstack.h" + +namespace Illusions { + +// ScriptStack + +ScriptStack::ScriptStack() { + clear(); +} + +void ScriptStack::clear() { + for (uint i = 0; i < 256; ++i) + _stack[i] = (int16)0xEEEE; + _stackPos = 256; +} + +void ScriptStack::push(int16 value) { + --_stackPos; + if (_stackPos > 0) + _stack[_stackPos] = value; +} + +int16 ScriptStack::pop() { + int16 value = 0; + if (_stackPos < 256) { + value = _stack[_stackPos]; + _stack[_stackPos] = (int16)0xEEEE; + ++_stackPos; + } + return value; +} + +int16 ScriptStack::peek() { + int16 value = 0; + if (_stackPos < 256) + value = _stack[_stackPos]; + return value; +} + +int16 *ScriptStack::topPtr() { + return &_stack[_stackPos]; +} + +} // End of namespace Illusions |
