Jump to content
code34

OO CIRCULARLIST - Object Oriented Circular List

Recommended Posts

Object Oriented Circularlist - OO CIRCULAR LIST
Lastest version : 0.2 by code34

 

Like to Donate ? Donate with paypal
 



Github: https://github.com/code34/oo_circularlist.altis
Reference: http://forums.bistudio.com/showthread.php?167980-Object-Oriented-SQF-Scripting-and-Compiling

 

 

 



Description
OO CIRCULARLIST is a class (object oriented) that permits to use a circular list instead of simple array.

Features:

 

 

 

 

  • getPrev / GetNext Methods to parse the list meeting some custom conditions

 

 

Licence:
Under Gpl, you can share, modify, distribute this script but don't remove the licence and the name of the original author

Readme:

 

	/*
	Author: code34 nicolas_boiteux@yahoo.fr
	Copyright (C) 2014-2018 Nicolas BOITEUX

	CLASS OO_CIRCULARLIST -  Circular LIST
	
	This program is free software: you can redistribute it and/or modify
	it under the terms of the GNU General Public License as published by
	the Free Software Foundation, either version 3 of the License, or
	(at your option) any later version.
	
	This program is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
	GNU General Public License for more details.
	
	You should have received a copy of the GNU General Public License
	along with this program.  If not, see <http://www.gnu.org/licenses/>. 
	*/

	Create a circular list from array with next/get method
	
	Usage:
		put the "oo_circularlist.sqf" and the "oop.h" files in your mission directory
		put this code into your mission init.sqf
		call compilefinal preprocessFileLineNumbers "oo_circularlist.sqf";

	See example mission in directory: init.sqf
	
	Licence: 
	You can share, modify, distribute this script but don't remove the licence and the name of the original author

	logs:
		0.2	fix private var / add use case / tune sleep
		0.1 	- OO CIRCULARLIST - first release


Documentation

/*
Author: code34 nicolas_boiteux@yahoo.fr
Copyright (C) 2014-2015 Nicolas BOITEUX

CLASS OO_CIRCULARLIST - Circular LIST

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/




/*
Function: _list = ["new", array] call OO_CIRCULARLIST;
Create a new circular list

Parameters:
array - array contains the list

*/


/*
Function: = ["getPrev", [condition,return]] call _list;
Retrieve the previous element of the list

Parameters:
condition - code condition return false/true
return - return expected when all conditions are false

*/

/*
Function: = ["getNext", [condition,return]] call _list;
Retrieve the next element of the list

Parameters:
condition - code condition return false/true
return - return expected when all conditions are false

*/

/*
Function: = ["set", array] call _list;
Set the list

Parameters:
array - array containing the new list

*/


/*
Function: = ["delete", _list] call OO_CIRCULARLIST;
Destroy the list

Parameters:
_list - _list object reference

*/


Examples

	call compilefinal preprocessFileLineNumbers "oo_circularlist.sqf";

	private ["_list", "_condition"];

	_list = ["new", allunits] call OO_CIRCULARLIST;
	_condition = { if(getDammage _this > 0.5) then { false; }else{ true; }; };

	while { true } do {
		_element = ["getPrev", [_condition, objnull]] call _list;
		hint  format ["try to hurt someone - %1 is fine", name _element];
		sleep 1;
	};

Share this post


Link to post
Share on other sites

Hi

 

Just release the v 0.2

 

Changelogs:

  • fix private var 
  • add use case
  • tune sleep

Share this post


Link to post
Share on other sites

Hi

 

Just create the develop branch. The last update concerned only some issue. But, this old object will be considerably improve in the next release.

 

If you need some features about it, it s time :)

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×