mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-04-28 21:07:59 +03:00
make MenuMode, Random, GetSecondsPassed regular functions
This commit is contained in:
parent
f0e2ee45fa
commit
3875b837bc
15 changed files with 50 additions and 155 deletions
|
@ -35,8 +35,6 @@ namespace Interpreter
|
|||
|
||||
virtual void report (const std::string& message) = 0;
|
||||
|
||||
virtual bool menuMode() = 0;
|
||||
|
||||
virtual int getGlobalShort (const std::string& name) const = 0;
|
||||
|
||||
virtual int getGlobalLong (const std::string& name) const = 0;
|
||||
|
@ -79,8 +77,6 @@ namespace Interpreter
|
|||
|
||||
virtual std::string getCurrentCellName() const = 0;
|
||||
|
||||
virtual float getSecondsPassed() const = 0;
|
||||
|
||||
virtual int getMemberShort (const std::string& id, const std::string& name, bool global) const = 0;
|
||||
|
||||
virtual int getMemberLong (const std::string& id, const std::string& name, bool global) const = 0;
|
||||
|
|
|
@ -95,9 +95,6 @@ namespace Interpreter
|
|||
|
||||
// misc
|
||||
interpreter.installSegment3 (0, new OpMessageBox);
|
||||
interpreter.installSegment5 (38, new OpMenuMode);
|
||||
interpreter.installSegment5 (45, new OpRandom);
|
||||
interpreter.installSegment5 (50, new OpGetSecondsPassed);
|
||||
interpreter.installSegment5 (58, new OpReport);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
#include "runtime.hpp"
|
||||
#include "defines.hpp"
|
||||
|
||||
#include <components/misc/rng.hpp>
|
||||
#include <components/misc/messageformatparser.hpp>
|
||||
|
||||
namespace Interpreter
|
||||
|
@ -168,44 +167,6 @@ namespace Interpreter
|
|||
}
|
||||
};
|
||||
|
||||
class OpMenuMode : public Opcode0
|
||||
{
|
||||
public:
|
||||
|
||||
virtual void execute (Runtime& runtime)
|
||||
{
|
||||
runtime.push (runtime.getContext().menuMode());
|
||||
}
|
||||
};
|
||||
|
||||
class OpRandom : public Opcode0
|
||||
{
|
||||
public:
|
||||
|
||||
virtual void execute (Runtime& runtime)
|
||||
{
|
||||
Type_Integer limit = runtime[0].mInteger;
|
||||
|
||||
if (limit<0)
|
||||
throw std::runtime_error (
|
||||
"random: argument out of range (Don't be so negative!)");
|
||||
|
||||
runtime[0].mFloat = static_cast<Type_Float>(Misc::Rng::rollDice(limit)); // [o, limit)
|
||||
}
|
||||
};
|
||||
|
||||
class OpGetSecondsPassed : public Opcode0
|
||||
{
|
||||
public:
|
||||
|
||||
virtual void execute (Runtime& runtime)
|
||||
{
|
||||
Type_Float duration = runtime.getContext().getSecondsPassed();
|
||||
|
||||
runtime.push (duration);
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue