From b32e37649d7ff8703c3b711f38e061936069a4d3 Mon Sep 17 00:00:00 2001 From: sigonasr2 Date: Thu, 27 Jul 2023 18:26:23 -0500 Subject: [PATCH] Include error handling to make detecting bugs or typos easier due to missing configuration items. --- Crawler/Ability.cpp | 4 +++- Crawler/Version.h | 2 +- Crawler/assets/config/classes/Ranger.txt | 16 ++++++++-------- Crawler/assets/config/classes/Thief.txt | 16 ++++++++-------- Crawler/assets/config/classes/Trapper.txt | 16 ++++++++-------- Crawler/assets/config/classes/Warrior.txt | 16 ++++++++-------- Crawler/assets/config/classes/Witch.txt | 16 ++++++++-------- Crawler/assets/config/classes/Wizard.txt | 16 ++++++++-------- Crawler/olcUTIL_DataFile.h | 11 +++++++++-- 9 files changed, 61 insertions(+), 52 deletions(-) diff --git a/Crawler/Ability.cpp b/Crawler/Ability.cpp index aa21e5a0..12f2c55e 100644 --- a/Crawler/Ability.cpp +++ b/Crawler/Ability.cpp @@ -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) diff --git a/Crawler/Version.h b/Crawler/Version.h index 48b48983..e74309ec 100644 --- a/Crawler/Version.h +++ b/Crawler/Version.h @@ -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 diff --git a/Crawler/assets/config/classes/Ranger.txt b/Crawler/assets/config/classes/Ranger.txt index 15a4f76b..e4fe62f8 100644 --- a/Crawler/assets/config/classes/Ranger.txt +++ b/Crawler/assets/config/classes/Ranger.txt @@ -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 diff --git a/Crawler/assets/config/classes/Thief.txt b/Crawler/assets/config/classes/Thief.txt index dccfb039..58fdd136 100644 --- a/Crawler/assets/config/classes/Thief.txt +++ b/Crawler/assets/config/classes/Thief.txt @@ -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 diff --git a/Crawler/assets/config/classes/Trapper.txt b/Crawler/assets/config/classes/Trapper.txt index 7bf6f1e2..41ec5c1b 100644 --- a/Crawler/assets/config/classes/Trapper.txt +++ b/Crawler/assets/config/classes/Trapper.txt @@ -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 diff --git a/Crawler/assets/config/classes/Warrior.txt b/Crawler/assets/config/classes/Warrior.txt index 4d4a50a1..2da03774 100644 --- a/Crawler/assets/config/classes/Warrior.txt +++ b/Crawler/assets/config/classes/Warrior.txt @@ -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 diff --git a/Crawler/assets/config/classes/Witch.txt b/Crawler/assets/config/classes/Witch.txt index 459240df..ad08401f 100644 --- a/Crawler/assets/config/classes/Witch.txt +++ b/Crawler/assets/config/classes/Witch.txt @@ -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 diff --git a/Crawler/assets/config/classes/Wizard.txt b/Crawler/assets/config/classes/Wizard.txt index e1555b96..fc04174e 100644 --- a/Crawler/assets/config/classes/Wizard.txt +++ b/Crawler/assets/config/classes/Wizard.txt @@ -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 diff --git a/Crawler/olcUTIL_DataFile.h b/Crawler/olcUTIL_DataFile.h index 1f42bdf4..a78a076f 100644 --- a/Crawler/olcUTIL_DataFile.h +++ b/Crawler/olcUTIL_DataFile.h @@ -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 "<> m_vecObjects; std::unordered_map 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;