chore: Log caller tag when executing a script
This commit is contained in:
parent
c120f8382e
commit
5efd1e02b8
5 changed files with 15 additions and 9 deletions
|
@ -376,6 +376,7 @@ set(SCRIPT_SOURCES
|
|||
src/script/execution.cpp
|
||||
src/script/instrutil.cpp
|
||||
src/script/ncsreader.cpp
|
||||
src/script/object.cpp
|
||||
src/script/program.cpp
|
||||
src/script/routine.cpp
|
||||
src/script/scripts.cpp
|
||||
|
|
|
@ -38,10 +38,6 @@ void Object::clearAllActions() {
|
|||
_actionQueue.clear();
|
||||
}
|
||||
|
||||
void Object::setTag(const string &tag) {
|
||||
_tag = tag;
|
||||
}
|
||||
|
||||
void Object::setMinOneHP(bool minOneHP) {
|
||||
_minOneHP = minOneHP;
|
||||
}
|
||||
|
|
|
@ -40,13 +40,11 @@ public:
|
|||
|
||||
ObjectType type() const { return _type; }
|
||||
const std::string &blueprintResRef() const { return _blueprintResRef; }
|
||||
const std::string &tag() const { return _tag; }
|
||||
const std::string &name() const { return _name; }
|
||||
const std::string &conversation() const { return _conversation; }
|
||||
ActionQueue &actionQueue() { return _actionQueue; }
|
||||
int plotFlag() const { return _plotFlag; }
|
||||
|
||||
void setTag(const std::string &tag);
|
||||
void setPlotFlag(int flag);
|
||||
void setCommandable(bool value);
|
||||
|
||||
|
@ -76,7 +74,6 @@ public:
|
|||
protected:
|
||||
ObjectType _type { ObjectType::Invalid };
|
||||
std::string _blueprintResRef;
|
||||
std::string _tag;
|
||||
std::string _name;
|
||||
std::string _conversation;
|
||||
ActionQueue _actionQueue;
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
#include "../common/log.h"
|
||||
|
||||
#include "instrutil.h"
|
||||
#include "object.h"
|
||||
#include "routine.h"
|
||||
|
||||
using namespace std;
|
||||
|
@ -83,7 +84,13 @@ ScriptExecution::ScriptExecution(const shared_ptr<ScriptProgram> &program, const
|
|||
}
|
||||
|
||||
int ScriptExecution::run() {
|
||||
debug("Script: run " + _program->name(), 1, DebugChannels::script);
|
||||
string callerTag;
|
||||
if (_context.caller) {
|
||||
callerTag = _context.caller->tag();
|
||||
} else {
|
||||
callerTag = "[empty]";
|
||||
}
|
||||
debug(boost::format("Script: run %s %s") % callerTag % _program->name(), 1, DebugChannels::script);
|
||||
uint32_t insOff = kStartInstructionOffset;
|
||||
|
||||
if (_context.savedState) {
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
|
||||
#include <boost/noncopyable.hpp>
|
||||
|
||||
|
@ -30,11 +31,15 @@ public:
|
|||
virtual ~ScriptObject() = default;
|
||||
|
||||
uint32_t id() const { return _id; }
|
||||
const std::string &tag() const { return _tag; }
|
||||
|
||||
void setTag(std::string tag);
|
||||
|
||||
protected:
|
||||
uint32_t _id { 0 };
|
||||
std::string _tag;
|
||||
|
||||
ScriptObject(uint32_t id) : _id(id) { }
|
||||
ScriptObject(uint32_t id);
|
||||
};
|
||||
|
||||
} // namespace script
|
||||
|
|
Loading…
Reference in a new issue