Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add scriptNames to functions for debugging #1079

Merged
merged 1 commit into from
Mar 7, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions addons/common/init_perFrameHandler.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ GVAR(waitUntilAndExecArray) = [];

// per frame handler system
[QFUNC(onFrame), {
SCRIPT(onFrame);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have wished for this stuff for SOOOO long, to be able to see it in the debugger. Which it can't because there is no identifying factor in there.
Maybe just move it into a SQF file ^^

private _tickTime = diag_tickTime;
call FUNC(missionTimePFH);

Expand Down Expand Up @@ -103,6 +104,7 @@ if (isMultiplayer) then {
if (isServer) then {
// multiplayer server
[QFUNC(missionTimePFH), {
SCRIPT(missionTimePFH_server);
if (time != GVAR(lastTime)) then {
CBA_missionTime = CBA_missionTime + (_tickTime - GVAR(lastTickTime));
GVAR(lastTime) = time; // used to detect paused game
Expand All @@ -126,6 +128,7 @@ if (isMultiplayer) then {
GVAR(lastTickTime) = diag_tickTime; // prevent time skip on clients

[QFUNC(missionTimePFH), {
SCRIPT(missionTimePFH_client);
if (time != GVAR(lastTime)) then {
CBA_missionTime = CBA_missionTime + (_tickTime - GVAR(lastTickTime));
GVAR(lastTime) = time; // used to detect paused game
Expand All @@ -148,6 +151,7 @@ if (isMultiplayer) then {
} else {
// single player
[QFUNC(missionTimePFH), {
SCRIPT(missionTimePFH_sp);
if (time != GVAR(lastTime)) then {
CBA_missionTime = CBA_missionTime + (_tickTime - GVAR(lastTickTime)) * accTime;
GVAR(lastTime) = time; // used to detect paused game
Expand Down
3 changes: 3 additions & 0 deletions addons/events/fnc_addPlayerEventHandler.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ if (_id != -1) then {

GVAR(playerEHInfo) pushBack addMissionEventHandler ["EachFrame", {call FUNC(playerEH_EachFrame)}];
[QFUNC(playerEH_EachFrame), {
SCRIPT(playerEH_EachFrame);
private _player = missionNamespace getVariable ["bis_fnc_moduleRemoteControl_unit", player];
if !(_player isEqualTo GVAR(oldUnit)) then {
[QGVAR(unitEvent), [_player, GVAR(oldUnit)]] call CBA_fnc_localEvent;
Expand Down Expand Up @@ -224,6 +225,7 @@ if (_id != -1) then {

GVAR(playerEHInfo) pushBack addMissionEventHandler ["Map", {call FUNC(playerEH_Map)}];
[QFUNC(playerEH_Map), {
SCRIPT(playerEH_Map);
params ["_data"]; // visibleMap is updated one frame later
if !(_data isEqualTo GVAR(oldVisibleMap)) then {
GVAR(oldVisibleMap) = _data;
Expand All @@ -244,6 +246,7 @@ if (_id != -1) then {
};

GVAR(playerEHInfo) pushBack ([{
SCRIPT(playerEH_featureCamera);
private _data = call CBA_fnc_getActiveFeatureCamera;
if !(_data isEqualTo GVAR(oldFeatureCamera)) then {
GVAR(oldFeatureCamera) = _data;
Expand Down
10 changes: 7 additions & 3 deletions addons/xeh/fnc_preInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -54,16 +54,20 @@ CBA_isHeadlessClient = !hasInterface && !isDedicated;
// make case insensitive list of all supported events
GVAR(EventsLowercase) = [];
{
private _header = "";
#ifndef SKIP_SCRIPT_NAME
_header = format ["scriptName 'XEH:%1';", _x];
#endif
// generate event functions
if (_x isEqualTo "Init") then {
FUNC(Init) = compileFinal "(_this select 0) call CBA_fnc_initEvents; (_this select 0) call CBA_fnc_init";
FUNC(Init) = compileFinal (_header + "(_this select 0) call CBA_fnc_initEvents; (_this select 0) call CBA_fnc_init");
} else {
if (_x isEqualTo "HitPart") then {
FUNC(HitPart) = compileFinal format ['{call _x; nil} count ((_this select 0 select 0) getVariable QGVAR(%1))', _x];
FUNC(HitPart) = compileFinal (_header + format ['{call _x; nil} count ((_this select 0 select 0) getVariable QGVAR(%1))', _x]);
} else {
missionNamespace setVariable [
format [QFUNC(%1), _x],
compileFinal format ['{call _x; nil} count ((_this select 0) getVariable QGVAR(%1))', _x]
compileFinal (_header + format ['{call _x; nil} count ((_this select 0) getVariable QGVAR(%1))', _x])
];
};
};
Expand Down
1 change: 1 addition & 0 deletions addons/xeh/fnc_startFallbackLoop.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ GVAR(fallbackRunning) = true;
GVAR(entities) = [];

[{
SCRIPT(fallbackLoopPFEH);
private _entities = entities [[], [], true, true];

if !(_entities isEqualTo GVAR(entities)) then {
Expand Down