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

pull/28/head
sigonasr2 2 years ago
parent eb1ceb31dd
commit b32e37649d
  1. 4
      Crawler/Ability.cpp
  2. 2
      Crawler/Version.h
  3. 16
      Crawler/assets/config/classes/Ranger.txt
  4. 16
      Crawler/assets/config/classes/Thief.txt
  5. 16
      Crawler/assets/config/classes/Trapper.txt
  6. 16
      Crawler/assets/config/classes/Warrior.txt
  7. 16
      Crawler/assets/config/classes/Witch.txt
  8. 16
      Crawler/assets/config/classes/Wizard.txt
  9. 11
      Crawler/olcUTIL_DataFile.h

@ -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)

@ -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

@ -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

@ -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

@ -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

@ -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

@ -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

@ -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

@ -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,11 +139,14 @@ 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
{
return operator[](name);
@ -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;

Loading…
Cancel
Save