PersistentTreeLogging/Server Addon/TreeLogging/functions/ExileServer_world_loadAllDatabaseTrees.sqf
2017-12-25 13:33:07 +01:00

35 lines
1.1 KiB
Plaintext

/**
* ExileServer_world_loadAllDatabaseTrees
*
* Exile Mod
* www.exilemod.com
* © 2015 Exile Mod Team
*
* This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License.
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.
*/
private["_continueLoading", "_page", "_pageSize", "_TreeIDs", "_numberOfTrees", "_i"];
"Loading trees from database..." call ExileServer_TreeLogging_log;
_continueLoading = true;
_page = 0;
_pageSize = 100;
while {_continueLoading} do
{
_TreeIDs = format ["loadTreeIdPage:%1:%2", _page * _pageSize, _pageSize] call ExileServer_system_database_query_selectFull;
_numberOfTrees = count _TreeIDs;
if (_numberOfTrees > 0) then
{
for "_i" from 0 to _numberOfTrees - 1 do
{
((_TreeIDs select _i) select 0) call ExileServer_object_tree_database_load;
};
};
_page = _page + 1;
if (_numberOfTrees < 100) then
{
_continueLoading = false;
};
};
"Done loading trees!" call ExileServer_TreeLogging_log;
true