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/execution.cpp
|
||||||
src/script/instrutil.cpp
|
src/script/instrutil.cpp
|
||||||
src/script/ncsreader.cpp
|
src/script/ncsreader.cpp
|
||||||
|
src/script/object.cpp
|
||||||
src/script/program.cpp
|
src/script/program.cpp
|
||||||
src/script/routine.cpp
|
src/script/routine.cpp
|
||||||
src/script/scripts.cpp
|
src/script/scripts.cpp
|
||||||
|
|
|
@ -38,10 +38,6 @@ void Object::clearAllActions() {
|
||||||
_actionQueue.clear();
|
_actionQueue.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Object::setTag(const string &tag) {
|
|
||||||
_tag = tag;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Object::setMinOneHP(bool minOneHP) {
|
void Object::setMinOneHP(bool minOneHP) {
|
||||||
_minOneHP = minOneHP;
|
_minOneHP = minOneHP;
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,13 +40,11 @@ public:
|
||||||
|
|
||||||
ObjectType type() const { return _type; }
|
ObjectType type() const { return _type; }
|
||||||
const std::string &blueprintResRef() const { return _blueprintResRef; }
|
const std::string &blueprintResRef() const { return _blueprintResRef; }
|
||||||
const std::string &tag() const { return _tag; }
|
|
||||||
const std::string &name() const { return _name; }
|
const std::string &name() const { return _name; }
|
||||||
const std::string &conversation() const { return _conversation; }
|
const std::string &conversation() const { return _conversation; }
|
||||||
ActionQueue &actionQueue() { return _actionQueue; }
|
ActionQueue &actionQueue() { return _actionQueue; }
|
||||||
int plotFlag() const { return _plotFlag; }
|
int plotFlag() const { return _plotFlag; }
|
||||||
|
|
||||||
void setTag(const std::string &tag);
|
|
||||||
void setPlotFlag(int flag);
|
void setPlotFlag(int flag);
|
||||||
void setCommandable(bool value);
|
void setCommandable(bool value);
|
||||||
|
|
||||||
|
@ -76,7 +74,6 @@ public:
|
||||||
protected:
|
protected:
|
||||||
ObjectType _type { ObjectType::Invalid };
|
ObjectType _type { ObjectType::Invalid };
|
||||||
std::string _blueprintResRef;
|
std::string _blueprintResRef;
|
||||||
std::string _tag;
|
|
||||||
std::string _name;
|
std::string _name;
|
||||||
std::string _conversation;
|
std::string _conversation;
|
||||||
ActionQueue _actionQueue;
|
ActionQueue _actionQueue;
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
#include "../common/log.h"
|
#include "../common/log.h"
|
||||||
|
|
||||||
#include "instrutil.h"
|
#include "instrutil.h"
|
||||||
|
#include "object.h"
|
||||||
#include "routine.h"
|
#include "routine.h"
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
@ -83,7 +84,13 @@ ScriptExecution::ScriptExecution(const shared_ptr<ScriptProgram> &program, const
|
||||||
}
|
}
|
||||||
|
|
||||||
int ScriptExecution::run() {
|
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;
|
uint32_t insOff = kStartInstructionOffset;
|
||||||
|
|
||||||
if (_context.savedState) {
|
if (_context.savedState) {
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
#include <boost/noncopyable.hpp>
|
#include <boost/noncopyable.hpp>
|
||||||
|
|
||||||
|
@ -30,11 +31,15 @@ public:
|
||||||
virtual ~ScriptObject() = default;
|
virtual ~ScriptObject() = default;
|
||||||
|
|
||||||
uint32_t id() const { return _id; }
|
uint32_t id() const { return _id; }
|
||||||
|
const std::string &tag() const { return _tag; }
|
||||||
|
|
||||||
|
void setTag(std::string tag);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
uint32_t _id { 0 };
|
uint32_t _id { 0 };
|
||||||
|
std::string _tag;
|
||||||
|
|
||||||
ScriptObject(uint32_t id) : _id(id) { }
|
ScriptObject(uint32_t id);
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace script
|
} // namespace script
|
||||||
|
|
Loading…
Reference in a new issue