Skip to content

Commit

Permalink
Added allGroups nullar
Browse files Browse the repository at this point in the history
  • Loading branch information
X39 committed Sep 24, 2017
1 parent 1d3cdd2 commit 1d96bb1
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
1 change: 1 addition & 0 deletions SQF-VM/Entry.c
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,7 @@ void register_commmands(PVM vm)
create_cmd(vm, "civilian", 'n', CMD_CIVILIAN, 4, "civilian", "", "");
create_cmd(vm, "sideEmpty", 'n', CMD_SIDEEMPTY, 4, "sideEmpty", "", "");
create_cmd(vm, "objNull", 'n', CMD_OBJNULL, 4, "objNull", "", "");
create_cmd(vm, "allGroups", 'n', CMD_ALLGROUPS, 4, "allGroups", "", "Return a list of all groups created. Unlike ArmA, contains groups of all sides.");
create_cmd(vm, "nil", 'n', CMD_NIL, 4, "nil", "", "Nil value. This value can be used to undefine existing variables.");


Expand Down
15 changes: 15 additions & 0 deletions SQF-VM/SQF_commands.c
Original file line number Diff line number Diff line change
Expand Up @@ -4526,4 +4526,19 @@ void CMD_UNITS(void* input, CPCMD self)
}
push_stack(vm, vm->stack, inst_value(value(ARRAY_TYPE(), base_voidptr(array_copy(group->members->val.ptr)))));
inst_destroy(right);
}
void CMD_ALLGROUPS(void* input, CPCMD self)
{
PVM vm = input;
PARRAY arr;
unsigned int i;
unsigned int j;
j = sm_count(vm->groupmap);
arr = array_create2(j);
for (i = 0; i < j; i++)
{
array_push(arr, value(GROUP_TYPE(), base_voidptr(((PVALUE)sm_get_value_index(vm->groupmap, i))->val.ptr)));
}

push_stack(vm, vm->stack, inst_value(value(ARRAY_TYPE(), base_voidptr(arr))));
}
1 change: 1 addition & 0 deletions SQF-VM/SQF_commands.h
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ void CMD_DELETEGROUP(void* input, CPCMD self);
void CMD_GROUPID(void* input, CPCMD self);
void CMD_CREATEUNIT(void* input, CPCMD self);
void CMD_UNITS(void* input, CPCMD self);
void CMD_ALLGROUPS(void* input, CPCMD self);


#endif // !_SQF_COMMANDS_H_

0 comments on commit 1d96bb1

Please sign in to comment.