Skip to content

Commit 08bb938

Browse files
committed
Update Intercept
x
1 parent 9aabdb9 commit 08bb938

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

src/scriptProfiler.cpp

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
#include <numeric>
55
#include <Brofiler.h>
66
#include <random>
7+
#include <windows.h>
78

89
#define BROFILER_ONLY
910

@@ -100,10 +101,10 @@ class GameInstructionProfileScopeStart : public game_instruction {
100101
#else
101102
std::chrono::high_resolution_clock::now(), profiler.startNewScope(),
102103
#endif
103-
state.eval->varspace->varspace.get("_this").val,
104+
state.eval->local->variables.get("_this").value,
104105
eventDescription);
105106

106-
state.eval->varspace->varspace.insert(
107+
state.eval->local->variables.insert(
107108
game_variable("1scp"sv, game_value(new GameDataProfileScope(std::move(data))), false)
108109
);
109110
lastScopeStart = name;
@@ -131,7 +132,7 @@ game_value createProfileScope(uintptr_t st, game_value_parameter name) {
131132

132133
auto data = std::make_shared<GameDataProfileScope::scopeData>(name, std::chrono::high_resolution_clock::now(),
133134
profiler.startNewScope(),
134-
sqf::str(state->eval->varspace->varspace.get("_this").val), //#TODO remove this. We don't want this
135+
sqf::str(state->eval->local->variables.get("_this").value), //#TODO remove this. We don't want this
135136
found->second
136137
);
137138
return game_value(new GameDataProfileScope(std::move(data)));
@@ -196,7 +197,7 @@ game_value profileScript(uintptr_t stat, game_value_parameter par) {
196197
//CBA fastForEach
197198

198199
if (par.get(1) && !par[1].is_nil()) {
199-
state->eval->varspace->varspace.insert({ "_this"sv, par[1] });
200+
state->eval->local->variables.insert({ "_this"sv, par[1] });
200201
}
201202

202203
//prep for action
@@ -484,7 +485,7 @@ uint32_t getRandColor() {
484485
return colors[colorsDist(rng)];
485486
}
486487

487-
std::string getScriptFromFirstLine(game_instruction::sourcedocpos& pos, bool compact) {//https://github.com/dedmen/ArmaDebugEngine/blob/master/BIDebugEngine/BIDebugEngine/Script.cpp
488+
std::string getScriptFromFirstLine(sourcedocpos& pos, bool compact) {//https://github.com/dedmen/ArmaDebugEngine/blob/master/BIDebugEngine/BIDebugEngine/Script.cpp
488489
if (pos.content.empty()) return pos.content.data();
489490
auto needSourceFile = pos.sourcefile.empty();
490491
int line = pos.sourceline + 1;
@@ -838,7 +839,7 @@ class GameInstructionOperator : public game_instruction {
838839
static inline std::map<size_t, Brofiler::EventDescription*> descriptions;
839840

840841
virtual bool exec(game_state& state, vm_context& t) {
841-
if (false && !sqf::can_suspend() && !state.eval->varspace->varspace.has_key("1scp")) {
842+
if (false && !sqf::can_suspend() && !state.eval->local->variables.has_key("1scp")) {
842843
auto found = descriptions.find(sdp.content.hash());
843844
if (found == descriptions.end()) {
844845
found = descriptions.insert({ sdp.content.hash(),::Brofiler::EventDescription::Create(_operators->_name, sdp.sourcefile, sdp.sourceline) }).first;
@@ -849,10 +850,10 @@ class GameInstructionOperator : public game_instruction {
849850
#else
850851
std::chrono::high_resolution_clock::now(), profiler.startNewScope(),
851852
#endif
852-
state.eval->varspace->varspace.get("_this").val,
853+
state.eval->local->variables.get("_this").value,
853854
(found->second));
854855
auto newScope = new GameDataProfileScope(std::move(data));
855-
state.eval->varspace->varspace.insert(
856+
state.eval->local->variables.insert(
856857
game_variable("1scp"sv, game_value(newScope), false)
857858
);
858859

0 commit comments

Comments
 (0)