Include error handling to make detecting bugs or typos easier due to missing configuration items.

This commit is contained in:
2023-07-27 18:26:23 -05:00
parent eb1ceb31dd
commit b32e37649d
9 changed files with 61 additions and 52 deletions
+3 -1
View File
@@ -4,7 +4,9 @@ PrecastData::PrecastData(){};
PrecastData::PrecastData(float castTime)
:castTime(castTime),range(0),size(0){precastTargetingRequired=true;};
PrecastData::PrecastData(float castTime,float range,float size)
:castTime(castTime),range(range),size(size){precastTargetingRequired=true;};
:castTime(castTime),range(range),size(size){
if(castTime>0)precastTargetingRequired=true;
};
Ability::Ability(){};
Ability::Ability(std::string name,float cooldownTime,int manaCost,Pixel barColor1,Pixel barColor2,PrecastData precastInfo)
+1 -1
View File
@@ -2,7 +2,7 @@
#define VERSION_MAJOR 0
#define VERSION_MINOR 2
#define VERSION_PATCH 0
#define VERSION_BUILD 868
#define VERSION_BUILD 876
#define stringify(a) stringify_(a)
#define stringify_(a) #a
+8 -8
View File
@@ -9,8 +9,8 @@ Ranger
Mana Cost = 0
#RGB Values. Color 1 is the left side of the bar, Color 2 is the right side.
Cooldown Bar Color 1 = 0, 0, 64
Cooldown Bar Color 2 = 0, 0, 128
Cooldown Bar Color 1 = 0, 0, 64, 255
Cooldown Bar Color 2 = 0, 0, 128, 255
Precast Time = 0
Casting Range = 0
@@ -23,8 +23,8 @@ Ranger
Mana Cost = 35
#RGB Values. Color 1 is the left side of the bar, Color 2 is the right side.
Cooldown Bar Color 1 = 64, 0, 0
Cooldown Bar Color 2 = 128, 0, 0
Cooldown Bar Color 1 = 64, 0, 0, 255
Cooldown Bar Color 2 = 128, 0, 0, 255
Precast Time = 0
Casting Range = 0
@@ -37,8 +37,8 @@ Ranger
Mana Cost = 40
#RGB Values. Color 1 is the left side of the bar, Color 2 is the right side.
Cooldown Bar Color 1 = 64, 0, 0
Cooldown Bar Color 2 = 128, 0, 0
Cooldown Bar Color 1 = 64, 0, 0, 255
Cooldown Bar Color 2 = 128, 0, 0, 255
Precast Time = 0.3
Casting Range = 0
@@ -51,8 +51,8 @@ Ranger
Mana Cost = 50
#RGB Values. Color 1 is the left side of the bar, Color 2 is the right side.
Cooldown Bar Color 1 = 64, 0, 0
Cooldown Bar Color 2 = 128, 0, 0
Cooldown Bar Color 1 = 64, 0, 0, 255
Cooldown Bar Color 2 = 128, 0, 0, 255
Precast Time = 0
Casting Range = 0
+8 -8
View File
@@ -9,8 +9,8 @@ Thief
Mana Cost = 5
#RGB Values. Color 1 is the left side of the bar, Color 2 is the right side.
Cooldown Bar Color 1 = 0, 0, 64
Cooldown Bar Color 2 = 0, 0, 128
Cooldown Bar Color 1 = 0, 0, 64, 255
Cooldown Bar Color 2 = 0, 0, 128, 255
Precast Time = 0
Casting Range = 0
@@ -23,8 +23,8 @@ Thief
Mana Cost = 30
#RGB Values. Color 1 is the left side of the bar, Color 2 is the right side.
Cooldown Bar Color 1 = 64, 0, 0
Cooldown Bar Color 2 = 128, 0, 0
Cooldown Bar Color 1 = 64, 0, 0, 255
Cooldown Bar Color 2 = 128, 0, 0, 255
Precast Time = 0
Casting Range = 0
@@ -37,8 +37,8 @@ Thief
Mana Cost = 25
#RGB Values. Color 1 is the left side of the bar, Color 2 is the right side.
Cooldown Bar Color 1 = 64, 0, 0
Cooldown Bar Color 2 = 128, 0, 0
Cooldown Bar Color 1 = 64, 0, 0, 255
Cooldown Bar Color 2 = 128, 0, 0, 255
Precast Time = 0
Casting Range = 0
@@ -51,8 +51,8 @@ Thief
Mana Cost = 75
#RGB Values. Color 1 is the left side of the bar, Color 2 is the right side.
Cooldown Bar Color 1 = 64, 0, 0
Cooldown Bar Color 2 = 128, 0, 0
Cooldown Bar Color 1 = 64, 0, 0, 255
Cooldown Bar Color 2 = 128, 0, 0, 255
Precast Time = 0
Casting Range = 0
+8 -8
View File
@@ -9,8 +9,8 @@ Trapper
Mana Cost = 5
#RGB Values. Color 1 is the left side of the bar, Color 2 is the right side.
Cooldown Bar Color 1 = 0, 0, 64
Cooldown Bar Color 2 = 0, 0, 128
Cooldown Bar Color 1 = 0, 0, 64, 255
Cooldown Bar Color 2 = 0, 0, 128, 255
Precast Time = 0
Casting Range = 0
@@ -23,8 +23,8 @@ Trapper
Mana Cost = 30
#RGB Values. Color 1 is the left side of the bar, Color 2 is the right side.
Cooldown Bar Color 1 = 64, 0, 0
Cooldown Bar Color 2 = 128, 0, 0
Cooldown Bar Color 1 = 64, 0, 0, 255
Cooldown Bar Color 2 = 128, 0, 0, 255
Precast Time = 0
Casting Range = 0
@@ -37,8 +37,8 @@ Trapper
Mana Cost = 25
#RGB Values. Color 1 is the left side of the bar, Color 2 is the right side.
Cooldown Bar Color 1 = 64, 0, 0
Cooldown Bar Color 2 = 128, 0, 0
Cooldown Bar Color 1 = 64, 0, 0, 255
Cooldown Bar Color 2 = 128, 0, 0, 255
Precast Time = 0
Casting Range = 0
@@ -51,8 +51,8 @@ Trapper
Mana Cost = 75
#RGB Values. Color 1 is the left side of the bar, Color 2 is the right side.
Cooldown Bar Color 1 = 64, 0, 0
Cooldown Bar Color 2 = 128, 0, 0
Cooldown Bar Color 1 = 64, 0, 0, 255
Cooldown Bar Color 2 = 128, 0, 0, 255
Precast Time = 0
Casting Range = 0
+8 -8
View File
@@ -14,8 +14,8 @@ Warrior
Mana Cost = 0
#RGB Values. Color 1 is the left side of the bar, Color 2 is the right side.
Cooldown Bar Color 1 = 0, 0, 64
Cooldown Bar Color 2 = 0, 0, 128
Cooldown Bar Color 1 = 0, 0, 64, 255
Cooldown Bar Color 2 = 0, 0, 128, 255
Precast Time = 0
Casting Range = 0
@@ -36,8 +36,8 @@ Warrior
Mana Cost = 40
#RGB Values. Color 1 is the left side of the bar, Color 2 is the right side.
Cooldown Bar Color 1 = 64, 0, 0
Cooldown Bar Color 2 = 128, 0, 0
Cooldown Bar Color 1 = 64, 0, 0, 255
Cooldown Bar Color 2 = 128, 0, 0, 255
Precast Time = 0
Casting Range = 0
@@ -79,8 +79,8 @@ Warrior
Mana Cost = 50
#RGB Values. Color 1 is the left side of the bar, Color 2 is the right side.
Cooldown Bar Color 1 = 64, 0, 0
Cooldown Bar Color 2 = 128, 0, 0
Cooldown Bar Color 1 = 64, 0, 0, 255
Cooldown Bar Color 2 = 128, 0, 0, 255
Precast Time = 0
Casting Range = 0
@@ -93,8 +93,8 @@ Warrior
Mana Cost = 60
#RGB Values. Color 1 is the left side of the bar, Color 2 is the right side.
Cooldown Bar Color 1 = 64, 0, 0
Cooldown Bar Color 2 = 128, 0, 0
Cooldown Bar Color 1 = 64, 0, 0, 255
Cooldown Bar Color 2 = 128, 0, 0, 255
Precast Time = 0
Casting Range = 0
+8 -8
View File
@@ -9,8 +9,8 @@ Witch
Mana Cost = 5
#RGB Values. Color 1 is the left side of the bar, Color 2 is the right side.
Cooldown Bar Color 1 = 0, 0, 64
Cooldown Bar Color 2 = 0, 0, 128
Cooldown Bar Color 1 = 0, 0, 64, 255
Cooldown Bar Color 2 = 0, 0, 128, 255
Precast Time = 0
Casting Range = 0
@@ -23,8 +23,8 @@ Witch
Mana Cost = 30
#RGB Values. Color 1 is the left side of the bar, Color 2 is the right side.
Cooldown Bar Color 1 = 64, 0, 0
Cooldown Bar Color 2 = 128, 0, 0
Cooldown Bar Color 1 = 64, 0, 0, 255
Cooldown Bar Color 2 = 128, 0, 0, 255
Precast Time = 0
Casting Range = 0
@@ -37,8 +37,8 @@ Witch
Mana Cost = 25
#RGB Values. Color 1 is the left side of the bar, Color 2 is the right side.
Cooldown Bar Color 1 = 64, 0, 0
Cooldown Bar Color 2 = 128, 0, 0
Cooldown Bar Color 1 = 64, 0, 0, 255
Cooldown Bar Color 2 = 128, 0, 0, 255
Precast Time = 0
Casting Range = 0
@@ -51,8 +51,8 @@ Witch
Mana Cost = 75
#RGB Values. Color 1 is the left side of the bar, Color 2 is the right side.
Cooldown Bar Color 1 = 64, 0, 0
Cooldown Bar Color 2 = 128, 0, 0
Cooldown Bar Color 1 = 64, 0, 0, 255
Cooldown Bar Color 2 = 128, 0, 0, 255
Precast Time = 0
Casting Range = 0
+8 -8
View File
@@ -9,8 +9,8 @@ Wizard
Mana Cost = 5
#RGB Values. Color 1 is the left side of the bar, Color 2 is the right side.
Cooldown Bar Color 1 = 0, 0, 64
Cooldown Bar Color 2 = 0, 0, 128
Cooldown Bar Color 1 = 0, 0, 64, 255
Cooldown Bar Color 2 = 0, 0, 128, 255
Precast Time = 0
Casting Range = 0
@@ -23,8 +23,8 @@ Wizard
Mana Cost = 30
#RGB Values. Color 1 is the left side of the bar, Color 2 is the right side.
Cooldown Bar Color 1 = 64, 0, 0
Cooldown Bar Color 2 = 128, 0, 0
Cooldown Bar Color 1 = 64, 0, 0, 255
Cooldown Bar Color 2 = 128, 0, 0, 255
Precast Time = 0
Casting Range = 0
@@ -37,8 +37,8 @@ Wizard
Mana Cost = 25
#RGB Values. Color 1 is the left side of the bar, Color 2 is the right side.
Cooldown Bar Color 1 = 64, 0, 0
Cooldown Bar Color 2 = 128, 0, 0
Cooldown Bar Color 1 = 64, 0, 0, 255
Cooldown Bar Color 2 = 128, 0, 0, 255
Precast Time = 0
Casting Range = 0
@@ -51,8 +51,8 @@ Wizard
Mana Cost = 75
#RGB Values. Color 1 is the left side of the bar, Color 2 is the right side.
Cooldown Bar Color 1 = 64, 0, 0
Cooldown Bar Color 2 = 128, 0, 0
Cooldown Bar Color 1 = 64, 0, 0, 255
Cooldown Bar Color 2 = 128, 0, 0, 255
Precast Time = 1.5
Casting Range = 900
+9 -2
View File
@@ -82,8 +82,10 @@ namespace olc::utils
// Retrieves the String Value of a Property (for a given index) or ""
inline const std::string GetString(const size_t nItem = 0) const
{
if (nItem >= m_vContent.size())
if (nItem >= m_vContent.size()){
std::cout<<"WARNING! Accesing out-of-bounds list item "<<nItem<<" of "<<lastAccessedProperty<<"!";
return "";
}
else
return m_vContent[nItem];
}
@@ -137,10 +139,13 @@ namespace olc::utils
if (x != std::string::npos)
{
std::string sProperty = name.substr(0, x);
lastAccessedProperty=sProperty;
if (HasProperty(sProperty))
return operator[](sProperty).GetProperty(name.substr(x + 1, name.size()));
else
else {
std::cout<<"WARNING! Could not read Property "<<sProperty<<"! Potential bugs may occur."<<std::endl;
return operator[](sProperty);
}
}
else
{
@@ -433,6 +438,8 @@ namespace olc::utils
std::vector<std::pair<std::string, datafile>> m_vecObjects;
std::unordered_map<std::string, size_t> m_mapObjects;
inline static std::string lastAccessedProperty="";
protected:
// Used to identify if a property is a comment or not, not user facing
bool m_bIsComment = false;