1 #ifndef INTERPRETER_MISCOPCODES_H_INCLUDED
2 #define INTERPRETER_MISCOPCODES_H_INCLUDED
29 std::ostringstream out;
34 out.precision(precision);
63 out << std::fixed << value;
69 std::string standard = out.str();
71 out.str(std::string());
74 out << std::scientific << value;
75 std::string scientific = out.str();
77 mFormattedMessage += standard.length() < scientific.length() ? standard : scientific;
81 out << std::scientific << value;
105 MessageFormatParser::process(message);
121 return formattedMessage;
131 int index = runtime[0].mInteger;
136 std::vector<std::string> buttons;
138 for (std::size_t i=0; i<arg0; ++i)
140 index = runtime[0].mInteger;
145 std::reverse (buttons.begin(), buttons.end());
148 std::string formattedMessage =
formatMessage (message, runtime);
161 int index = runtime[0].mInteger;
166 std::string formattedMessage =
formatMessage (message, runtime);
191 throw std::runtime_error (
192 "random: argument out of range (Don't be so negative!)");
196 runtime[0].mInteger = value;
208 runtime.
push (duration);
248 int index = runtime[0].mInteger;
262 int index = runtime[0].mInteger;
276 int index = runtime[0].mInteger;
virtual void enable(const std::string &id="")=0
std::string formatMessage(const std::string &message, Runtime &runtime)
Definition: miscopcodes.hpp:114
void message(CodeContainer &code, Literals &literals, const std::string &message, int buttons)
Definition: generator.cpp:537
void pop()
pop stack
Definition: runtime.cpp:94
void push(const Data &data)
push data on stack
Definition: runtime.cpp:75
std::string getStringLiteral(int index) const
Definition: runtime.cpp:34
Runtime data and engine interface.
Definition: runtime.hpp:15
Definition: miscopcodes.hpp:256
opcode for 0 arguments
Definition: opcodes.hpp:9
virtual void execute(Runtime &runtime)
Definition: miscopcodes.hpp:260
Definition: miscopcodes.hpp:212
virtual bool isDisabled(const std::string &id="") const =0
virtual void execute(Runtime &runtime)
Definition: miscopcodes.hpp:216
virtual void execute(Runtime &runtime)
Definition: miscopcodes.hpp:204
virtual void execute(Runtime &runtime)
Definition: miscopcodes.hpp:274
Definition: miscopcodes.hpp:154
static int rollDice(int max)
return value in range [0, max) <- note open upper range.
Definition: rng.cpp:26
virtual void execute(Runtime &runtime)
Definition: miscopcodes.hpp:226
Definition: miscopcodes.hpp:182
Definition: miscopcodes.hpp:270
Definition: miscopcodes.hpp:200
virtual void execute(Runtime &runtime)
Definition: miscopcodes.hpp:246
virtual void messageBox(const std::string &message, const std::vector< std::string > &buttons)=0
virtual void execute(Runtime &runtime)
Definition: miscopcodes.hpp:158
virtual void execute(Runtime &runtime, unsigned int arg0)
Definition: miscopcodes.hpp:128
virtual void execute(Runtime &runtime)
Definition: miscopcodes.hpp:186
Context & getContext()
Definition: runtime.cpp:110
virtual float getSecondsPassed() const =0
float Type_Float
Definition: types.hpp:16
std::string fixDefinesMsgBox(const std::string &text, Context &context)
Definition: defines.cpp:215
Definition: miscopcodes.hpp:222
opcode for 1 argument
Definition: opcodes.hpp:19
virtual void execute(Runtime &runtime)
Definition: miscopcodes.hpp:236
Definition: miscopcodes.hpp:232
virtual void disable(const std::string &id="")=0
Definition: miscopcodes.hpp:242
virtual bool menuMode()=0
virtual void report(const std::string &message)=0
Definition: miscopcodes.hpp:124