From 94667b9ab9f8c67511387351bc883e149a1d920b Mon Sep 17 00:00:00 2001 From: Mike Hoffert Date: Sat, 19 Jul 2014 10:31:57 -0600 Subject: [PATCH] Error checking now active for start-ep You can no longer have both start-value and start-percentage. --- source/glest_game/types/unit_type.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/source/glest_game/types/unit_type.cpp b/source/glest_game/types/unit_type.cpp index a9b264d0..960b19c5 100644 --- a/source/glest_game/types/unit_type.cpp +++ b/source/glest_game/types/unit_type.cpp @@ -250,6 +250,14 @@ void UnitType::loaddd(int id,const string &dir, const TechTree *techTree, } addItemToVault(&(this->epRegeneration),this->epRegeneration); + // Check that we don't use both start-value and start-percentage, as they are mutually + // exclusive + if(parametersNode->getChild("max-ep")->hasAttribute("start-value") && + parametersNode->getChild("max-ep")->hasAttribute("start-percentage")) { + throw megaglest_runtime_error("Unit " + name + + " has both start-value and start-percentage for EP", validationMode); + } + //startEpValue -- the *absolute* value to use for starting EP if(parametersNode->getChild("max-ep")->hasAttribute("start-value")) { //checkItemInVault(&(this->startEp),this->startEp);