Changeset 2442 for code/branches/physics_merge/src/core
- Timestamp:
- Dec 14, 2008, 4:16:52 PM (16 years ago)
- Location:
- code/branches/physics_merge
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/physics_merge
- Property svn:mergeinfo changed
-
code/branches/physics_merge/src/core/RootGameState.cc
r2103 r2442 130 130 void RootGameState::start() 131 131 { 132 #ifdef NDEBUG 132 // Don't catch errors when having a debugger in msvc 133 #if ORXONOX_COMPILER != ORXONOX_COMPILER_MSVC || defined(NDEBUG) 133 134 try 134 135 { … … 156 157 157 158 this->deactivate(); 158 #if def NDEBUG159 #if ORXONOX_COMPILER != ORXONOX_COMPILER_MSVC || defined(NDEBUG) 159 160 } 160 161 // Note: These are all unhandled exceptions that should not have made its way here! … … 162 163 catch (std::exception& ex) 163 164 { 164 COUT(1) << ex.what() << std::endl; 165 COUT(1) << "Program aborted." << std::endl; 165 COUT(0) << ex.what() << std::endl; 166 COUT(0) << "Program aborted." << std::endl; 167 abort(); 166 168 } 167 169 // anything that doesn't inherit from std::exception 168 170 catch (...) 169 171 { 170 COUT(1) << "An unidentifiable exception has occured. Program aborted." << std::endl; 172 COUT(0) << "An unidentifiable exception has occured. Program aborted." << std::endl; 173 abort(); 171 174 } 172 175 #endif -
code/branches/physics_merge/src/core/Template.cc
- Property svn:mergeinfo changed (with no actual effect on merging)
-
code/branches/physics_merge/src/core/Template.h
- Property svn:mergeinfo changed (with no actual effect on merging)
-
code/branches/physics_merge/src/core/XMLFile.h
- Property svn:mergeinfo changed
/code/trunk/src/core/XMLFile.h (added) merged: 1913-2085
- Property svn:mergeinfo changed
-
code/branches/physics_merge/src/core/XMLIncludes.h
- Property svn:mergeinfo changed
/code/branches/physics/src/core/XMLIncludes.h (added) merged: 2192
- Property svn:mergeinfo changed
-
code/branches/physics_merge/src/core/XMLPort.h
r2171 r2442 74 74 static ExecutorMember<classname>* xmlcontainer##loadfunction##savefunction##saveexecutor = orxonox::createExecutor(orxonox::createFunctor(&classname::savefunction), std::string( #classname ) + "::" + #savefunction); \ 75 75 XMLPortParamGeneric(xmlcontainer##loadfunction##savefunction, classname, classname, this, paramname, xmlcontainer##loadfunction##savefunction##loadexecutor, xmlcontainer##loadfunction##savefunction##saveexecutor, xmlelement, mode) 76 77 /** 78 @brief Declares an XML attribute with a name, which will be set through a variable. 79 @param classname The name of the class owning this param 80 @param paramname The name of the attribute 81 @param variable Name of the variable used to save and load the value 82 @param xmlelement The XMLElement, you get this from the XMLPort function 83 @param mode The mode (load or save), you get this from the XMLPort function 84 85 In the XML file, a param or attribute will be set like this: 86 <classname paramname="value" /> 87 88 The macro will then store "value" in the variable or read it when saving. 89 */ 90 #define XMLPortParamVariable(classname, paramname, variable, xmlelement, mode) \ 91 static XMLPortVariableHelperClass xmlcontainer##variable##dummy((void*)&variable); \ 92 static ExecutorMember<orxonox::XMLPortVariableHelperClass>* xmlcontainer##variable##loadexecutor = static_cast<ExecutorMember<orxonox::XMLPortVariableHelperClass>*>(&(orxonox::createExecutor(orxonox::createFunctor(orxonox::XMLPortVariableHelperClass::getLoader(variable)), std::string( #classname ) + "::" + #variable + "loader"))); \ 93 static ExecutorMember<orxonox::XMLPortVariableHelperClass>* xmlcontainer##variable##saveexecutor = static_cast<ExecutorMember<orxonox::XMLPortVariableHelperClass>*>(&(orxonox::createExecutor(orxonox::createFunctor(orxonox::XMLPortVariableHelperClass::getSaver (variable)), std::string( #classname ) + "::" + #variable + "saver" ))); \ 94 XMLPortParamGeneric(xmlcontainer##variable, classname, orxonox::XMLPortVariableHelperClass, &xmlcontainer##variable##dummy, paramname, xmlcontainer##variable##loadexecutor, xmlcontainer##variable##saveexecutor, xmlelement, mode) 95 96 /** 97 @brief Declares an XML attribute with a name, which will be set through a variable and gotten from a function. 98 @param classname The name of the class owning this param 99 @param paramname The name of the attribute 100 @param variable Name of the variable used to save the value 101 @param savefunction A function to get the value of the param from the object (~a get-function) 102 @param xmlelement The XMLElement, you get this from the XMLPort function 103 @param mode The mode (load or save), you get this from the XMLPort function 104 105 In the XML file, a param or attribute will be set like this: 106 <classname paramname="value" /> 107 108 The macro will then store "value" in the variable or read it when saving. 109 */ 110 #define XMLPortParamVariableOnLoad(classname, paramname, variable, savefunction, xmlelement, mode) \ 111 static XMLPortVariableHelperClass xmlcontainer##variable##dummy((void*)&variable); \ 112 static ExecutorMember<orxonox::XMLPortVariableHelperClass>* xmlcontainer##variable##loadexecutor = static_cast<ExecutorMember<orxonox::XMLPortVariableHelperClass>*>(&(orxonox::createExecutor(orxonox::createFunctor(orxonox::XMLPortVariableHelperClass::getLoader(variable)), std::string( #classname ) + "::" + #variable + "loader"))); \ 113 static ExecutorMember<classname>* xmlcontainer##loadfunction##savefunction##saveexecutor = orxonox::createExecutor(orxonox::createFunctor(&classname::savefunction), std::string( #classname ) + "::" + #savefunction); \ 114 XMLPortParamGeneric(xmlcontainer##variable, classname, orxonox::XMLPortVariableHelperClass, &xmlcontainer##variable##dummy, paramname, xmlcontainer##variable##loadexecutor, xmlcontainer##variable##saveexecutor, xmlelement, mode) 115 76 116 /** 77 117 @brief This is the same as XMLPortParam, but you can set the template arguments needed to store the loadfunction. … … 175 215 @param xmlelement The XMLElement (recieved through the XMLPort function) 176 216 @param mode The mode (load/save) (received through the XMLPort function) 177 @param bApplyLoaderMask If this is true, an added sub-object only gets loadedif it's class is included in the Loaders ClassTreeMask (this is usually false)178 @param bLoadBefore If this is true, the sub- cobject gets loaded (through XMLPort) BEFORE it gets added to the main class (this is usually true)217 @param bApplyLoaderMask If this is true, an added sub-object gets loaded only if it's class is included in the Loaders ClassTreeMask (this is usually false) 218 @param bLoadBefore If this is true, the sub-object gets loaded (through XMLPort) BEFORE it gets added to the main class (this is usually true) 179 219 180 220 bApplyLoaderMask is usually false for the following reason: … … 183 223 Of course, if there are "standalone" weapons in the level, they wont be loaded. 184 224 185 If bLoadBefore , an added object already has all attributes set (like it's name). This is most225 If bLoadBefore is true, an added object already has all attributes set (like it's name). This is most 186 226 likely the best option, so this is usually true. 187 227 … … 222 262 Note that "weapons" is the subsection. This allows you to add more types of sub-objects. In our example, 223 263 you could add pilots, blinking lights or other stuff. If you don't want a subsection, just use "" (an 224 empty string). The you can add sub-objects directly into the mainclass.264 empty string). Then you can add sub-objects directly into the mainclass. 225 265 */ 226 266 #define XMLPortObjectExtended(classname, objectclass, sectionname, loadfunction, savefunction, xmlelement, mode, bApplyLoaderMask, bLoadBefore) \ … … 588 628 ExecutorMember<T>* saveexecutor_; 589 629 }; 630 631 632 // #################################### 633 // ### XMLPortVariableHelperClass ### 634 // #################################### 635 /** 636 @brief 637 Helper class to load and save simple variables with XMLPort. 638 639 getLoader and getSaver were necessary to get the type T with 640 the help of template function type deduction (const T& is unused). 641 These functions return the adress of save<T> or load<T>. 642 */ 643 class XMLPortVariableHelperClass 644 { 645 public: 646 XMLPortVariableHelperClass(void* var) 647 : variable_(var) 648 { } 649 650 template <class T> 651 void load(const T& value) 652 { *((T*)this->variable_) = value; } 653 654 template <class T> 655 const T& save() 656 { return *((T*)this->variable_); } 657 658 template <class T> 659 static void (XMLPortVariableHelperClass::*getLoader(const T& var))(const T& value) 660 { return &XMLPortVariableHelperClass::load<T>; } 661 662 template <class T> 663 static const T& (XMLPortVariableHelperClass::*getSaver(const T& var))() 664 { return &XMLPortVariableHelperClass::save<T>; } 665 666 private: 667 void* variable_; 668 }; 590 669 } 591 670
Note: See TracChangeset
for help on using the changeset viewer.