Better UID Calculation + Longer ObjectUID Column

Don't even bother using vector in the key calculation, the sqf ObjectUID
isn't as critical anymore. This method will be much faster.

Changed ObjectUID column to Varchar since with this key generation
method we can approach the BigINT ceiling much quicker than we used to.
This commit is contained in:
icomrade
2016-09-26 16:34:26 -04:00
parent 111d9e46f0
commit 8c3fe83a87
2 changed files with 4 additions and 43 deletions

View File

@@ -177,50 +177,10 @@ dayz_objectUID2 = {
_position = _this select 1;
if((count _this) == 2) then {
//_key = str(round(diag_tickTime max 1)) + (str(round(abs(_position select 0))) + str(round(abs(_position select 1))) + str(round _dir));
_key = format["%1%2%3%4",(round(diag_tickTime max 1)), (round(abs(_position select 0))), (round(abs(_position select 1))), (round _dir)];
_key = format["%1%2%3%4%5",(round(diag_tickTime max 1)), (round(abs(_position select 0))), (round(abs(_position select 1))), (round _dir), (round (random(diag_tickTime max 1)))];
} else {
_vector = [];
_usedVec = false;
{
_element = _x;
if(typeName _element == "ARRAY") then{
_vector = _element;
if((count _vector) == 2)then{
if(((count (_vector select 0)) == 3) && ((count (_vector select 1)) == 3))then{
{
_x = _x * 10;
if ( _x < 0 ) then { _x = _x * -10 };
_key = _key + str(round(_x));
} count _position;
_vecCnt = 0;
{
_set = _x;
{
_vecCnt = _vecCnt + (round (_x * 100));
} foreach _set;
} foreach _vector;
if(_vecCnt < 0)then{
_vecCnt = ((_vecCnt * -1) * 3);
};
_key = _key + str(_vecCnt);
_usedVec = true;
};
};
};
} count _this;
if!(_usedVec) then{
{
_x = _x * 10;
if ( _x < 0 ) then { _x = _x * -10 };
_key = _key + str(round(_x));
} count _position;
_key = _key + str(round(_dir));
};
};
_key = format["%1%2%3%4%5%6",(round(diag_tickTime max 1)), (round(abs(_position select 0))), (round(abs(_position select 1))), (round(abs(_position select 2))), (round _dir), (round (random(diag_tickTime max 1)))];
};
_key
};

View File

@@ -15,6 +15,7 @@ ALTER TABLE `Object_DATA` CHANGE `Hitpoints` `Hitpoints` VARCHAR(1024) CHARACTER
-- Update Object_DATA to support longer CharacterID and hitpoints
-- ----------------------------
ALTER TABLE Object_DATA MODIFY COLUMN CharacterID bigint(20);
ALTER TABLE Object_DATA MODIFY COLUMN ObjectUID varchar(64);
ALTER TABLE Object_DATA MODIFY COLUMN Hitpoints varchar(1024);
-- ----------------------------