summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVittorio Romeo <vittorio.romeo@outlook.com>2013-04-10 17:55:28 +0200
committerVittorio Romeo <vittorio.romeo@outlook.com>2013-04-10 17:55:28 +0200
commitc4b6d6a6d73333a6dae8796e174a5172e265c290 (patch)
tree6ad1b74646c76954011102f8b9abdd0df5906f0b
parent9465c5ae2a888714923f2f8eb43729f31f4c6231 (diff)
Adapted to newest librariesv1.91
-rw-r--r--src/SSVOpenHexagon/Core/HGScripting.cpp14
-rw-r--r--src/SSVOpenHexagon/Data/LevelData.cpp20
-rw-r--r--src/SSVOpenHexagon/Data/StyleData.cpp22
-rw-r--r--src/SSVOpenHexagon/Online/Online.cpp4
4 files changed, 30 insertions, 30 deletions
diff --git a/src/SSVOpenHexagon/Core/HGScripting.cpp b/src/SSVOpenHexagon/Core/HGScripting.cpp
index 1be2abff..b1c91499 100644
--- a/src/SSVOpenHexagon/Core/HGScripting.cpp
+++ b/src/SSVOpenHexagon/Core/HGScripting.cpp
@@ -21,16 +21,16 @@ namespace hg
for (Json::Value& eventRoot : mRoot)
{
if(eventRoot["executed"].asBool()) continue;
- float time{asOrDefault(eventRoot, "time", 0.f)};
+ float time{as<float>(eventRoot, "time", 0.f)};
if(time > mTime) continue;
eventRoot["executed"] = true;
- string type {asOrDefault(eventRoot, "type", "")};
- float duration {asOrDefault(eventRoot, "duration", 0.f)};
- string valueName{asOrDefault(eventRoot, "value_name", "")};
- float value {asOrDefault(eventRoot, "value", 0.f)};
- string message {asOrDefault(eventRoot, "message", "")};
- string id {asOrDefault(eventRoot, "id", "")};
+ string type {as<string>(eventRoot, "type", "")};
+ float duration {as<float>(eventRoot, "duration", 0.f)};
+ string valueName{as<string>(eventRoot, "value_name", "")};
+ float value {as<float>(eventRoot, "value", 0.f)};
+ string message {as<string>(eventRoot, "message", "")};
+ string id {as<string>(eventRoot, "id", "")};
if (type == "level_change") { status.mustRestart = true; restartId = id; restartFirstTime = true; return; }
else if(type == "menu") { goToMenu(); }
diff --git a/src/SSVOpenHexagon/Data/LevelData.cpp b/src/SSVOpenHexagon/Data/LevelData.cpp
index 579f04d4..7a3a153a 100644
--- a/src/SSVOpenHexagon/Data/LevelData.cpp
+++ b/src/SSVOpenHexagon/Data/LevelData.cpp
@@ -47,18 +47,18 @@ namespace hg
int LevelData::getSidesMax() { return as<int>(root, "sides_max"); }
int LevelData::getSidesMin() { return as<int>(root, "sides_min"); }
float LevelData::getIncrementTime() { return as<float>(root, "increment_time"); }
- float LevelData::getPulseMin() { return asOrDefault(root, "pulse_min", 75.f); }
- float LevelData::getPulseMax() { return asOrDefault(root, "pulse_max", 80.f); }
- float LevelData::getPulseSpeed() { return asOrDefault(root, "pulse_speed", 0.f); }
- float LevelData::getPulseSpeedR() { return asOrDefault(root, "pulse_speed_r", 0.f); }
- float LevelData::getPulseDelayMax() { return asOrDefault(root, "pulse_delay_max", 0.f); }
- float LevelData::getPulseDelayHalfMax() { return asOrDefault(root, "pulse_delay_half_max", 0.f); }
- float LevelData::getBeatPulseMax() { return asOrDefault(root, "beatpulse_max", 0.f); }
- float LevelData::getBeatPulseDelayMax() { return asOrDefault(root, "beatpulse_delay_max", 0.f); }
- float LevelData::getRadiusMin() { return asOrDefault(root, "radius_min", 72.f); }
+ float LevelData::getPulseMin() { return as<float>(root, "pulse_min", 75.f); }
+ float LevelData::getPulseMax() { return as<float>(root, "pulse_max", 80.f); }
+ float LevelData::getPulseSpeed() { return as<float>(root, "pulse_speed", 0.f); }
+ float LevelData::getPulseSpeedR() { return as<float>(root, "pulse_speed_r", 0.f); }
+ float LevelData::getPulseDelayMax() { return as<float>(root, "pulse_delay_max", 0.f); }
+ float LevelData::getPulseDelayHalfMax() { return as<float>(root, "pulse_delay_half_max", 0.f); }
+ float LevelData::getBeatPulseMax() { return as<float>(root, "beatpulse_max", 0.f); }
+ float LevelData::getBeatPulseDelayMax() { return as<float>(root, "beatpulse_delay_max", 0.f); }
+ float LevelData::getRadiusMin() { return as<float>(root, "radius_min", 72.f); }
vector<float> LevelData::getDifficultyMultipliers()
{
- vector<float> result{asVectorOrDefault<float>(root, "difficulty_multipliers", {})};
+ vector<float> result{as<vector<float>>(root, "difficulty_multipliers", {})};
result.push_back(1.0f);
sort(result); return result;
}
diff --git a/src/SSVOpenHexagon/Data/StyleData.cpp b/src/SSVOpenHexagon/Data/StyleData.cpp
index 71e8b568..ec7fdf0a 100644
--- a/src/SSVOpenHexagon/Data/StyleData.cpp
+++ b/src/SSVOpenHexagon/Data/StyleData.cpp
@@ -88,7 +88,7 @@ namespace hg
float StyleData::getHueMax() { return root["hue_max"].asFloat(); }
bool StyleData::getHuePingPong() { return root["hue_ping_pong"].asBool(); }
float StyleData::getHueIncrement() { return root["hue_increment"].asFloat(); }
- float StyleData::getMaxSwapTime() { return asOrDefault(root, "max_swap_time", 100.f); }
+ float StyleData::getMaxSwapTime() { return as<float>(root, "max_swap_time", 100.f); }
float StyleData::getCurrentHue() { return currentHue; }
float StyleData::getCurrentSwapTime() { return currentSwapTime; }
@@ -127,16 +127,16 @@ namespace hg
mRenderTarget.draw(vertices);
}
- unsigned int StyleData::get3DDepth() { return asOrDefault(root, "3D_depth", 15); }
- float StyleData::get3DSkew() { return asOrDefault(root, "3D_skew", 0.18f); }
- float StyleData::get3DSpacing() { return asOrDefault(root, "3D_spacing", 1.0f); }
- float StyleData::get3DDarkenMultiplier() { return asOrDefault(root, "3D_darken_multiplier", 1.5f); }
- float StyleData::get3DAlphaMultiplier() { return asOrDefault(root, "3D_alpha_multiplier", 0.5f); }
- float StyleData::get3DAlphaFalloff() { return asOrDefault(root, "3D_alpha_falloff", 3.0f); }
+ unsigned int StyleData::get3DDepth() { return as<float>(root, "3D_depth", 15); }
+ float StyleData::get3DSkew() { return as<float>(root, "3D_skew", 0.18f); }
+ float StyleData::get3DSpacing() { return as<float>(root, "3D_spacing", 1.0f); }
+ float StyleData::get3DDarkenMultiplier() { return as<float>(root, "3D_darken_multiplier", 1.5f); }
+ float StyleData::get3DAlphaMultiplier() { return as<float>(root, "3D_alpha_multiplier", 0.5f); }
+ float StyleData::get3DAlphaFalloff() { return as<float>(root, "3D_alpha_falloff", 3.0f); }
Color StyleData::get3DOverrideColor() { return root.isMember("3D_override_color") ? getColorFromJsonArray(root["3D_override_color"]) : getMainColor(); }
- float StyleData::get3DPulseMax() { return asOrDefault(root, "3D_pulse_max", 3.2f); }
- float StyleData::get3DPulseMin() { return asOrDefault(root, "3D_pulse_min", -0.0f); }
- float StyleData::get3DPulseSpeed() { return asOrDefault(root, "3D_pulse_speed", 0.01f); }
- float StyleData::get3DPerspectiveMultiplier() { return asOrDefault(root, "3D_perspective_multiplier", 1.0f); }
+ float StyleData::get3DPulseMax() { return as<float>(root, "3D_pulse_max", 3.2f); }
+ float StyleData::get3DPulseMin() { return as<float>(root, "3D_pulse_min", -0.0f); }
+ float StyleData::get3DPulseSpeed() { return as<float>(root, "3D_pulse_speed", 0.01f); }
+ float StyleData::get3DPerspectiveMultiplier() { return as<float>(root, "3D_perspective_multiplier", 1.0f); }
}
diff --git a/src/SSVOpenHexagon/Online/Online.cpp b/src/SSVOpenHexagon/Online/Online.cpp
index 6a01d68c..f3180476 100644
--- a/src/SSVOpenHexagon/Online/Online.cpp
+++ b/src/SSVOpenHexagon/Online/Online.cpp
@@ -57,10 +57,10 @@ namespace hg
if(status == Response::Ok)
{
Json::Value root{getRootFromString(response.getBody())};
- serverMessage = asOrDefault<string>(root, "message", "");
+ serverMessage = as<string>(root, "message", "");
log("Server message:\n" + serverMessage, "Online");
- serverVersion = asOrDefault<float>(root, "latest_version", -1);
+ serverVersion = as<float>(root, "latest_version", -1);
log("Server latest version: " + toStr(getServerVersion()), "Online");
if(serverVersion == getVersion()) log("No updates available", "Online");