diff --git a/src/config/stk_config.cpp b/src/config/stk_config.cpp index e6cdd8c53..2e6795dbf 100644 --- a/src/config/stk_config.cpp +++ b/src/config/stk_config.cpp @@ -82,7 +82,6 @@ void STKConfig::load(const std::string &filename) { Log::error("StkConfig", "FATAL ERROR while reading '%s':", filename.c_str()); Log::fatal("StkConfig", " %s", err.what()); - exit(1); } delete root; @@ -91,24 +90,21 @@ void STKConfig::load(const std::string &filename) #define CHECK_NEG( a,strA) if(a<=UNDEFINED) { \ Log::fatal("StkConfig", "Missing default value for '%s' in '%s'.", \ - strA,filename.c_str());exit(-1); \ + strA,filename.c_str()); \ } if(m_score_increase.size()==0 || (int)m_score_increase.size()!=m_max_karts) { Log::fatal("StkConfig", "Not or not enough scores defined in stk_config"); - exit(-1); } if(m_leader_intervals.size()==0) { Log::fatal("StkConfig", "No follow leader interval(s) defined in stk_config"); - exit(-1); } if(m_switch_items.size()!=Item::ITEM_LAST-Item::ITEM_FIRST+1) { Log::fatal("StkConfig", "Wrong number of item switches defined in stk_config"); - exit(-1); } CHECK_NEG(m_max_karts, "getSceneManager(); diff --git a/src/graphics/referee.cpp b/src/graphics/referee.cpp index ef4b1db37..9f9d45520 100644 --- a/src/graphics/referee.cpp +++ b/src/graphics/referee.cpp @@ -48,19 +48,16 @@ void Referee::init() if(filename=="") { Log::fatal("referee", "Can't find referee.xml, aborting."); - exit(-1); } XMLNode *node = file_manager->createXMLTree(filename); if(!node) { Log::fatal("referee", "Can't read XML file referee.xml, aborting."); - exit(-1); } if(node->getName()!="referee") { Log::fatal("referee", "The file referee.xml does not contain a referee" "node, aborting."); - exit(-1); } std::string model_filename; node->get("model", &model_filename); @@ -71,7 +68,6 @@ void Referee::init() { Log::fatal("referee", "Can't find referee model '%s', aborting.", model_filename.c_str()); - exit(-1); } // Translate the mesh so that the x/z middle point @@ -109,7 +105,6 @@ void Referee::init() { Log::fatal("referee", "Not enough colors for referee defined, aborting."); - exit(-1); } for(unsigned int i=0; i<3; i++) { @@ -119,7 +114,6 @@ void Referee::init() Log::fatal("referee", "Can't find texture '%s' for referee, aborting.", colors[i].c_str()); - exit(-1); } m_st_traffic_lights[i] = irr_driver->getTexture(full_path); } diff --git a/src/karts/controller/ai_properties.cpp b/src/karts/controller/ai_properties.cpp index 9c03fe744..49ce34ee7 100644 --- a/src/karts/controller/ai_properties.cpp +++ b/src/karts/controller/ai_properties.cpp @@ -82,10 +82,9 @@ void AIProperties::load(const XMLNode *ai_node) m_nitro_usage = NITRO_ALL; else { - Log::error("AIProperties", + Log::fatal("AIProperties", "Incorrect nitro-usage '%s' in AI '%s'.\n",s.c_str(), m_ident.c_str()); - exit(-1); } // We actually need the square of the distance later m_bad_item_closeness_2 *= m_bad_item_closeness_2; @@ -100,10 +99,9 @@ void AIProperties::load(const XMLNode *ai_node) void AIProperties::checkAllSet(const std::string &filename) const { #define CHECK_NEG( a,str_a) if(a<=UNDEFINED) { \ - Log::error("AIProperties","Missing default value for" \ + Log::fatal("AIProperties","Missing default value for" \ " '%s' in '%s' 'for AI '%s'.\n", \ str_a, filename.c_str(), m_ident.c_str()); \ - exit(-1); \ } CHECK_NEG(m_max_item_angle, "max-item-angle" ); CHECK_NEG(m_max_item_angle_high_speed, "max-item-angle-high-speed" ); @@ -117,20 +115,17 @@ void AIProperties::checkAllSet(const std::string &filename) const if(m_skid_probability.size()==0) { - Log::error("AIProperties", "No skid probability defined.\n"); - exit(-1); + Log::fatal("AIProperties", "No skid probability defined.\n"); } if(m_speed_cap.size()==0) { - Log::error("AIProperties", "No speed cap defined.\n"); - exit(-1); + Log::fatal("AIProperties", "No speed cap defined.\n"); } if(m_collect_item_probability.size()==0) { - Log::error("AIProperties", "No collect-item-probability defined.\n"); - exit(-1); + Log::fatal("AIProperties", "No collect-item-probability defined.\n"); } } // checkAllSet diff --git a/src/karts/kart_properties.cpp b/src/karts/kart_properties.cpp index da6bfdd16..387d799fc 100644 --- a/src/karts/kart_properties.cpp +++ b/src/karts/kart_properties.cpp @@ -376,7 +376,6 @@ void KartProperties::getAllData(const XMLNode * root) Log::fatal("KartProperties", "Incorrect engine-power specifications for kart '%s'\n", getIdent().c_str()); - exit(-1); } engine_node->get("max-speed", &m_max_speed); if(m_max_speed.size()!=RaceManager::DIFFICULTY_COUNT) @@ -384,7 +383,6 @@ void KartProperties::getAllData(const XMLNode * root) Log::fatal("KartProperties", "Incorrect max-speed specifications for kart '%s'\n", getIdent().c_str()); - exit(-1); } } // if getNode("engine") @@ -458,7 +456,6 @@ void KartProperties::getAllData(const XMLNode * root) Log::fatal("KartProperties", "Missing or incorrect value for impulse-type: '%s'.\n", s.c_str()); - exit(-1); } } @@ -478,7 +475,6 @@ void KartProperties::getAllData(const XMLNode * root) { Log::fatal("KartProperties", "Invalid plunger in-face-time specification."); - exit(-1); } } @@ -573,14 +569,12 @@ void KartProperties::checkAllSet(const std::string &filename) Log::fatal("KartProperties", "Missing default value for 'gear-switch-ratio' in '%s'.\n", filename.c_str()); - exit(-1); } if(m_gear_power_increase.size()==0) { - Log::error("KartProperties", + Log::fatal("KartProperties", "Missing default value for 'gear-power-increase' in '%s'.\n", filename.c_str()); - exit(-1); } if(m_gear_switch_ratio.size()!=m_gear_power_increase.size()) { Log::error("KartProperties", @@ -588,19 +582,17 @@ void KartProperties::checkAllSet(const std::string &filename) "'gear-power-increase\n"); Log::fatal("KartProperties", "in '%s' must be equal.\n", filename.c_str()); - exit(-1); } if(m_startup_boost.size()!=m_startup_times.size()) { Log::error("KartProperties", "Number of entried for 'startup times' and 'startup-boost\n"); Log::fatal("KartProperties", "must be identical.\n"); - exit(-1); } #define CHECK_NEG( a,strA) if(a<=UNDEFINED) { \ Log::fatal("KartProperties", \ "Missing default value for '%s' in '%s'.\n", \ - strA,filename.c_str());exit(-1); \ + strA,filename.c_str()); \ } CHECK_NEG(m_mass, "mass" ); diff --git a/src/karts/skidding_properties.cpp b/src/karts/skidding_properties.cpp index 8bf52dc74..425dc834c 100644 --- a/src/karts/skidding_properties.cpp +++ b/src/karts/skidding_properties.cpp @@ -75,9 +75,9 @@ void SkiddingProperties::load(const XMLNode *skid_node) void SkiddingProperties::checkAllSet(const std::string &filename) const { #define CHECK_NEG( a,strA) if(a<=UNDEFINED) { \ - Log::error("Skidding_Properties", "Missing default value for '%s'"\ + Log::fatal("Skidding_Properties", "Missing default value for '%s'"\ "in '%s'.", \ - strA,filename.c_str());exit(-1); \ + strA,filename.c_str()); \ } CHECK_NEG(m_skid_increase, "skid increase" ); CHECK_NEG(m_skid_decrease, "skid decrease" ); @@ -98,29 +98,25 @@ void SkiddingProperties::checkAllSet(const std::string &filename) const "can be ignored."); if(m_skid_time_till_bonus.size()!=m_skid_bonus_speed.size()) { - Log::error("Skidding_Properties", "Warning: skid time-till-bonus" + Log::fatal("Skidding_Properties", "Warning: skid time-till-bonus" "and bonus-speed\n must have same number of elements."); - exit(-1); } if(m_skid_time_till_bonus.size()!=m_skid_bonus_time.size()) { - Log::error("Skidding_Properties", "Warning: skid time-till-bonus" + Log::fatal("Skidding_Properties", "Warning: skid time-till-bonus" "and bonus-time must\n have same number of elements."); - exit(-1); } if(m_skid_time_till_bonus.size()!=m_skid_bonus_force.size()) { - Log::error("Skidding_Properties", "Warning: skid time-till-bonus" + Log::fatal("Skidding_Properties", "Warning: skid time-till-bonus" "and bonus-force must\n have same number of elements."); - exit(-1); } for(unsigned int i=0; i=m_skid_time_till_bonus[i+1]) { - Log::error("Skidding_Properties", "Warning: skid time-till-bonus" + Log::fatal("Skidding_Properties", "Warning: skid time-till-bonus" "not sorted."); - exit(-1); } } // for i diff --git a/src/main.cpp b/src/main.cpp index e10dcd29a..71c083beb 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -572,7 +572,6 @@ int handleCmdLinePreliminary(int argc, char **argv) { Log::fatal("main", "Error: --screensize argument must be " "given as WIDTHxHEIGHT"); - exit(EXIT_FAILURE); } } else if (strcmp(argv[i], "--version") == 0 || diff --git a/src/modes/three_strikes_battle.cpp b/src/modes/three_strikes_battle.cpp index 5c57309f7..e102d6975 100644 --- a/src/modes/three_strikes_battle.cpp +++ b/src/modes/three_strikes_battle.cpp @@ -57,8 +57,7 @@ void ThreeStrikesBattle::init() // check for possible problems if AI karts were incorrectly added if(getNumKarts() > race_manager->getNumPlayers()) { - Log::error("Three Strikes Battle", "No AI exists for this game mode"); - exit(1); + Log::fatal("Three Strikes Battle", "No AI exists for this game mode"); } m_kart_info.resize(m_karts.size()); } // ThreeStrikesBattle diff --git a/src/tracks/track.cpp b/src/tracks/track.cpp index 226fbbd7f..8184290e2 100644 --- a/src/tracks/track.cpp +++ b/src/tracks/track.cpp @@ -474,7 +474,6 @@ void Track::loadQuadGraph(unsigned int mode_id, const bool reverse) { Log::fatal("track", "I can handle the lack of driveline in single" "kart mode, but not with AIs\n"); - exit(-1); } } else @@ -744,7 +743,6 @@ bool Track::loadMainTrack(const XMLNode &root) Log::fatal("track", "Main track model '%s' in '%s' not found, aborting.\n", track_node->getName().c_str(), model_name.c_str()); - exit(-1); } // The mesh as returned does not have all mesh buffers with the same @@ -1141,7 +1139,6 @@ bool Track::loadMainTrack(const XMLNode &root) if (m_track_mesh == NULL) { Log::fatal("track", "m_track_mesh == NULL, cannot loadMainTrack\n"); - exit(-1); } m_gfx_effect_mesh->createCollisionShape(); diff --git a/src/utils/log.hpp b/src/utils/log.hpp index 35246f060..300070258 100644 --- a/src/utils/log.hpp +++ b/src/utils/log.hpp @@ -74,6 +74,8 @@ public: va_start(args, format); \ printMessage(LEVEL, component, format, args); \ va_end(args); \ +\ + if (LEVEL == LL_FATAL) exit(1); \ } LOG(verbose, LL_VERBOSE); LOG(debug, LL_DEBUG);