further optimized db call for weather script

This commit is contained in:
vbawol 2017-04-12 10:16:23 -05:00
parent af56e4b89a
commit 6600844a4b

View File

@ -6,7 +6,7 @@
https://github.com/EpochModTeam/Epoch/tree/release/Sources/epoch_server_settings/EpochEvents/ChangeWeather.sqf
*/
//[[[cog import generate_private_arrays ]]]
private ["_weatherChangeTime","_arr","_fog","_force","_lightning","_overcast","_rain","_randomDayRainTemp","_randomDayTemp","_randomDirection","_randomFogAfterRainBase","_randomFogAfterRainDecay","_randomFogAfterRainValue","_randomFogBase","_randomFogDecay","_randomFogValue","_randomLightningValue","_randomNightRainTemp","_randomNightTemp","_randomOvercastValue","_randomRainValue","_randomWindStr","_response","_staticWeatherForecast","_temp","_windVal","_windValX","_windValY"];
private ["_fog","_force","_lightning","_overcast","_rain","_randomDayRainTemp","_randomDayTemp","_randomDirection","_randomFogAfterRainBase","_randomFogAfterRainDecay","_randomFogAfterRainValue","_randomFogBase","_randomFogDecay","_randomFogValue","_randomLightningValue","_randomNightRainTemp","_randomNightTemp","_randomOvercastValue","_randomRainValue","_randomWindStr","_staticWeatherForecast","_temp","_weatherChangeTime","_windVal","_windValX","_windValY"];
//[[[end]]]
// Initalize variable for tracking time between runs.
@ -28,10 +28,9 @@ if !(EPOCH_WeatherStaticForecast isEqualTo []) then {
_staticWeatherForecast = EPOCH_WeatherStaticForecast;
} else {
// Make database call to get "Weather:InstanceID" that can be set in the database to allow for weather controls outside of the game.
_response = ["Weather", (call EPOCH_fn_InstanceID)] call EPOCH_fnc_server_hiveGETRANGE;
if ((_response select 0) == 1 && (_response select 1) isEqualType [] && !((_response select 1) isEqualTo[])) then {
_arr = _response select 1;
_staticWeatherForecast = _arr;
(["Weather", (call EPOCH_fn_InstanceID)] call EPOCH_fnc_server_hiveGETRANGE) params [["_status", 0 ], ["_data", [] ]];
if (_status == 1 && _data isEqualType [] && !(_data isEqualTo[])) then {
_staticWeatherForecast = _data;
};
};
_staticWeatherForecast params ["_tempOVRD","_rainOVRD","_fogOVRD","_overcastOVRD","_windOVRD","_lightningOVRD"];