mirror of
https://github.com/EpochModTeam/DayZ-Epoch.git
synced 2025-12-14 20:13:13 +03:00
Correct duplicate object UID check
I forgot numbers greater than 1 million are truncated when converted to
string:
http://killzonekid.com/arma-scripting-tutorials-float-to-string-position-to-string/
KeyStartNumber exceeded 6 digits which is why it was being truncated to
"1e+011" and getting stuck on loop (as that string was already in
currentObjectUIDs) as mentioned in 2df7279.
Starting at 10, there should never be more than a couple duplicates
generated, so keyStartNumber will never exceed about 100 max. Added an
exit just for a fail safe.
This commit is contained in:
@@ -555,7 +555,7 @@ if (isServer) then {
|
||||
|
||||
// EPOCH ADDITIONS
|
||||
currentObjectUIDs = [];
|
||||
keyStartNumber = 100000000000;
|
||||
keyStartNumber = 10; // Can not exceed 6 digits. Numbers >= 1 million are truncated when converted to string. i.e. "1e+006"
|
||||
DZE_safeVehicle = ["ParachuteWest","ParachuteC"];
|
||||
if (isNil "EpochUseEvents") then {EpochUseEvents = false;};
|
||||
if (isNil "EpochEvents") then {EpochEvents = [];};
|
||||
|
||||
@@ -228,6 +228,9 @@ dayz_objectUID2 = {
|
||||
while {true} do {
|
||||
if !(_key in currentObjectUIDs) exitWith {currentObjectUIDs set [count currentObjectUIDs,_key];};
|
||||
keyStartNumber = keyStartNumber + 1;
|
||||
if (keyStartNumber > 40000) exitWith { //Should never fail more times than total number of objects in database
|
||||
diag_log format["ERROR: dayz_objectUID2 failed to correct duplicate objectUID: %1. This should not happen.",_key];
|
||||
};
|
||||
_key = str keyStartNumber;
|
||||
diag_log format["Duplicate UID generated by dayz_objectUID2. Automatically corrected to +1= %1. This should rarely happen.",_key];
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user