Changeset 11068
- Timestamp:
- Jan 17, 2016, 6:41:22 PM (9 years ago)
- Location:
- code/branches/cpp11_v3
- Files:
-
- 124 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/cpp11_v3
- Property svn:mergeinfo changed
/code/branches/cpp11_v2 merged: 10996-11008,11010
- Property svn:mergeinfo changed
-
code/branches/cpp11_v3/src/OrxonoxConfig.h.in
r11054 r11068 207 207 #endif 208 208 209 // Forward declare the everywhere used std::string210 namespace std211 {212 template<class _Elem> struct char_traits;213 template<class _Ty> class allocator;214 template<class _Elem, class _Traits, class _Ax> class basic_string;215 typedef basic_string<char, char_traits<char>, allocator<char>> string;216 }217 218 209 // Define Boost Filesystem version 219 210 #include <boost/version.hpp> -
code/branches/cpp11_v3/src/libraries/core/CorePrereqs.h
r11054 r11068 38 38 #include "OrxonoxConfig.h" 39 39 #include <boost/version.hpp> 40 #include <string> 40 41 41 42 //----------------------------------------------------------------------- -
code/branches/cpp11_v3/src/libraries/core/XMLPort.h
r11054 r11068 324 324 { 325 325 public: 326 enum ParseResult326 enum class ParseResult 327 327 { 328 PR_not_started,329 PR_finished,330 PR_waiting_for_default_values328 not_started, 329 finished, 330 waiting_for_default_values 331 331 }; 332 332 333 333 public: 334 334 XMLPortParamContainer() 335 { this->parseResult_ = P R_not_started; }335 { this->parseResult_ = ParseResult::not_started; } 336 336 virtual ~XMLPortParamContainer() = default; 337 337 … … 415 415 this->loadexecutor_->parse(object, attributeValue, &error, ","); 416 416 if (!error || (mode == XMLPort::ExpandObject)) 417 this->parseResult_ = P R_finished;417 this->parseResult_ = ParseResult::finished; 418 418 else 419 this->parseResult_ = P R_waiting_for_default_values;419 this->parseResult_ = ParseResult::waiting_for_default_values; 420 420 } 421 421 else if (mode == XMLPort::ExpandObject) 422 this->parseResult_ = P R_finished;422 this->parseResult_ = ParseResult::finished; 423 423 else 424 this->parseResult_ = P R_waiting_for_default_values;424 this->parseResult_ = ParseResult::waiting_for_default_values; 425 425 } 426 426 catch (ticpp::Exception& ex) … … 449 449 XMLPortParamContainer& portIfWaitingForDefaultValues(const ParseResult& result, const ParseParams& params) 450 450 { 451 if (result == P R_waiting_for_default_values)451 if (result == ParseResult::waiting_for_default_values) 452 452 return this->port(this->owner_, params); 453 453 else -
code/branches/cpp11_v3/src/libraries/core/command/ConsoleCommand.h
r11054 r11068 60 60 } 61 61 62 namespace AccessLevel 62 /** 63 @brief Possible access levels: A command can only be executed if the program is in the state which is requested by the access level. 64 */ 65 enum class AccessLevel 63 66 { 64 /** 65 @brief Possible access levels: A command can only be executed if the program is in the state which is requested by the access level. 66 */ 67 enum Enum 68 { 69 All, 70 Standalone, 71 Master, 72 Server, 73 Client, 74 Online, 75 Offline, 76 None 77 }; 78 } 67 All, 68 Standalone, 69 Master, 70 Server, 71 Client, 72 Online, 73 Offline, 74 None 75 }; 79 76 80 77 /** … … 249 246 250 247 /// Changes the access level of the command. 251 inline ConsoleCommandManipulator& accessLevel(AccessLevel ::Enumlevel)248 inline ConsoleCommandManipulator& accessLevel(AccessLevel level) 252 249 { if (this->command_) { this->command_->accessLevel(level); } return *this; } 253 250 … … 332 329 333 330 /// Changes the access level of the command. 334 inline ConsoleCommand& accessLevel(AccessLevel ::Enumlevel)331 inline ConsoleCommand& accessLevel(AccessLevel level) 335 332 { this->accessLevel_ = level; return *this; } 336 333 /// Returns the access level of the command. 337 inline AccessLevel ::EnumgetAccessLevel() const334 inline AccessLevel getAccessLevel() const 338 335 { return this->accessLevel_; } 339 336 … … 394 391 bool bActive_; ///< True if the command should be active (it can still be inactive, for example if the function is missing) 395 392 bool bHidden_; ///< True if the command is hidden (it is still executable, but not visible in the list of available commands) 396 AccessLevel ::Enum accessLevel_;///< The access level (the state of the game in which you can access the command)393 AccessLevel accessLevel_; ///< The access level (the state of the game in which you can access the command) 397 394 std::string baseName_; ///< The name that was first assigned to the command 398 395 std::vector<CommandName> names_; ///< All names and aliases of this command -
code/branches/cpp11_v3/src/libraries/core/command/Executor.h
r11054 r11068 147 147 { return this->functor_->hasReturnvalue(); } 148 148 /// Returns the type of the wrapped function (static or member). 149 inline Functor::Type ::EnumgetType() const149 inline Functor::Type getType() const 150 150 { return this->functor_->getType(); } 151 151 /// Returns the name of the type of a parameter with given index (the first parameter has index 0). -
code/branches/cpp11_v3/src/libraries/core/command/Functor.h
r11054 r11068 176 176 { 177 177 public: 178 struct Type 179 { 180 /// Defines the type of a function (static or member) 181 enum Enum 182 { 183 Static, 184 Member 185 }; 178 /// Defines the type of a function (static or member) 179 enum class Type 180 { 181 Static, 182 Member 186 183 }; 187 184 … … 196 193 197 194 /// Returns the type of the function: static or member. 198 virtual Type ::EnumgetType() const = 0;195 virtual Type getType() const = 0; 199 196 /// Returns the number of parameters of the function. 200 197 virtual unsigned int getParamCount() const = 0; … … 262 259 263 260 // see Functor::getType() 264 virtual inline Functor::Type ::EnumgetType() const override261 virtual inline Functor::Type getType() const override 265 262 { return Functor::Type::Member; } 266 263 … … 339 336 340 337 // see Functor::getType() 341 virtual inline Functor::Type ::EnumgetType() const override338 virtual inline Functor::Type getType() const override 342 339 { return Functor::Type::Static; } 343 340 -
code/branches/cpp11_v3/src/libraries/core/command/IOConsolePOSIX.cc
r11054 r11068 46 46 IOConsole* IOConsole::singletonPtr_s = nullptr; 47 47 48 namespace EscapeMode 49 { 50 enum Value 51 { 52 None, 53 First, 54 Second 55 }; 56 } 48 enum class EscapeMode 49 { 50 None, 51 First, 52 Second 53 }; 57 54 58 55 IOConsole::IOConsole() … … 90 87 std::cout.flush(); 91 88 if (!this->origCout_.str().empty()) 92 this->shell_->addOutput(this->origCout_.str(), Shell:: Cout);89 this->shell_->addOutput(this->origCout_.str(), Shell::LineType::Cout); 93 90 // Erase input and status lines 94 91 this->cout_ << "\033[1G\033[J"; … … 111 108 unsigned char c; 112 109 std::string escapeSequence; 113 EscapeMode ::ValueescapeMode = EscapeMode::None;110 EscapeMode escapeMode = EscapeMode::None; 114 111 while (std::cin.good()) 115 112 { … … 231 228 if (!this->origCout_.str().empty()) 232 229 { 233 this->shell_->addOutput(this->origCout_.str(), Shell:: Cout);230 this->shell_->addOutput(this->origCout_.str(), Shell::LineType::Cout); 234 231 this->origCout_.str(""); 235 232 } … … 241 238 switch (type) 242 239 { 243 case Shell:: Message:244 case Shell:: DebugOutput: this->cout_ << "\033[0m"; break;245 246 case Shell:: UserError: this->cout_ << "\033[91m"; break;247 case Shell:: UserWarning: this->cout_ << "\033[93m"; break;248 case Shell:: UserStatus: this->cout_ << "\033[92m"; break;249 case Shell:: UserInfo: this->cout_ << "\033[96m"; break;250 251 case Shell:: InternalError: this->cout_ << "\033[31m"; break;252 case Shell:: InternalWarning: this->cout_ << "\033[33m"; break;253 case Shell:: InternalStatus: this->cout_ << "\033[32m"; break;254 case Shell:: InternalInfo: this->cout_ << "\033[36m"; break;255 256 case Shell:: Verbose: this->cout_ << "\033[94m"; break;257 case Shell:: VerboseMore: this->cout_ << "\033[34m"; break;258 case Shell:: VerboseUltra: this->cout_ << "\033[34m"; break;259 260 case Shell:: Command: this->cout_ << "\033[95m"; break;261 case Shell:: Hint: this->cout_ << "\033[35m"; break;262 263 default: this->cout_ << "\033[37m"; break;240 case Shell::LineType::Message: 241 case Shell::LineType::DebugOutput: this->cout_ << "\033[0m"; break; 242 243 case Shell::LineType::UserError: this->cout_ << "\033[91m"; break; 244 case Shell::LineType::UserWarning: this->cout_ << "\033[93m"; break; 245 case Shell::LineType::UserStatus: this->cout_ << "\033[92m"; break; 246 case Shell::LineType::UserInfo: this->cout_ << "\033[96m"; break; 247 248 case Shell::LineType::InternalError: this->cout_ << "\033[31m"; break; 249 case Shell::LineType::InternalWarning: this->cout_ << "\033[33m"; break; 250 case Shell::LineType::InternalStatus: this->cout_ << "\033[32m"; break; 251 case Shell::LineType::InternalInfo: this->cout_ << "\033[36m"; break; 252 253 case Shell::LineType::Verbose: this->cout_ << "\033[94m"; break; 254 case Shell::LineType::VerboseMore: this->cout_ << "\033[34m"; break; 255 case Shell::LineType::VerboseUltra: this->cout_ << "\033[34m"; break; 256 257 case Shell::LineType::Command: this->cout_ << "\033[95m"; break; 258 case Shell::LineType::Hint: this->cout_ << "\033[35m"; break; 259 260 default: this->cout_ << "\033[37m"; break; 264 261 } 265 262 … … 384 381 void IOConsole::executed() 385 382 { 386 this->shell_->addOutput(this->promptString_ + this->shell_->getInput(), Shell:: Command);383 this->shell_->addOutput(this->promptString_ + this->shell_->getInput(), Shell::LineType::Command); 387 384 } 388 385 -
code/branches/cpp11_v3/src/libraries/core/command/IOConsoleWindows.cc
r11054 r11068 97 97 std::cout.flush(); 98 98 if (!this->origCout_.str().empty()) 99 this->shell_->addOutput(this->origCout_.str(), Shell:: Cout);99 this->shell_->addOutput(this->origCout_.str(), Shell::LineType::Cout); 100 100 101 101 this->shell_->unregisterListener(this); … … 190 190 if (!this->origCout_.str().empty()) 191 191 { 192 this->shell_->addOutput(this->origCout_.str(), Shell:: Cout);192 this->shell_->addOutput(this->origCout_.str(), Shell::LineType::Cout); 193 193 this->origCout_.str(""); 194 194 } … … 202 202 switch (type) 203 203 { 204 case Shell:: Message:205 case Shell:: DebugOutput: colour = FOREGROUND_INTENSITY | FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE; break;206 207 case Shell:: UserError: colour = FOREGROUND_INTENSITY | FOREGROUND_RED | 0 | 0 ; break;208 case Shell:: UserWarning: colour = FOREGROUND_INTENSITY | FOREGROUND_RED | FOREGROUND_GREEN | 0 ; break;209 case Shell:: UserStatus: colour = FOREGROUND_INTENSITY | 0 | FOREGROUND_GREEN | 0 ; break;210 case Shell:: UserInfo: colour = FOREGROUND_INTENSITY | 0 | FOREGROUND_GREEN | FOREGROUND_BLUE; break;211 212 case Shell:: InternalError: colour = 0 | FOREGROUND_RED | 0 | 0 ; break;213 case Shell:: InternalWarning: colour = 0 | FOREGROUND_RED | FOREGROUND_GREEN | 0 ; break;214 case Shell:: InternalStatus: colour = 0 | 0 | FOREGROUND_GREEN | 0 ; break;215 case Shell:: InternalInfo: colour = 0 | 0 | FOREGROUND_GREEN | FOREGROUND_BLUE; break;216 217 case Shell:: Verbose: colour = FOREGROUND_INTENSITY | 0 | 0 | FOREGROUND_BLUE; break;218 case Shell:: VerboseMore: colour = FOREGROUND_INTENSITY | 0 | 0 | FOREGROUND_BLUE; break;219 case Shell:: VerboseUltra: colour = FOREGROUND_INTENSITY | 0 | 0 | FOREGROUND_BLUE; break;220 221 case Shell:: Command: colour = FOREGROUND_INTENSITY | FOREGROUND_RED | 0 | FOREGROUND_BLUE; break;222 case Shell:: Hint: colour = 0 | FOREGROUND_RED | 0 | FOREGROUND_BLUE; break;223 224 default: colour = 0 | FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE; break;204 case Shell::LineType::Message: 205 case Shell::LineType::DebugOutput: colour = FOREGROUND_INTENSITY | FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE; break; 206 207 case Shell::LineType::UserError: colour = FOREGROUND_INTENSITY | FOREGROUND_RED | 0 | 0 ; break; 208 case Shell::LineType::UserWarning: colour = FOREGROUND_INTENSITY | FOREGROUND_RED | FOREGROUND_GREEN | 0 ; break; 209 case Shell::LineType::UserStatus: colour = FOREGROUND_INTENSITY | 0 | FOREGROUND_GREEN | 0 ; break; 210 case Shell::LineType::UserInfo: colour = FOREGROUND_INTENSITY | 0 | FOREGROUND_GREEN | FOREGROUND_BLUE; break; 211 212 case Shell::LineType::InternalError: colour = 0 | FOREGROUND_RED | 0 | 0 ; break; 213 case Shell::LineType::InternalWarning: colour = 0 | FOREGROUND_RED | FOREGROUND_GREEN | 0 ; break; 214 case Shell::LineType::InternalStatus: colour = 0 | 0 | FOREGROUND_GREEN | 0 ; break; 215 case Shell::LineType::InternalInfo: colour = 0 | 0 | FOREGROUND_GREEN | FOREGROUND_BLUE; break; 216 217 case Shell::LineType::Verbose: colour = FOREGROUND_INTENSITY | 0 | 0 | FOREGROUND_BLUE; break; 218 case Shell::LineType::VerboseMore: colour = FOREGROUND_INTENSITY | 0 | 0 | FOREGROUND_BLUE; break; 219 case Shell::LineType::VerboseUltra: colour = FOREGROUND_INTENSITY | 0 | 0 | FOREGROUND_BLUE; break; 220 221 case Shell::LineType::Command: colour = FOREGROUND_INTENSITY | FOREGROUND_RED | 0 | FOREGROUND_BLUE; break; 222 case Shell::LineType::Hint: colour = 0 | FOREGROUND_RED | 0 | FOREGROUND_BLUE; break; 223 224 default: colour = 0 | FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE; break; 225 225 } 226 226 … … 331 331 void IOConsole::executed() 332 332 { 333 this->shell_->addOutput(this->promptString_ + this->shell_->getInput(), Shell:: Command);333 this->shell_->addOutput(this->promptString_ + this->shell_->getInput(), Shell::LineType::Command); 334 334 } 335 335 -
code/branches/cpp11_v3/src/libraries/core/command/Shell.cc
r11054 r11068 268 268 { 269 269 // yes it was - push the new line to the list 270 this->outputLines_.push_front(std::make_pair(line, static_cast<LineType>(type)));270 this->outputLines_.push_front(std::make_pair(line, type)); 271 271 272 272 // adjust the scroll position if needed … … 381 381 const std::string& result = CommandExecutor::query(this->inputBuffer_->get(), &error); 382 382 if (error) 383 this->addOutput("Error: Can't execute \"" + this->inputBuffer_->get() + "\", " + CommandExecutor::getErrorDescription(error) + ". (Shell)", UserError);383 this->addOutput("Error: Can't execute \"" + this->inputBuffer_->get() + "\", " + CommandExecutor::getErrorDescription(error) + ". (Shell)", LineType::UserError); 384 384 else if (result != "") 385 this->addOutput(result, Result);385 this->addOutput(result, LineType::Result); 386 386 387 387 this->clearInput(); … … 392 392 { 393 393 this->inputBuffer_->set(CommandExecutor::evaluate(this->inputBuffer_->get()).complete()); 394 this->addOutput(CommandExecutor::evaluate(this->inputBuffer_->get()).hint(), Hint);394 this->addOutput(CommandExecutor::evaluate(this->inputBuffer_->get()).hint(), LineType::Hint); 395 395 396 396 this->inputChanged(); -
code/branches/cpp11_v3/src/libraries/core/command/Shell.h
r11054 r11068 88 88 public: 89 89 /// Defines the type of a line of text in the Shell - some types depend on the output level, others are of internal use. 90 enum LineType90 enum class LineType 91 91 { 92 92 DebugOutput = debug_output, … … 133 133 LineList::const_iterator getEndIterator() const; 134 134 135 void addOutput(const std::string& text, LineType type = DebugOutput);136 void addLine(const std::string& line, LineType type = DebugOutput);135 void addOutput(const std::string& text, LineType type = LineType::DebugOutput); 136 void addLine(const std::string& line, LineType type = LineType::DebugOutput); 137 137 void clearOutput(); 138 138 -
code/branches/cpp11_v3/src/libraries/core/config/ConfigFileSection.h
r9684 r11068 39 39 #include <string> 40 40 #include <list> 41 #include "util/StringUtils.h" 41 42 #include "ConfigFileEntry.h" 42 43 -
code/branches/cpp11_v3/src/libraries/network/Connection.cc
r11054 r11068 81 81 { 82 82 // this->overallMutex_->lock(); 83 outgoingEvent outEvent = { peerID, outgoingEventType::disconnectPeer, nullptr, 0 };83 outgoingEvent outEvent = { peerID, OutgoingEventType::disconnectPeer, nullptr, 0 }; 84 84 85 85 this->outgoingEventsMutex_->lock(); … … 91 91 void Connection::disconnectPeers() 92 92 { 93 outgoingEvent outEvent = { 0, outgoingEventType::disconnectPeers, nullptr, 0 };93 outgoingEvent outEvent = { 0, OutgoingEventType::disconnectPeers, nullptr, 0 }; 94 94 95 95 this->outgoingEventsMutex_->lock(); … … 101 101 { 102 102 // this->overallMutex_->lock(); 103 outgoingEvent outEvent = { peerID, outgoingEventType::sendPacket, packet, channelID };103 outgoingEvent outEvent = { peerID, OutgoingEventType::sendPacket, packet, channelID }; 104 104 105 105 this->outgoingEventsMutex_->lock(); … … 112 112 { 113 113 // this->overallMutex_->lock(); 114 outgoingEvent outEvent = { 0, outgoingEventType::broadcastPacket, packet, channelID };114 outgoingEvent outEvent = { 0, OutgoingEventType::broadcastPacket, packet, channelID }; 115 115 116 116 this->outgoingEventsMutex_->lock(); … … 197 197 switch( event.type ) 198 198 { 199 case outgoingEventType::sendPacket:199 case OutgoingEventType::sendPacket: 200 200 // check whether the peer is still/already in the peer list 201 201 if( this->peerMap_.find(event.peerID) != this->peerMap_.end() ) … … 211 211 } 212 212 break; 213 case outgoingEventType::disconnectPeer:213 case OutgoingEventType::disconnectPeer: 214 214 if( this->peerMap_.find(event.peerID) != this->peerMap_.end() ) 215 215 { … … 223 223 } 224 224 break; 225 case outgoingEventType::disconnectPeers:225 case OutgoingEventType::disconnectPeers: 226 226 disconnectPeersInternal(); 227 227 break; 228 case outgoingEventType::broadcastPacket:228 case OutgoingEventType::broadcastPacket: 229 229 enet_host_broadcast( this->host_, event.channelID, event.packet ); 230 230 break; … … 271 271 switch( inEvent.type ) 272 272 { 273 case incomingEventType::peerConnect:273 case IncomingEventType::peerConnect: 274 274 addPeer(inEvent.peerID); 275 275 break; 276 case incomingEventType::peerDisconnect:276 case IncomingEventType::peerDisconnect: 277 277 removePeer(inEvent.peerID); 278 278 break; 279 case incomingEventType::receivePacket:279 case IncomingEventType::receivePacket: 280 280 processPacket(inEvent.packet); 281 281 break; … … 322 322 323 323 // create new peerEvent and return it 324 incomingEvent inEvent = { peerID, incomingEventType::peerConnect, nullptr };324 incomingEvent inEvent = { peerID, IncomingEventType::peerConnect, nullptr }; 325 325 return inEvent; 326 326 } … … 337 337 338 338 // create new peerEvent and return it 339 incomingEvent inEvent = { peerID, incomingEventType::peerDisconnect, nullptr };339 incomingEvent inEvent = { peerID, IncomingEventType::peerDisconnect, nullptr }; 340 340 return inEvent; 341 341 } … … 351 351 352 352 // create new peerEvent and return it 353 incomingEvent inEvent = { peerID, incomingEventType::receivePacket, p };353 incomingEvent inEvent = { peerID, IncomingEventType::receivePacket, p }; 354 354 return inEvent; 355 355 } -
code/branches/cpp11_v3/src/libraries/network/Connection.h
r11054 r11068 60 60 const unsigned int NETWORK_MAX_QUEUE_PROCESS_TIME = 5; 61 61 62 namespace incomingEventType62 enum class IncomingEventType 63 63 { 64 enum Value 65 { 66 receivePacket = 1, // incoming packet 67 peerConnect = 2, // incoming connect request 68 peerDisconnect = 3 // incoming disconnect request 69 }; 70 71 } 64 receivePacket = 1, // incoming packet 65 peerConnect = 2, // incoming connect request 66 peerDisconnect = 3 // incoming disconnect request 67 }; 72 68 73 namespace outgoingEventType69 enum class OutgoingEventType 74 70 { 75 enum Value 76 { 77 sendPacket = 1, // outgoing packet 78 broadcastPacket = 2, // outgoing broadcast packet 79 disconnectPeer = 3, // outgoing disconnect request 80 disconnectPeers = 4 // outgoing disconnect request 81 }; 82 83 } 71 sendPacket = 1, // outgoing packet 72 broadcastPacket = 2, // outgoing broadcast packet 73 disconnectPeer = 3, // outgoing disconnect request 74 disconnectPeers = 4 // outgoing disconnect request 75 }; 84 76 85 77 struct _NetworkExport incomingEvent 86 78 { 87 uint32_t 88 incomingEventType::Valuetype;89 packet::Packet* 79 uint32_t peerID; 80 IncomingEventType type; 81 packet::Packet* packet; 90 82 }; 91 83 92 84 struct _NetworkExport outgoingEvent 93 85 { 94 uint32_t 95 outgoingEventType::Valuetype;96 ENetPacket* 97 ENetChannelID 86 uint32_t peerID; 87 OutgoingEventType type; 88 ENetPacket* packet; 89 ENetChannelID channelID; 98 90 }; 99 91 -
code/branches/cpp11_v3/src/libraries/network/NetworkPrereqs.h
r11054 r11068 89 89 namespace PacketFlag 90 90 { 91 enum Value 92 { 93 Reliable = 1, 94 Unsequenced = 2, 95 NoAllocate = 4 96 }; 91 static constexpr uint32_t Reliable = 1; 92 static constexpr uint32_t Unsequenced = 2; 93 static constexpr uint32_t NoAllocate = 4; 97 94 } 98 95 } … … 101 98 { 102 99 typedef int Type; 103 static const Type NETWORK_FUNCTION = 6;100 static constexpr Type NETWORK_FUNCTION = 6; 104 101 } 105 102 } -
code/branches/cpp11_v3/src/libraries/network/packet/Acknowledgement.cc
r8858 r11068 38 38 #define PACKET_FLAGS_ACK 0 39 39 #define _PACKETID 0 40 #define _ACKID _PACKETID + sizeof(packet::Type ::Value)40 #define _ACKID _PACKETID + sizeof(packet::Type) 41 41 42 42 Acknowledgement::Acknowledgement( unsigned int id, unsigned int peerID ) … … 45 45 flags_ = flags_ | PACKET_FLAGS_ACK; 46 46 data_=new uint8_t[ getSize() ]; 47 *(Type ::Value*)(data_ + _PACKETID ) = Type::Acknowledgement;47 *(Type *)(data_ + _PACKETID ) = Type::Acknowledgement; 48 48 *(uint32_t *)(data_ + _ACKID ) = id; 49 49 peerID_=peerID; -
code/branches/cpp11_v3/src/libraries/network/packet/Chat.cc
r8858 r11068 40 40 /* Some lengths */ 41 41 #define _PACKETID 0 42 #define _SOURCEID _PACKETID + sizeof(Type ::Value)42 #define _SOURCEID _PACKETID + sizeof(Type) 43 43 #define _TARGETID _SOURCEID + sizeof(uint32_t) 44 44 #define _MESSAGELENGTH _TARGETID + sizeof(uint32_t) … … 57 57 data_=new unsigned char[ getSize() ]; 58 58 59 *(Type ::Value*)(data_ + _PACKETID ) = Type::Chat;59 *(Type *)(data_ + _PACKETID ) = Type::Chat; 60 60 *(unsigned int *)(data_ + _SOURCEID ) = sourceID; 61 61 *(unsigned int *)(data_ + _TARGETID ) = targetID; -
code/branches/cpp11_v3/src/libraries/network/packet/ClassID.cc
r11054 r11068 70 70 //set the appropriate packet id 71 71 assert(this->data_); 72 *(Type ::Value*)(this->data_ + _PACKETID ) = Type::ClassID;72 *(Type *)(this->data_ + _PACKETID ) = Type::ClassID; 73 73 74 74 uint8_t *temp=data_+sizeof(uint32_t); -
code/branches/cpp11_v3/src/libraries/network/packet/DeleteObjects.cc
r8858 r11068 39 39 #define PACKET_FLAG_DELETE PacketFlag::Reliable 40 40 #define _PACKETID 0 41 #define _QUANTITY _PACKETID + sizeof(Type ::Value)41 #define _QUANTITY _PACKETID + sizeof(Type) 42 42 #define _OBJECTIDS _QUANTITY + sizeof(uint32_t) 43 43 … … 63 63 return false; 64 64 orxout(verbose, context::packets) << "sending DeleteObjects: "; 65 unsigned int size = sizeof(Type ::Value) + sizeof(uint32_t)*(number+1);65 unsigned int size = sizeof(Type) + sizeof(uint32_t)*(number+1); 66 66 data_ = new uint8_t[size]; 67 67 uint8_t *tdata = data_; 68 *reinterpret_cast<Type ::Value*>(tdata) = Type::DeleteObjects;69 tdata += sizeof(Type ::Value);68 *reinterpret_cast<Type*>(tdata) = Type::DeleteObjects; 69 tdata += sizeof(Type); 70 70 *(uint32_t *)tdata = number; 71 71 tdata += sizeof(uint32_t); -
code/branches/cpp11_v3/src/libraries/network/packet/FunctionCalls.cc
r10624 r11068 96 96 assert(this->functionCalls_.size()); 97 97 data_=new uint8_t[ currentSize_ ]; 98 *(Type ::Value*)(data_ + _PACKETID ) = Type::FunctionCalls; // Set the Packet ID98 *(Type *)(data_ + _PACKETID ) = Type::FunctionCalls; // Set the Packet ID 99 99 *(uint32_t*)(data_+sizeof(uint32_t)) = this->functionCalls_.size(); // set nrOfCalls 100 100 *(uint32_t*)(data_+2*sizeof(uint32_t)) = this->minGamestateID_; // set minGamestateID_ -
code/branches/cpp11_v3/src/libraries/network/packet/FunctionIDs.cc
r11054 r11068 71 71 //set the appropriate packet id 72 72 assert(this->data_); 73 *(Type ::Value*)(this->data_ + _PACKETID ) = Type::FunctionIDs;73 *(Type *)(this->data_ + _PACKETID ) = Type::FunctionIDs; 74 74 75 75 uint8_t *temp=data_+sizeof(uint32_t); -
code/branches/cpp11_v3/src/libraries/network/packet/Gamestate.h
r11054 r11068 56 56 GamestateHeader(){ data_=nullptr; } 57 57 GamestateHeader(uint8_t* data) 58 { assert(data); data_ = data; *( uint32_t*)data_ = Type::Gamestate; }58 { assert(data); data_ = data; *(Type*)data_ = Type::Gamestate; } 59 59 /*GamestateHeader(uint8_t* data, GamestateHeader* h) 60 60 { assert(data); data_=data; memcpy(data_, h->data_, getSize()); }*/ 61 61 void setData(uint8_t* data) 62 { assert(data); data_ = data; *( uint32_t*)data_ = Type::Gamestate; }62 { assert(data); data_ = data; *(Type*)data_ = Type::Gamestate; } 63 63 static inline uint32_t getSize() 64 64 { return 21; } -
code/branches/cpp11_v3/src/libraries/network/packet/Packet.cc
r11054 r11068 157 157 } 158 158 #ifndef NDEBUG 159 switch( *(Type ::Value*)(data_ + _PACKETID) )159 switch( *(Type *)(data_ + _PACKETID) ) 160 160 { 161 161 case Type::Acknowledgement: … … 191 191 // peerID = NETWORK_PEER_ID_SERVER; 192 192 Packet *p = nullptr; 193 // orxout(verbose_ultra, context::packets) << "packet type: " << *(Type ::Value*)&data[_PACKETID] << endl;194 switch( *(Type ::Value*)(data + _PACKETID) )193 // orxout(verbose_ultra, context::packets) << "packet type: " << *(Type *)&data[_PACKETID] << endl; 194 switch( *(Type *)(data + _PACKETID) ) 195 195 { 196 196 case Type::Acknowledgement: -
code/branches/cpp11_v3/src/libraries/network/packet/Packet.h
r8327 r11068 38 38 { 39 39 40 namespaceDirection40 enum class Direction 41 41 { 42 enum Value 43 { 44 Incoming, 45 Outgoing, 46 Bidirectional 47 }; 48 } 49 namespace Type 42 Incoming, 43 Outgoing, 44 Bidirectional 45 }; 46 enum class Type : uint8_t 50 47 { 51 enum Value 52 { 53 Acknowledgement, 54 Chat, 55 ClassID, 56 DeleteObjects, 57 FunctionIDs, 58 FunctionCalls, 59 Gamestate, 60 Welcome 61 }; 62 } 48 Acknowledgement, 49 Chat, 50 ClassID, 51 DeleteObjects, 52 FunctionIDs, 53 FunctionCalls, 54 Gamestate, 55 Welcome 56 }; 63 57 64 58 /** … … 98 92 unsigned int peerID_; 99 93 uint32_t requiredGamestateID_; 100 Direction ::ValuepacketDirection_;94 Direction packetDirection_; 101 95 /** Pointer to the data. Be careful when deleting it because it might 102 96 point to a location that was allocated by ENet. -
code/branches/cpp11_v3/src/libraries/network/packet/Welcome.cc
r8858 r11068 41 41 #define PACKET_FLAGS_CLASSID PacketFlag::Reliable 42 42 #define _PACKETID 0 43 #define _CLIENTID _PACKETID + sizeof(Type ::Value)43 #define _CLIENTID _PACKETID + sizeof(Type) 44 44 #define _ENDIANTEST _CLIENTID + sizeof(uint32_t) 45 45 … … 51 51 data_=new uint8_t[ getSize() ]; 52 52 assert(data_); 53 *(packet::Type ::Value*)(data_ + _PACKETID ) = packet::Type::Welcome;53 *(packet::Type *)(data_ + _PACKETID ) = packet::Type::Welcome; 54 54 *(uint32_t *)(data_ + _CLIENTID ) = static_cast<uint32_t>(clientID); 55 55 *(uint32_t *)(data_ + _ENDIANTEST ) = 0xFEDC4321; … … 70 70 71 71 unsigned int Welcome::getSize() const{ 72 return sizeof(packet::Type ::Value) + 2*sizeof(uint32_t);72 return sizeof(packet::Type) + 2*sizeof(uint32_t); 73 73 } 74 74 -
code/branches/cpp11_v3/src/libraries/network/synchronisable/Synchronisable.h
r11054 r11068 38 38 #include <queue> 39 39 #include <set> 40 #include <type_traits> 40 41 41 42 #include "util/mbool.h" … … 203 204 }; 204 205 205 template <class T> void Synchronisable::registerVariable(T& variable, uint8_t mode, NetworkCallbackBase *cb, bool bidirectional) 206 { 206 namespace detail 207 { 208 template <class T, bool = std::is_enum<T>::value> 209 struct UnderlyingType; 210 template <class T> 211 struct UnderlyingType<T, true> { typedef typename std::underlying_type<T>::type type; }; 212 template <class T> 213 struct UnderlyingType<T, false> { typedef T type; }; 214 } 215 216 template <class T> 217 void Synchronisable::registerVariable(T& variable, uint8_t mode, NetworkCallbackBase *cb, bool bidirectional) 218 { 219 typedef typename detail::UnderlyingType<T>::type UnderlyingType; 207 220 if (bidirectional) 208 221 { 209 syncList_.push_back(new SynchronisableVariableBidirectional< T>(variable, mode, cb));222 syncList_.push_back(new SynchronisableVariableBidirectional<UnderlyingType>(reinterpret_cast<UnderlyingType&>(variable), mode, cb)); 210 223 this->dataSize_ += syncList_.back()->getSize(state_); 211 224 } 212 225 else 213 226 { 214 syncList_.push_back(new SynchronisableVariable< T>(variable, mode, cb));227 syncList_.push_back(new SynchronisableVariable<UnderlyingType>(reinterpret_cast<UnderlyingType&>(variable), mode, cb)); 215 228 if ( this->state_ == mode ) 216 229 this->dataSize_ += syncList_.back()->getSize(state_); … … 218 231 } 219 232 220 template <class T> void Synchronisable::unregisterVariable(T& variable) 233 template <class T> 234 void Synchronisable::unregisterVariable(T& variable) 221 235 { 222 236 std::vector<SynchronisableVariableBase*>::iterator it = syncList_.begin(); … … 238 252 } 239 253 240 template <class T> void Synchronisable::registerVariable( std::set<T>& variable, uint8_t mode, NetworkCallbackBase *cb, bool bidirectional) 241 { 254 template <class T> 255 void Synchronisable::registerVariable( std::set<T>& variable, uint8_t mode, NetworkCallbackBase *cb, bool bidirectional) 256 { 257 typedef typename detail::UnderlyingType<T>::type UnderlyingType; 242 258 SynchronisableVariableBase* sv; 243 259 if (bidirectional) 244 sv = new SynchronisableVariableBidirectional<std::set< T>>(variable, mode, cb);260 sv = new SynchronisableVariableBidirectional<std::set<UnderlyingType>>(reinterpret_cast<std::set<UnderlyingType>&>(variable), mode, cb); 245 261 else 246 sv = new SynchronisableVariable<std::set< T>>(variable, mode, cb);262 sv = new SynchronisableVariable<std::set<UnderlyingType>>(reinterpret_cast<std::set<UnderlyingType>&>(variable), mode, cb); 247 263 syncList_.push_back(sv); 248 264 stringList_.push_back(sv); -
code/branches/cpp11_v3/src/libraries/util/Math.h
r11054 r11068 47 47 #include <cstdlib> 48 48 #include <random> 49 #include <type_traits> 49 50 50 51 #include <OgreMath.h> … … 178 179 @c Vector3 you get <tt>Vector3(0, 0, 0)</tt>. 179 180 */ 180 template <typename T> 181 inline Tzeroise()181 template <typename T> /* for normal classes */ typename std::enable_if<!std::is_enum<T>::value, T>::type 182 inline /*T*/ zeroise() 182 183 { 183 184 // If you reach this code, you abused zeroise()! 184 185 static_assert(sizeof(T) != sizeof(T), "No template specialization available for T"); 186 } 187 /// Implementation for enum classes: uses the underlying type to create a zero value. 188 template <typename T> /* for enum classes */ typename std::enable_if<std::is_enum<T>::value, T>::type 189 inline /*T*/ zeroise() 190 { 191 return static_cast<T>(zeroise<typename std::underlying_type<T>::type>()); 185 192 } 186 193 -
code/branches/cpp11_v3/src/libraries/util/MultiType.cc
r9550 r11068 43 43 @param type The type 44 44 */ 45 bool MultiType::convert(Type ::Enumtype)45 bool MultiType::convert(Type type) 46 46 { 47 47 switch (type) … … 106 106 std::string MultiType::getTypename() const 107 107 { 108 Type ::Enumtype = (this->value_) ? this->value_->type_ : Type::Null;108 Type type = (this->value_) ? this->value_->type_ : Type::Null; 109 109 110 110 switch (type) -
code/branches/cpp11_v3/src/libraries/util/MultiType.h
r11054 r11068 132 132 template <typename T> friend class MT_Value; 133 133 134 struct Type 134 /** 135 @brief Enum of all possible types of a MultiType. 136 */ 137 enum class Type : uint8_t 135 138 { 136 /** 137 @brief Enum of all possible types of a MultiType. 138 */ 139 enum Enum 140 { 141 Null, 142 Char, 143 UnsignedChar, 144 Short, 145 UnsignedShort, 146 Int, 147 UnsignedInt, 148 Long, 149 UnsignedLong, 150 LongLong, 151 UnsignedLongLong, 152 Float, 153 Double, 154 LongDouble, 155 Bool, 156 VoidPointer, 157 String, 158 Vector2, 159 Vector3, 160 Vector4, 161 ColourValue, 162 Quaternion, 163 Radian, 164 Degree 165 }; 139 Null, 140 Char, 141 UnsignedChar, 142 Short, 143 UnsignedShort, 144 Int, 145 UnsignedInt, 146 Long, 147 UnsignedLong, 148 LongLong, 149 UnsignedLongLong, 150 Float, 151 Double, 152 LongDouble, 153 Bool, 154 VoidPointer, 155 String, 156 Vector2, 157 Vector3, 158 Vector4, 159 ColourValue, 160 Quaternion, 161 Radian, 162 Degree 166 163 }; 167 164 … … 174 171 { 175 172 public: 176 inline MT_ValueBase(void* data, Type ::Enumtype) : type_(type), bLastConversionSuccessful(true), data_(data) {}173 inline MT_ValueBase(void* data, Type type) : type_(type), bLastConversionSuccessful(true), data_(data) {} 177 174 virtual inline ~MT_ValueBase() {} 178 175 … … 182 179 183 180 /// Returns the type of the current value. 184 inline const Type::Enum& getType() const { return this->type_; } 185 /// Returns true if the type of the stored value is T. 186 template <typename T> inline bool isType() const { return false; } 181 inline const Type& getType() const { return this->type_; } 182 183 /// Returns true if the type of the stored value is T. Note: the actual implementations for all supported types are defined outside of the class. 184 template <typename T> /* for normal classes */ typename std::enable_if<!std::is_enum<T>::value, bool>::type 185 inline /*bool*/ isType() const 186 { 187 // If you reach this code, you used MultiType with an unsupported type T 188 static_assert(sizeof(T) != sizeof(T), "No template specialization available for T"); 189 return false; 190 } 191 /// Implementation for enum classes: Returns true if the type of the stored value is the underlying type of T. 192 template <typename T> /* for enum classes */ typename std::enable_if<std::is_enum<T>::value, bool>::type 193 inline /*bool*/ isType() const 194 { 195 return this->isType<typename std::underlying_type<T>::type>(); 196 } 187 197 188 198 /// Checks whether the value is a default one. … … 215 225 virtual bool setValue(const MultiType& other) = 0; 216 226 227 template <typename T> /* for normal classes */ typename std::enable_if<!std::is_enum<T>::value, bool>::type 228 inline /*bool*/ setValue(const T& value) 229 { 230 // If you reach this code, you used MultiType with an unsupported type T 231 static_assert(sizeof(T) != sizeof(T), "No template specialization available for T"); 232 return false; 233 } 234 template <typename T> /* for enum classes */ typename std::enable_if<std::is_enum<T>::value, bool>::type 235 inline /*bool*/ setValue(const T& value) 236 { 237 typedef typename std::underlying_type<T>::type UnderlyingType; 238 return this->setValue(reinterpret_cast<const UnderlyingType&>(value)); 239 } 240 217 241 virtual bool getValue(char* value) const = 0; 218 242 virtual bool getValue(unsigned char* value) const = 0; … … 239 263 virtual bool getValue(orxonox::Degree* value) const = 0; 240 264 265 template <typename T> /* for normal classes */ typename std::enable_if<!std::is_enum<T>::value, bool>::type 266 inline /*bool*/ getValue(T* value) const 267 { 268 // If you reach this code, you used MultiType with an unsupported type T 269 static_assert(sizeof(T) != sizeof(T), "No template specialization available for T"); 270 return false; 271 } 272 template <typename T> /* for enum classes */ typename std::enable_if<std::is_enum<T>::value, bool>::type 273 inline /*bool*/ getValue(T* value) const 274 { 275 typedef typename std::underlying_type<T>::type UnderlyingType; 276 return this->getValue(reinterpret_cast<UnderlyingType*>(value)); 277 } 278 241 279 template <typename T> T get() const 242 280 { … … 257 295 virtual uint8_t getSize() const = 0; 258 296 259 Type ::Enum type_;///< The type of the current value297 Type type_; ///< The type of the current value 260 298 bool bLastConversionSuccessful; ///< True if the last conversion was successful 261 299 void* data_; ///< For direct access to the value if the type is known … … 354 392 template <typename T> inline bool getValue(T* value) const { if (this->value_) { return this->value_->getValue(value); } return false; } 355 393 356 /// Returns the current value, converted to the requested type. This base implementation works only for pointers. All other supported types are 357 /// implemented in specialized functions at the bottom of this file. 358 template <typename T> inline T get() const { return static_cast<T>(this->get<void*>()); } 394 /// Returns the current value, converted to the requested type. 395 template <typename T> /* for normal types */ typename std::enable_if<!std::is_pointer<T>::value, T>::type 396 inline /*T*/ get() const { return (this->value_ ? this->value_->get<T>() : NilValue<T>()); } 397 /// Returns the current value, converted to a pointer of the requested type. 398 template <typename T> /* for pointers */ typename std::enable_if<std::is_pointer<T>::value, T>::type 399 inline /*T*/ get() const { return this->value_ ? static_cast<T>(this->value_->get<void*>()) : nullptr; } 359 400 360 401 … … 365 406 inline void exportData(uint8_t*& mem) const 366 407 { 367 assert(sizeof(Type ::Enum) <= 8);368 *static_cast<uint8_t*>(mem) = this->getType();408 assert(sizeof(Type) <= 8); 409 *static_cast<uint8_t*>(mem) = static_cast<uint8_t>(this->getType()); 369 410 mem += sizeof(uint8_t); 370 411 this->value_->exportData(mem); … … 373 414 inline void importData(uint8_t*& mem) 374 415 { 375 assert(sizeof(Type ::Enum) <= 8);376 this->setType(static_cast<Type ::Enum>(*static_cast<uint8_t*>(mem)));416 assert(sizeof(Type) <= 8); 417 this->setType(static_cast<Type>(*static_cast<uint8_t*>(mem))); 377 418 mem += sizeof(uint8_t); 378 419 this->value_->importData(mem); … … 414 455 415 456 /// Resets the value and changes the internal type to the given type. 416 inline void setType(Type ::Enumtype) { this->reset(); this->convert(type); this->resetValue(); }457 inline void setType(Type type) { this->reset(); this->convert(type); this->resetValue(); } 417 458 /// Returns the current type. 418 inline Type ::EnumgetType() const { return (this->value_) ? this->value_->type_ : Type::Null; }459 inline Type getType() const { return (this->value_) ? this->value_->type_ : Type::Null; } 419 460 /// Converts the current value to the given type. 420 bool convert(Type ::Enumtype);461 bool convert(Type type); 421 462 422 463 /// Changes the value container. … … 428 469 } 429 470 /// Creates a new value container (works only with specialized types). 430 template <typename T> inline void createNewValueContainer(const T& value) 471 template <typename T> /* for normal classes */ typename std::enable_if<!std::is_enum<T>::value>::type 472 inline /*void*/ createNewValueContainer(const T& value) 431 473 { 432 474 // If you reach this code, you used MultiType with an unsupported type T 433 475 static_assert(sizeof(T) != sizeof(T), "No template specialization available for T"); 476 } 477 /// Creates a new value container (implementation for enum classes that must be cast to the underlying type). 478 template <typename T> /* for enum classes */ typename std::enable_if<std::is_enum<T>::value>::type 479 inline /*void*/ createNewValueContainer(const T& value) 480 { 481 typedef typename std::underlying_type<T>::type UnderlyingType; 482 this->createNewValueContainer<UnderlyingType>(reinterpret_cast<const UnderlyingType&>(value)); 434 483 } 435 484 … … 475 524 template <> inline bool MultiType::isType<void>() const { return this->null(); } 476 525 template <> inline bool MultiType::convert<void>() { this->reset(); return true; } 477 478 template <> inline char MultiType::get() const { return (this->value_ ? this->value_->get<char>() : 0); }479 template <> inline unsigned char MultiType::get() const { return (this->value_ ? this->value_->get<unsigned char>() : 0); }480 template <> inline short MultiType::get() const { return (this->value_ ? this->value_->get<short>() : 0); }481 template <> inline unsigned short MultiType::get() const { return (this->value_ ? this->value_->get<unsigned short>() : 0); }482 template <> inline int MultiType::get() const { return (this->value_ ? this->value_->get<int>() : 0); }483 template <> inline unsigned int MultiType::get() const { return (this->value_ ? this->value_->get<unsigned int>() : 0); }484 template <> inline long MultiType::get() const { return (this->value_ ? this->value_->get<long>() : 0); }485 template <> inline unsigned long MultiType::get() const { return (this->value_ ? this->value_->get<unsigned long>() : 0); }486 template <> inline long long MultiType::get() const { return (this->value_ ? this->value_->get<long long>() : 0); }487 template <> inline unsigned long long MultiType::get() const { return (this->value_ ? this->value_->get<unsigned long long>() : 0); }488 template <> inline float MultiType::get() const { return (this->value_ ? this->value_->get<float>() : 0); }489 template <> inline double MultiType::get() const { return (this->value_ ? this->value_->get<double>() : 0); }490 template <> inline long double MultiType::get() const { return (this->value_ ? this->value_->get<long double>() : 0); }491 template <> inline bool MultiType::get() const { return (this->value_ ? this->value_->get<bool>() : 0); }492 template <> inline void* MultiType::get() const { return (this->value_ ? this->value_->get<void*>() : nullptr); }493 template <> inline std::string MultiType::get() const { return (this->value_ ? this->value_->get<std::string>() : NilValue<std::string>()); }494 template <> inline orxonox::Vector2 MultiType::get() const { return (this->value_ ? this->value_->get<orxonox::Vector2>() : NilValue<orxonox::Vector2>()); }495 template <> inline orxonox::Vector3 MultiType::get() const { return (this->value_ ? this->value_->get<orxonox::Vector3>() : NilValue<orxonox::Vector3>()); }496 template <> inline orxonox::Vector4 MultiType::get() const { return (this->value_ ? this->value_->get<orxonox::Vector4>() : NilValue<orxonox::Vector4>()); }497 template <> inline orxonox::ColourValue MultiType::get() const { return (this->value_ ? this->value_->get<orxonox::ColourValue>() : NilValue<orxonox::ColourValue>()); }498 template <> inline orxonox::Quaternion MultiType::get() const { return (this->value_ ? this->value_->get<orxonox::Quaternion>() : NilValue<orxonox::Quaternion>()); }499 template <> inline orxonox::Radian MultiType::get() const { return (this->value_ ? this->value_->get<orxonox::Radian>() : NilValue<orxonox::Radian>()); }500 template <> inline orxonox::Degree MultiType::get() const { return (this->value_ ? this->value_->get<orxonox::Degree>() : NilValue<orxonox::Degree>()); }501 526 502 527 template <> _UtilExport void MultiType::createNewValueContainer(const char& value); -
code/branches/cpp11_v3/src/libraries/util/MultiTypeValue.h
r11054 r11068 55 55 public: 56 56 /// Constructor: Assigns the value and the type identifier. 57 MT_Value(const T& value, MultiType::Type ::Enumtype) : MT_ValueBase(&this->value_, type), value_(value) {}57 MT_Value(const T& value, MultiType::Type type) : MT_ValueBase(&this->value_, type), value_(value) {} 58 58 59 59 /// Creates a copy of itself. -
code/branches/cpp11_v3/src/libraries/util/SubString.cc
r11054 r11068 265 265 bool inSafemode = false; 266 266 267 if(start_state != S L_NORMAL && tokens.size() > 0)267 if(start_state != SPLIT_LINE_STATE::NORMAL && tokens.size() > 0) 268 268 { 269 269 token = tokens[tokens.size()-1]; 270 270 tokens.pop_back(); 271 271 } 272 if(start_state != S L_NORMAL && bTokenInSafemode.size() > 0)272 if(start_state != SPLIT_LINE_STATE::NORMAL && bTokenInSafemode.size() > 0) 273 273 { 274 274 inSafemode = bTokenInSafemode[bTokenInSafemode.size()-1]; … … 280 280 switch(state) 281 281 { 282 case S L_NORMAL:282 case SPLIT_LINE_STATE::NORMAL: 283 283 if(line[i] == escapeChar) 284 284 { 285 state = S L_ESCAPE;285 state = SPLIT_LINE_STATE::ESCAPE; 286 286 if (!bRemoveEscapeChar) 287 287 token += line[i]; … … 290 290 else if(line[i] == safemodeChar) 291 291 { 292 state = S L_SAFEMODE;292 state = SPLIT_LINE_STATE::SAFEMODE; 293 293 inSafemode = true; 294 294 if (!bRemoveSafemodeChar) … … 298 298 else if(line[i] == openparenthesisChar) 299 299 { 300 state = S L_PARENTHESES;300 state = SPLIT_LINE_STATE::PARENTHESES; 301 301 inSafemode = true; 302 302 if (!bRemoveParenthesisChars) … … 318 318 } 319 319 token += line[i]; // EAT 320 state = S L_COMMENT;320 state = SPLIT_LINE_STATE::COMMENT; 321 321 } 322 322 else if(delimiters.find(line[i]) != std::string::npos) … … 334 334 inSafemode = false; 335 335 } 336 state = S L_NORMAL;336 state = SPLIT_LINE_STATE::NORMAL; 337 337 } 338 338 else … … 353 353 } 354 354 break; 355 case S L_ESCAPE:355 case SPLIT_LINE_STATE::ESCAPE: 356 356 if (!bRemoveSafemodeChar) 357 357 token += line[i]; … … 368 368 else token += line[i]; // EAT 369 369 } 370 state = S L_NORMAL;371 break; 372 case S L_SAFEMODE:370 state = SPLIT_LINE_STATE::NORMAL; 371 break; 372 case SPLIT_LINE_STATE::SAFEMODE: 373 373 if(line[i] == safemodeChar) 374 374 { 375 state = S L_NORMAL;375 state = SPLIT_LINE_STATE::NORMAL; 376 376 if (!bRemoveSafemodeChar) 377 377 token += line[i]; … … 379 379 else if(line[i] == escapeChar) 380 380 { 381 state = S L_SAFEESCAPE;381 state = SPLIT_LINE_STATE::SAFEESCAPE; 382 382 } 383 383 else … … 387 387 break; 388 388 389 case S L_SAFEESCAPE:389 case SPLIT_LINE_STATE::SAFEESCAPE: 390 390 if(line[i] == 'n') token += '\n'; 391 391 else if(line[i] == 't') token += '\t'; … … 397 397 else if(line[i] == '?') token += '\?'; 398 398 else token += line[i]; // EAT 399 state = S L_SAFEMODE;400 break; 401 402 case S L_PARENTHESES:399 state = SPLIT_LINE_STATE::SAFEMODE; 400 break; 401 402 case SPLIT_LINE_STATE::PARENTHESES: 403 403 if(line[i] == closeparenthesisChar) 404 404 { 405 state = S L_NORMAL;405 state = SPLIT_LINE_STATE::NORMAL; 406 406 if (!bRemoveParenthesisChars) 407 407 token += line[i]; … … 409 409 else if(line[i] == escapeChar) 410 410 { 411 state = S L_PARENTHESESESCAPE;411 state = SPLIT_LINE_STATE::PARENTHESESESCAPE; 412 412 } 413 413 else … … 417 417 break; 418 418 419 case S L_PARENTHESESESCAPE:419 case SPLIT_LINE_STATE::PARENTHESESESCAPE: 420 420 if(line[i] == 'n') token += '\n'; 421 421 else if(line[i] == 't') token += '\t'; … … 427 427 else if(line[i] == '?') token += '\?'; 428 428 else token += line[i]; // EAT 429 state = S L_PARENTHESES;430 break; 431 432 case S L_COMMENT:429 state = SPLIT_LINE_STATE::PARENTHESES; 430 break; 431 432 case SPLIT_LINE_STATE::COMMENT: 433 433 if(line[i] == '\n') 434 434 { … … 441 441 inSafemode = false; 442 442 } 443 state = S L_NORMAL;443 state = SPLIT_LINE_STATE::NORMAL; 444 444 } 445 445 else -
code/branches/cpp11_v3/src/libraries/util/SubString.h
r9550 r11068 102 102 { 103 103 /// An enumerator for the internal state of the parser 104 enum SPLIT_LINE_STATE104 enum class SPLIT_LINE_STATE 105 105 { 106 SL_NORMAL, //!< Normal state107 SL_ESCAPE, //!< After an escape character108 S L_SAFEMODE, //!< In safe mode (usually between quotation marks).109 S L_SAFEESCAPE, //!< In safe mode with the internal escape character, that escapes even the savemode character.110 SL_COMMENT, //!< In Comment mode.111 SL_PARENTHESES, //!< Between parentheses (usually '{' and '}')112 SL_PARENTHESESESCAPE, //!< Between parentheses with the internal escape character, that escapes even the closing parenthesis character.106 NORMAL, //!< Normal state 107 ESCAPE, //!< After an escape character 108 SAFEMODE, //!< In safe mode (usually between quotation marks). 109 SAFEESCAPE, //!< In safe mode with the internal escape character, that escapes even the savemode character. 110 COMMENT, //!< In Comment mode. 111 PARENTHESES, //!< Between parentheses (usually '{' and '}') 112 PARENTHESESESCAPE, //!< Between parentheses with the internal escape character, that escapes even the closing parenthesis character. 113 113 }; 114 114 … … 204 204 bool bRemoveParenthesisChars = true, 205 205 char commentChar = '\0', 206 SPLIT_LINE_STATE start_state = S L_NORMAL);206 SPLIT_LINE_STATE start_state = SPLIT_LINE_STATE::NORMAL); 207 207 208 208 std::vector<std::string> tokens_; ///< The tokens after splitting the input line -
code/branches/cpp11_v3/src/libraries/util/UtilPrereqs.h
r11054 r11068 37 37 38 38 #include "OrxonoxConfig.h" 39 #include <string> 39 40 40 41 //----------------------------------------------------------------------- -
code/branches/cpp11_v3/src/modules/gametypes/OldRaceCheckPoint.cc
r10624 r11068 49 49 50 50 this->setRadarObjectColour(ColourValue::Blue); 51 this->setRadarObjectShape(RadarViewable:: Triangle);51 this->setRadarObjectShape(RadarViewable::Shape::Triangle); 52 52 this->setRadarVisibility(false); 53 53 } -
code/branches/cpp11_v3/src/modules/gametypes/RaceCheckPoint.cc
r11054 r11068 53 53 54 54 this->setRadarObjectColour(ColourValue::Blue); 55 this->setRadarObjectShape(RadarViewable:: Triangle);55 this->setRadarObjectShape(RadarViewable::Shape::Triangle); 56 56 this->setRadarVisibility(false); 57 57 this->settingsChanged(); -
code/branches/cpp11_v3/src/modules/jump/Jump.cc
r11054 r11068 610 610 const int numJ = 4; 611 611 612 enum PlatformType613 { 614 PLATFORM_EMPTY, PLATFORM_STATIC, PLATFORM_HMOVE, PLATFORM_VMOVE, PLATFORM_DISAPPEAR, PLATFORM_TIMER, PLATFORM_FAKE612 enum class PlatformType 613 { 614 EMPTY, STATIC, HMOVE, VMOVE, DISAPPEAR, TIMER, FAKE 615 615 }; 616 616 617 enum ItemType618 { 619 ITEM_NOTHING, ITEM_SPRING, ITEM_PROPELLER, ITEM_ROCKET, ITEM_BOOTS, ITEM_SHIELD617 enum class ItemType 618 { 619 NOTHING, SPRING, PROPELLER, ROCKET, BOOTS, SHIELD 620 620 }; 621 621 … … 631 631 for (int j = 0; j < numJ; ++j) 632 632 { 633 matrix[i][j].type = P LATFORM_EMPTY;633 matrix[i][j].type = PlatformType::EMPTY; 634 634 matrix[i][j].done = false; 635 635 } … … 637 637 PlatformType platformtype1; 638 638 PlatformType platformtype2; 639 ItemType itemType = I TEM_NOTHING;639 ItemType itemType = ItemType::NOTHING; 640 640 641 641 if (rand()%2 == 0) 642 642 { 643 itemType = I TEM_SPRING;643 itemType = ItemType::SPRING; 644 644 } 645 645 else if (rand()%2 == 0 && sectionNumber_ > 3) … … 648 648 { 649 649 case 0: 650 itemType = I TEM_PROPELLER;650 itemType = ItemType::PROPELLER; 651 651 break; 652 652 case 1: 653 itemType = I TEM_ROCKET;653 itemType = ItemType::ROCKET; 654 654 break; 655 655 case 2: 656 itemType = I TEM_BOOTS;656 itemType = ItemType::BOOTS; 657 657 break; 658 658 case 3: 659 itemType = I TEM_SHIELD;659 itemType = ItemType::SHIELD; 660 660 break; 661 661 default: … … 667 667 { 668 668 case 0: 669 platformtype1 = P LATFORM_STATIC;670 platformtype2 = P LATFORM_STATIC;669 platformtype1 = PlatformType::STATIC; 670 platformtype2 = PlatformType::STATIC; 671 671 break; 672 672 case 1: 673 platformtype1 = P LATFORM_STATIC;674 platformtype2 = P LATFORM_STATIC;673 platformtype1 = PlatformType::STATIC; 674 platformtype2 = PlatformType::STATIC; 675 675 break; 676 676 case 2: 677 platformtype1 = P LATFORM_STATIC;678 platformtype2 = P LATFORM_HMOVE;677 platformtype1 = PlatformType::STATIC; 678 platformtype2 = PlatformType::HMOVE; 679 679 break; 680 680 case 3: 681 platformtype1 = P LATFORM_STATIC;682 platformtype2 = P LATFORM_DISAPPEAR;681 platformtype1 = PlatformType::STATIC; 682 platformtype2 = PlatformType::DISAPPEAR; 683 683 break; 684 684 case 4: 685 platformtype1 = P LATFORM_STATIC;686 platformtype2 = P LATFORM_VMOVE;685 platformtype1 = PlatformType::STATIC; 686 platformtype2 = PlatformType::VMOVE; 687 687 break; 688 688 case 5: 689 platformtype1 = P LATFORM_STATIC;690 platformtype2 = P LATFORM_TIMER;689 platformtype1 = PlatformType::STATIC; 690 platformtype2 = PlatformType::TIMER; 691 691 break; 692 692 case 6: 693 platformtype1 = P LATFORM_HMOVE;694 platformtype2 = P LATFORM_STATIC;693 platformtype1 = PlatformType::HMOVE; 694 platformtype2 = PlatformType::STATIC; 695 695 break; 696 696 case 7: 697 platformtype1 = P LATFORM_HMOVE;698 platformtype2 = P LATFORM_HMOVE;697 platformtype1 = PlatformType::HMOVE; 698 platformtype2 = PlatformType::HMOVE; 699 699 break; 700 700 case 8: 701 platformtype1 = P LATFORM_HMOVE;702 platformtype2 = P LATFORM_HMOVE;701 platformtype1 = PlatformType::HMOVE; 702 platformtype2 = PlatformType::HMOVE; 703 703 break; 704 704 case 9: 705 platformtype1 = P LATFORM_HMOVE;706 platformtype2 = P LATFORM_DISAPPEAR;705 platformtype1 = PlatformType::HMOVE; 706 platformtype2 = PlatformType::DISAPPEAR; 707 707 break; 708 708 case 10: 709 platformtype1 = P LATFORM_HMOVE;710 platformtype2 = P LATFORM_VMOVE;709 platformtype1 = PlatformType::HMOVE; 710 platformtype2 = PlatformType::VMOVE; 711 711 break; 712 712 case 11: 713 platformtype1 = P LATFORM_HMOVE;714 platformtype2 = P LATFORM_TIMER;713 platformtype1 = PlatformType::HMOVE; 714 platformtype2 = PlatformType::TIMER; 715 715 break; 716 716 case 12: 717 platformtype1 = P LATFORM_DISAPPEAR;718 platformtype2 = P LATFORM_STATIC;717 platformtype1 = PlatformType::DISAPPEAR; 718 platformtype2 = PlatformType::STATIC; 719 719 break; 720 720 case 13: 721 platformtype1 = P LATFORM_DISAPPEAR;722 platformtype2 = P LATFORM_HMOVE;721 platformtype1 = PlatformType::DISAPPEAR; 722 platformtype2 = PlatformType::HMOVE; 723 723 break; 724 724 case 14: 725 platformtype1 = P LATFORM_DISAPPEAR;726 platformtype2 = P LATFORM_DISAPPEAR;725 platformtype1 = PlatformType::DISAPPEAR; 726 platformtype2 = PlatformType::DISAPPEAR; 727 727 break; 728 728 case 15: 729 platformtype1 = P LATFORM_DISAPPEAR;730 platformtype2 = P LATFORM_DISAPPEAR;729 platformtype1 = PlatformType::DISAPPEAR; 730 platformtype2 = PlatformType::DISAPPEAR; 731 731 break; 732 732 case 16: 733 platformtype1 = P LATFORM_DISAPPEAR;734 platformtype2 = P LATFORM_VMOVE;733 platformtype1 = PlatformType::DISAPPEAR; 734 platformtype2 = PlatformType::VMOVE; 735 735 break; 736 736 case 17: 737 platformtype1 = P LATFORM_DISAPPEAR;738 platformtype2 = P LATFORM_TIMER;737 platformtype1 = PlatformType::DISAPPEAR; 738 platformtype2 = PlatformType::TIMER; 739 739 break; 740 740 case 18: 741 platformtype1 = P LATFORM_VMOVE;742 platformtype2 = P LATFORM_STATIC;741 platformtype1 = PlatformType::VMOVE; 742 platformtype2 = PlatformType::STATIC; 743 743 break; 744 744 case 19: 745 platformtype1 = P LATFORM_VMOVE;746 platformtype2 = P LATFORM_HMOVE;745 platformtype1 = PlatformType::VMOVE; 746 platformtype2 = PlatformType::HMOVE; 747 747 break; 748 748 case 20: 749 platformtype1 = P LATFORM_VMOVE;750 platformtype2 = P LATFORM_DISAPPEAR;749 platformtype1 = PlatformType::VMOVE; 750 platformtype2 = PlatformType::DISAPPEAR; 751 751 break; 752 752 case 21: 753 platformtype1 = P LATFORM_VMOVE;754 platformtype2 = P LATFORM_VMOVE;753 platformtype1 = PlatformType::VMOVE; 754 platformtype2 = PlatformType::VMOVE; 755 755 break; 756 756 case 22: 757 platformtype1 = P LATFORM_VMOVE;758 platformtype2 = P LATFORM_VMOVE;757 platformtype1 = PlatformType::VMOVE; 758 platformtype2 = PlatformType::VMOVE; 759 759 break; 760 760 case 23: 761 platformtype1 = P LATFORM_VMOVE;762 platformtype2 = P LATFORM_TIMER;761 platformtype1 = PlatformType::VMOVE; 762 platformtype2 = PlatformType::TIMER; 763 763 break; 764 764 case 24: 765 platformtype1 = P LATFORM_TIMER;766 platformtype2 = P LATFORM_STATIC;765 platformtype1 = PlatformType::TIMER; 766 platformtype2 = PlatformType::STATIC; 767 767 break; 768 768 case 25: 769 platformtype1 = P LATFORM_TIMER;770 platformtype2 = P LATFORM_HMOVE;769 platformtype1 = PlatformType::TIMER; 770 platformtype2 = PlatformType::HMOVE; 771 771 break; 772 772 case 26: 773 platformtype1 = P LATFORM_TIMER;774 platformtype2 = P LATFORM_DISAPPEAR;773 platformtype1 = PlatformType::TIMER; 774 platformtype2 = PlatformType::DISAPPEAR; 775 775 break; 776 776 case 27: 777 platformtype1 = P LATFORM_TIMER;778 platformtype2 = P LATFORM_VMOVE;777 platformtype1 = PlatformType::TIMER; 778 platformtype2 = PlatformType::VMOVE; 779 779 break; 780 780 case 28: 781 platformtype1 = P LATFORM_TIMER;782 platformtype2 = P LATFORM_TIMER;781 platformtype1 = PlatformType::TIMER; 782 platformtype2 = PlatformType::TIMER; 783 783 break; 784 784 default: 785 platformtype1 = P LATFORM_TIMER;786 platformtype2 = P LATFORM_TIMER;785 platformtype1 = PlatformType::TIMER; 786 platformtype2 = PlatformType::TIMER; 787 787 break; 788 788 } … … 807 807 if (platformtype1 == platformtype2 && sectionNumber_ > 10 && rand()%2 == 0) 808 808 { 809 matrix[rand()%numI][rand()%numJ].type = P LATFORM_EMPTY;810 matrix[rand()%numI][rand()%numJ].type = P LATFORM_EMPTY;809 matrix[rand()%numI][rand()%numJ].type = PlatformType::EMPTY; 810 matrix[rand()%numI][rand()%numJ].type = PlatformType::EMPTY; 811 811 } 812 812 … … 816 816 if (rand()%2 == 0) 817 817 { 818 matrix[rand()%numI][rand()%numJ].type = P LATFORM_EMPTY;819 } 820 else 821 { 822 matrix[rand()%numI][rand()%numJ].type = P LATFORM_FAKE;818 matrix[rand()%numI][rand()%numJ].type = PlatformType::EMPTY; 819 } 820 else 821 { 822 matrix[rand()%numI][rand()%numJ].type = PlatformType::FAKE; 823 823 } 824 824 } … … 827 827 if (rand()%2 == 0) 828 828 { 829 matrix[rand()%numI][rand()%numJ].type = P LATFORM_EMPTY;830 } 831 else 832 { 833 matrix[rand()%numI][rand()%numJ].type = P LATFORM_FAKE;829 matrix[rand()%numI][rand()%numJ].type = PlatformType::EMPTY; 830 } 831 else 832 { 833 matrix[rand()%numI][rand()%numJ].type = PlatformType::FAKE; 834 834 } 835 835 if (rand()%2 == 0) 836 836 { 837 matrix[rand()%numI][rand()%numJ].type = P LATFORM_EMPTY;838 } 839 else 840 { 841 matrix[rand()%numI][rand()%numJ].type = P LATFORM_FAKE;837 matrix[rand()%numI][rand()%numJ].type = PlatformType::EMPTY; 838 } 839 else 840 { 841 matrix[rand()%numI][rand()%numJ].type = PlatformType::FAKE; 842 842 } 843 843 } … … 846 846 if (rand()%2 == 0) 847 847 { 848 matrix[rand()%numI][rand()%numJ].type = P LATFORM_EMPTY;849 } 850 else 851 { 852 matrix[rand()%numI][rand()%numJ].type = P LATFORM_FAKE;848 matrix[rand()%numI][rand()%numJ].type = PlatformType::EMPTY; 849 } 850 else 851 { 852 matrix[rand()%numI][rand()%numJ].type = PlatformType::FAKE; 853 853 } 854 854 if (rand()%2 == 0) 855 855 { 856 matrix[rand()%numI][rand()%numJ].type = P LATFORM_EMPTY;857 } 858 else 859 { 860 matrix[rand()%numI][rand()%numJ].type = P LATFORM_FAKE;856 matrix[rand()%numI][rand()%numJ].type = PlatformType::EMPTY; 857 } 858 else 859 { 860 matrix[rand()%numI][rand()%numJ].type = PlatformType::FAKE; 861 861 } 862 862 if (rand()%2 == 0) 863 863 { 864 matrix[rand()%numI][rand()%numJ].type = P LATFORM_EMPTY;865 } 866 else 867 { 868 matrix[rand()%numI][rand()%numJ].type = P LATFORM_FAKE;864 matrix[rand()%numI][rand()%numJ].type = PlatformType::EMPTY; 865 } 866 else 867 { 868 matrix[rand()%numI][rand()%numJ].type = PlatformType::FAKE; 869 869 } 870 870 } … … 889 889 switch(matrix[i][j].type) 890 890 { 891 case P LATFORM_EMPTY:891 case PlatformType::EMPTY: 892 892 matrix[i][j].done = true; 893 893 break; 894 case P LATFORM_STATIC:894 case PlatformType::STATIC: 895 895 xPosition = randomXPosition(numJ, j); 896 896 zPosition = sectionBegin + i*sectionLength/numI; … … 898 898 matrix[i][j].done = true; 899 899 break; 900 case P LATFORM_FAKE:900 case PlatformType::FAKE: 901 901 xPosition = randomXPosition(numJ, j); 902 902 zPosition = sectionBegin + i*sectionLength/numI; … … 904 904 matrix[i][j].done = true; 905 905 break; 906 case P LATFORM_TIMER:906 case PlatformType::TIMER: 907 907 xPosition = randomXPosition(numJ, j); 908 908 zPosition = sectionBegin + i*sectionLength/numI; … … 910 910 matrix[i][j].done = true; 911 911 break; 912 case P LATFORM_DISAPPEAR:912 case PlatformType::DISAPPEAR: 913 913 xPosition = randomXPosition(numJ, j); 914 914 zPosition = sectionBegin + i*sectionLength/numI; … … 916 916 matrix[i][j].done = true; 917 917 break; 918 case P LATFORM_HMOVE:918 case PlatformType::HMOVE: 919 919 xVelocity = randomSpeed(); 920 if (j <= numJ-3 && matrix[i][j+1].type == P LATFORM_HMOVE && matrix[i][j+2].type == PLATFORM_HMOVE && rand()%2 == 0)920 if (j <= numJ-3 && matrix[i][j+1].type == PlatformType::HMOVE && matrix[i][j+2].type == PlatformType::HMOVE && rand()%2 == 0) 921 921 { 922 922 leftBoundary = randomXPositionLeft(numJ, j); … … 929 929 matrix[i][j+2].done = true; 930 930 } 931 else if (j <= numJ-2 && matrix[i][j+1].type == P LATFORM_HMOVE && rand()%2 == 0)931 else if (j <= numJ-2 && matrix[i][j+1].type == PlatformType::HMOVE && rand()%2 == 0) 932 932 { 933 933 leftBoundary = randomXPositionLeft(numJ, j); … … 949 949 } 950 950 break; 951 case P LATFORM_VMOVE:951 case PlatformType::VMOVE: 952 952 zVelocity = randomSpeed(); 953 if (i <= numI-3 && matrix[i+1][j].type == P LATFORM_VMOVE && matrix[i+2][j].type == PLATFORM_VMOVE && rand()%2 == 0)953 if (i <= numI-3 && matrix[i+1][j].type == PlatformType::VMOVE && matrix[i+2][j].type == PlatformType::VMOVE && rand()%2 == 0) 954 954 { 955 955 lowerBoundary = randomZPositionLower(numI, i, sectionBegin, sectionEnd); … … 962 962 matrix[i+2][j].done = true; 963 963 } 964 else if (i <= numI-2 && matrix[i+1][j].type == P LATFORM_VMOVE && rand()%2 == 0)964 else if (i <= numI-2 && matrix[i+1][j].type == PlatformType::VMOVE && rand()%2 == 0) 965 965 { 966 966 lowerBoundary = randomZPositionLower(numI, i, sectionBegin, sectionEnd); … … 1000 1000 switch (itemType) 1001 1001 { 1002 case I TEM_ROCKET:1002 case ItemType::ROCKET: 1003 1003 addRocket(0.0, randomPosition(sectionBegin, sectionBegin + sectionLength), -fieldWidth/2, fieldWidth/2, 0.0, 0.0, randomSpeed(), 0.0); 1004 1004 break; 1005 case I TEM_PROPELLER:1005 case ItemType::PROPELLER: 1006 1006 addPropeller(0.0, randomPosition(sectionBegin, sectionBegin + sectionLength), -fieldWidth/2, fieldWidth/2, 0.0, 0.0, randomSpeed(), 0.0); 1007 1007 break; 1008 case I TEM_BOOTS:1008 case ItemType::BOOTS: 1009 1009 addBoots(0.0, randomPosition(sectionBegin, sectionBegin + sectionLength), -fieldWidth/2, fieldWidth/2, 0.0, 0.0, randomSpeed(), 0.0); 1010 1010 break; 1011 case I TEM_SHIELD:1011 case ItemType::SHIELD: 1012 1012 addShield(0.0, randomPosition(sectionBegin, sectionBegin + sectionLength), -fieldWidth/2, fieldWidth/2, 0.0, 0.0, randomSpeed(), 0.0); 1013 1013 break; … … 1020 1020 switch (itemType) 1021 1021 { 1022 case I TEM_ROCKET:1022 case ItemType::ROCKET: 1023 1023 addRocket(randomPosition(-fieldWidth/2, fieldWidth/2), sectionBegin + sectionLength/2, 0.0, 0.0, sectionBegin, sectionEnd, 0.0, randomSpeed()); 1024 1024 break; 1025 case I TEM_PROPELLER:1025 case ItemType::PROPELLER: 1026 1026 addPropeller(randomPosition(-fieldWidth/2, fieldWidth/2), sectionBegin + sectionLength/2, 0.0, 0.0, sectionBegin, sectionEnd, 0.0, randomSpeed()); 1027 1027 break; 1028 case I TEM_BOOTS:1028 case ItemType::BOOTS: 1029 1029 addBoots(randomPosition(-fieldWidth/2, fieldWidth/2), sectionBegin + sectionLength/2, 0.0, 0.0, sectionBegin, sectionEnd, 0.0, randomSpeed()); 1030 1030 break; 1031 case I TEM_SHIELD:1031 case ItemType::SHIELD: 1032 1032 addShield(randomPosition(-fieldWidth/2, fieldWidth/2), sectionBegin + sectionLength/2, 0.0, 0.0, sectionBegin, sectionEnd, 0.0, randomSpeed()); 1033 1033 break; … … 1045 1045 switch (itemType) 1046 1046 { 1047 case I TEM_SPRING:1047 case ItemType::SPRING: 1048 1048 addSpring(itemPlatform); 1049 1049 break; 1050 case I TEM_ROCKET:1050 case ItemType::ROCKET: 1051 1051 addRocket(itemPlatform); 1052 1052 break; 1053 case I TEM_PROPELLER:1053 case ItemType::PROPELLER: 1054 1054 addPropeller(itemPlatform); 1055 1055 break; 1056 case I TEM_BOOTS:1056 case ItemType::BOOTS: 1057 1057 addBoots(itemPlatform); 1058 1058 break; 1059 case I TEM_SHIELD:1059 case ItemType::SHIELD: 1060 1060 addShield(itemPlatform); 1061 1061 break; -
code/branches/cpp11_v3/src/modules/mini4dgame/Mini4Dgame.h
r11054 r11068 41 41 namespace orxonox 42 42 { 43 44 namespace mini4DgamePlayerColor45 {46 enum color47 {48 none,49 red,50 blue,51 green52 };53 }54 55 43 /** 56 44 @brief -
code/branches/cpp11_v3/src/modules/mini4dgame/Mini4DgameAI.cc
r11058 r11068 104 104 for(int k=0;k<4;k++){ 105 105 for(int l=0;l<4;l++){ 106 if (this->board_[i][j][k][l]== mini4DgamePlayerColor::none)106 if (this->board_[i][j][k][l]==Mini4DgamePlayerColor::none) 107 107 possibleMoves.push_back(Vector4(i,j,k,l)); 108 108 } -
code/branches/cpp11_v3/src/modules/mini4dgame/Mini4DgameAI.h
r11058 r11068 83 83 std::list<Vector4> getPossibleMoves(); 84 84 void copyBoard(); 85 mini4DgamePlayerColor::color board_[4][4][4][4];85 Mini4DgamePlayerColor board_[4][4][4][4]; 86 86 }; 87 87 } -
code/branches/cpp11_v3/src/modules/mini4dgame/Mini4DgameBoard.cc
r11057 r11068 61 61 for(int k=0;k<4;k++){ 62 62 for(int l=0;l<4;l++){ 63 this->board[i][j][k][l]= mini4DgamePlayerColor::none;63 this->board[i][j][k][l]=Mini4DgamePlayerColor::none; 64 64 this->blinkingBillboards[i][j][k][l] = nullptr; 65 65 } … … 79 79 return (move.x<4 && move.y<4 && move.z<4 && move.w<4 80 80 && move.x>=0 && move.y>=0 && move.z>=0 && move.w>=0 81 && this->board[move.x][move.y][move.z][move.w] == mini4DgamePlayerColor::none);81 && this->board[move.x][move.y][move.z][move.w] == Mini4DgamePlayerColor::none); 82 82 } 83 83 … … 86 86 const Mini4DgamePosition& move = moves.back(); 87 87 moves.pop_back(); 88 this->board[move.x][move.y][move.z][move.w] = mini4DgamePlayerColor::none;88 this->board[move.x][move.y][move.z][move.w] = Mini4DgamePlayerColor::none; 89 89 this->blinkingBillboards[move.x][move.y][move.z][move.w]->destroy(); 90 90 this->blinkingBillboards[move.x][move.y][move.z][move.w] = nullptr; … … 115 115 116 116 moves.push_back(move); 117 mini4DgamePlayerColor::color playerColor = mini4DgamePlayerColor::none;117 Mini4DgamePlayerColor playerColor = Mini4DgamePlayerColor::none; 118 118 if(player_toggle_){ 119 playerColor = mini4DgamePlayerColor::blue;119 playerColor = Mini4DgamePlayerColor::blue; 120 120 this->player_toggle_ = false; 121 121 }else{ 122 playerColor = mini4DgamePlayerColor::green;122 playerColor = Mini4DgamePlayerColor::green; 123 123 this->player_toggle_ = true; 124 124 } 125 125 126 this->board[move.x][move.y][move.z][move.w] = (mini4DgamePlayerColor::color)playerColor;126 this->board[move.x][move.y][move.z][move.w] = playerColor; 127 127 128 128 BlinkingBillboard* bb = new BlinkingBillboard(this->getContext()); … … 146 146 147 147 switch(playerColor){ 148 case mini4DgamePlayerColor::red:148 case Mini4DgamePlayerColor::red: 149 149 bb->setColour(ColourValue(1,0,0)); break; 150 case mini4DgamePlayerColor::green:150 case Mini4DgamePlayerColor::green: 151 151 bb->setColour(ColourValue(0,1,0)); break; 152 case mini4DgamePlayerColor::blue:152 case Mini4DgamePlayerColor::blue: 153 153 bb->setColour(ColourValue(0,0,1)); break; 154 154 default: break; … … 160 160 161 161 Mini4DgameWinner winner = this->getWinner(); 162 if(winner.color_ != mini4DgamePlayerColor::none)162 if(winner.color_ != Mini4DgamePlayerColor::none) 163 163 { 164 164 orxout(user_status) << "Mini4Dgame: win!!!!!!!" << endl; … … 188 188 { 189 189 Mini4DgameWinner winner; 190 winner.color_ = mini4DgamePlayerColor::none;190 winner.color_ = Mini4DgamePlayerColor::none; 191 191 192 192 //check diagonals rows-columns-height-numbers 193 193 for(int i=1; i<4; i++) 194 194 { 195 if(this->board[i][i][i][i]== mini4DgamePlayerColor::none || this->board[0][0][0][0] != this->board[i][i][i][i])195 if(this->board[i][i][i][i]==Mini4DgamePlayerColor::none || this->board[0][0][0][0] != this->board[i][i][i][i]) 196 196 break; 197 197 if(i==3) … … 209 209 for(int i=1; i<4; i++) 210 210 { 211 if(this->board[3-i][i][i][i]== mini4DgamePlayerColor::none || this->board[3][0][0][0] != this->board[3-i][i][i][i])211 if(this->board[3-i][i][i][i]==Mini4DgamePlayerColor::none || this->board[3][0][0][0] != this->board[3-i][i][i][i]) 212 212 break; 213 213 if(i==3) … … 225 225 for(int i=1; i<4; i++) 226 226 { 227 if(this->board[i][3-i][i][i]== mini4DgamePlayerColor::none || this->board[0][3][0][0] != this->board[i][3-i][i][i])227 if(this->board[i][3-i][i][i]==Mini4DgamePlayerColor::none || this->board[0][3][0][0] != this->board[i][3-i][i][i]) 228 228 break; 229 229 if(i==3) … … 241 241 for(int i=1; i<4; i++) 242 242 { 243 if(this->board[i][i][3-i][i]== mini4DgamePlayerColor::none || this->board[0][0][3][0] != this->board[i][i][3-i][i])243 if(this->board[i][i][3-i][i]==Mini4DgamePlayerColor::none || this->board[0][0][3][0] != this->board[i][i][3-i][i]) 244 244 break; 245 245 if(i==3) … … 257 257 for(int i=1; i<4; i++) 258 258 { 259 if(this->board[i][i][i][3-i]== mini4DgamePlayerColor::none || this->board[0][0][0][3] != this->board[i][i][i][3-i])259 if(this->board[i][i][i][3-i]==Mini4DgamePlayerColor::none || this->board[0][0][0][3] != this->board[i][i][i][3-i]) 260 260 break; 261 261 if(i==3) … … 273 273 for(int i=1; i<4; i++) 274 274 { 275 if(this->board[3-i][3-i][i][i]== mini4DgamePlayerColor::none || this->board[3][3][0][0] != this->board[3-i][3-i][i][i])275 if(this->board[3-i][3-i][i][i]==Mini4DgamePlayerColor::none || this->board[3][3][0][0] != this->board[3-i][3-i][i][i]) 276 276 break; 277 277 if(i==3) … … 289 289 for(int i=1; i<4; i++) 290 290 { 291 if(this->board[3-i][i][3-i][i]== mini4DgamePlayerColor::none || this->board[3][0][3][0] != this->board[3-i][i][3-i][i])291 if(this->board[3-i][i][3-i][i]==Mini4DgamePlayerColor::none || this->board[3][0][3][0] != this->board[3-i][i][3-i][i]) 292 292 break; 293 293 if(i==3) … … 305 305 for(int i=1; i<4; i++) 306 306 { 307 if(this->board[3-i][i][i][3-i]== mini4DgamePlayerColor::none || this->board[3][0][0][3] != this->board[3-i][i][i][3-i])307 if(this->board[3-i][i][i][3-i]==Mini4DgamePlayerColor::none || this->board[3][0][0][3] != this->board[3-i][i][i][3-i]) 308 308 break; 309 309 if(i==3) … … 325 325 for(int i=1; i<4; i++) 326 326 { 327 if(this->board[i][i][i][l]== mini4DgamePlayerColor::none || this->board[0][0][0][l] != this->board[i][i][i][l])327 if(this->board[i][i][i][l]==Mini4DgamePlayerColor::none || this->board[0][0][0][l] != this->board[i][i][i][l]) 328 328 break; 329 329 if(i==3) … … 341 341 for(int i=1; i<4; i++) 342 342 { 343 if(this->board[3-i][i][i][l]== mini4DgamePlayerColor::none || this->board[3][0][0][l] != this->board[3-i][i][i][l])343 if(this->board[3-i][i][i][l]==Mini4DgamePlayerColor::none || this->board[3][0][0][l] != this->board[3-i][i][i][l]) 344 344 break; 345 345 if(i==3) … … 357 357 for(int i=1; i<4; i++) 358 358 { 359 if(this->board[i][3-i][i][l]== mini4DgamePlayerColor::none || this->board[0][3][0][l] != this->board[i][3-i][i][l])359 if(this->board[i][3-i][i][l]==Mini4DgamePlayerColor::none || this->board[0][3][0][l] != this->board[i][3-i][i][l]) 360 360 break; 361 361 if(i==3) … … 373 373 for(int i=1; i<4; i++) 374 374 { 375 if(this->board[i][i][3-i][l]== mini4DgamePlayerColor::none || this->board[0][0][3][l] != this->board[i][i][3-i][l])375 if(this->board[i][i][3-i][l]==Mini4DgamePlayerColor::none || this->board[0][0][3][l] != this->board[i][i][3-i][l]) 376 376 break; 377 377 if(i==3) … … 394 394 for(int i=1; i<4; i++) 395 395 { 396 if(this->board[i][i][l][i]== mini4DgamePlayerColor::none || this->board[0][0][l][0] != this->board[i][i][l][i])396 if(this->board[i][i][l][i]==Mini4DgamePlayerColor::none || this->board[0][0][l][0] != this->board[i][i][l][i]) 397 397 break; 398 398 if(i==3) … … 410 410 for(int i=1; i<4; i++) 411 411 { 412 if(this->board[3-i][i][l][i]== mini4DgamePlayerColor::none || this->board[3][0][l][0] != this->board[3-i][i][l][i])412 if(this->board[3-i][i][l][i]==Mini4DgamePlayerColor::none || this->board[3][0][l][0] != this->board[3-i][i][l][i]) 413 413 break; 414 414 if(i==3) … … 426 426 for(int i=1; i<4; i++) 427 427 { 428 if(this->board[i][3-i][l][i]== mini4DgamePlayerColor::none || this->board[0][3][l][0] != this->board[i][3-i][l][i])428 if(this->board[i][3-i][l][i]==Mini4DgamePlayerColor::none || this->board[0][3][l][0] != this->board[i][3-i][l][i]) 429 429 break; 430 430 if(i==3) … … 442 442 for(int i=1; i<4; i++) 443 443 { 444 if(this->board[i][i][l][3-i]== mini4DgamePlayerColor::none || this->board[0][0][l][3] != this->board[i][i][l][3-i])444 if(this->board[i][i][l][3-i]==Mini4DgamePlayerColor::none || this->board[0][0][l][3] != this->board[i][i][l][3-i]) 445 445 break; 446 446 if(i==3) … … 463 463 for(int i=1; i<4; i++) 464 464 { 465 if(this->board[i][l][i][i]== mini4DgamePlayerColor::none || this->board[0][l][0][0] != this->board[i][l][i][i])465 if(this->board[i][l][i][i]==Mini4DgamePlayerColor::none || this->board[0][l][0][0] != this->board[i][l][i][i]) 466 466 break; 467 467 if(i==3) … … 479 479 for(int i=1; i<4; i++) 480 480 { 481 if(this->board[3-i][l][i][i]== mini4DgamePlayerColor::none || this->board[3][l][0][0] != this->board[3-i][l][i][i])481 if(this->board[3-i][l][i][i]==Mini4DgamePlayerColor::none || this->board[3][l][0][0] != this->board[3-i][l][i][i]) 482 482 break; 483 483 if(i==3) … … 495 495 for(int i=1; i<4; i++) 496 496 { 497 if(this->board[i][l][3-i][i]== mini4DgamePlayerColor::none || this->board[0][l][3][0] != this->board[i][l][3-i][i])497 if(this->board[i][l][3-i][i]==Mini4DgamePlayerColor::none || this->board[0][l][3][0] != this->board[i][l][3-i][i]) 498 498 break; 499 499 if(i==3) … … 511 511 for(int i=1; i<4; i++) 512 512 { 513 if(this->board[i][l][i][3-i]== mini4DgamePlayerColor::none || this->board[0][l][0][3] != this->board[i][l][i][3-i])513 if(this->board[i][l][i][3-i]==Mini4DgamePlayerColor::none || this->board[0][l][0][3] != this->board[i][l][i][3-i]) 514 514 break; 515 515 if(i==3) … … 532 532 for(int i=1; i<4; i++) 533 533 { 534 if(this->board[l][i][i][i]== mini4DgamePlayerColor::none || this->board[l][0][0][0] != this->board[l][i][i][i])534 if(this->board[l][i][i][i]==Mini4DgamePlayerColor::none || this->board[l][0][0][0] != this->board[l][i][i][i]) 535 535 break; 536 536 if(i==3) … … 548 548 for(int i=1; i<4; i++) 549 549 { 550 if(this->board[l][3-i][i][i]== mini4DgamePlayerColor::none || this->board[l][3][0][0] != this->board[l][3-i][i][i])550 if(this->board[l][3-i][i][i]==Mini4DgamePlayerColor::none || this->board[l][3][0][0] != this->board[l][3-i][i][i]) 551 551 break; 552 552 if(i==3) … … 564 564 for(int i=1; i<4; i++) 565 565 { 566 if(this->board[l][i][3-i][i]== mini4DgamePlayerColor::none || this->board[l][0][3][0] != this->board[l][i][3-i][i])566 if(this->board[l][i][3-i][i]==Mini4DgamePlayerColor::none || this->board[l][0][3][0] != this->board[l][i][3-i][i]) 567 567 break; 568 568 if(i==3) … … 580 580 for(int i=1; i<4; i++) 581 581 { 582 if(this->board[l][i][i][3-i]== mini4DgamePlayerColor::none || this->board[l][0][0][3] != this->board[l][i][i][3-i])582 if(this->board[l][i][i][3-i]==Mini4DgamePlayerColor::none || this->board[l][0][0][3] != this->board[l][i][i][3-i]) 583 583 break; 584 584 if(i==3) … … 602 602 for(int i=1; i<4; i++) 603 603 { 604 if(this->board[i][i][k][l]== mini4DgamePlayerColor::none || this->board[0][0][k][l] != this->board[i][i][k][l])604 if(this->board[i][i][k][l]==Mini4DgamePlayerColor::none || this->board[0][0][k][l] != this->board[i][i][k][l]) 605 605 break; 606 606 if(i==3) … … 618 618 for(int i=1; i<4; i++) 619 619 { 620 if(this->board[3-i][i][k][l]== mini4DgamePlayerColor::none || this->board[3][0][k][l] != this->board[3-i][i][k][l])620 if(this->board[3-i][i][k][l]==Mini4DgamePlayerColor::none || this->board[3][0][k][l] != this->board[3-i][i][k][l]) 621 621 break; 622 622 if(i==3) … … 635 635 for(int i=1; i<4; i++) 636 636 { 637 if(this->board[i][k][i][l]== mini4DgamePlayerColor::none || this->board[0][k][0][l] != this->board[i][k][i][l])637 if(this->board[i][k][i][l]==Mini4DgamePlayerColor::none || this->board[0][k][0][l] != this->board[i][k][i][l]) 638 638 break; 639 639 if(i==3) … … 651 651 for(int i=1; i<4; i++) 652 652 { 653 if(this->board[3-i][k][i][l]== mini4DgamePlayerColor::none || this->board[3][k][0][l] != this->board[3-i][k][i][l])653 if(this->board[3-i][k][i][l]==Mini4DgamePlayerColor::none || this->board[3][k][0][l] != this->board[3-i][k][i][l]) 654 654 break; 655 655 if(i==3) … … 668 668 for(int i=1; i<4; i++) 669 669 { 670 if(this->board[i][k][l][i]== mini4DgamePlayerColor::none || this->board[0][k][l][0] != this->board[i][k][l][i])670 if(this->board[i][k][l][i]==Mini4DgamePlayerColor::none || this->board[0][k][l][0] != this->board[i][k][l][i]) 671 671 break; 672 672 if(i==3) … … 684 684 for(int i=1; i<4; i++) 685 685 { 686 if(this->board[3-i][k][l][i]== mini4DgamePlayerColor::none || this->board[3][k][l][0] != this->board[3-i][k][l][i])686 if(this->board[3-i][k][l][i]==Mini4DgamePlayerColor::none || this->board[3][k][l][0] != this->board[3-i][k][l][i]) 687 687 break; 688 688 if(i==3) … … 701 701 for(int i=1; i<4; i++) 702 702 { 703 if(this->board[k][i][i][l]== mini4DgamePlayerColor::none || this->board[k][0][0][l] != this->board[k][i][i][l])703 if(this->board[k][i][i][l]==Mini4DgamePlayerColor::none || this->board[k][0][0][l] != this->board[k][i][i][l]) 704 704 break; 705 705 if(i==3) … … 717 717 for(int i=1; i<4; i++) 718 718 { 719 if(this->board[k][3-i][i][l]== mini4DgamePlayerColor::none || this->board[k][3][0][l] != this->board[k][3-i][i][l])719 if(this->board[k][3-i][i][l]==Mini4DgamePlayerColor::none || this->board[k][3][0][l] != this->board[k][3-i][i][l]) 720 720 break; 721 721 if(i==3) … … 734 734 for(int i=1; i<4; i++) 735 735 { 736 if(this->board[k][i][l][i]== mini4DgamePlayerColor::none || this->board[k][0][l][0] != this->board[k][i][l][i])736 if(this->board[k][i][l][i]==Mini4DgamePlayerColor::none || this->board[k][0][l][0] != this->board[k][i][l][i]) 737 737 break; 738 738 if(i==3) … … 750 750 for(int i=1; i<4; i++) 751 751 { 752 if(this->board[k][3-i][l][i]== mini4DgamePlayerColor::none || this->board[k][3][l][0] != this->board[k][3-i][l][i])752 if(this->board[k][3-i][l][i]==Mini4DgamePlayerColor::none || this->board[k][3][l][0] != this->board[k][3-i][l][i]) 753 753 break; 754 754 if(i==3) … … 767 767 for(int i=1; i<4; i++) 768 768 { 769 if(this->board[k][l][i][i]== mini4DgamePlayerColor::none || this->board[k][l][0][0] != this->board[k][l][i][i])769 if(this->board[k][l][i][i]==Mini4DgamePlayerColor::none || this->board[k][l][0][0] != this->board[k][l][i][i]) 770 770 break; 771 771 if(i==3) … … 783 783 for(int i=1; i<4; i++) 784 784 { 785 if(this->board[k][l][3-i][i]== mini4DgamePlayerColor::none || this->board[k][l][3][0] != this->board[k][l][3-i][i])785 if(this->board[k][l][3-i][i]==Mini4DgamePlayerColor::none || this->board[k][l][3][0] != this->board[k][l][3-i][i]) 786 786 break; 787 787 if(i==3) … … 804 804 for(int k=0;k<4;k++){ 805 805 for(int l=0;l<4;l++){ 806 if(this->board[0][j][k][l]!= mini4DgamePlayerColor::none806 if(this->board[0][j][k][l]!= Mini4DgamePlayerColor::none 807 807 && this->board[0][j][k][l]==this->board[1][j][k][l] 808 808 && this->board[1][j][k][l]==this->board[2][j][k][l] … … 826 826 for(int k=0;k<4;k++){ 827 827 for(int l=0;l<4;l++){ 828 if(this->board[i][0][k][l]!= mini4DgamePlayerColor::none828 if(this->board[i][0][k][l]!= Mini4DgamePlayerColor::none 829 829 && this->board[i][0][k][l]==this->board[i][1][k][l] 830 830 && this->board[i][1][k][l]==this->board[i][2][k][l] … … 848 848 for(int j=0;j<4;j++){ 849 849 for(int l=0;l<4;l++){ 850 if(this->board[i][j][0][l]!= mini4DgamePlayerColor::none850 if(this->board[i][j][0][l]!= Mini4DgamePlayerColor::none 851 851 && this->board[i][j][0][l]==this->board[i][j][1][l] 852 852 && this->board[i][j][1][l]==this->board[i][j][2][l] … … 870 870 for(int j=0;j<4;j++){ 871 871 for(int k=0;k<4;k++){ 872 if(this->board[i][j][k][0]!= mini4DgamePlayerColor::none872 if(this->board[i][j][k][0]!= Mini4DgamePlayerColor::none 873 873 && this->board[i][j][k][0]==this->board[i][j][k][1] 874 874 && this->board[i][j][k][1]==this->board[i][j][k][2] -
code/branches/cpp11_v3/src/modules/mini4dgame/Mini4DgameBoard.h
r11057 r11068 42 42 namespace orxonox 43 43 { 44 enum class Mini4DgamePlayerColor 45 { 46 none, 47 red, 48 blue, 49 green 50 }; 44 51 45 52 struct Mini4DgamePosition … … 58 65 int winningHeight[4]; 59 66 int winningNumber[4]; 60 intcolor_;67 Mini4DgamePlayerColor color_; 61 68 }; 62 69 … … 86 93 bool player_toggle_; 87 94 BlinkingBillboard* blinkingBillboards[4][4][4][4]; 88 intboard[4][4][4][4]; //!< The logical board where the game takes place. board[row][column][height][number]95 Mini4DgamePlayerColor board[4][4][4][4]; //!< The logical board where the game takes place. board[row][column][height][number] 89 96 }; 90 97 } -
code/branches/cpp11_v3/src/modules/notifications/NotificationDispatcher.cc
r11054 r11068 113 113 // TODO: Needed? 114 114 const std::string message = this->createNotificationMessage(); 115 NotificationListener::sendNotification(message, this->getSender(), notificationMessageType::info, notificationSendMode::local);115 NotificationListener::sendNotification(message, this->getSender(), NotificationMessageType::info, NotificationSendMode::local); 116 116 117 117 // Broadcast … … 144 144 const std::string message = this->createNotificationMessage(); 145 145 // TODO: Make the type configurable. 146 NotificationListener::sendNotification(message, this->getSender(), notificationMessageType::info, notificationSendMode::network, clientId);146 NotificationListener::sendNotification(message, this->getSender(), NotificationMessageType::info, NotificationSendMode::network, clientId); 147 147 } 148 148 else if(GameMode::isServer()) -
code/branches/cpp11_v3/src/modules/notifications/NotificationManager.cc
r11054 r11068 106 106 Returns true if successful. 107 107 */ 108 bool NotificationManager::registerNotification(const std::string& message, const std::string& sender, notificationMessageType::Value type)108 bool NotificationManager::registerNotification(const std::string& message, const std::string& sender, NotificationMessageType type) 109 109 { 110 110 // TODO: Do something with the type. … … 124 124 Returns true if the command was successfully executed. 125 125 */ 126 bool NotificationManager::executeCommand( notificationCommand::Valuecommand, const std::string& sender)126 bool NotificationManager::executeCommand(NotificationCommand command, const std::string& sender) 127 127 { 128 128 bool commandExecuted = false; 129 if(command == notificationCommand::clear)129 if(command == NotificationCommand::clear) 130 130 { 131 131 if(this->commandClear(sender)) … … 437 437 438 438 */ 439 Notification::Notification(const std::string& message, const std::string& sender, notificationMessageType::Value type)439 Notification::Notification(const std::string& message, const std::string& sender, NotificationMessageType type) 440 440 { 441 441 this->initialize(); -
code/branches/cpp11_v3/src/modules/notifications/NotificationManager.h
r11054 r11068 62 62 { 63 63 public: 64 Notification(const std::string& message, const std::string& sender, notificationMessageType::Value type);64 Notification(const std::string& message, const std::string& sender, NotificationMessageType type); 65 65 virtual ~Notification(); 66 66 … … 89 89 @return Returns an enum with the type of the Notification. 90 90 */ 91 inline notificationMessageType::Value getType(void) const91 inline NotificationMessageType getType(void) const 92 92 { return this->type_; } 93 93 … … 95 95 std::string message_; //!< The Notification message. 96 96 std::string sender_; //!< The sender of the notification. 97 notificationMessageType::Value type_; //!< The type of the notification.97 NotificationMessageType type_; //!< The type of the notification. 98 98 99 99 void initialize(void); //!< Registers the object and sets some default values. … … 128 128 static NotificationManager& getInstance() { return Singleton<NotificationManager>::getInstance(); } // tolua_export 129 129 130 virtual bool registerNotification(const std::string& message, const std::string& sender, notificationMessageType::Value type) override;131 virtual bool executeCommand( notificationCommand::Valuecommand, const std::string& sender) override;130 virtual bool registerNotification(const std::string& message, const std::string& sender, NotificationMessageType type) override; 131 virtual bool executeCommand(NotificationCommand command, const std::string& sender) override; 132 132 133 133 bool registerNotification(Notification* notification); // Registers a Notification within the NotificationManager. -
code/branches/cpp11_v3/src/modules/objects/ForceField.cc
r11054 r11068 67 67 this->setMassDiameter(0); //! We allow point-masses 68 68 this->setLength(2000); 69 this->mode_ = forceFieldMode::tube;69 this->mode_ = ForceFieldMode::tube; 70 70 71 71 this->registerVariables(); … … 115 115 void ForceField::tick(float dt) 116 116 { 117 if(this->mode_ == forceFieldMode::tube)117 if(this->mode_ == ForceFieldMode::tube) 118 118 { 119 119 // Iterate over all objects that could possibly be affected by the ForceField. … … 143 143 } 144 144 } 145 else if(this->mode_ == forceFieldMode::sphere)145 else if(this->mode_ == ForceFieldMode::sphere) 146 146 { 147 147 // Iterate over all objects that could possibly be affected by the ForceField. … … 159 159 } 160 160 } 161 else if(this->mode_ == forceFieldMode::invertedSphere)161 else if(this->mode_ == ForceFieldMode::invertedSphere) 162 162 { 163 163 // Iterate over all objects that could possibly be affected by the ForceField. … … 176 176 } 177 177 } 178 else if(this->mode_ == forceFieldMode::newtonianGravity)178 else if(this->mode_ == ForceFieldMode::newtonianGravity) 179 179 { 180 180 // Iterate over all objects that could possibly be affected by the ForceField. … … 201 201 } 202 202 } 203 else if(this->mode_ == forceFieldMode::homogen)203 else if(this->mode_ == ForceFieldMode::homogen) 204 204 { 205 205 // Iterate over all objects that could possibly be affected by the ForceField. … … 227 227 { 228 228 if(mode == ForceField::modeTube_s) 229 this->mode_ = forceFieldMode::tube;229 this->mode_ = ForceFieldMode::tube; 230 230 else if(mode == ForceField::modeSphere_s) 231 this->mode_ = forceFieldMode::sphere;231 this->mode_ = ForceFieldMode::sphere; 232 232 else if(mode == ForceField::modeInvertedSphere_s) 233 this->mode_ = forceFieldMode::invertedSphere;233 this->mode_ = ForceFieldMode::invertedSphere; 234 234 else if(mode == ForceField::modeNewtonianGravity_s) 235 this->mode_ = forceFieldMode::newtonianGravity;235 this->mode_ = ForceFieldMode::newtonianGravity; 236 236 237 237 else if(mode == ForceField::modeHomogen_s) 238 this->mode_ = forceFieldMode::homogen;238 this->mode_ = ForceFieldMode::homogen; 239 239 240 240 else 241 241 { 242 242 orxout(internal_warning) << "Wrong mode '" << mode << "' in ForceField. Setting to 'tube'." << endl; 243 this->mode_ = forceFieldMode::tube;243 this->mode_ = ForceFieldMode::tube; 244 244 } 245 245 } … … 255 255 switch(this->mode_) 256 256 { 257 case forceFieldMode::tube:257 case ForceFieldMode::tube: 258 258 return ForceField::modeTube_s; 259 case forceFieldMode::sphere:259 case ForceFieldMode::sphere: 260 260 return ForceField::modeSphere_s; 261 case forceFieldMode::invertedSphere:261 case ForceFieldMode::invertedSphere: 262 262 return ForceField::modeInvertedSphere_s; 263 case forceFieldMode::newtonianGravity:263 case ForceFieldMode::newtonianGravity: 264 264 return ForceField::modeNewtonianGravity_s; 265 265 266 case forceFieldMode::homogen:266 case ForceFieldMode::homogen: 267 267 return ForceField::modeHomogen_s; 268 268 -
code/branches/cpp11_v3/src/modules/objects/ForceField.h
r11054 r11068 52 52 @ingroup Objects 53 53 */ 54 namespace forceFieldMode 55 { 56 enum Value { 57 tube, //!< The ForceField has a tube shape. 58 sphere, //!< The ForceField has a spherical shape. 59 invertedSphere, //!< The ForceField has a spherical shape but "inverted" behavior. 60 newtonianGravity, //!< The ForceField imitates Newtonian gravitation for use in stellar bodies. 61 homogen //!< Local homogenous Force field with changeable direction for the Space Station 62 }; 63 } 54 enum class ForceFieldMode { 55 tube, //!< The ForceField has a tube shape. 56 sphere, //!< The ForceField has a spherical shape. 57 invertedSphere, //!< The ForceField has a spherical shape but "inverted" behavior. 58 newtonianGravity, //!< The ForceField imitates Newtonian gravitation for use in stellar bodies. 59 homogen //!< Local homogenous Force field with changeable direction for the Space Station 60 }; 64 61 65 62 /** … … 172 169 float massRadius_; //!< The radius of the stellar body for the Newtonian ForceField. 173 170 float halfLength_; //!< Half of the length of the ForceField. 174 intmode_; //!< The mode of the ForceField.171 ForceFieldMode mode_; //!< The mode of the ForceField. 175 172 176 173 //! Gravitational constant for Newtonian ForceFields. -
code/branches/cpp11_v3/src/modules/objects/Script.h
r11054 r11068 51 51 @brief The mode a specific @ref orxonox::Script "Script" is in. 52 52 */ 53 namespaceScriptMode53 enum class ScriptMode 54 54 { 55 enum Value 56 { 57 normal, //!< The @ref orxonox::Script "Scripts'" code is executed through the @ref orxonox::CommandExecutor "CommandExecutor". 58 lua //!< The @ref orxonox::Script "Scripts'" code is executed through lua. 59 }; 60 } 55 normal, //!< The @ref orxonox::Script "Scripts'" code is executed through the @ref orxonox::CommandExecutor "CommandExecutor". 56 lua //!< The @ref orxonox::Script "Scripts'" code is executed through lua. 57 }; 61 58 62 59 /** … … 178 175 179 176 std::string code_; //!< The code that is executed by this Script. 180 ScriptMode ::Valuemode_; //!< The mode the Script is in. Determines whether the code is executed the normal way or in lua.177 ScriptMode mode_; //!< The mode the Script is in. Determines whether the code is executed the normal way or in lua. 181 178 std::string modeStr_; //!< The mode the Script is in, as a string. Is used for networking purposes. 182 179 bool onLoad_; //!< Whether the Scripts code is executed upon loading (creation) of this Script. … … 193 190 @param mode The mode of the Script. 194 191 */ 195 inline void setMode(ScriptMode ::Valuemode)192 inline void setMode(ScriptMode mode) 196 193 { this->mode_ = mode; } 197 194 }; -
code/branches/cpp11_v3/src/modules/objects/Turret.cc
r10622 r11068 278 278 //slower the closer it is to the destination 279 279 Quaternion drot = Quaternion::nlerp(dt*this->rotationThrust_/20.f, Quaternion::IDENTITY, this->rotation_); 280 this->rotate(drot, WorldEntity:: World);280 this->rotate(drot, WorldEntity::TransformSpace::World); 281 281 this->rotation_ = Quaternion::IDENTITY; 282 282 } -
code/branches/cpp11_v3/src/modules/objects/triggers/CheckPoint.cc
r10624 r11068 56 56 57 57 this->setRadarObjectColour(ColourValue::Green); 58 this->setRadarObjectShape(RadarViewable:: Dot);58 this->setRadarObjectShape(RadarViewable::Shape::Dot); 59 59 this->setRadarVisibility(false); 60 60 -
code/branches/cpp11_v3/src/modules/objects/triggers/DistanceMultiTrigger.cc
r11054 r11068 58 58 59 59 this->distance_ = 100.0f; 60 this->setBeaconModeDirect( distanceMultiTriggerBeaconMode::off);60 this->setBeaconModeDirect(DistanceMultiTriggerBeaconMode::off); 61 61 this->targetName_ = ""; 62 62 this->beaconMask_.exclude(Class(BaseObject)); … … 136 136 ClassTreeMask targetMask = this->getTargetMask(); 137 137 // If we are in identify-mode another target mask has to be applies to find the DistanceTriggerBeacons. 138 if(this->beaconMode_ == distanceMultiTriggerBeaconMode::identify)138 if(this->beaconMode_ == DistanceMultiTriggerBeaconMode::identify) 139 139 targetMask = this->beaconMask_; 140 140 … … 145 145 146 146 // If the DistanceMultiTrigger is in identify-mode and the DistanceTriggerBeacon attached to the object has the wrong name we ignore it. 147 if(this->beaconMode_ == distanceMultiTriggerBeaconMode::identify)147 if(this->beaconMode_ == DistanceMultiTriggerBeaconMode::identify) 148 148 { 149 149 if(entity->getName() != this->targetName_) … … 155 155 156 156 // If the DistanceMultiTrigger is in exclude mode and the DistanceTriggerBeacon attached to the object has the right name, we ignore it. 157 if(this->beaconMode_ == distanceMultiTriggerBeaconMode::exclude)157 if(this->beaconMode_ == DistanceMultiTriggerBeaconMode::exclude) 158 158 { 159 159 … … 182 182 183 183 // Change the entity to the parent of the DistanceTriggerBeacon (if in identify-mode), which is the entity to which the beacon is attached. 184 if(this->beaconMode_ == distanceMultiTriggerBeaconMode::identify)184 if(this->beaconMode_ == DistanceMultiTriggerBeaconMode::identify) 185 185 entity = entity->getParent(); 186 186 … … 206 206 The mode as an enum. 207 207 */ 208 void DistanceMultiTrigger::setBeaconModeDirect( distanceMultiTriggerBeaconMode::Value mode)208 void DistanceMultiTrigger::setBeaconModeDirect(DistanceMultiTriggerBeaconMode mode) 209 209 { 210 210 this->beaconMode_ = mode; … … 221 221 switch(this->getBeaconModeDirect()) 222 222 { 223 case distanceMultiTriggerBeaconMode::off :223 case DistanceMultiTriggerBeaconMode::off : 224 224 return DistanceMultiTrigger::beaconModeOff_s; 225 case distanceMultiTriggerBeaconMode::identify:225 case DistanceMultiTriggerBeaconMode::identify: 226 226 return DistanceMultiTrigger::beaconModeIdentify_s; 227 case distanceMultiTriggerBeaconMode::exclude:227 case DistanceMultiTriggerBeaconMode::exclude: 228 228 return DistanceMultiTrigger::beaconModeExlcude_s; 229 229 default : … … 242 242 { 243 243 if(mode == DistanceMultiTrigger::beaconModeOff_s) 244 this->setBeaconModeDirect( distanceMultiTriggerBeaconMode::off);244 this->setBeaconModeDirect(DistanceMultiTriggerBeaconMode::off); 245 245 else if(mode == DistanceMultiTrigger::beaconModeIdentify_s) 246 this->setBeaconModeDirect( distanceMultiTriggerBeaconMode::identify);246 this->setBeaconModeDirect(DistanceMultiTriggerBeaconMode::identify); 247 247 else if(mode == DistanceMultiTrigger::beaconModeExlcude_s) 248 this->setBeaconModeDirect( distanceMultiTriggerBeaconMode::exclude);248 this->setBeaconModeDirect(DistanceMultiTriggerBeaconMode::exclude); 249 249 else 250 250 orxout(internal_error, context::triggers) << "Invalid beacon mode in DistanceMultiTrigger." << endl; -
code/branches/cpp11_v3/src/modules/objects/triggers/DistanceMultiTrigger.h
r11054 r11068 55 55 @ingroup MultiTrigger 56 56 */ 57 namespace distanceMultiTriggerBeaconMode 58 { 59 enum Value { 60 off, //!< The DistanceMultiTrigger is not in <em>beacon-mode</em>. 61 identify, //!< The DistanceTrigger is in <em>identify-mode</em>. 62 exclude //!< The DistanceTrigger is in <em>exclude-mode</em>. 63 }; 64 } 57 enum class DistanceMultiTriggerBeaconMode { 58 off, //!< The DistanceMultiTrigger is not in <em>beacon-mode</em>. 59 identify, //!< The DistanceTrigger is in <em>identify-mode</em>. 60 exclude //!< The DistanceTrigger is in <em>exclude-mode</em>. 61 }; 65 62 66 63 /** … … 113 110 { return this->distance_; } 114 111 115 void setBeaconModeDirect( distanceMultiTriggerBeaconMode::Value mode); // Set the beacon mode.112 void setBeaconModeDirect(DistanceMultiTriggerBeaconMode mode); // Set the beacon mode. 116 113 /** 117 114 @brief Get the beacon mode. 118 115 @return Returns the mode as an enum. 119 116 */ 120 inline distanceMultiTriggerBeaconMode::Value getBeaconModeDirect(void) const117 inline DistanceMultiTriggerBeaconMode getBeaconModeDirect(void) const 121 118 { return this->beaconMode_; } 122 119 void setBeaconMode(const std::string& mode); // Set the beacon mode. … … 149 146 float distance_; //!< The distance at which the DistanceMultiTrigger triggers. 150 147 151 distanceMultiTriggerBeaconMode::Value beaconMode_; //!< The beacon mode, the DistanceMultiTrigger is in.148 DistanceMultiTriggerBeaconMode beaconMode_; //!< The beacon mode, the DistanceMultiTrigger is in. 152 149 std::string targetName_; //!< The target name, used in <em>single-target</em> mode. 153 150 ClassTreeMask beaconMask_; //!< A mask, that only accepts DistanceTriggerBeacons. -
code/branches/cpp11_v3/src/modules/objects/triggers/DistanceTrigger.cc
r11054 r11068 158 158 ClassTreeMask targetMask = this->targetMask_; 159 159 // If we are in identify-mode another target mask has to be applies to find the DistanceTriggerBeacons. 160 if(this->beaconMode_ == distanceTriggerBeaconMode::identify)160 if(this->beaconMode_ == DistanceTriggerBeaconMode::identify) 161 161 targetMask = this->beaconMask_; 162 162 … … 167 167 168 168 // If the DistanceTrigger is in identify-mode and the DistanceTriggerBeacon attached to the object has the wrong name we ignore it. 169 if(this->beaconMode_ == distanceTriggerBeaconMode::identify)169 if(this->beaconMode_ == DistanceTriggerBeaconMode::identify) 170 170 { 171 171 if(entity->getName() != this->targetName_) … … 177 177 178 178 // If the DistanceTrigger is in exclude mode and the DistanceTriggerBeacon attached to the object has the right name, we ignore it. 179 if(this->beaconMode_ == distanceTriggerBeaconMode::exclude)179 if(this->beaconMode_ == DistanceTriggerBeaconMode::exclude) 180 180 { 181 181 … … 202 202 { 203 203 // Change the entity to the parent of the DistanceTriggerBeacon (if in identify-mode), which is the entity to which the beacon is attached. 204 if(this->beaconMode_ == distanceTriggerBeaconMode::identify)204 if(this->beaconMode_ == DistanceTriggerBeaconMode::identify) 205 205 entity = entity->getParent(); 206 206 … … 228 228 The mode as an enum. 229 229 */ 230 void DistanceTrigger::setBeaconModeDirect( distanceTriggerBeaconMode::Value mode)230 void DistanceTrigger::setBeaconModeDirect(DistanceTriggerBeaconMode mode) 231 231 { 232 232 this->beaconMode_ = mode; … … 243 243 switch(this->getBeaconModeDirect()) 244 244 { 245 case distanceTriggerBeaconMode::off :245 case DistanceTriggerBeaconMode::off : 246 246 return DistanceTrigger::beaconModeOff_s; 247 case distanceTriggerBeaconMode::identify:247 case DistanceTriggerBeaconMode::identify: 248 248 return DistanceTrigger::beaconModeIdentify_s; 249 case distanceTriggerBeaconMode::exclude:249 case DistanceTriggerBeaconMode::exclude: 250 250 return DistanceTrigger::beaconModeExlcude_s; 251 251 default : … … 264 264 { 265 265 if(mode == DistanceTrigger::beaconModeOff_s) 266 this->setBeaconModeDirect( distanceTriggerBeaconMode::off);266 this->setBeaconModeDirect(DistanceTriggerBeaconMode::off); 267 267 else if(mode == DistanceTrigger::beaconModeIdentify_s) 268 this->setBeaconModeDirect( distanceTriggerBeaconMode::identify);268 this->setBeaconModeDirect(DistanceTriggerBeaconMode::identify); 269 269 else if(mode == DistanceTrigger::beaconModeExlcude_s) 270 this->setBeaconModeDirect( distanceTriggerBeaconMode::exclude);270 this->setBeaconModeDirect(DistanceTriggerBeaconMode::exclude); 271 271 else 272 272 orxout(internal_error, context::triggers) << "Invalid beacon mode in DistanceTrigger." << endl; … … 282 282 Returns true if it is triggered ,false if not. 283 283 */ 284 bool DistanceTrigger::isTriggered(TriggerMode ::Valuemode)284 bool DistanceTrigger::isTriggered(TriggerMode mode) 285 285 { 286 286 if (Trigger::isTriggered(mode)) -
code/branches/cpp11_v3/src/modules/objects/triggers/DistanceTrigger.h
r9667 r11068 55 55 @ingroup NormalTrigger 56 56 */ 57 namespace distanceTriggerBeaconMode 58 { 59 enum Value { 60 off, 61 identify, 62 exclude 63 }; 64 } 57 enum class DistanceTriggerBeaconMode { 58 off, 59 identify, 60 exclude 61 }; 65 62 66 63 /** … … 118 115 { return this->distance_; } 119 116 120 void setBeaconModeDirect( distanceTriggerBeaconMode::Value mode); // Set the beacon mode.117 void setBeaconModeDirect(DistanceTriggerBeaconMode mode); // Set the beacon mode. 121 118 /** 122 119 @brief Get the beacon mode. 123 120 @return Returns the mode as an enum. 124 121 */ 125 inline distanceTriggerBeaconMode::Value getBeaconModeDirect(void) const122 inline DistanceTriggerBeaconMode getBeaconModeDirect(void) const 126 123 { return this->beaconMode_; } 127 124 void setBeaconMode(const std::string& mode); // Set the beacon mode. … … 144 141 145 142 protected: 146 virtual bool isTriggered(TriggerMode ::Value mode); // Check whether the DistanceTrigger is triggered.143 virtual bool isTriggered(TriggerMode mode) override; // Check whether the DistanceTrigger is triggered. 147 144 /** 148 145 @brief Notifies interested parties about a change of the DistanceTrigger's target mask. … … 160 157 float distance_; //!< The range of the DistanceTrigger. 161 158 162 distanceTriggerBeaconMode::Value beaconMode_; //!< The beacon mode.159 DistanceTriggerBeaconMode beaconMode_; //!< The beacon mode. 163 160 std::string targetName_; //!< The name a DistanceTriggerBeacon needs to have to make the DistanceTrigger react to it if in beacon-mode. 164 161 ClassTreeMask beaconMask_; //!< A mask, that only accepts DistanceTriggerBeacons. -
code/branches/cpp11_v3/src/modules/objects/triggers/EventTrigger.cc
r9667 r11068 79 79 It should be triggered if it is triggered according just to its sub-triggers and if the last event that came in was an event that changed from not triggered to triggered. 80 80 */ 81 bool EventTrigger::isTriggered(TriggerMode ::Valuemode)81 bool EventTrigger::isTriggered(TriggerMode mode) 82 82 { 83 83 if (Trigger::isTriggered(mode)) -
code/branches/cpp11_v3/src/modules/objects/triggers/EventTrigger.h
r9667 r11068 84 84 85 85 protected: 86 virtual bool isTriggered(TriggerMode ::Value mode); // Check whether the EventTrigger should be triggered.86 virtual bool isTriggered(TriggerMode mode) override; // Check whether the EventTrigger should be triggered. 87 87 88 88 private: -
code/branches/cpp11_v3/src/modules/objects/triggers/Trigger.cc
r11057 r11068 193 193 Returns true if the Trigger should be triggered and false if not. 194 194 */ 195 bool Trigger::isTriggered(TriggerMode ::Valuemode)195 bool Trigger::isTriggered(TriggerMode mode) 196 196 { 197 197 // If the trigger has sub-triggers. -
code/branches/cpp11_v3/src/modules/objects/triggers/Trigger.h
r11057 r11068 104 104 inline bool isTriggered() 105 105 { return this->isTriggered(this->mode_); } 106 virtual bool isTriggered(TriggerMode ::Valuemode); // Check whether the Trigger should be triggered, given only its sub-triggers, given a specific mode.106 virtual bool isTriggered(TriggerMode mode); // Check whether the Trigger should be triggered, given only its sub-triggers, given a specific mode. 107 107 virtual void triggered(bool bIsTriggered); // Fires an event with the input triggered state. 108 108 -
code/branches/cpp11_v3/src/modules/objects/triggers/TriggerBase.h
r11058 r11068 52 52 @ingroup Triggers 53 53 */ 54 namespaceTriggerMode54 enum class TriggerMode 55 55 { 56 enum Value 57 { 58 EventTriggerAND, //!< The <em>and</em> mode. The trigger can only trigger if all the children are active. 59 EventTriggerOR, //!< The <em>or</em> mode. The trigger can only trigger if at least one child is active. 60 EventTriggerXOR, //!< The <em>xor</em> mode. The trigger can only trigger if exactly one child is active. 61 }; 62 } 56 EventTriggerAND, //!< The <em>and</em> mode. The trigger can only trigger if all the children are active. 57 EventTriggerOR, //!< The <em>or</em> mode. The trigger can only trigger if at least one child is active. 58 EventTriggerXOR, //!< The <em>xor</em> mode. The trigger can only trigger if exactly one child is active. 59 }; 63 60 64 61 /** … … 157 154 @param mode The mode of the trigger. 158 155 */ 159 inline void setMode(TriggerMode ::Valuemode) //!< Get the mode of the trigger.156 inline void setMode(TriggerMode mode) //!< Get the mode of the trigger. 160 157 { this->mode_ = mode; } 161 158 const std::string& getModeString(void) const; … … 164 161 @return Returns and Enum for the mode of the trigger. 165 162 */ 166 inline TriggerMode ::ValuegetMode(void) const163 inline TriggerMode getMode(void) const 167 164 { return mode_; } 168 165 … … 210 207 211 208 bool bInvertMode_; //!< Bool for the invert-mode, if true the trigger is inverted. 212 TriggerMode ::Valuemode_; //!< The mode of the trigger.209 TriggerMode mode_; //!< The mode of the trigger. 213 210 214 211 TriggerBase* parent_; //!< The parent of this trigger. -
code/branches/cpp11_v3/src/modules/overlays/OverlayText.cc
r11054 r11068 42 42 RegisterClass(OverlayText); 43 43 44 static_assert((int)Ogre::TextAreaOverlayElement::Left == (int)OverlayText:: Left, "check enum");45 static_assert((int)Ogre::TextAreaOverlayElement::Center == (int)OverlayText:: Center, "check enum");46 static_assert((int)Ogre::TextAreaOverlayElement::Right == (int)OverlayText:: Right, "check enum");44 static_assert((int)Ogre::TextAreaOverlayElement::Left == (int)OverlayText::Alignment::Left, "check enum"); 45 static_assert((int)Ogre::TextAreaOverlayElement::Center == (int)OverlayText::Alignment::Center, "check enum"); 46 static_assert((int)Ogre::TextAreaOverlayElement::Right == (int)OverlayText::Alignment::Right, "check enum"); 47 47 48 48 OverlayText::OverlayText(Context* context) … … 85 85 { 86 86 if (alignment == "right") 87 this->setAlignment(OverlayText:: Right);87 this->setAlignment(OverlayText::Alignment::Right); 88 88 else if (alignment == "center") 89 this->setAlignment(OverlayText:: Center);89 this->setAlignment(OverlayText::Alignment::Center); 90 90 else // "left" and default 91 this->setAlignment(OverlayText:: Left);91 this->setAlignment(OverlayText::Alignment::Left); 92 92 } 93 93 … … 111 111 void OverlayText::sizeChanged() 112 112 { 113 if (this->rotState_ == Horizontal)113 if (this->rotState_ == RotationState::Horizontal) 114 114 this->overlay_->setScale(size_.y * sizeCorrection_.y, size_.y * sizeCorrection_.y); 115 else if (this->rotState_ == Vertical)115 else if (this->rotState_ == RotationState::Vertical) 116 116 this->overlay_->setScale(size_.y / (sizeCorrection_.y * sizeCorrection_.y), size_.y * sizeCorrection_.y); 117 117 else -
code/branches/cpp11_v3/src/modules/overlays/OverlayText.h
r11054 r11068 42 42 { 43 43 public: 44 enum Alignment44 enum class Alignment 45 45 { 46 46 Left, -
code/branches/cpp11_v3/src/modules/overlays/hud/HUDRadar.cc
r11054 r11068 65 65 this->setMaximumDotSize3D(0.07f); 66 66 67 this->shapeMaterials_[RadarViewable:: Dot] = "RadarDot.png";68 this->shapeMaterials_[RadarViewable:: Triangle] = "RadarTriangle.png";69 this->shapeMaterials_[RadarViewable::S quare] = "RadarSquare.png";67 this->shapeMaterials_[RadarViewable::Shape::Dot] = "RadarDot.png"; 68 this->shapeMaterials_[RadarViewable::Shape::Triangle] = "RadarTriangle.png"; 69 this->shapeMaterials_[RadarViewable::Shape::Square] = "RadarSquare.png"; 70 70 this->owner_ = nullptr; 71 71 -
code/branches/cpp11_v3/src/modules/overlays/stats/CreateLines.h
r5980 r11068 29 29 30 30 #include "overlays/OverlaysPrereqs.h" 31 32 #include <string> 31 33 32 34 namespace orxonox -
code/branches/cpp11_v3/src/modules/pickup/Pickup.cc
r9667 r11068 78 78 void Pickup::initialize(void) 79 79 { 80 this->activationType_ = pickupActivationType::immediate;81 this->durationType_ = pickupDurationType::once;80 this->activationType_ = PickupActivationType::immediate; 81 this->durationType_ = PickupDurationType::once; 82 82 } 83 83 … … 105 105 switch(this->getActivationType()) 106 106 { 107 case pickupActivationType::immediate:107 case PickupActivationType::immediate: 108 108 return activationTypeImmediate_s; 109 case pickupActivationType::onUse:109 case PickupActivationType::onUse: 110 110 return activationTypeOnUse_s; 111 111 default: … … 124 124 switch(this->getDurationType()) 125 125 { 126 case pickupDurationType::once:126 case PickupDurationType::once: 127 127 return durationTypeOnce_s; 128 case pickupDurationType::continuous:128 case PickupDurationType::continuous: 129 129 return durationTypeContinuous_s; 130 130 default: … … 142 142 { 143 143 if(type == Pickup::activationTypeImmediate_s) 144 this->setActivationType( pickupActivationType::immediate);144 this->setActivationType(PickupActivationType::immediate); 145 145 else if(type == Pickup::activationTypeOnUse_s) 146 this->setActivationType( pickupActivationType::onUse);146 this->setActivationType(PickupActivationType::onUse); 147 147 else 148 148 orxout(internal_error, context::pickups) << "Invalid activationType '" << type << "' in " << this->getIdentifier()->getName() << "." << endl; … … 158 158 { 159 159 if(type == Pickup::durationTypeOnce_s) 160 this->setDurationType( pickupDurationType::once);160 this->setDurationType(PickupDurationType::once); 161 161 else if(type == Pickup::durationTypeContinuous_s) 162 this->setDurationType( pickupDurationType::continuous);162 this->setDurationType(PickupDurationType::continuous); 163 163 else 164 164 orxout(internal_error, context::pickups) << "Invalid durationType '" << type << "' in " << this->getIdentifier()->getName() << "." << endl; -
code/branches/cpp11_v3/src/modules/pickup/Pickup.h
r11054 r11068 53 53 @ingroup Pickup 54 54 */ 55 namespace pickupActivationType55 enum class PickupActivationType 56 56 { 57 enum Value 58 { 59 immediate, //!< Means that the @ref orxonox::Pickup "Pickup" will be used immediately after pickup. 60 onUse, //!< Means that the @ref orxonox::Pickup "Pickup" will be used at a later point trough some external influence. 61 }; 62 } 57 immediate, //!< Means that the @ref orxonox::Pickup "Pickup" will be used immediately after pickup. 58 onUse, //!< Means that the @ref orxonox::Pickup "Pickup" will be used at a later point trough some external influence. 59 }; 63 60 64 61 /** … … 68 65 @ingroup Pickup 69 66 */ 70 namespace pickupDurationType67 enum class PickupDurationType 71 68 { 72 enum Value 73 { 74 once, //!< Means that the @ref orxonox::Pickup "Pickup" will be used only once at a singular time instant. 75 continuous, //!< Means that the @ref orxonox::Pickup "Pickup" will be used over a continuous timespan. 76 }; 77 } 69 once, //!< Means that the @ref orxonox::Pickup "Pickup" will be used only once at a singular time instant. 70 continuous, //!< Means that the @ref orxonox::Pickup "Pickup" will be used over a continuous timespan. 71 }; 78 72 79 73 /** … … 112 106 @return Returns the activation type of the Pickup. 113 107 */ 114 inline pickupActivationType::Value getActivationType(void) const108 inline PickupActivationType getActivationType(void) const 115 109 { return this->activationType_; } 116 110 /** … … 118 112 @return Returns the duration type of the Pickup. 119 113 */ 120 inline pickupDurationType::Value getDurationType(void) const114 inline PickupDurationType getDurationType(void) const 121 115 { return this->durationType_; } 122 116 … … 129 123 */ 130 124 inline bool isImmediate(void) const 131 { return this->getActivationType() == pickupActivationType::immediate; }125 { return this->getActivationType() == PickupActivationType::immediate; } 132 126 /** 133 127 @brief Get whether the activation type is 'onUse'. … … 135 129 */ 136 130 inline bool isOnUse(void) const 137 { return this->getActivationType() == pickupActivationType::onUse; }131 { return this->getActivationType() == PickupActivationType::onUse; } 138 132 /** 139 133 @brief Get whether the duration type is 'once'. … … 141 135 */ 142 136 inline bool isOnce(void) const 143 { return this->getDurationType() == pickupDurationType::once; }137 { return this->getDurationType() == PickupDurationType::once; } 144 138 /** 145 139 @brief Get whether the duration type is 'continuous'. … … 147 141 */ 148 142 inline bool isContinuous(void) const 149 { return this->getDurationType() == pickupDurationType::continuous; }143 { return this->getDurationType() == PickupDurationType::continuous; } 150 144 151 145 virtual void changedPickedUp(void) override; //!< Should be called when the pickup has transited from picked up to dropped or the other way around. … … 164 158 @param type The activation type of the Pickup. 165 159 */ 166 inline void setActivationType( pickupActivationType::Value type)160 inline void setActivationType(PickupActivationType type) 167 161 { this->activationType_ = type; } 168 162 /** … … 170 164 @param type The duration type of the Pickup. 171 165 */ 172 inline void setDurationType( pickupDurationType::Value type)166 inline void setDurationType(PickupDurationType type) 173 167 { this->durationType_ = type; } 174 168 … … 180 174 181 175 std::string representationName_; //!< The name of the associated PickupRepresentation. 182 pickupActivationType::Value activationType_; //!< The activation type of the Pickup.183 pickupDurationType::Value durationType_; //!< The duration type of the Pickup.176 PickupActivationType activationType_; //!< The activation type of the Pickup. 177 PickupDurationType durationType_; //!< The duration type of the Pickup. 184 178 185 179 //! Strings for the activation and duration types. -
code/branches/cpp11_v3/src/modules/pickup/items/DronePickup.cc
r11054 r11068 74 74 { 75 75 this->addTarget(ClassIdentifier<Pawn>::getIdentifier()); 76 this->setDurationType( pickupDurationType::once);76 this->setDurationType(PickupDurationType::once); 77 77 this->droneTemplate_ = ""; 78 78 } -
code/branches/cpp11_v3/src/modules/pickup/items/HealthPickup.cc
r11054 r11068 77 77 this->health_ = 0.0f; 78 78 this->healthRate_ = 0.0f; 79 this->healthType_ = pickupHealthType::limited;79 this->healthType_ = PickupHealthType::limited; 80 80 this->maxHealthSave_ = 0.0f; 81 81 this->maxHealthOverwrite_ = 0.0f; … … 127 127 switch(this->getHealthType()) 128 128 { 129 case pickupHealthType::permanent:129 case PickupHealthType::permanent: 130 130 if(pawn->getMaxHealth() < fullHealth) 131 131 pawn->setMaxHealth(fullHealth); 132 case pickupHealthType::limited:132 case PickupHealthType::limited: 133 133 pawn->addHealth(health); 134 134 break; 135 case pickupHealthType::temporary:135 case PickupHealthType::temporary: 136 136 if(pawn->getMaxHealth() > fullHealth) 137 137 { … … 174 174 switch(this->getHealthType()) 175 175 { 176 case pickupHealthType::permanent:176 case PickupHealthType::permanent: 177 177 health = pawn->getHealth()+this->getHealth(); 178 178 if(pawn->getMaxHealth() < health) 179 179 pawn->setMaxHealth(health); 180 case pickupHealthType::limited:180 case PickupHealthType::limited: 181 181 pawn->addHealth(this->getHealth()); 182 182 break; 183 case pickupHealthType::temporary:183 case PickupHealthType::temporary: 184 184 health = pawn->getHealth()+this->getHealth(); 185 185 if(pawn->getMaxHealth() < health) … … 201 201 else 202 202 { 203 if(this->getHealthType() == pickupHealthType::temporary)203 if(this->getHealthType() == PickupHealthType::temporary) 204 204 { 205 205 PickupCarrier* carrier = this->getCarrier(); … … 256 256 switch(this->getHealthType()) 257 257 { 258 case pickupHealthType::limited:258 case PickupHealthType::limited: 259 259 return HealthPickup::healthTypeLimited_s; 260 case pickupHealthType::temporary:260 case PickupHealthType::temporary: 261 261 return HealthPickup::healthTypeTemporary_s; 262 case pickupHealthType::permanent:262 case PickupHealthType::permanent: 263 263 return HealthPickup::healthTypePermanent_s; 264 264 default: … … 308 308 { 309 309 if(type == HealthPickup::healthTypeLimited_s) 310 this->setHealthType( pickupHealthType::limited);310 this->setHealthType(PickupHealthType::limited); 311 311 else if(type == HealthPickup::healthTypeTemporary_s) 312 this->setHealthType( pickupHealthType::temporary);312 this->setHealthType(PickupHealthType::temporary); 313 313 else if(type == HealthPickup::healthTypePermanent_s) 314 this->setHealthType( pickupHealthType::permanent);314 this->setHealthType(PickupHealthType::permanent); 315 315 else 316 316 orxout(internal_error, context::pickups) << "Invalid healthType '" << type << "' in HealthPickup." << endl; -
code/branches/cpp11_v3/src/modules/pickup/items/HealthPickup.h
r9667 r11068 51 51 @ingroup PickupItems 52 52 */ 53 namespace pickupHealthType53 enum class PickupHealthType 54 54 { 55 enum Value 56 { 57 limited, //!< Means that the @ref orxonox::HealthPickup "HealthPickup" only increases the users health to its maximum health. 58 temporary, //!< Means that the @ref orxonox::HealthPickup "HealthPickup" temporarily increases the users health even above its maximum health, but only as long as it is in use. 59 permanent //!< Means that the @ref orxonox::HealthPickup "HealthPickup" increases the users health even above its maximum health and increases the maximum health permanently such that it matches the new health. 60 }; 61 } 55 limited, //!< Means that the @ref orxonox::HealthPickup "HealthPickup" only increases the users health to its maximum health. 56 temporary, //!< Means that the @ref orxonox::HealthPickup "HealthPickup" temporarily increases the users health even above its maximum health, but only as long as it is in use. 57 permanent //!< Means that the @ref orxonox::HealthPickup "HealthPickup" increases the users health even above its maximum health and increases the maximum health permanently such that it matches the new health. 58 }; 62 59 63 60 /** … … 115 112 @return Returns the health type as an enum. 116 113 */ 117 inline pickupHealthType::Value getHealthType(void) const114 inline PickupHealthType getHealthType(void) const 118 115 { return this->healthType_; } 119 116 const std::string& getHealthTypeAsString(void) const; //!< Get the health type of this pickup. … … 127 124 @param type The type of this pickup as an enum. 128 125 */ 129 inline void setHealthType( pickupHealthType::Value type)126 inline void setHealthType(PickupHealthType type) 130 127 { this->healthType_ = type; } 131 128 void setHealthTypeAsString(const std::string& type); //!< Set the type of the HealthPickup. … … 139 136 float maxHealthSave_; //!< Helper to remember what the actual maxHealth of the Pawn was before we changed it. 140 137 float maxHealthOverwrite_; //!< Helper to remember with which value we overwrote the maxHealh, to detect if someone else changed it as well. 141 pickupHealthType::Value healthType_; //!< The type of the HealthPickup.138 PickupHealthType healthType_; //!< The type of the HealthPickup. 142 139 143 140 //! Strings for the health types. -
code/branches/cpp11_v3/src/modules/pickup/items/MetaPickup.cc
r11054 r11068 79 79 this->addTarget(ClassIdentifier<PickupCarrier>::getIdentifier()); 80 80 81 this->setDurationType( pickupDurationType::once);82 this->metaType_ = pickupMetaType::none;81 this->setDurationType(PickupDurationType::once); 82 this->metaType_ = PickupMetaType::none; 83 83 } 84 84 … … 104 104 105 105 // If the MetaPickup transited to used, and the metaType is not none. 106 if(this->isUsed() && this->metaType_ != pickupMetaType::none)106 if(this->isUsed() && this->metaType_ != PickupMetaType::none) 107 107 { 108 108 PickupCarrier* carrier = this->getCarrier(); 109 if(this->getMetaType() != pickupMetaType::none && carrier != nullptr)109 if(this->getMetaType() != PickupMetaType::none && carrier != nullptr) 110 110 { 111 111 // If the metaType is destroyCarrier, then the PickupCarrier is destroyed. 112 if(this->getMetaType() == pickupMetaType::destroyCarrier)112 if(this->getMetaType() == PickupMetaType::destroyCarrier) 113 113 { 114 114 Pawn* pawn = orxonox_cast<Pawn*>(carrier); … … 124 124 125 125 // If the metaType is use, then the Pickupable is set to used. 126 if(this->getMetaType() == pickupMetaType::use && !pickup->isUsed())126 if(this->getMetaType() == PickupMetaType::use && !pickup->isUsed()) 127 127 { 128 128 pickup->setUsed(true); 129 129 } 130 130 // If the metaType is drop, then the Pickupable is dropped. 131 else if(this->getMetaType() == pickupMetaType::drop)131 else if(this->getMetaType() == PickupMetaType::drop) 132 132 { 133 133 pickup->drop(); 134 134 } 135 135 // If the metaType is destroy, then the Pickupable is destroyed. 136 else if(this->getMetaType() == pickupMetaType::destroy)136 else if(this->getMetaType() == PickupMetaType::destroy) 137 137 { 138 138 pickup->Pickupable::destroy(); … … 154 154 switch(this->getMetaType()) 155 155 { 156 case pickupMetaType::none:156 case PickupMetaType::none: 157 157 return MetaPickup::metaTypeNone_s; 158 case pickupMetaType::use:158 case PickupMetaType::use: 159 159 return MetaPickup::metaTypeUse_s; 160 case pickupMetaType::drop:160 case PickupMetaType::drop: 161 161 return MetaPickup::metaTypeDrop_s; 162 case pickupMetaType::destroy:162 case PickupMetaType::destroy: 163 163 return MetaPickup::metaTypeDestroy_s; 164 case pickupMetaType::destroyCarrier:164 case PickupMetaType::destroyCarrier: 165 165 return MetaPickup::metaTypeDestroyCarrier_s; 166 166 default: … … 179 179 if(type == MetaPickup::metaTypeNone_s) 180 180 { 181 this->setMetaType( pickupMetaType::none);181 this->setMetaType(PickupMetaType::none); 182 182 } 183 183 else if(type == MetaPickup::metaTypeUse_s) 184 184 { 185 this->setMetaType( pickupMetaType::use);185 this->setMetaType(PickupMetaType::use); 186 186 } 187 187 else if(type == MetaPickup::metaTypeDrop_s) 188 188 { 189 this->setMetaType( pickupMetaType::drop);189 this->setMetaType(PickupMetaType::drop); 190 190 } 191 191 else if(type == MetaPickup::metaTypeDestroy_s) 192 192 { 193 this->setMetaType( pickupMetaType::destroy);193 this->setMetaType(PickupMetaType::destroy); 194 194 } 195 195 else if(type == MetaPickup::metaTypeDestroyCarrier_s) 196 196 { 197 this->setMetaType( pickupMetaType::destroyCarrier);197 this->setMetaType(PickupMetaType::destroyCarrier); 198 198 } 199 199 else -
code/branches/cpp11_v3/src/modules/pickup/items/MetaPickup.h
r9667 r11068 48 48 @ingroup PickupItems 49 49 */ 50 namespace pickupMetaType50 enum class PickupMetaType 51 51 { 52 enum Value 53 { 54 none, //!< The @ref orxonox::MetaPickup "MetaPickup" does nothing. 55 use, //!< The @ref orxonox::MetaPickup "MetaPickup" uses all the @ref orxonox::PickupCarrier "PickupCarriers'" @ref orxonox::Pickupable "Pickupables". 56 drop, //!< The @ref orxonox::MetaPickup "MetaPickup" drops all the @ref orxonox::PickupCarrier "PickupCarriers'" @ref orxonox::Pickupable "Pickupables". 57 destroy, //!< The @ref orxonox::MetaPickup "MetaPickup" destroys all the @ref orxonox::PickupCarrier "PickupCarriers'" @ref orxonox::Pickupable "Pickupables". 58 destroyCarrier //!< The @ref orxonox::MetaPickup "MetaPickup" destroys the @ref orxonox::PickupCarrier "PickupCarrier". 59 }; 60 } 52 none, //!< The @ref orxonox::MetaPickup "MetaPickup" does nothing. 53 use, //!< The @ref orxonox::MetaPickup "MetaPickup" uses all the @ref orxonox::PickupCarrier "PickupCarriers'" @ref orxonox::Pickupable "Pickupables". 54 drop, //!< The @ref orxonox::MetaPickup "MetaPickup" drops all the @ref orxonox::PickupCarrier "PickupCarriers'" @ref orxonox::Pickupable "Pickupables". 55 destroy, //!< The @ref orxonox::MetaPickup "MetaPickup" destroys all the @ref orxonox::PickupCarrier "PickupCarriers'" @ref orxonox::Pickupable "Pickupables". 56 destroyCarrier //!< The @ref orxonox::MetaPickup "MetaPickup" destroys the @ref orxonox::PickupCarrier "PickupCarrier". 57 }; 61 58 62 59 /** … … 100 97 @return Returns an enum with the meta type of the MetaPickup. 101 98 */ 102 inline pickupMetaType::Value getMetaType(void) const99 inline PickupMetaType getMetaType(void) const 103 100 { return this->metaType_; } 104 101 const std::string& getMetaTypeAsString(void) const; //!< Get the meta type of this MetaPickup. … … 109 106 @param type The meta type as an enum. 110 107 */ 111 inline void setMetaType( pickupMetaType::Value type)108 inline void setMetaType(PickupMetaType type) 112 109 { this->metaType_ = type; } 113 110 void setMetaTypeAsString(const std::string& type); //!< Set the meta type of this MetaPickup. … … 116 113 void initialize(void); //!< Initializes the member variables. 117 114 118 pickupMetaType::Value metaType_; //!< The meta type of the MetaPickup, determines which actions are taken.115 PickupMetaType metaType_; //!< The meta type of the MetaPickup, determines which actions are taken. 119 116 120 117 //! Static strings for the meta types. -
code/branches/cpp11_v3/src/modules/portals/PortalEndPoint.cc
r11054 r11068 57 57 58 58 this->setRadarObjectColour(ColourValue::White); 59 this->setRadarObjectShape(RadarViewable:: Dot);59 this->setRadarObjectShape(RadarViewable::Shape::Dot); 60 60 this->setRadarVisibility(true); 61 61 if( GameMode::isMaster() ) -
code/branches/cpp11_v3/src/modules/questsystem/GlobalQuest.cc
r11054 r11068 177 177 The player. 178 178 */ 179 QuestStatus ::ValueGlobalQuest::getStatus(const PlayerInfo* player) const179 QuestStatus GlobalQuest::getStatus(const PlayerInfo* player) const 180 180 { 181 181 assert(player); … … 200 200 Returns false if player is nullptr. 201 201 */ 202 bool GlobalQuest::setStatus(PlayerInfo* player, const QuestStatus ::Value& status)202 bool GlobalQuest::setStatus(PlayerInfo* player, const QuestStatus & status) 203 203 { 204 204 assert(player); -
code/branches/cpp11_v3/src/modules/questsystem/GlobalQuest.h
r11054 r11068 103 103 virtual bool isCompletable(const PlayerInfo* player) const override; //!< Checks whether the Quest can be completed. 104 104 105 virtual QuestStatus ::ValuegetStatus(const PlayerInfo* player) const override; //!< Returns the status of the Quest for a specific player.105 virtual QuestStatus getStatus(const PlayerInfo* player) const override; //!< Returns the status of the Quest for a specific player. 106 106 107 virtual bool setStatus(PlayerInfo* player, const QuestStatus ::Value& status) override; //!< Sets the status for a specific player.107 virtual bool setStatus(PlayerInfo* player, const QuestStatus & status) override; //!< Sets the status for a specific player. 108 108 109 109 private: 110 110 std::set<PlayerInfo*> players_; //!< The set of players which possess this Quest. 111 QuestStatus ::Valuestatus_; //!< The status of this Quest.111 QuestStatus status_; //!< The status of this Quest. 112 112 std::list<QuestEffect*> rewards_; //!< Reward QuestEffects only invoked on the player completing the Quest. 113 113 -
code/branches/cpp11_v3/src/modules/questsystem/LocalQuest.cc
r11054 r11068 168 168 Returns the status of the Quest for the input player. 169 169 */ 170 QuestStatus ::ValueLocalQuest::getStatus(const PlayerInfo* player) const170 QuestStatus LocalQuest::getStatus(const PlayerInfo* player) const 171 171 { 172 172 assert(player); 173 173 174 std::map<const PlayerInfo*, QuestStatus ::Value>::const_iterator it = this->playerStatus_.find(player);174 std::map<const PlayerInfo*, QuestStatus>::const_iterator it = this->playerStatus_.find(player); 175 175 if (it != this->playerStatus_.end()) // If there is a player in the map. 176 176 return it->second; … … 190 190 Returns false if player is nullptr. 191 191 */ 192 bool LocalQuest::setStatus(PlayerInfo* player, const QuestStatus ::Value& status)192 bool LocalQuest::setStatus(PlayerInfo* player, const QuestStatus & status) 193 193 { 194 194 assert(player); -
code/branches/cpp11_v3/src/modules/questsystem/LocalQuest.h
r11054 r11068 97 97 virtual bool isCompletable(const PlayerInfo* player) const override; //!< Checks whether the Quest can be completed. 98 98 99 virtual QuestStatus ::ValuegetStatus(const PlayerInfo* player) const override; //!< Returns the status of the Quest for a specific player.100 virtual bool setStatus(PlayerInfo* player, const QuestStatus ::Value& status) override; //!< Sets the status for a specific player.99 virtual QuestStatus getStatus(const PlayerInfo* player) const override; //!< Returns the status of the Quest for a specific player. 100 virtual bool setStatus(PlayerInfo* player, const QuestStatus & status) override; //!< Sets the status for a specific player. 101 101 102 102 private: 103 std::map<const PlayerInfo*, QuestStatus ::Value> playerStatus_; //!< List of the status for each player, with the Player-pointer as key.103 std::map<const PlayerInfo*, QuestStatus> playerStatus_; //!< List of the status for each player, with the Player-pointer as key. 104 104 105 105 }; -
code/branches/cpp11_v3/src/modules/questsystem/Quest.h
r11054 r11068 51 51 @ingroup Questsystem 52 52 */ 53 namespaceQuestStatus53 enum class QuestStatus 54 54 { 55 enum Value 56 { 57 Inactive, //!< The @ref orxonox::Quest "Quest" is inactive. 58 Active, //!< The @ref orxonox::Quest "Quest" is active. 59 Failed, //!< The @ref orxonox::Quest "Quest" has been failed. 60 Completed //!< The @ref orxonox::Quest "Quest" has been completed. 61 }; 62 } 55 Inactive, //!< The @ref orxonox::Quest "Quest" is inactive. 56 Active, //!< The @ref orxonox::Quest "Quest" is active. 57 Failed, //!< The @ref orxonox::Quest "Quest" has been failed. 58 Completed //!< The @ref orxonox::Quest "Quest" has been completed. 59 }; 63 60 64 61 /** … … 143 140 { return this->completeEffects_; } 144 141 145 virtual QuestStatus ::ValuegetStatus(const PlayerInfo* player) const = 0; //!< Returns the status of the Quest for a specific player.146 virtual bool setStatus(PlayerInfo* player, const QuestStatus ::Value& status) = 0; //!< Changes the status for a specific player.142 virtual QuestStatus getStatus(const PlayerInfo* player) const = 0; //!< Returns the status of the Quest for a specific player. 143 virtual bool setStatus(PlayerInfo* player, const QuestStatus & status) = 0; //!< Changes the status for a specific player. 147 144 148 145 private: -
code/branches/cpp11_v3/src/modules/questsystem/QuestDescription.cc
r9667 r11068 119 119 } 120 120 121 NotificationListener::sendNotification(message, QuestDescription::SENDER, notificationMessageType::info, notificationSendMode::network, player->getClientID());121 NotificationListener::sendNotification(message, QuestDescription::SENDER, NotificationMessageType::info, NotificationSendMode::network, player->getClientID()); 122 122 return true; 123 123 } -
code/branches/cpp11_v3/src/modules/questsystem/QuestEffectBeacon.h
r11054 r11068 50 50 @ingroup Questsystem 51 51 */ 52 namespaceQuestEffectBeaconStatus52 enum class QuestEffectBeaconStatus 53 53 { 54 enum Value 55 { 56 Inactive, //!< The @ref orxonox::QuestEffectBeacon "QuestEffectBeacon" is inactive. 57 Active //!< The @ref orxonox::QuestEffectBeacon "QuestEffectBeacon" is active. 58 }; 59 } 54 Inactive, //!< The @ref orxonox::QuestEffectBeacon "QuestEffectBeacon" is inactive. 55 Active //!< The @ref orxonox::QuestEffectBeacon "QuestEffectBeacon" is active. 56 }; 60 57 61 58 /** … … 125 122 std::list<QuestEffect*> effects_; //!< The list of QuestEffects to be invoked on the executing player. 126 123 int times_; //!< Number of times the beacon can be exectued. 127 QuestEffectBeaconStatus ::Valuestatus_; //!< The status of the QuestEffectBeacon, Can be eighter active or inactive.124 QuestEffectBeaconStatus status_; //!< The status of the QuestEffectBeacon, Can be eighter active or inactive. 128 125 129 126 bool setTimes(const int & n); //!< Set the number of times the QuestEffectBeacon can be executed. -
code/branches/cpp11_v3/src/modules/questsystem/QuestHint.cc
r11054 r11068 92 92 93 93 // Find the player. 94 std::map<const PlayerInfo*, QuestHintStatus ::Value>::const_iterator it = this->playerStatus_.find(player);94 std::map<const PlayerInfo*, QuestHintStatus>::const_iterator it = this->playerStatus_.find(player); 95 95 if (it != this->playerStatus_.end()) // If the player is in the map. 96 return it->second;96 return (it->second == QuestHintStatus::Active); 97 97 98 return QuestStatus::Inactive;98 return false; 99 99 } 100 100 -
code/branches/cpp11_v3/src/modules/questsystem/QuestHint.h
r11054 r11068 50 50 @ingroup Questsystem 51 51 */ 52 namespaceQuestHintStatus52 enum class QuestHintStatus 53 53 { 54 enum Value 55 { 56 Inactive, //!< The @ref orxonox::QuestHint "QuestHint" is inactive. 57 Active //!< The @ref orxonox::QuestHint "QuestHint" is active. 58 }; 59 } 54 Inactive, //!< The @ref orxonox::QuestHint "QuestHint" is inactive. 55 Active //!< The @ref orxonox::QuestHint "QuestHint" is active. 56 }; 60 57 61 58 /** … … 101 98 private: 102 99 Quest* quest_; //!< The Quest the QuestHint belongs to. 103 std::map<const PlayerInfo*, QuestHintStatus ::Value> playerStatus_; //!< List of the states for each player, with the Player-pointer as key.100 std::map<const PlayerInfo*, QuestHintStatus> playerStatus_; //!< List of the states for each player, with the Player-pointer as key. 104 101 105 102 }; // tolua_export -
code/branches/cpp11_v3/src/modules/questsystem/QuestListener.h
r11054 r11068 50 50 @ingroup Questsystem 51 51 */ 52 namespaceQuestListenerMode52 enum class QuestListenerMode 53 53 { 54 enum Value 55 { 56 All, //!< Listens to all events. 57 Start, //!< Only listens to events pertaining the starting of @ref orxonox::Quest "Quests". 58 Fail, //!< Only listens to events pertaining the failing of @ref orxonox::Quest "Quests". 59 Complete //!< Only listens to events pertaining the completing of @ref orxonox::Quest "Quests". 60 }; 61 } 54 All, //!< Listens to all events. 55 Start, //!< Only listens to events pertaining the starting of @ref orxonox::Quest "Quests". 56 Fail, //!< Only listens to events pertaining the failing of @ref orxonox::Quest "Quests". 57 Complete //!< Only listens to events pertaining the completing of @ref orxonox::Quest "Quests". 58 }; 62 59 63 60 /** … … 103 100 104 101 private: 105 QuestListenerMode ::Valuemode_; //!< The mode of the QuestListener.102 QuestListenerMode mode_; //!< The mode of the QuestListener. 106 103 Quest* quest_; //!< A pointer to the Quest the QuestListener is reacting to. 107 104 -
code/branches/cpp11_v3/src/modules/towerdefense/TowerDefense.cc
r11054 r11068 355 355 fields_[i][j]->create(fields.at(pos), fields.at(pos+1)); 356 356 pos += 2; 357 if (fields_[i][j]->getType() == START)357 if (fields_[i][j]->getType() == TowerDefenseFieldType::START) 358 358 { 359 359 startCoord.Set(i,j); … … 379 379 TDCoordinate* nextCoord = new TDCoordinate(0,0); 380 380 381 if (thisField->getType() != STREET && thisField->getType() !=START)381 if (thisField->getType() != TowerDefenseFieldType::STREET && thisField->getType() != TowerDefenseFieldType::START) 382 382 { 383 383 return nullptr; -
code/branches/cpp11_v3/src/modules/towerdefense/TowerDefenseEnemy.cc
r11058 r11068 27 27 RegisterObject(TowerDefenseEnemy); 28 28 29 this->setCollisionType(WorldEntity:: Dynamic);29 this->setCollisionType(WorldEntity::CollisionType::Dynamic); 30 30 //needed to keep track of the PlayerStats coded in TowerDefense.h 31 31 this->td = orxonox_cast<TowerDefense*>(this->getGametype()); -
code/branches/cpp11_v3/src/modules/towerdefense/TowerDefenseField.cc
r11054 r11068 50 50 51 51 tower_ = nullptr; 52 type_ = FREE;52 type_ = TowerDefenseFieldType::FREE; 53 53 center_ = nullptr; 54 54 upgrade_ = 0; … … 186 186 modelGround_->setMeshSource("TD_F1.mesh"); 187 187 tower_ = nullptr; 188 type_ = FREE;188 type_ = TowerDefenseFieldType::FREE; 189 189 setUpgrade(0); 190 190 setAngle(orientation); … … 195 195 modelGround_->setMeshSource("TD_S5.mesh"); 196 196 tower_ = nullptr; 197 type_ = START;197 type_ = TowerDefenseFieldType::START; 198 198 setUpgrade(0); 199 199 setAngle(orientation); … … 205 205 modelGround_->setMeshSource("TD_S4.mesh"); 206 206 tower_ = nullptr; 207 type_ = END;207 type_ = TowerDefenseFieldType::END; 208 208 setUpgrade(0); 209 209 setAngle(orientation); … … 214 214 modelGround_->setMeshSource("TD_S1.mesh"); 215 215 tower_ = nullptr; 216 type_ = STREET;216 type_ = TowerDefenseFieldType::STREET; 217 217 setUpgrade(0); 218 218 setAngle(orientation); … … 223 223 modelGround_->setMeshSource("TD_S2.mesh"); 224 224 tower_ = nullptr; 225 type_ = STREET;225 type_ = TowerDefenseFieldType::STREET; 226 226 setUpgrade(0); 227 227 setAngle(orientation); … … 232 232 modelGround_->setMeshSource("TD_S3.mesh"); 233 233 tower_ = nullptr; 234 type_ = STREET;234 type_ = TowerDefenseFieldType::STREET; 235 235 setUpgrade(0); 236 236 setAngle(orientation); … … 242 242 modelObject_->setMeshSource("TD_O1.mesh"); 243 243 tower_ = nullptr; 244 type_ = OBSTACLE;244 type_ = TowerDefenseFieldType::OBSTACLE; 245 245 setUpgrade(0); 246 246 setAngle(orientation); … … 254 254 tower_ = new TowerDefenseTower(center_->getContext()); 255 255 attach(tower_); 256 type_ = T OWER;256 type_ = TowerDefenseFieldType::TOWER; 257 257 setUpgrade(upgrade); 258 258 if (upgrade_ > 0 && modelObject_ != nullptr) -
code/branches/cpp11_v3/src/modules/towerdefense/TowerDefenseField.h
r11054 r11068 46 46 namespace orxonox 47 47 { 48 enum TowerDefenseFieldType48 enum class TowerDefenseFieldType 49 49 { 50 50 FREE, … … 64 64 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; 65 65 const bool isFree() const 66 { return type_== FREE; }66 { return type_==TowerDefenseFieldType::FREE; } 67 67 virtual void create(char object, char param); 68 68 virtual void setCenterpoint(TowerDefenseCenterpoint* center); -
code/branches/cpp11_v3/src/modules/towerdefense/TowerDefenseTower.cc
r11054 r11068 26 26 RegisterObject(TowerDefenseTower); 27 27 game_ =nullptr; 28 this->setCollisionType(WorldEntity:: None);28 this->setCollisionType(WorldEntity::CollisionType::None); 29 29 upgrade = 1; 30 30 -
code/branches/cpp11_v3/src/modules/weapons/projectiles/GravityBomb.cc
r10622 r11068 28 28 this->timeToLife_= LIFETIME; 29 29 this->setCollisionResponse(false); 30 this->setCollisionType(WorldEntity:: Dynamic);30 this->setCollisionType(WorldEntity::CollisionType::Dynamic); 31 31 this->enableCollisionCallback(); 32 32 -
code/branches/cpp11_v3/src/modules/weapons/projectiles/GravityBombField.cc
r11054 r11068 41 41 //Make the Field visible on Radar and minimap. 42 42 this->setRadarObjectColour(ColourValue(1.0, 0.0, 0.2,1)); // Red 43 this->setRadarObjectShape(RadarViewable:: Dot);43 this->setRadarObjectShape(RadarViewable::Shape::Dot); 44 44 this->setRadarObjectScale(1.0f); 45 45 -
code/branches/cpp11_v3/src/modules/weapons/projectiles/IceGunProjectile.cc
r11052 r11068 120 120 Vector3 offset = this->getWorldPosition() - otherObject->getWorldPosition(); 121 121 freezer->setPosition(Vector3(0,0,0)); 122 freezer->translate(offset, WorldEntity:: World);122 freezer->translate(offset, WorldEntity::TransformSpace::World); 123 123 // Start the freezing effect. 124 124 freezer->startFreezing(); -
code/branches/cpp11_v3/src/modules/weapons/projectiles/LightningGunProjectile.cc
r10622 r11068 48 48 this->textureIndex_ = 1; 49 49 this->setMass(2); 50 this->setCollisionType( Dynamic);50 this->setCollisionType(CollisionType::Dynamic); 51 51 this->maxTextureIndex_ = 8; 52 52 this->textureTimer_.setTimer(0.01f, true, createExecutor(createFunctor(&LightningGunProjectile::changeTexture, this))); -
code/branches/cpp11_v3/src/modules/weapons/projectiles/Projectile.cc
r11054 r11068 57 57 this->enableCollisionCallback(); 58 58 this->setCollisionResponse(false); 59 this->setCollisionType( Dynamic);59 this->setCollisionType(CollisionType::Dynamic); 60 60 61 61 // Create a sphere collision shape and attach it to the projectile. -
code/branches/cpp11_v3/src/modules/weapons/projectiles/Rocket.cc
r11054 r11068 70 70 if (GameMode::isMaster()) 71 71 { 72 this->setCollisionType(WorldEntity:: Kinematic);72 this->setCollisionType(WorldEntity::CollisionType::Kinematic); 73 73 this->setVelocity(0,0,-100); 74 74 … … 92 92 this->enableCollisionCallback(); 93 93 this->setCollisionResponse(false); 94 this->setCollisionType( Kinematic);94 this->setCollisionType(CollisionType::Kinematic); 95 95 96 96 // Add collision shape … … 128 128 129 129 this->setRadarObjectColour(ColourValue(1.0, 0.5, 0.0)); // orange 130 this->setRadarObjectShape(RadarViewable:: Triangle);130 this->setRadarObjectShape(RadarViewable::Shape::Triangle); 131 131 this->setRadarObjectScale(0.5f); 132 132 } -
code/branches/cpp11_v3/src/modules/weapons/projectiles/RocketOld.cc
r11054 r11068 70 70 if (GameMode::isMaster()) 71 71 { 72 this->setCollisionType(WorldEntity:: Kinematic);72 this->setCollisionType(WorldEntity::CollisionType::Kinematic); 73 73 this->setVelocity(0,0,-100); 74 74 … … 92 92 this->enableCollisionCallback(); 93 93 this->setCollisionResponse(false); 94 this->setCollisionType( Kinematic);94 this->setCollisionType(CollisionType::Kinematic); 95 95 96 96 // Add collision shape … … 128 128 129 129 this->setRadarObjectColour(ColourValue(1.0, 0.5, 0.0)); // orange 130 this->setRadarObjectShape(RadarViewable:: Triangle);130 this->setRadarObjectShape(RadarViewable::Shape::Triangle); 131 131 this->setRadarObjectScale(0.5f); 132 132 } -
code/branches/cpp11_v3/src/modules/weapons/projectiles/SimpleRocket.cc
r11052 r11068 70 70 if (GameMode::isMaster()) 71 71 { 72 this->setCollisionType(WorldEntity:: Kinematic);72 this->setCollisionType(WorldEntity::CollisionType::Kinematic); 73 73 this->fuel_ = true; 74 74 … … 87 87 this->enableCollisionCallback(); 88 88 this->setCollisionResponse(false); 89 this->setCollisionType( Kinematic);89 this->setCollisionType(CollisionType::Kinematic); 90 90 91 91 // Add collision shape. … … 101 101 102 102 this->setRadarObjectColour(ColourValue(1.0, 1.0, 0.0)); // yellow 103 this->setRadarObjectShape(RadarViewable:: Triangle);103 this->setRadarObjectShape(RadarViewable::Shape::Triangle); 104 104 this->setRadarObjectScale(0.5f); 105 105 } -
code/branches/cpp11_v3/src/orxonox/Main.h
r5693 r11068 33 33 #include "OrxonoxPrereqs.h" 34 34 35 #include <string> 36 35 37 namespace orxonox 36 38 { -
code/branches/cpp11_v3/src/orxonox/Radar.cc
r11054 r11068 55 55 // TODO: make this mapping configurable. Maybe there's a possibility with self configured 56 56 // configValues.. 57 this->objectTypes_["Asteroid"] = RadarViewable:: Dot;58 this->objectTypes_["SpaceShip"] = RadarViewable::S quare;59 this->objectTypes_["AsdfQwerty"] = RadarViewable:: Triangle;57 this->objectTypes_["Asteroid"] = RadarViewable::Shape::Dot; 58 this->objectTypes_["SpaceShip"] = RadarViewable::Shape::Square; 59 this->objectTypes_["AsdfQwerty"] = RadarViewable::Shape::Triangle; 60 60 61 61 /*WorldEntity* object; … … 113 113 std::map<std::string, RadarViewable::Shape>::iterator it = this->objectTypes_.find(name); 114 114 if (it == this->objectTypes_.end()) 115 return this->objectTypes_[name] = RadarViewable::S quare; // default, configure!!115 return this->objectTypes_[name] = RadarViewable::Shape::Square; // default, configure!! 116 116 else 117 117 return this->objectTypes_[name]; -
code/branches/cpp11_v3/src/orxonox/gametypes/Gametype.h
r11054 r11068 45 45 namespace orxonox 46 46 { 47 namespace PlayerState 48 { 49 enum Value 50 { 51 Uninitialized, 52 Joined, 53 Alive, 54 Dead 55 }; 56 } 47 enum class PlayerState 48 { 49 Uninitialized, 50 Joined, 51 Alive, 52 Dead 53 }; 57 54 58 55 struct Player 59 56 { 60 57 PlayerInfo* info_; 61 PlayerState ::Valuestate_;58 PlayerState state_; 62 59 int frags_; 63 60 int killed_; -
code/branches/cpp11_v3/src/orxonox/graphics/Light.cc
r11054 r11068 44 44 45 45 // Be sure we don't do bad conversions 46 static_assert((int)Ogre::Light::LT_POINT == (int)Light:: Point, "check enum");47 static_assert((int)Ogre::Light::LT_DIRECTIONAL == (int)Light:: Directional, "check enum");48 static_assert((int)Ogre::Light::LT_SPOTLIGHT == (int)Light:: Spotlight, "check enum");46 static_assert((int)Ogre::Light::LT_POINT == (int)Light::Type::Point, "check enum"); 47 static_assert((int)Ogre::Light::LT_DIRECTIONAL == (int)Light::Type::Directional, "check enum"); 48 static_assert((int)Ogre::Light::LT_SPOTLIGHT == (int)Light::Type::Spotlight, "check enum"); 49 49 50 50 Light::Light(Context* context) : StaticEntity(context) … … 55 55 this->diffuse_ = ColourValue::White; 56 56 this->specular_ = ColourValue::White; 57 this->type_ = Light::Point;57 this->type_ = Type::Point; 58 58 this->attenuation_ = Vector4(100000, 1, 0, 0); 59 59 this->spotlightRange_ = Vector3(40.0f, 30.0f, 1.0f); … … 105 105 void Light::registerVariables() 106 106 { 107 registerVariable( (int&)this->type_,VariableDirection::ToClient, new NetworkCallback<Light>(this, &Light::updateType));107 registerVariable(this->type_, VariableDirection::ToClient, new NetworkCallback<Light>(this, &Light::updateType)); 108 108 registerVariable(this->diffuse_, VariableDirection::ToClient, new NetworkCallback<Light>(this, &Light::updateDiffuseColour)); 109 109 registerVariable(this->specular_, VariableDirection::ToClient, new NetworkCallback<Light>(this, &Light::updateSpecularColour)); … … 126 126 void Light::updateAttenuation() 127 127 { 128 if (this->light_ && this->type_ != Light::Directional)128 if (this->light_ && this->type_ != Type::Directional) 129 129 this->light_->setAttenuation(this->attenuation_.x, this->attenuation_.y, this->attenuation_.z, this->attenuation_.w); 130 130 } … … 132 132 void Light::updateSpotlightRange() 133 133 { 134 if (this->light_ && this->type_ == Light::Spotlight)134 if (this->light_ && this->type_ == Type::Spotlight) 135 135 this->light_->setSpotlightRange(Degree(this->spotlightRange_.x), Degree(this->spotlightRange_.y), this->spotlightRange_.z); 136 136 } … … 139 139 { 140 140 if (type == "point") 141 this->setType( Light::Point);141 this->setType(Type::Point); 142 142 else if (type == "directional") 143 this->setType( Light::Directional);143 this->setType(Type::Directional); 144 144 else if (type == "spotlight") 145 this->setType( Light::Spotlight);145 this->setType(Type::Spotlight); 146 146 else 147 this->setType( Light::Point);147 this->setType(Type::Point); 148 148 } 149 149 … … 152 152 switch (this->type_) 153 153 { 154 case Light::Directional:154 case Type::Directional: 155 155 return "directional"; 156 case Light::Spotlight:156 case Type::Spotlight: 157 157 return "spotlight"; 158 case Light::Point:158 case Type::Point: 159 159 default: 160 160 return "point"; … … 168 168 this->light_->setType(static_cast<Ogre::Light::LightTypes>(this->type_)); 169 169 170 if (this->type_ != Light::Directional)170 if (this->type_ != Type::Directional) 171 171 this->updateAttenuation(); 172 if (this->type_ == Light::Spotlight)172 if (this->type_ == Type::Spotlight) 173 173 this->updateSpotlightRange(); 174 174 } -
code/branches/cpp11_v3/src/orxonox/graphics/Light.h
r11054 r11068 42 42 { 43 43 public: 44 enum LightTypes// Copy from the Ogre enum44 enum class Type // Copy from the Ogre enum 45 45 { 46 46 /// Point light sources give off light equally in all directions, so require only position not direction … … 63 63 { return this->light_; } 64 64 65 inline void setType(Light:: LightTypestype)65 inline void setType(Light::Type type) 66 66 { this->type_ = type; this->updateType(); } 67 inline Light:: LightTypesgetType() const67 inline Light::Type getType() const 68 68 { return this->type_; } 69 69 … … 144 144 145 145 Ogre::Light* light_; 146 Light Typestype_;146 Light::Type type_; 147 147 ColourValue diffuse_; 148 148 ColourValue specular_; -
code/branches/cpp11_v3/src/orxonox/infos/GametypeInfo.cc
r11054 r11068 291 291 if(GameMode::isMaster()) 292 292 { 293 NotificationListener::sendNotification("Press [Fire] to respawn", GametypeInfo::NOTIFICATION_SENDER, notificationMessageType::info, notificationSendMode::network, player->getClientID());293 NotificationListener::sendNotification("Press [Fire] to respawn", GametypeInfo::NOTIFICATION_SENDER, NotificationMessageType::info, NotificationSendMode::network, player->getClientID()); 294 294 // Remove the player from the list of players that have spawned, since it currently is not. 295 295 this->spawnedPlayers_.erase(player); … … 346 346 // Display "Press [Fire] to start the match" if the game has not yet ended. 347 347 if(!this->hasEnded()) 348 NotificationListener::sendNotification("Press [Fire] to start the match", GametypeInfo::NOTIFICATION_SENDER, notificationMessageType::info, notificationSendMode::network, player->getClientID());348 NotificationListener::sendNotification("Press [Fire] to start the match", GametypeInfo::NOTIFICATION_SENDER, NotificationMessageType::info, NotificationSendMode::network, player->getClientID()); 349 349 // Else display "Game has ended". 350 350 else 351 NotificationListener::sendNotification("Game has ended", GametypeInfo::NOTIFICATION_SENDER, notificationMessageType::info, notificationSendMode::network, player->getClientID());351 NotificationListener::sendNotification("Game has ended", GametypeInfo::NOTIFICATION_SENDER, NotificationMessageType::info, NotificationSendMode::network, player->getClientID()); 352 352 } 353 353 } -
code/branches/cpp11_v3/src/orxonox/interfaces/NotificationListener.cc
r11054 r11068 74 74 The type of the notification, can be either 'info' or 'important'. 75 75 */ 76 /*static*/ void NotificationListener::sendNetworkHelper(const std::string& message, const std::string& sender, notificationSendMode::Value sendMode, unsigned int clientId, bool isCommand, notificationMessageType::Value messageType)76 /*static*/ void NotificationListener::sendNetworkHelper(const std::string& message, const std::string& sender, NotificationSendMode sendMode, unsigned int clientId, bool isCommand, NotificationMessageType messageType) 77 77 { 78 78 // If we're in standalone mode or we're already no the right client we create and send the notification/command. 79 if(GameMode::isStandalone() || sendMode == notificationSendMode::local || (sendMode == notificationSendMode::network && Host::getPlayerID() == clientId))79 if(GameMode::isStandalone() || sendMode == NotificationSendMode::local || (sendMode == NotificationSendMode::network && Host::getPlayerID() == clientId)) 80 80 { 81 81 sendHelper(message, sender, isCommand, messageType); 82 82 } 83 83 // If we're on the server (and the server is not the intended recipient of the notification/command) we send it over the network. 84 else if(GameMode::isServer() && sendMode == notificationSendMode::network && Host::getPlayerID() != clientId)84 else if(GameMode::isServer() && sendMode == NotificationSendMode::network && Host::getPlayerID() != clientId) 85 85 { 86 callStaticNetworkFunction(&NotificationListener::sendHelper, clientId, message, sender, isCommand, (unsigned int)messageType);86 callStaticNetworkFunction(&NotificationListener::sendHelper, clientId, message, sender, isCommand, messageType); 87 87 } 88 else if(GameMode::isServer() && sendMode == notificationSendMode::broadcast)88 else if(GameMode::isServer() && sendMode == NotificationSendMode::broadcast) 89 89 { 90 90 // TODO: Works as intended? 91 callStaticNetworkFunction(&NotificationListener::sendHelper, NETWORK_PEER_ID_BROADCAST, message, sender, isCommand, (unsigned int)messageType);91 callStaticNetworkFunction(&NotificationListener::sendHelper, NETWORK_PEER_ID_BROADCAST, message, sender, isCommand, messageType); 92 92 } 93 93 } … … 105 105 The type of the notification. 106 106 */ 107 /*static*/ void NotificationListener::sendHelper(const std::string& message, const std::string& sender, bool isCommand, unsigned int messageType)107 /*static*/ void NotificationListener::sendHelper(const std::string& message, const std::string& sender, bool isCommand, NotificationMessageType type) 108 108 { 109 109 // Iterate through all NotificationListeners and notify them by calling the method they overloaded. … … 112 112 // If the notification is a message. 113 113 if(!isCommand) 114 listener->registerNotification(message, sender, notificationMessageType::Value(messageType));114 listener->registerNotification(message, sender, type); 115 115 116 116 // If the notification is a command. 117 117 if(isCommand) 118 118 { 119 notificationCommand::Valuecommand = str2Command(message);120 if(command != notificationCommand::none)119 NotificationCommand command = str2Command(message); 120 if(command != NotificationCommand::none) 121 121 listener->executeCommand(command, sender); 122 122 } … … 130 130 The string to be converted. 131 131 @return 132 Returns the corresponding enum, notificationCommand::none if the command doesn't exist.132 Returns the corresponding enum, NotificationCommand::none if the command doesn't exist. 133 133 */ 134 /*static*/ notificationCommand::ValueNotificationListener::str2Command(const std::string& string)134 /*static*/ NotificationCommand NotificationListener::str2Command(const std::string& string) 135 135 { 136 notificationCommand::Value command = notificationCommand::none;136 NotificationCommand command = NotificationCommand::none; 137 137 138 138 if(string == NotificationListener::COMMAND_CLEAR) 139 command = notificationCommand::clear;139 command = NotificationCommand::clear; 140 140 141 141 return command; … … 150 150 Returns the corresponding string. 151 151 */ 152 /*static*/ const std::string& NotificationListener::command2Str( notificationCommand::Valuecommand)152 /*static*/ const std::string& NotificationListener::command2Str(NotificationCommand command) 153 153 { 154 154 switch(command) 155 155 { 156 case notificationCommand::clear:156 case NotificationCommand::clear: 157 157 return NotificationListener::COMMAND_CLEAR; 158 158 default: -
code/branches/cpp11_v3/src/orxonox/interfaces/NotificationListener.h
r9667 r11068 49 49 { 50 50 // TODO: Document. 51 namespace notificationMessageType 52 { 53 enum Value { 54 info, 55 important 56 }; 57 } 51 enum class NotificationMessageType { 52 info, 53 important 54 }; 58 55 59 namespace notificationSendMode 60 { 61 enum Value { 62 local, 63 network, 64 broadcast 65 }; 66 } 56 enum class NotificationSendMode { 57 local, 58 network, 59 broadcast 60 }; 67 61 68 namespace notificationCommand 69 { 70 enum Value { 71 none, 72 clear 73 }; 74 } 62 enum class NotificationCommand { 63 none, 64 clear 65 }; 75 66 76 67 // TODO: Update doc. … … 101 92 @param sender The sender that sent the notification. Default is 'none'. 102 93 @param messageType The type of the message, can be either 'info' or 'important'. Default is 'info'. 103 @param sendMode The mode in which the notification is sent, can be 'local' to send the notification to the client where this function is executed, 'network' if the notification is to be sent to the client with the specified clientID, or 'broadcast' if the notification should be sent to all hosts. Default is notificationSendMode::local.94 @param sendMode The mode in which the notification is sent, can be 'local' to send the notification to the client where this function is executed, 'network' if the notification is to be sent to the client with the specified clientID, or 'broadcast' if the notification should be sent to all hosts. Default is NotificationSendMode::local. 104 95 @param clientId The id of the client the notification should be sent to. Default is 0. 105 96 */ 106 static void sendNotification(const std::string& message, const std::string& sender = NotificationListener::NONE, notificationMessageType::Value messageType = notificationMessageType::info, notificationSendMode::Value sendMode = notificationSendMode::local, unsigned int clientId = 0)97 static void sendNotification(const std::string& message, const std::string& sender = NotificationListener::NONE, NotificationMessageType messageType = NotificationMessageType::info, NotificationSendMode sendMode = NotificationSendMode::local, unsigned int clientId = 0) 107 98 { NotificationListener::sendNetworkHelper(message, sender, sendMode, clientId, false, messageType); } 108 99 /** … … 110 101 @param command The command that should be sent (and later executed). 111 102 @param sender The sender that sent the notification. Default is 'none'. 112 @param sendMode The mode in which the command is sent, can be 'local' to send the command to the client where this function is executed, 'network' if the command is to be sent to the client with the specified clientID, or 'broadcast' if the command should be sent to all hosts. Default is notificationSendMode::local.103 @param sendMode The mode in which the command is sent, can be 'local' to send the command to the client where this function is executed, 'network' if the command is to be sent to the client with the specified clientID, or 'broadcast' if the command should be sent to all hosts. Default is NotificationSendMode::local. 113 104 @param clientId The id of the client the command should be sent to. Default is 0. 114 105 */ 115 static void sendCommand(const std::string& command, const std::string& sender = NotificationListener::NONE, notificationSendMode::Value sendMode = notificationSendMode::local, unsigned int clientId = 0)106 static void sendCommand(const std::string& command, const std::string& sender = NotificationListener::NONE, NotificationSendMode sendMode = NotificationSendMode::local, unsigned int clientId = 0) 116 107 { NotificationListener::sendNetworkHelper(command, sender, sendMode, clientId, true); } 117 108 118 static void sendHelper(const std::string& message, const std::string& sender, bool isCommand = false, unsigned int messageMode = 0); // Helper method to register a notification/execute a command with all NotificationListeners after it has been sent over the network.109 static void sendHelper(const std::string& message, const std::string& sender, bool isCommand, NotificationMessageType type); // Helper method to register a notification/execute a command with all NotificationListeners after it has been sent over the network. 119 110 120 111 //TODO: Make protected? … … 128 119 @return Returns true if the notification was successfully registered, false if not. 129 120 */ 130 virtual bool registerNotification(const std::string& message, const std::string& sender, notificationMessageType::Value type)121 virtual bool registerNotification(const std::string& message, const std::string& sender, NotificationMessageType type) 131 122 { return false; } 132 123 /** … … 137 128 @return Returns true if the command was successfully executed, false if not. 138 129 */ 139 virtual bool executeCommand( notificationCommand::Valuecommand, const std::string& sender) { return false; }130 virtual bool executeCommand(NotificationCommand command, const std::string& sender) { return false; } 140 131 141 132 public: … … 149 140 150 141 protected: 151 static void sendNetworkHelper(const std::string& message, const std::string& sender, notificationSendMode::Value sendMode, unsigned int clientId, bool isCommand = false, notificationMessageType::Value messageType = notificationMessageType::info); // Helper method to send both notifications and commands over the network.142 static void sendNetworkHelper(const std::string& message, const std::string& sender, NotificationSendMode sendMode, unsigned int clientId, bool isCommand = false, NotificationMessageType messageType = NotificationMessageType::info); // Helper method to send both notifications and commands over the network. 152 143 153 static notificationCommand::Valuestr2Command(const std::string& string); // Helper method. Converts a string into the enum for a command.154 static const std::string& command2Str( notificationCommand::Valuecommand); // Helper method. Converts a command enum into its corresponding string.144 static NotificationCommand str2Command(const std::string& string); // Helper method. Converts a string into the enum for a command. 145 static const std::string& command2Str(NotificationCommand command); // Helper method. Converts a command enum into its corresponding string. 155 146 }; 156 147 } -
code/branches/cpp11_v3/src/orxonox/interfaces/RadarViewable.cc
r10624 r11068 49 49 , wePtr_(wePtr) 50 50 , radarObjectCamouflage_(0.0f) 51 , radarObjectShape_( Dot)51 , radarObjectShape_(Shape::Dot) 52 52 , radarObjectDescription_("staticObject") 53 53 , scale_(1.0f) -
code/branches/cpp11_v3/src/orxonox/interfaces/RadarViewable.h
r11054 r11068 49 49 { 50 50 public: 51 enum Shape51 enum class Shape 52 52 { 53 53 Square, -
code/branches/cpp11_v3/src/orxonox/items/MultiStateEngine.cc
r11054 r11068 124 124 this->state_ = 0; 125 125 if (this->getShip()->isBoosting() && forward) 126 this->state_ = Boost;126 this->state_ = EngineState::Boost; 127 127 else if (forward && !this->state_) // this->state_ == Boost 128 this->state_ = Normal;128 this->state_ = EngineState::Normal; 129 129 else if (direction.z > 0.0 && velocity.z < 0.0) 130 this->state_ = Brake;130 this->state_ = EngineState::Brake; 131 131 else 132 this->state_ = Idle;133 134 if (this->state_ == Idle && this->getSpeedAdd() > 0)135 this->state_ = Normal;132 this->state_ = EngineState::Idle; 133 134 if (this->state_ == EngineState::Idle && this->getSpeedAdd() > 0) 135 this->state_ = EngineState::Normal; 136 136 } 137 137 … … 141 141 142 142 float pitch = velocity.length(); 143 if (this->state_ & Normal)143 if (this->state_ & EngineState::Normal) 144 144 defEngineSndNormal_->setPitch(clamp(pitch/MAX_VELOCITY_NORMAL + 1, 0.5f, 2.0f)); 145 if (this->state_ & Boost)145 if (this->state_ & EngineState::Boost) 146 146 defEngineSndBoost_->setPitch(clamp(pitch/MAX_VELOCITY_BOOST + 1, 0.5f, 2.0f)); 147 147 148 if (changes & Idle)149 { 150 lua_pushboolean(this->lua_->getInternalLuaState(), this->state_ & Idle);148 if (changes & EngineState::Idle) 149 { 150 lua_pushboolean(this->lua_->getInternalLuaState(), this->state_ & EngineState::Idle); 151 151 lua_setglobal(this->lua_->getInternalLuaState(), "idle"); 152 152 } 153 if (changes & Normal)154 { 155 lua_pushboolean(this->lua_->getInternalLuaState(), this->state_ & Normal);153 if (changes & EngineState::Normal) 154 { 155 lua_pushboolean(this->lua_->getInternalLuaState(), this->state_ & EngineState::Normal); 156 156 lua_setglobal(this->lua_->getInternalLuaState(), "normal"); 157 if (this->state_ & Normal)157 if (this->state_ & EngineState::Normal) 158 158 defEngineSndNormal_->play(); 159 159 else 160 160 defEngineSndNormal_->stop(); 161 161 } 162 if (changes & Brake)163 { 164 lua_pushboolean(this->lua_->getInternalLuaState(), this->state_ & Brake);162 if (changes & EngineState::Brake) 163 { 164 lua_pushboolean(this->lua_->getInternalLuaState(), this->state_ & EngineState::Brake); 165 165 lua_setglobal(this->lua_->getInternalLuaState(), "brake"); 166 166 } 167 if (changes & Boost)168 { 169 lua_pushboolean(this->lua_->getInternalLuaState(), this->state_ & Boost);167 if (changes & EngineState::Boost) 168 { 169 lua_pushboolean(this->lua_->getInternalLuaState(), this->state_ & EngineState::Boost); 170 170 lua_setglobal(this->lua_->getInternalLuaState(), "boost"); 171 if (this->state_ & Boost)171 if (this->state_ & EngineState::Boost) 172 172 defEngineSndBoost_->play(); 173 173 else -
code/branches/cpp11_v3/src/orxonox/items/MultiStateEngine.h
r11054 r11068 41 41 { 42 42 public: 43 enumEngineState43 struct EngineState 44 44 { 45 Idle = 1,46 Normal = 2,47 Brake = 4,48 Boost = 845 static constexpr int Idle = 1; 46 static constexpr int Normal = 2; 47 static constexpr int Brake = 4; 48 static constexpr int Boost = 8; 49 49 }; 50 50 -
code/branches/cpp11_v3/src/orxonox/items/PartDestructionEvent.cc
r10262 r11068 98 98 { 99 99 switch (this->targetParam_) { 100 case shieldhealth:100 case TargetParam::shieldhealth: 101 101 this->parent_->getParent()->setShieldHealth(operate(this->parent_->getParent()->getShieldHealth())); 102 102 break; 103 case boostpower:103 case TargetParam::boostpower: 104 104 this->parent_->getParent()->setInitialBoostPower(operate(this->parent_->getParent()->getInitialBoostPower())); 105 105 break; 106 case boostpowerrate:106 case TargetParam::boostpowerrate: 107 107 this->parent_->getParent()->setBoostPowerRate(operate(this->parent_->getParent()->getBoostPowerRate())); 108 108 break; 109 case rotationthrust:109 case TargetParam::rotationthrust: 110 110 this->parent_->getParent()->setRotationThrust(operate(this->parent_->getParent()->getRotationThrust())); 111 111 break; … … 120 120 { 121 121 switch (this->targetParam_) { 122 case null:122 case TargetParam::null: 123 123 this->parent_->getParent()->getEngineByName(targetName_)->destroy(); 124 124 break; 125 case boostfactor:125 case TargetParam::boostfactor: 126 126 this->parent_->getParent()->getEngineByName(targetName_)->setBoostFactor(operate(this->parent_->getParent()->getEngineByName(targetName_)->getBoostFactor())); 127 127 break; 128 case speedfront:128 case TargetParam::speedfront: 129 129 this->parent_->getParent()->getEngineByName(targetName_)->setMaxSpeedFront(operate(this->parent_->getParent()->getEngineByName(targetName_)->getMaxSpeedFront())); 130 130 break; 131 case accelerationfront:131 case TargetParam::accelerationfront: 132 132 this->parent_->getParent()->getEngineByName(targetName_)->setAccelerationFront(operate(this->parent_->getParent()->getEngineByName(targetName_)->getAccelerationFront())); 133 133 break; … … 142 142 { 143 143 switch (this->targetParam_) { 144 case null:144 case TargetParam::null: 145 145 if (!this->parent_->getParent()->getShipPartByName(targetName_)) 146 146 return; … … 214 214 if (param == "NULL") 215 215 { 216 this->targetParam_ = null;216 this->targetParam_ = TargetParam::null; 217 217 return; 218 218 } 219 219 if (param == "boostfactor") 220 220 { 221 this->targetParam_ = boostfactor;221 this->targetParam_ = TargetParam::boostfactor; 222 222 return; 223 223 } 224 224 if (param == "speedfront") 225 225 { 226 this->targetParam_ = speedfront;226 this->targetParam_ = TargetParam::speedfront; 227 227 return; 228 228 } 229 229 if (param == "accelerationfront") 230 230 { 231 this->targetParam_ = accelerationfront;231 this->targetParam_ = TargetParam::accelerationfront; 232 232 return; 233 233 } … … 244 244 if (param == "shieldhealth") 245 245 { 246 this->targetParam_ = shieldhealth;246 this->targetParam_ = TargetParam::shieldhealth; 247 247 return; 248 248 } 249 249 if (param == "boostpower") 250 250 { 251 this->targetParam_ = boostpower;251 this->targetParam_ = TargetParam::boostpower; 252 252 return; 253 253 } 254 254 if (param == "boostpowerrate") 255 255 { 256 this->targetParam_ = boostpowerrate;256 this->targetParam_ = TargetParam::boostpowerrate; 257 257 return; 258 258 } 259 259 if (param == "rotationthrust") 260 260 { 261 this->targetParam_ = rotationthrust;261 this->targetParam_ = TargetParam::rotationthrust; 262 262 return; 263 263 } … … 271 271 if (param == "NULL") 272 272 { 273 this->targetParam_ = null;273 this->targetParam_ = TargetParam::null; 274 274 return; 275 275 } -
code/branches/cpp11_v3/src/orxonox/items/PartDestructionEvent.h
r11054 r11068 82 82 List of all allowed parameters. 83 83 */ 84 enum TargetParam84 enum class TargetParam 85 85 { 86 86 shieldhealth, -
code/branches/cpp11_v3/src/orxonox/overlays/InGameConsole.cc
r11054 r11068 292 292 293 293 for (int i = LINES - 1; i > max; --i) 294 this->print("", Shell:: DebugOutput, i, true);294 this->print("", Shell::LineType::DebugOutput, i, true); 295 295 296 296 for (int i = max; i >= 1; --i) … … 318 318 { 319 319 if (LINES > 0) 320 this->print(this->shell_->getInput(), Shell:: Input, 0);320 this->print(this->shell_->getInput(), Shell::LineType::Input, 0); 321 321 322 322 if (this->shell_->getInput().empty()) … … 342 342 void InGameConsole::executed() 343 343 { 344 this->shell_->addOutput(this->shell_->getInput(), Shell:: Command);344 this->shell_->addOutput(this->shell_->getInput(), Shell::LineType::Command); 345 345 } 346 346 … … 562 562 switch (type) 563 563 { 564 case Shell:: Message:565 case Shell:: DebugOutput: colourTop = ColourValue(0.9f, 0.9f, 0.9f); break;566 567 case Shell:: UserError: colourTop = ColourValue(0.9f, 0.0f, 0.0f); break;568 case Shell:: UserWarning: colourTop = ColourValue(0.9f, 0.5f, 0.0f); break;569 case Shell:: UserStatus: colourTop = ColourValue(0.0f, 0.9f, 0.0f); break;570 case Shell:: UserInfo: colourTop = ColourValue(0.0f, 0.8f, 0.8f); break;571 572 case Shell:: InternalError: colourTop = ColourValue(0.5f, 0.0f, 0.0f); break;573 case Shell:: InternalWarning: colourTop = ColourValue(0.5f, 0.2f, 0.0f); break;574 case Shell:: InternalStatus: colourTop = ColourValue(0.0f, 0.5f, 0.0f); break;575 case Shell:: InternalInfo: colourTop = ColourValue(0.0f, 0.4f, 0.4f); break;576 577 case Shell:: Verbose: colourTop = ColourValue(0.3f, 0.3f, 0.9f); break;578 case Shell:: VerboseMore: colourTop = ColourValue(0.2f, 0.2f, 0.7f); break;579 case Shell:: VerboseUltra: colourTop = ColourValue(0.1f, 0.1f, 0.5f); break;580 581 case Shell:: Command: colourTop = ColourValue(0.8f, 0.2f, 0.8f); break;582 case Shell:: Hint: colourTop = ColourValue(0.4f, 0.0f, 0.4f); break;583 case Shell:: Input: colourTop = ColourValue(0.9f, 0.9f, 0.9f); break;584 585 default: colourTop = ColourValue(0.5f, 0.5f, 0.5f); break;564 case Shell::LineType::Message: 565 case Shell::LineType::DebugOutput: colourTop = ColourValue(0.9f, 0.9f, 0.9f); break; 566 567 case Shell::LineType::UserError: colourTop = ColourValue(0.9f, 0.0f, 0.0f); break; 568 case Shell::LineType::UserWarning: colourTop = ColourValue(0.9f, 0.5f, 0.0f); break; 569 case Shell::LineType::UserStatus: colourTop = ColourValue(0.0f, 0.9f, 0.0f); break; 570 case Shell::LineType::UserInfo: colourTop = ColourValue(0.0f, 0.8f, 0.8f); break; 571 572 case Shell::LineType::InternalError: colourTop = ColourValue(0.5f, 0.0f, 0.0f); break; 573 case Shell::LineType::InternalWarning: colourTop = ColourValue(0.5f, 0.2f, 0.0f); break; 574 case Shell::LineType::InternalStatus: colourTop = ColourValue(0.0f, 0.5f, 0.0f); break; 575 case Shell::LineType::InternalInfo: colourTop = ColourValue(0.0f, 0.4f, 0.4f); break; 576 577 case Shell::LineType::Verbose: colourTop = ColourValue(0.3f, 0.3f, 0.9f); break; 578 case Shell::LineType::VerboseMore: colourTop = ColourValue(0.2f, 0.2f, 0.7f); break; 579 case Shell::LineType::VerboseUltra: colourTop = ColourValue(0.1f, 0.1f, 0.5f); break; 580 581 case Shell::LineType::Command: colourTop = ColourValue(0.8f, 0.2f, 0.8f); break; 582 case Shell::LineType::Hint: colourTop = ColourValue(0.4f, 0.0f, 0.4f); break; 583 case Shell::LineType::Input: colourTop = ColourValue(0.9f, 0.9f, 0.9f); break; 584 585 default: colourTop = ColourValue(0.5f, 0.5f, 0.5f); break; 586 586 } 587 587 -
code/branches/cpp11_v3/src/orxonox/overlays/OrxonoxOverlay.cc
r11054 r11068 94 94 this->angle_ = Degree(0.0); 95 95 this->bCorrectAspect_ = false; 96 this->rotState_ = Horizontal;96 this->rotState_ = RotationState::Horizontal; 97 97 this->angleChanged(); // updates all other values as well 98 98 … … 259 259 { 260 260 tempAspect = 1.0f / this->windowAspectRatio_; 261 rotState_ = Vertical;261 rotState_ = RotationState::Vertical; 262 262 } 263 263 else if (angle > 179 || angle < 1) 264 264 { 265 265 tempAspect = this->windowAspectRatio_; 266 rotState_ = Horizontal;266 rotState_ = RotationState::Horizontal; 267 267 } 268 268 else 269 269 { 270 270 tempAspect = 1.0f; 271 rotState_ = Inbetween;271 rotState_ = RotationState::Inbetween; 272 272 } 273 273 -
code/branches/cpp11_v3/src/orxonox/overlays/OrxonoxOverlay.h
r11061 r11068 79 79 and in between is everything else. 80 80 */ 81 enum RotationState81 enum class RotationState 82 82 { 83 83 Horizontal, -
code/branches/cpp11_v3/src/orxonox/sound/BaseSound.cc
r11054 r11068 49 49 , volume_(0.7) 50 50 , bLooping_(false) 51 , state_(St opped)51 , state_(State::Stopped) 52 52 , pitch_ (1.0) 53 53 { … … 63 63 BaseSound::~BaseSound() 64 64 { 65 if (this->state_ != St opped)65 if (this->state_ != State::Stopped) 66 66 this->stop(); 67 67 // Release buffer … … 83 83 void BaseSound::doPlay() 84 84 { 85 this->state_ = Playing;85 this->state_ = State::Playing; 86 86 if (GameMode::playsSound() && this->getSourceState() != AL_PLAYING && this->soundBuffer_ != nullptr) 87 87 { … … 102 102 bool BaseSound::doStop() 103 103 { 104 this->state_ = St opped;104 this->state_ = State::Stopped; 105 105 if (alIsSource(this->audioSource_)) 106 106 { … … 123 123 if (this->isStopped()) 124 124 return; 125 this->state_ = Paused;125 this->state_ = State::Paused; 126 126 if (alIsSource(this->audioSource_)) 127 127 alSourcePause(this->audioSource_); … … 256 256 else // No source acquired so far, but might be set to playing or paused 257 257 { 258 State state = static_cast<State>(this->state_); // save258 State state = this->state_; // save 259 259 if (this->isPlaying() || this->isPaused()) 260 260 doPlay(); 261 if (state == Paused)262 { 263 this->state_ = Paused;261 if (state == State::Paused) 262 { 263 this->state_ = State::Paused; 264 264 doPause(); 265 265 } … … 271 271 switch (this->state_) 272 272 { 273 case Playing:273 case State::Playing: 274 274 this->play(); 275 275 break; 276 case Paused:276 case State::Paused: 277 277 this->pause(); 278 278 break; 279 case St opped:279 case State::Stopped: 280 280 default: 281 281 this->stop(); -
code/branches/cpp11_v3/src/orxonox/sound/BaseSound.h
r11054 r11068 54 54 virtual void pause() { this->doPause(); } 55 55 56 bool isPlaying() const { return this->state_ == Playing; }57 bool isPaused() const { return this->state_ == Paused; }58 bool isStopped() const { return this->state_ == St opped; }56 bool isPlaying() const { return this->state_ == State::Playing; } 57 bool isPaused() const { return this->state_ == State::Paused; } 58 bool isStopped() const { return this->state_ == State::Stopped; } 59 59 60 60 virtual void setSource(const std::string& source); … … 76 76 77 77 protected: 78 enum State78 enum class State 79 79 { 80 80 Stopped, … … 111 111 float volume_; 112 112 bool bLooping_; 113 uint8_tstate_; // This Variable is actually of type State113 State state_; // This Variable is actually of type State 114 114 float pitch_; 115 115 -
code/branches/cpp11_v3/src/orxonox/sound/WorldSound.cc
r9939 r11068 58 58 registerVariable(bLooping_, ObjectDirection::ToClient, new NetworkCallback<WorldSound>(this, &WorldSound::loopingChanged)); 59 59 registerVariable(pitch_, ObjectDirection::ToClient, new NetworkCallback<WorldSound>(this, &WorldSound::pitchChanged)); 60 registerVariable( (uint8_t&)(BaseSound::state_), ObjectDirection::ToClient, new NetworkCallback<WorldSound>(this, &WorldSound::stateChanged));60 registerVariable(BaseSound::state_, ObjectDirection::ToClient, new NetworkCallback<WorldSound>(this, &WorldSound::stateChanged)); 61 61 } 62 62 -
code/branches/cpp11_v3/src/orxonox/worldentities/Drone.cc
r11054 r11068 49 49 this->localAngularAcceleration_.setValue(0, 0, 0); 50 50 this->setRadarVisibility(false); 51 this->setCollisionType(WorldEntity:: Dynamic);51 this->setCollisionType(WorldEntity::CollisionType::Dynamic); 52 52 53 53 myController_ = new DroneController(this->getContext()); //!< Creates a new controller and passes our this pointer to it as creator. -
code/branches/cpp11_v3/src/orxonox/worldentities/MobileEntity.cc
r9667 r11068 189 189 bool MobileEntity::isCollisionTypeLegal(WorldEntity::CollisionType type) const 190 190 { 191 if (type == WorldEntity:: Static)191 if (type == WorldEntity::CollisionType::Static) 192 192 { 193 193 orxout(internal_warning) << "Cannot tell a MobileEntity to have static collision type! Ignoring." << endl; -
code/branches/cpp11_v3/src/orxonox/worldentities/StaticEntity.cc
r9667 r11068 95 95 bool StaticEntity::isCollisionTypeLegal(WorldEntity::CollisionType type) const 96 96 { 97 if (type == WorldEntity:: Kinematic || type == WorldEntity::Dynamic)97 if (type == WorldEntity::CollisionType::Kinematic || type == WorldEntity::CollisionType::Dynamic) 98 98 { 99 99 orxout(internal_warning) << "Cannot tell a StaticEntity to have kinematic or dynamic collision type! Ignoring." << endl; -
code/branches/cpp11_v3/src/orxonox/worldentities/WorldEntity.cc
r11054 r11068 56 56 57 57 // Be sure we don't do bad conversions 58 static_assert((int)Ogre::Node::TS_LOCAL == (int)WorldEntity:: Local, "check enum");59 static_assert((int)Ogre::Node::TS_PARENT == (int)WorldEntity:: Parent, "check enum");60 static_assert((int)Ogre::Node::TS_WORLD == (int)WorldEntity:: World, "check enum");58 static_assert((int)Ogre::Node::TS_LOCAL == (int)WorldEntity::TransformSpace::Local, "check enum"); 59 static_assert((int)Ogre::Node::TS_PARENT == (int)WorldEntity::TransformSpace::Parent, "check enum"); 60 static_assert((int)Ogre::Node::TS_WORLD == (int)WorldEntity::TransformSpace::World, "check enum"); 61 61 62 62 RegisterAbstractClass(WorldEntity).inheritsFrom<BaseObject>().inheritsFrom<Synchronisable>(); … … 95 95 this->collisionShape_ = new WorldEntityCollisionShape(this->getContext()); 96 96 this->collisionShape_->setWorldEntityOwner(this); 97 this->collisionType_ = None;98 this->collisionTypeSynchronised_ = None;97 this->collisionType_ = CollisionType::None; 98 this->collisionTypeSynchronised_ = CollisionType::None; 99 99 this->mass_ = 1.0f; 100 100 this->childrenMass_ = 0; … … 207 207 registerVariable(this->bCollisionResponseActive_, 208 208 VariableDirection::ToClient, new NetworkCallback<WorldEntity>(this, &WorldEntity::collisionResponseActivityChanged)); 209 registerVariable( (int&)this->collisionTypeSynchronised_,209 registerVariable(this->collisionTypeSynchronised_, 210 210 VariableDirection::ToClient, new NetworkCallback<WorldEntity>(this, &WorldEntity::collisionTypeChanged)); 211 211 registerVariable(this->bPhysicsActiveSynchronised_, … … 322 322 void WorldEntity::collisionTypeChanged() 323 323 { 324 if (this->collisionTypeSynchronised_ != Dynamic &&325 this->collisionTypeSynchronised_ != Kinematic &&326 this->collisionTypeSynchronised_ != Static &&327 this->collisionTypeSynchronised_ != None)324 if (this->collisionTypeSynchronised_ != CollisionType::Dynamic && 325 this->collisionTypeSynchronised_ != CollisionType::Kinematic && 326 this->collisionTypeSynchronised_ != CollisionType::Static && 327 this->collisionTypeSynchronised_ != CollisionType::None) 328 328 { 329 329 orxout(internal_error) << "Error when collsion Type was received over network. Unknown enum value:" << this->collisionTypeSynchronised_ << endl; … … 681 681 switch (relativeTo) 682 682 { 683 case WorldEntity::Local:683 case TransformSpace::Local: 684 684 // position is relative to parent so transform downwards 685 685 this->setPosition(this->getPosition() + this->getOrientation() * distance); 686 686 break; 687 case WorldEntity::Parent:687 case TransformSpace::Parent: 688 688 this->setPosition(this->getPosition() + distance); 689 689 break; 690 case WorldEntity::World:690 case TransformSpace::World: 691 691 // position is relative to parent so transform upwards 692 692 if (this->node_->getParent()) … … 711 711 switch(relativeTo) 712 712 { 713 case WorldEntity::Local:713 case TransformSpace::Local: 714 714 this->setOrientation(this->getOrientation() * rotation); 715 715 break; 716 case WorldEntity::Parent:716 case TransformSpace::Parent: 717 717 // Rotations are normally relative to local axes, transform up 718 718 this->setOrientation(rotation * this->getOrientation()); 719 719 break; 720 case WorldEntity::World:720 case TransformSpace::World: 721 721 // Rotations are normally relative to local axes, transform up 722 722 this->setOrientation(this->getOrientation() * this->getWorldOrientation().Inverse() … … 741 741 switch (relativeTo) 742 742 { 743 case WorldEntity::Local:743 case TransformSpace::Local: 744 744 origin = Vector3::ZERO; 745 745 break; 746 case WorldEntity::Parent:746 case TransformSpace::Parent: 747 747 origin = this->getPosition(); 748 748 break; 749 case WorldEntity::World:749 case TransformSpace::World: 750 750 origin = this->getWorldPosition(); 751 751 break; … … 831 831 832 832 // Check whether we have to create or destroy. 833 if (type != None && this->collisionType_ ==None)833 if (type != CollisionType::None && this->collisionType_ == CollisionType::None) 834 834 { 835 835 /* … … 849 849 this->physicalBody_->setActivationState(DISABLE_DEACTIVATION); 850 850 } 851 else if (type == None && this->collisionType_ !=None)851 else if (type == CollisionType::None && this->collisionType_ != CollisionType::None) 852 852 { 853 853 // Destroy rigid body … … 856 856 delete this->physicalBody_; 857 857 this->physicalBody_ = nullptr; 858 this->collisionType_ = None;859 this->collisionTypeSynchronised_ = None;858 this->collisionType_ = CollisionType::None; 859 this->collisionTypeSynchronised_ = CollisionType::None; 860 860 return; 861 861 } … … 864 864 switch (type) 865 865 { 866 case Dynamic:866 case CollisionType::Dynamic: 867 867 this->physicalBody_->setCollisionFlags(this->physicalBody_->getCollisionFlags() & !btCollisionObject::CF_STATIC_OBJECT & !btCollisionObject::CF_KINEMATIC_OBJECT); 868 868 break; 869 case Kinematic:869 case CollisionType::Kinematic: 870 870 this->physicalBody_->setCollisionFlags((this->physicalBody_->getCollisionFlags() & !btCollisionObject::CF_STATIC_OBJECT) | btCollisionObject::CF_KINEMATIC_OBJECT); 871 871 break; 872 case Static:872 case CollisionType::Static: 873 873 this->physicalBody_->setCollisionFlags((this->physicalBody_->getCollisionFlags() & !btCollisionObject::CF_KINEMATIC_OBJECT) | btCollisionObject::CF_STATIC_OBJECT); 874 874 break; 875 case None:875 case CollisionType::None: 876 876 assert(false); // Doesn't happen 877 877 return; … … 895 895 CollisionType type; 896 896 if (typeStrLower == "dynamic") 897 type = Dynamic;897 type = CollisionType::Dynamic; 898 898 else if (typeStrLower == "static") 899 type = Static;899 type = CollisionType::Static; 900 900 else if (typeStrLower == "kinematic") 901 type = Kinematic;901 type = CollisionType::Kinematic; 902 902 else if (typeStrLower == "none") 903 type = None;903 type = CollisionType::None; 904 904 else 905 905 ThrowException(ParseError, std::string("Attempting to set an unknown collision type: '") + typeStr + "'."); … … 912 912 switch (this->getCollisionType()) 913 913 { 914 case Dynamic:914 case CollisionType::Dynamic: 915 915 return "dynamic"; 916 case Kinematic:916 case CollisionType::Kinematic: 917 917 return "kinematic"; 918 case Static:918 case CollisionType::Static: 919 919 return "static"; 920 case None:920 case CollisionType::None: 921 921 return "none"; 922 922 default: -
code/branches/cpp11_v3/src/orxonox/worldentities/WorldEntity.h
r11054 r11068 82 82 Enumeration denoting the spaces which a transform can be relative to. 83 83 */ 84 enum TransformSpace84 enum class TransformSpace 85 85 { 86 86 //! Transform is relative to the local space … … 117 117 const Vector3& getWorldPosition() const; 118 118 119 void translate(const Vector3& distance, TransformSpace relativeTo = WorldEntity::Parent);120 inline void translate(float x, float y, float z, TransformSpace relativeTo = WorldEntity::Parent)119 void translate(const Vector3& distance, TransformSpace relativeTo = TransformSpace::Parent); 120 inline void translate(float x, float y, float z, TransformSpace relativeTo = TransformSpace::Parent) 121 121 { this->translate(Vector3(x, y, z), relativeTo); } 122 122 … … 134 134 const Quaternion& getWorldOrientation() const; 135 135 136 void rotate(const Quaternion& rotation, TransformSpace relativeTo = WorldEntity::Local);137 inline void rotate(const Vector3& axis, const Degree& angle, TransformSpace relativeTo = WorldEntity::Local)136 void rotate(const Quaternion& rotation, TransformSpace relativeTo = TransformSpace::Local); 137 inline void rotate(const Vector3& axis, const Degree& angle, TransformSpace relativeTo = TransformSpace::Local) 138 138 { this->rotate(Quaternion(angle, axis), relativeTo); } 139 139 140 inline void yaw(const Degree& angle, TransformSpace relativeTo = WorldEntity::Local)140 inline void yaw(const Degree& angle, TransformSpace relativeTo = TransformSpace::Local) 141 141 { this->rotate(Quaternion(angle, Vector3::UNIT_Y), relativeTo); } 142 inline void pitch(const Degree& angle, TransformSpace relativeTo = WorldEntity::Local)142 inline void pitch(const Degree& angle, TransformSpace relativeTo = TransformSpace::Local) 143 143 { this->rotate(Quaternion(angle, Vector3::UNIT_X), relativeTo); } 144 inline void roll(const Degree& angle, TransformSpace relativeTo = WorldEntity::Local)144 inline void roll(const Degree& angle, TransformSpace relativeTo = TransformSpace::Local) 145 145 { this->rotate(Quaternion(angle, Vector3::UNIT_Z), relativeTo); } 146 146 147 void lookAt(const Vector3& target, TransformSpace relativeTo = WorldEntity::Parent, const Vector3& localDirectionVector = Vector3::NEGATIVE_UNIT_Z);148 void setDirection(const Vector3& direction, TransformSpace relativeTo = WorldEntity::Local, const Vector3& localDirectionVector = Vector3::NEGATIVE_UNIT_Z);149 inline void setDirection(float x, float y, float z, TransformSpace relativeTo = WorldEntity::Local, const Vector3& localDirectionVector = Vector3::NEGATIVE_UNIT_Z)147 void lookAt(const Vector3& target, TransformSpace relativeTo = TransformSpace::Parent, const Vector3& localDirectionVector = Vector3::NEGATIVE_UNIT_Z); 148 void setDirection(const Vector3& direction, TransformSpace relativeTo = TransformSpace::Local, const Vector3& localDirectionVector = Vector3::NEGATIVE_UNIT_Z); 149 inline void setDirection(float x, float y, float z, TransformSpace relativeTo = TransformSpace::Local, const Vector3& localDirectionVector = Vector3::NEGATIVE_UNIT_Z) 150 150 { this->setDirection(Vector3(x, y, z), relativeTo, localDirectionVector); } 151 151 … … 257 257 None: The object has no physics at all. 258 258 */ 259 enum CollisionType259 enum class CollisionType 260 260 { 261 261 Dynamic, … … 266 266 267 267 //! Tells whether the object has any connection to the Bullet physics engine. If hasPhysics() is false, the object may still have a velocity. 268 bool hasPhysics() const { return getCollisionType() != None ; }268 bool hasPhysics() const { return getCollisionType() != CollisionType::None ; } 269 269 //! @see CollisionType 270 bool isStatic() const { return getCollisionType() == Static ; }270 bool isStatic() const { return getCollisionType() == CollisionType::Static ; } 271 271 //! @see CollisionType 272 bool isKinematic() const { return getCollisionType() == Kinematic; }272 bool isKinematic() const { return getCollisionType() == CollisionType::Kinematic; } 273 273 //! @see CollisionType 274 bool isDynamic() const { return getCollisionType() == Dynamic ; }274 bool isDynamic() const { return getCollisionType() == CollisionType::Dynamic ; } 275 275 //! Tells whether physics has been activated (you can temporarily deactivate it) 276 276 bool isPhysicsActive() const { return this->bPhysicsActive_; } -
code/branches/cpp11_v3/src/orxonox/worldentities/pawns/FpsPlayer.cc
r11054 r11068 79 79 // FpsPlayer is always a physical object per default 80 80 // Be aware of this call: The collision type legality check will not reach derived classes! 81 this->setCollisionType(WorldEntity:: Dynamic);81 this->setCollisionType(WorldEntity::CollisionType::Dynamic); 82 82 // Get notification about collisions 83 83 this->enableCollisionCallback(); … … 130 130 bool FpsPlayer::isCollisionTypeLegal(WorldEntity::CollisionType type) const 131 131 { 132 if (type != WorldEntity:: Dynamic)132 if (type != WorldEntity::CollisionType::Dynamic) 133 133 { 134 134 orxout(internal_warning) << "Cannot tell a FpsPlayer not to be dynamic! Ignoring." << endl; … … 168 168 if (!this->isInMouseLook()) 169 169 { 170 this->yaw(Radian(this->yaw_ * this->getMouseLookSpeed()), WorldEntity:: Parent);170 this->yaw(Radian(this->yaw_ * this->getMouseLookSpeed()), WorldEntity::TransformSpace::Parent); 171 171 172 172 Radian pitch = this->cameraPositionRootNode_->getOrientation().getPitch(); -
code/branches/cpp11_v3/src/orxonox/worldentities/pawns/Pawn.cc
r11062 r11068 97 97 98 98 this->setRadarObjectColour(ColourValue::Red); 99 this->setRadarObjectShape(RadarViewable:: Dot);99 this->setRadarObjectShape(RadarViewable::Shape::Dot); 100 100 101 101 this->registerVariables(); -
code/branches/cpp11_v3/src/orxonox/worldentities/pawns/SpaceShip.cc
r11054 r11068 80 80 // SpaceShip is always a physical object per default 81 81 // Be aware of this call: The collision type legality check will not reach derived classes! 82 this->setCollisionType(WorldEntity:: Dynamic);82 this->setCollisionType(WorldEntity::CollisionType::Dynamic); 83 83 // Get notification about collisions 84 84 this->enableCollisionCallback(); … … 145 145 bool SpaceShip::isCollisionTypeLegal(WorldEntity::CollisionType type) const 146 146 { 147 if (type != WorldEntity:: Dynamic)147 if (type != WorldEntity::CollisionType::Dynamic) 148 148 { 149 149 orxout(internal_warning) << "Cannot tell a SpaceShip not to be dynamic! Ignoring." << endl; -
code/branches/cpp11_v3/src/orxonox/worldentities/pawns/TeamBaseMatchBase.cc
r11054 r11068 51 51 } 52 52 53 this->setRadarObjectShape(RadarViewable:: Triangle);53 this->setRadarObjectShape(RadarViewable::Shape::Triangle); 54 54 } 55 55 -
code/branches/cpp11_v3/src/orxonox/worldentities/pawns/TeamBaseMatchBase.h
r9667 r11068 36 36 namespace orxonox 37 37 { 38 namespaceBaseState38 enum class BaseState 39 39 { 40 enum Value 41 { 42 Uncontrolled, 43 ControlTeam1, 44 ControlTeam2, 45 }; 46 } 40 Uncontrolled, 41 ControlTeam1, 42 ControlTeam2, 43 }; 47 44 48 45 … … 58 55 59 56 // Set the state of a base to whatever the argument of the function is 60 void setState(BaseState ::Valuestate)57 void setState(BaseState state) 61 58 { 62 59 this->state_ = state; … … 66 63 67 64 // Get the state of a base as a return value 68 BaseState ::ValuegetState() const65 BaseState getState() const 69 66 { 70 67 return this->state_; … … 75 72 void changeTeamColour(); 76 73 77 BaseState ::Valuestate_;74 BaseState state_; 78 75 }; 79 76 } -
code/branches/cpp11_v3/test/util/MultiTypeTest.cc
r10197 r11068 697 697 EXPECT_TRUE(mt.null()); 698 698 } 699 700 /////////////////////////////// 701 // Strongly typed enum class // 702 /////////////////////////////// 703 enum class EnumWithChar : unsigned char 704 { 705 ValueA = 'A', 706 ValueB = 'B', 707 ValueC = 'C', 708 }; 709 enum class EnumWithInt 710 { 711 Value1 = 50, 712 Value2 = 0, 713 Value3, 714 }; 715 716 TEST(MultiType, Enum_Constructor) 717 { 718 // Constructor: 719 { 720 MultiType mt = EnumWithChar::ValueA; 721 722 EXPECT_TRUE(mt.isType<EnumWithChar>()); 723 EXPECT_EQ(EnumWithChar::ValueA, mt.get<EnumWithChar>()); 724 } 725 { 726 MultiType mt = MultiType(EnumWithInt::Value1); 727 728 EXPECT_TRUE(mt.isType<EnumWithInt>()); 729 EXPECT_EQ(EnumWithInt::Value1, mt.get<EnumWithInt>()); 730 } 731 } 732 733 TEST(MultiType, Enum_Assignment) 734 { 735 // operator=: 736 MultiType mt; 737 mt = EnumWithChar::ValueB; 738 739 EXPECT_TRUE(mt.isType<EnumWithChar>()); 740 EXPECT_EQ(EnumWithChar::ValueB, mt.get<EnumWithChar>()); 741 } 742 743 TEST(MultiType, Enum_Set) 744 { 745 // set(value): 746 { 747 MultiType mt; 748 mt.set(EnumWithInt::Value2); // assign enum to an empty MultiType 749 750 EXPECT_TRUE(mt.isType<EnumWithInt>()); 751 EXPECT_EQ(EnumWithInt::Value2, mt.get<EnumWithInt>()); 752 } 753 { 754 MultiType mt = "string"; 755 mt.set(EnumWithChar::ValueC); // assign enum to a MultiType with type std::string 756 757 EXPECT_TRUE(mt.isType<std::string>()); 758 EXPECT_EQ("C", mt.get<std::string>()); 759 } 760 { 761 MultiType mt = EnumWithChar::ValueA; 762 mt.set(EnumWithChar::ValueB); // assign enum to a MultiType with type std::string 763 764 EXPECT_TRUE(mt.isType<EnumWithChar>()); 765 EXPECT_EQ(EnumWithChar::ValueB, mt.get<EnumWithChar>()); 766 } 767 { 768 MultiType mt = EnumWithInt::Value3; 769 mt.set("50"); // assign enum to a MultiType with type std::string 770 771 EXPECT_TRUE(mt.isType<EnumWithInt>()); 772 EXPECT_EQ(EnumWithInt::Value1, mt.get<EnumWithInt>()); 773 } 774 } 775 776 TEST(MultiType, Enum_Force) 777 { 778 // force(value): 779 { 780 MultiType mt = "string"; 781 EXPECT_TRUE(mt.isType<std::string>()); 782 EXPECT_EQ("string", mt.get<std::string>()); 783 784 mt.force<EnumWithChar>("C"); 785 786 EXPECT_TRUE(mt.isType<EnumWithChar>()); 787 EXPECT_EQ(EnumWithChar::ValueC, mt.get<EnumWithChar>()); 788 } 789 { 790 MultiType mt = EnumWithChar::ValueA; 791 EXPECT_TRUE(mt.isType<EnumWithChar>()); 792 EXPECT_EQ(EnumWithChar::ValueA, mt.get<EnumWithChar>()); 793 794 mt.force<std::string>(EnumWithChar::ValueB); 795 796 EXPECT_TRUE(mt.isType<std::string>()); 797 EXPECT_EQ("B", mt.get<std::string>()); 798 } 799 } 800 801 TEST(MultiType, Enum_Convert) 802 { 803 // convert(): 804 { 805 MultiType mt = "C"; 806 mt.convert<EnumWithChar>(); 807 808 EXPECT_TRUE(mt.isType<EnumWithChar>()); 809 EXPECT_EQ(EnumWithChar::ValueC, mt.get<EnumWithChar>()); 810 } 811 { 812 MultiType mt = EnumWithChar::ValueA; 813 mt.convert<std::string>(); 814 815 EXPECT_TRUE(mt.isType<std::string>()); 816 EXPECT_EQ("A", mt.get<std::string>()); 817 } 818 } 819 820 TEST(MultiType, Enum_Reset) 821 { 822 // reset(): 823 { 824 MultiType mt = EnumWithChar::ValueA; 825 mt.reset<EnumWithChar>(); 826 827 EXPECT_TRUE(mt.isType<EnumWithChar>()); 828 EXPECT_TRUE(mt.isType<unsigned char>()); 829 EXPECT_EQ('\0', mt.get<unsigned char>()); 830 } 831 { 832 MultiType mt = "string"; 833 mt.reset<EnumWithInt>(); 834 835 EXPECT_TRUE(mt.isType<EnumWithInt>()); 836 EXPECT_TRUE(mt.isType<int>()); 837 EXPECT_EQ(0, mt.get<int>()); 838 } 839 } 840 841 TEST(MultiType, Enum_IsType) 842 { 843 // isType(): 844 { 845 MultiType mt = EnumWithChar::ValueB; 846 EXPECT_TRUE(mt.isType<EnumWithChar>()); 847 EXPECT_TRUE(mt.isType<unsigned char>()); 848 EXPECT_FALSE(mt.isType<char>()); 849 EXPECT_FALSE(mt.isType<int>()); 850 EXPECT_FALSE(mt.isType<bool>()); 851 EXPECT_FALSE(mt.isType<std::string>()); 852 } 853 { 854 MultiType mt = EnumWithInt::Value3; 855 EXPECT_TRUE(mt.isType<EnumWithInt>()); 856 EXPECT_TRUE(mt.isType<int>()); 857 EXPECT_FALSE(mt.isType<unsigned char>()); 858 EXPECT_FALSE(mt.isType<char>()); 859 EXPECT_FALSE(mt.isType<bool>()); 860 EXPECT_FALSE(mt.isType<std::string>()); 861 } 862 } 863 864 TEST(MultiType, Enum_ConversionOperator) 865 { 866 // conversion operator: 867 { 868 MultiType mt = EnumWithChar::ValueA; 869 EnumWithChar value = mt; 870 EXPECT_EQ(EnumWithChar::ValueA, value); 871 } 872 { 873 MultiType mt = 'B'; 874 EnumWithChar value = mt; 875 EXPECT_EQ(EnumWithChar::ValueB, value); 876 } 877 { 878 MultiType mt = EnumWithInt::Value1; 879 std::string value = mt; 880 EXPECT_EQ("50", value); 881 } 882 } 883 884 TEST(MultiType, Enum_GetValue) 885 { 886 // getValue(): 887 { 888 MultiType mt = EnumWithChar::ValueA; 889 EnumWithChar value; 890 mt.getValue(&value); 891 EXPECT_EQ(EnumWithChar::ValueA, value); 892 } 893 { 894 MultiType mt = 'B'; 895 EnumWithChar value; 896 mt.getValue(&value); 897 EXPECT_EQ(EnumWithChar::ValueB, value); 898 } 899 { 900 MultiType mt = EnumWithInt::Value1; 901 std::string value; 902 mt.getValue(&value); 903 EXPECT_EQ("50", value); 904 } 905 } 906 907 TEST(MultiType, Enum_Get) 908 { 909 // get(): 910 { 911 MultiType mt = EnumWithChar::ValueB; 912 EXPECT_EQ(EnumWithChar::ValueB, mt.get<EnumWithChar>()); 913 914 EXPECT_EQ('B', mt.get<unsigned char>()); 915 EXPECT_EQ("B", mt.get<std::string>()); 916 EXPECT_EQ(66, mt.get<int>()); 917 EXPECT_TRUE(mt.get<bool>()); 918 } 919 { 920 MultiType mt = EnumWithInt::Value1; 921 EXPECT_EQ(EnumWithInt::Value1, mt.get<EnumWithInt>()); 922 923 EXPECT_EQ('2', mt.get<unsigned char>()); 924 EXPECT_EQ("50", mt.get<std::string>()); 925 EXPECT_EQ(50, mt.get<int>()); 926 EXPECT_TRUE(mt.get<bool>()); 927 } 928 { 929 MultiType mt = EnumWithInt::Value2; 930 EXPECT_EQ(EnumWithInt::Value2, mt.get<EnumWithInt>()); 931 932 EXPECT_EQ('\0', mt.get<unsigned char>()); 933 EXPECT_EQ("0", mt.get<std::string>()); 934 EXPECT_EQ(0, mt.get<int>()); 935 EXPECT_FALSE(mt.get<bool>()); 936 } 937 } 699 938 }
Note: See TracChangeset
for help on using the changeset viewer.