Skip to content

Commit

Permalink
Removed diag_logs, used isEqualType, add support for inherition, use …
Browse files Browse the repository at this point in the history
…deleteNamespace
  • Loading branch information
BaerMitUmlaut committed Jun 21, 2016
1 parent b63898f commit f45489d
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 8 deletions.
3 changes: 0 additions & 3 deletions addons/statemachine/fnc_addState.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,9 @@ _stateMachine setVariable [ONSTATEENTERED(_name), _onStateEntered];
_stateMachine setVariable [ONSTATELEAVING(_name), _onStateLeaving];
_stateMachine setVariable [TRANSITIONS(_name), []];

diag_log "derp";

// First state added is always the intial state
if (isNil {_stateMachine getVariable QGVAR(initialState)}) then {
_stateMachine setVariable [QGVAR(initialState), _name];
diag_log "initial state set";
};

_name
2 changes: 1 addition & 1 deletion addons/statemachine/fnc_create.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ if (isNil QGVAR(stateMachines)) then {
};

private _updateCode = {};
if (typeName _list == "CODE") then {
if (_list isEqualType {}) then {
_updateCode = _list;
_list = [] call _updateCode;
};
Expand Down
6 changes: 3 additions & 3 deletions addons/statemachine/fnc_createFromConfig.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ private _stateMachine = [_list] call FUNC(create);
[_stateMachine, _onState, _onStateEntered, _onStateLeaving, _state] call FUNC(addState);

false
} count ("true" configClasses _config);
} count (configProperties [_config, "isClass _x", true]);

// We need to add the transitions in a second loop to make sure the states exist already
{
Expand All @@ -51,9 +51,9 @@ private _stateMachine = [_list] call FUNC(create);
[_stateMachine, _state, _targetState, _condition, _onTransition, _transition] call FUNC(addTransition);

false
} count ("true" configClasses _x);
} count (configProperties [_x, "isClass _x", true]);

false
} count ("true" configClasses _config);
} count (configProperties [_config, "isClass _x", true]);

_stateMachine
2 changes: 1 addition & 1 deletion addons/statemachine/fnc_delete.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,5 @@ if (isNil QGVAR(stateMachines)) exitWith {};
private _index = GVAR(stateMachines) find _stateMachine;
if (_index != -1) then {
GVAR(stateMachines) deleteAt _index;
deleteLocation _stateMachine;
[_stateMachine] call CBA_fnc_deleteNamespace;
};

0 comments on commit f45489d

Please sign in to comment.