Changeset 7127 for code/branches/presentation3/src/orxonox
- Timestamp:
- Jun 9, 2010, 9:32:58 PM (15 years ago)
- Location:
- code/branches/presentation3/src/orxonox
- Files:
-
- 29 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/presentation3/src/orxonox/ChatHistory.cc
r6928 r7127 39 39 /* constructor */ 40 40 #ifndef CHATTEST 41 //ChatHistory::ChatHistory( BaseObject* creator ) : BaseObject(creator) 42 ChatHistory::ChatHistory() 41 //ChatHistory::ChatHistory( BaseObject* creator ) : BaseObject(creator) 42 ChatHistory::ChatHistory() 43 43 #else 44 44 ChatHistory::ChatHistory() … … 68 68 { 69 69 chat_hist_closelog(); 70 70 71 71 /* clear list */ 72 72 this->hist_buffer.clear(); … … 74 74 75 75 /* react to incoming chat */ 76 void ChatHistory::incomingChat(const std::string& message, 76 void ChatHistory::incomingChat(const std::string& message, 77 77 unsigned int senderID) 78 78 { … … 104 104 /* add the line to the log */ 105 105 this->chat_hist_logline( text ); 106 } 106 } 107 107 108 108 /* Synchronize logfile onto the hard drive */ /* MARK MARK */ … … 128 128 /* log a line to a logfile */ 129 129 int ChatHistory::chat_hist_logline( const std::string& toadd ) 130 { 130 { 131 131 /* output the line to the file if logging is enabled */ 132 132 if( this->hist_log_enabled ) … … 138 138 int ChatHistory::chat_hist_openlog() 139 139 { 140 /* TODO: find out the name of the file to log to via settings 140 /* TODO: find out the name of the file to log to via settings 141 141 * and set the this->hist_logfile_path variable to it 142 142 */ … … 167 167 /* see if we've actually got a logfile */ 168 168 if( this->hist_logfile ) 169 { 169 { 170 170 /* yes, we've got one, add a line that shows we're closing it */ 171 171 this->chat_hist_logline( "--- Logfile closed ---" ); -
code/branches/presentation3/src/orxonox/ChatHistory.h
r6928 r7127 34 34 35 35 /* define this if you're unit testing */ 36 //#define CHATTEST 36 //#define CHATTEST 37 37 38 38 #ifndef CHATTEST … … 62 62 63 63 #else 64 class ChatHistory 64 class ChatHistory 65 65 #endif 66 66 { … … 75 75 virtual ~ChatHistory(); 76 76 77 77 78 78 //protected: 79 /** what to do with incoming chat 80 * 81 * \param message The incoming message 79 /** what to do with incoming chat 80 * 81 * \param message The incoming message 82 82 * \param senderID Identification number of the sender 83 83 */ 84 virtual void incomingChat(const std::string& message, 84 virtual void incomingChat(const std::string& message, 85 85 unsigned int senderID); 86 87 /** Synchronize logfile onto the hard drive 86 87 /** Synchronize logfile onto the hard drive 88 88 * 89 89 * \return 0 for success, other for error … … 93 93 /** debug-print: output the whole history to stdout */ 94 94 void debug_printhist(); 95 95 96 96 private: 97 97 /* FIELDS */ -
code/branches/presentation3/src/orxonox/ChatInputHandler.cc
r7049 r7127 40 40 #include <string> 41 41 42 namespace orxonox 42 namespace orxonox 43 43 { 44 44 /* singleton */ … … 48 48 SetConsoleCommandAlias( ChatInputHandler, activate_static, "startchat", 49 49 true ); 50 SetConsoleCommandAlias( ChatInputHandler, activate_small_static, 50 SetConsoleCommandAlias( ChatInputHandler, activate_small_static, 51 51 "startchat_small", true ); 52 52 … … 111 111 112 112 /* cast it to a listbox */ 113 lb_history = dynamic_cast<CEGUI::Listbox*>(history); 113 lb_history = dynamic_cast<CEGUI::Listbox*>(history); 114 114 115 115 /* assert wee */ … … 140 140 } 141 141 142 // blues 142 // blues 143 143 red = 0.5, green = 0.5, blue = 1; 144 144 for( ; i < NumberOfColors; ++i ) … … 171 171 } 172 172 173 void ChatInputHandler::deactivate() 173 void ChatInputHandler::deactivate() 174 174 { 175 175 /* stop listening */ … … 202 202 203 203 /* handle incoming chat */ 204 void ChatInputHandler::incomingChat(const std::string& message, 204 void ChatInputHandler::incomingChat(const std::string& message, 205 205 unsigned int senderID) 206 206 { … … 210 210 /* setup player name info */ 211 211 if (senderID != CLIENTID_UNKNOWN) 212 { 212 { 213 213 PlayerInfo* player = PlayerManager::getInstance().getClient(senderID); 214 214 if (player) … … 227 227 /* now add */ 228 228 this->lb_history->addItem( dynamic_cast<CEGUI::ListboxItem*>(toadd) ); 229 this->lb_history->ensureItemIsVisible( 229 this->lb_history->ensureItemIsVisible( 230 230 dynamic_cast<CEGUI::ListboxItem*>(toadd) ); 231 231 232 232 /* make sure the history handles it */ 233 233 this->lb_history->handleUpdatedItemData(); 234 } 234 } 235 235 236 236 237 237 /* sub for inputchanged */ 238 void ChatInputHandler::sub_adjust_dispoffset( int maxlen, 239 int cursorpos, 238 void ChatInputHandler::sub_adjust_dispoffset( int maxlen, 239 int cursorpos, 240 240 int inplen ) 241 241 { 242 242 /* already start offsetting 5 characters before end */ 243 243 if( cursorpos+5 > maxlen ) 244 { 244 { 245 245 /* always stay 5 characters ahead of end, looks better */ 246 246 ((disp_offset = cursorpos-maxlen+5) >= 0) ? 1 : disp_offset = 0; … … 249 249 (disp_offset > cursorpos ) ? disp_offset = 0 : 1; 250 250 } 251 251 252 252 /* make sure we don't die at substr */ 253 253 if( inplen <= disp_offset ) disp_offset = 0; … … 260 260 std::string raw = this->inpbuf->get(); 261 261 int cursorpos = this->inpbuf->getCursorPosition(); 262 262 263 263 /* get string before cursor */ 264 264 std::string left = raw.substr( 0, cursorpos ); … … 268 268 if( raw.length() >= left.length()+1 ) 269 269 right = raw.substr( cursorpos ); 270 270 271 271 /* set the text */ 272 272 std::string assembled = "$ " + left + "|" + right; 273 273 274 274 if( this->fullchat ) 275 { 275 { 276 276 /* adjust curser position - magic number 5 for font width */ 277 sub_adjust_dispoffset( (this->input->getUnclippedInnerRect().getWidth()/6), 277 sub_adjust_dispoffset( (this->input->getUnclippedInnerRect().getWidth()/6), 278 278 cursorpos, assembled.length() ); 279 279 this->input->setProperty( "Text", assembled.substr( disp_offset ) ); … … 282 282 { 283 283 /* adjust curser position - magic number 5 for font width */ 284 sub_adjust_dispoffset( (this->inputonly->getUnclippedInnerRect().getWidth()/6), 284 sub_adjust_dispoffset( (this->inputonly->getUnclippedInnerRect().getWidth()/6), 285 285 cursorpos, assembled.length() ); 286 286 this->inputonly->setProperty( "Text", assembled.substr( disp_offset) ); … … 323 323 void ChatInputHandler::cursorRight() 324 324 { this->inpbuf->increaseCursor(); } 325 325 326 326 void ChatInputHandler::cursorLeft() 327 327 { this->inpbuf->decreaseCursor(); } 328 328 329 329 void ChatInputHandler::cursorEnd() 330 330 { this->inpbuf->setCursorToEnd(); } -
code/branches/presentation3/src/orxonox/ChatInputHandler.h
r7043 r7127 62 62 private: 63 63 /** Input buffer, to be used to catch input from the 64 * keyboard 64 * keyboard 65 65 */ 66 66 InputBuffer *inpbuf; … … 126 126 * history window of the full chat window) 127 127 */ 128 void incomingChat( const std::string& message, 128 void incomingChat( const std::string& message, 129 129 unsigned int senderID ); 130 130 131 131 /** \param full true means show full chat window with history, 132 132 false means show only an input line 133 * 134 * Show the chat window and redirect the game's keyboard input 133 * 134 * Show the chat window and redirect the game's keyboard input 135 135 * into it. 136 136 */ -
code/branches/presentation3/src/orxonox/Level.cc
r7105 r7127 49 49 RegisterObject(Level); 50 50 51 51 52 52 this->registerVariables(); 53 53 this->xmlfilename_ = this->getFilename(); … … 73 73 XMLPortParam(Level, "description", setDescription, getDescription, xmlelement, mode); 74 74 XMLPortParam(Level, "gametype", setGametypeString, getGametypeString, xmlelement, mode).defaultValues("Gametype"); 75 75 76 76 XMLPortObject(Level, MeshLodInformation, "lodinformation", addLodInfo, getLodInfo, xmlelement, mode); 77 77 XMLPortObjectExtended(Level, BaseObject, "", addObject, getObject, xmlelement, mode, true, false); … … 99 99 Loader::open(this->xmlfile_); 100 100 } 101 101 102 102 void Level::networkCallbackTemplatesChanged() 103 103 { … … 151 151 return 0; 152 152 } 153 153 154 154 void Level::addLodInfo(MeshLodInformation* lodInformation) 155 155 { … … 165 165 if(this->lodInformation_.find(meshName)!=this->lodInformation_.end()) 166 166 return this->lodInformation_.find(meshName)->second; 167 167 168 168 return 0; 169 169 } -
code/branches/presentation3/src/orxonox/MoodManager.cc
r7121 r7127 45 45 RegisterRootObject(MoodManager); 46 46 this->setConfigValues(); 47 47 48 48 // Checking for the existence of the folder for the default mood 49 49 /* Note: Currently Resource::exists(path) will always return false when the path field points to a folder. -
code/branches/presentation3/src/orxonox/OrxonoxPrereqs.h
r7034 r7127 137 137 class OrxonoxOverlay; 138 138 class OverlayGroup; 139 139 140 140 // pickup 141 141 class PickupIdentifier; -
code/branches/presentation3/src/orxonox/Radar.cc
r6942 r7127 87 87 } 88 88 } 89 89 90 90 void Radar::removeRadarObject(RadarViewable* rv) 91 91 { … … 203 203 } 204 204 } 205 205 206 206 void Radar::radarObjectChanged(RadarViewable* rv) 207 207 { -
code/branches/presentation3/src/orxonox/controllers/AIController.cc
r7090 r7127 112 112 random = rnd(maxrand); 113 113 if (random < 25 && (this->bShooting_)) 114 this->bShooting_ = false; 114 this->bShooting_ = false; 115 115 116 116 } … … 127 127 this->commandSlaves(); 128 128 129 if (this->specificMasterAction_ != NONE) 129 if (this->specificMasterAction_ != NONE) 130 130 this->specificMasterActionHold(); 131 131 … … 149 149 // lose master status (only if less than 4 slaves in formation) 150 150 random = rnd(maxrand); 151 if(random < 15/(this->slaves_.size()+1) && this->slaves_.size() < 4 ) 151 if(random < 15/(this->slaves_.size()+1) && this->slaves_.size() < 4 ) 152 152 this->loseMasterState(); 153 153 -
code/branches/presentation3/src/orxonox/controllers/ArtificialController.cc
r7107 r7127 91 91 { 92 92 this->removeFromFormation(); 93 93 94 94 for (ObjectList<ArtificialController>::iterator it = ObjectList<ArtificialController>::begin(); it; ++it) 95 95 { … … 101 101 it->myMaster_ = 0; 102 102 } 103 103 104 104 while (true) 105 105 { … … 139 139 { 140 140 Controller* controller = 0; 141 141 142 142 if (it->getController()) 143 143 controller = it->getController(); 144 144 else if (it->getXMLController()) 145 145 controller = it->getXMLController(); 146 146 147 147 if (!controller) 148 148 continue; … … 162 162 163 163 /** 164 @brief Get all masters to do a "specific master action" 164 @brief Get all masters to do a "specific master action" 165 165 @param action which action to perform (integer, so it can be called with a console command (tmp solution)) 166 166 */ … … 170 170 { 171 171 Controller* controller = 0; 172 172 173 173 if (it->getController()) 174 174 controller = it->getController(); 175 175 else if (it->getXMLController()) 176 176 controller = it->getXMLController(); 177 177 178 178 if (!controller) 179 179 continue; … … 204 204 { 205 205 Controller* controller = 0; 206 206 207 207 if (it->getController()) 208 208 controller = it->getController(); 209 209 else if (it->getXMLController()) 210 210 controller = it->getXMLController(); 211 211 212 212 if (!controller) 213 213 continue; … … 252 252 { 253 253 Controller* controller = 0; 254 254 255 255 if (it->getController()) 256 256 controller = it->getController(); 257 257 else if (it->getXMLController()) 258 258 controller = it->getXMLController(); 259 259 260 260 if (!controller) 261 261 continue; … … 280 280 { 281 281 Controller* controller = 0; 282 282 283 283 if (it->getController()) 284 284 controller = it->getController(); 285 285 else if (it->getXMLController()) 286 286 controller = it->getXMLController(); 287 287 288 288 if (!controller) 289 289 continue; … … 303 303 void ArtificialController::changedControllableEntity() 304 304 { 305 if (!this->getControllableEntity()) 305 if (!this->getControllableEntity()) 306 306 this->removeFromFormation(); 307 307 } … … 400 400 this->myMaster_->slaves_.erase(it); 401 401 } 402 402 403 403 this->myMaster_ = 0; 404 404 this->state_ = FREE; … … 423 423 //has it an ArtificialController? 424 424 Controller* controller = 0; 425 425 426 426 if (it->getController()) 427 427 controller = it->getController(); 428 428 else if (it->getXMLController()) 429 429 controller = it->getXMLController(); 430 430 431 431 if (!controller) 432 432 continue; … … 476 476 @brief Commands the slaves of a master into a formation. Sufficiently fast not to be called within tick. Initiated by a master. 477 477 */ 478 void ArtificialController::commandSlaves() 478 void ArtificialController::commandSlaves() 479 479 { 480 480 if(this->state_ != MASTER) return; … … 489 489 this->slaves_.front()->setTargetPosition(dest); 490 490 } 491 else 491 else 492 492 { 493 493 dest += 1.0f*orient*WorldEntity::BACK; … … 592 592 bool ArtificialController::forcedFree() 593 593 { 594 if(this->freedomCount_ > 0) 594 if(this->freedomCount_ > 0) 595 595 { 596 596 this->freedomCount_--; … … 606 606 if(this->state_ != MASTER) return; 607 607 608 if (specificMasterActionHoldCount_ == 0) 608 if (specificMasterActionHoldCount_ == 0) 609 609 { 610 610 this->specificMasterAction_ = NONE; … … 677 677 if (!always) 678 678 this->specificMasterActionHoldCount_ = secondsToFollow; 679 else 679 else 680 680 this->specificMasterActionHoldCount_ = INT_MAX; //for now... 681 681 … … 698 698 699 699 currentHumanController = orxonox_cast<NewHumanController*>(it->getController()); 700 if(currentHumanController) 700 if(currentHumanController) 701 701 { 702 702 if (!ArtificialController::sameTeam(this->getControllableEntity(), *it, this->getGametype())) continue; -
code/branches/presentation3/src/orxonox/controllers/ArtificialController.h
r7107 r7127 64 64 inline int getFormationSize() const 65 65 { return this->maxFormationSize_; } 66 66 67 67 inline void setPassive(bool passive) 68 68 { this->passive_ = passive; } -
code/branches/presentation3/src/orxonox/controllers/DroneController.h
r7034 r7127 52 52 DroneController(BaseObject* creator); 53 53 virtual ~DroneController(); 54 54 55 55 virtual void tick(float dt); //!< The controlling happens here. This method defines what the controller has to do each tick. 56 56 -
code/branches/presentation3/src/orxonox/gametypes/Gametype.cc
r6996 r7127 330 330 if (index == randomspawn) 331 331 return (*it); 332 332 333 333 ++index; 334 334 } -
code/branches/presentation3/src/orxonox/graphics/MeshLodInformation.cc
r7039 r7127 40 40 CreateFactory(MeshLodInformation); 41 41 42 MeshLodInformation::MeshLodInformation(BaseObject* creator) 42 MeshLodInformation::MeshLodInformation(BaseObject* creator) 43 43 : BaseObject(creator), lodLevel_(5), bEnabled_(true), numLevels_(10), reductionRate_(0.15) 44 44 { … … 59 59 XMLPortParam(MeshLodInformation, "reductionRate", setReductionRate, getReductionRate, xmlelement, mode); 60 60 } 61 61 62 62 std::string MeshLodInformation::getMeshName() 63 63 { 64 64 return MeshLodInformation::getMeshSource(); 65 65 } 66 66 67 67 void MeshLodInformation::setLodLevel(float lodLevel) 68 68 { … … 73 73 { 74 74 return lodLevel_; 75 } 75 } 76 76 void MeshLodInformation::setMeshSource(std::string meshSource) 77 77 { … … 82 82 return meshSource_; 83 83 } 84 84 85 85 } -
code/branches/presentation3/src/orxonox/graphics/MeshLodInformation.h
r7036 r7127 43 43 MeshLodInformation(BaseObject* creator); 44 44 virtual ~MeshLodInformation(); 45 45 46 46 float getLodLevel(); 47 47 std::string getMeshName(); … … 49 49 unsigned int getNumLevels(){ return this->numLevels_; } 50 50 float getReductionRate(){ return this->reductionRate_; } 51 51 52 52 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); 53 53 -
code/branches/presentation3/src/orxonox/graphics/Model.cc
r7111 r7127 42 42 CreateFactory(Model); 43 43 44 Model::Model(BaseObject* creator) : 44 Model::Model(BaseObject* creator) : 45 45 StaticEntity(creator), bCastShadows_(true), lodLevel_(5), bLodEnabled_(true), numLodLevels_(10), lodReductionRate_(.15) 46 46 { … … 59 59 { 60 60 SUPER(Model, XMLPort, xmlelement, mode); 61 61 62 62 XMLPortParam(Model, "lodLevel", setLodLevel, getLodLevel, xmlelement, mode); 63 63 64 64 XMLPortParam(Model, "mesh", setMeshSource, getMeshSource, xmlelement, mode); 65 65 XMLPortParam(Model, "shadow", setCastShadows, getCastShadows, xmlelement, mode).defaultValues(true); … … 81 81 return scaleFactor; 82 82 } 83 83 84 84 void Model::changedMesh() 85 85 { … … 88 88 if (this->mesh_.getEntity()) 89 89 this->detachOgreObject(this->mesh_.getEntity()); 90 90 91 91 this->mesh_.setMeshSource(this->getScene()->getSceneManager(), this->meshSrc_); 92 92 … … 96 96 this->mesh_.getEntity()->setCastShadows(this->bCastShadows_); 97 97 this->mesh_.setVisible(this->isVisible()); 98 99 98 99 100 100 //LOD 101 101 if( this->mesh_.getEntity()->getMesh()->getNumLodLevels()==1 ) 102 102 { 103 103 Level* level = this->getLevel(); 104 104 105 105 assert( level != 0 ); 106 106 107 107 MeshLodInformation* lodInfo = level->getLodInfo(this->meshSrc_); 108 108 if( lodInfo ) … … 122 122 float volume = this->mesh_.getEntity()->getBoundingBox().volume(); 123 123 // float scaleFactor = 1; 124 124 125 125 // BaseObject* creatorPtr = this; 126 // 126 // 127 127 // while(creatorPtr!=NULL&&orxonox_cast<WorldEntity*>(creatorPtr)) 128 128 // { … … 131 131 // } 132 132 // COUT(0) << "name: " << this->meshSrc_ << "scaleFactor: " << scaleFactor << ", volume: " << volume << endl; 133 133 134 134 COUT(4) << "Setting lodLevel for " << this->meshSrc_<< " with lodLevel_: " << this->lodLevel_ <<" and volume: "<< volume << ":" << std::endl; 135 135 … … 144 144 // float factor = scaleFactor*5/lodLevel_; 145 145 float factor = pow(volume, 2.0f / 3.0f) * 15.0f / lodLevel_; 146 146 147 147 COUT(4) << "LodLevel set with factor: " << factor << endl; 148 148 … … 160 160 distList.pop_back(); 161 161 162 162 163 163 //Generiert LOD-Levels 164 164 this->mesh_.getEntity()->getMesh()->generateLodLevels(distList, Ogre::ProgressiveMesh::VRQ_PROPORTIONAL, this->lodReductionRate_); … … 171 171 else 172 172 what = "<0"; 173 173 174 174 COUT(4)<<"LodLevel not set because lodLevel("<<lodLevel_<<") was "<<what<<"." << endl; 175 175 } -
code/branches/presentation3/src/orxonox/graphics/Model.h
r7036 r7127 61 61 inline bool getCastShadows() const 62 62 { return this->bCastShadows_; } 63 63 64 64 protected: 65 65 void changedMesh(); 66 66 void changedShadows(); 67 67 68 68 //LoD 69 69 inline void setLodLevel(float lodLevel) … … 76 76 Mesh mesh_; 77 77 bool bCastShadows_; 78 78 79 79 //LoD 80 80 float lodLevel_; … … 82 82 unsigned int numLodLevels_; 83 83 float lodReductionRate_; 84 84 85 85 }; 86 86 } -
code/branches/presentation3/src/orxonox/infos/GametypeInfo.cc
r7062 r7127 157 157 it->staticmessage(this, message, colour); 158 158 } 159 159 160 160 void GametypeInfo::dispatchFadingMessage(const std::string& message) 161 161 { -
code/branches/presentation3/src/orxonox/interfaces/InterfaceCompilation.cc
r7096 r7127 52 52 RegisterRootObject(GametypeMessageListener); 53 53 } 54 54 55 55 //---------------------------- 56 56 // PickupCarrier … … 59 59 { 60 60 RegisterRootObject(PickupCarrier); 61 61 62 62 this->setCarrierName("PickupCarrier"); 63 63 } 64 64 65 65 PickupCarrier::~PickupCarrier() 66 66 { … … 85 85 this->isForPlayer_ = true; 86 86 } 87 87 88 88 //---------------------------- 89 89 // RadarListener -
code/branches/presentation3/src/orxonox/interfaces/PickupCarrier.h
r7034 r7127 68 68 friend class Pickupable; 69 69 friend class PickupManager; 70 //! Friends. 70 //! Friends. 71 71 friend class Pickup; 72 72 friend class HealthPickup; … … 170 170 */ 171 171 virtual const Vector3& getCarrierPosition(void) = 0; 172 172 173 173 /** 174 174 @brief Get the name of this PickupCarrier. … … 176 176 */ 177 177 const std::string& getCarrierName(void) { return this->carrierName_; } // tolua_export 178 179 protected: 178 179 protected: 180 180 /** 181 181 @brief Get all direct children of this PickupSpawner. … … 198 198 std::set<Pickupable*>& getPickups(void) 199 199 { return this->pickups_; } 200 200 201 201 /** 202 202 @brief Set the name of this PickupCarrier. … … 206 206 void setCarrierName(const std::string& name) 207 207 { this->carrierName_ = name; } 208 208 209 209 private: 210 210 std::set<Pickupable*> pickups_; //!< The list of Pickupables carried by this PickupCarrier. 211 211 std::string carrierName_; //!< The name of the PickupCarrier, as displayed in the PickupInventory. 212 212 213 213 /** 214 214 @brief Get the number of carrier children this PickupCarrier has. … … 222 222 return size; 223 223 } 224 224 225 225 /** 226 226 @brief Get the index-th child of this PickupCarrier. … … 237 237 return carrier; 238 238 } 239 239 240 240 /** 241 241 @brief Get the number of Pickupables this PickupCarrier carries. … … 244 244 unsigned int getNumPickups(void) 245 245 { return this->pickups_.size(); } 246 246 247 247 /** 248 248 @brief Get the index-th Pickupable of this PickupCarrier. … … 259 259 return *it; 260 260 } 261 261 262 262 }; 263 263 } -
code/branches/presentation3/src/orxonox/interfaces/Pickupable.cc
r7094 r7127 46 46 namespace orxonox 47 47 { 48 48 49 49 /** 50 50 @brief … … 52 52 */ 53 53 Pickupable::Pickupable() : pickupIdentifier_(NULL), used_(false), pickedUp_(false) 54 { 54 { 55 55 RegisterRootObject(Pickupable); 56 56 57 57 this->carrier_ = NULL; 58 58 59 59 this->pickupIdentifier_ = new PickupIdentifier(this); 60 60 } 61 62 /** 63 @brief 64 Destructor. 61 62 /** 63 @brief 64 Destructor. 65 65 */ 66 66 Pickupable::~Pickupable() … … 68 68 if(this->isUsed()) 69 69 this->setUsed(false); 70 70 71 71 if(this->isPickedUp() && this->getCarrier() != NULL) 72 72 { … … 74 74 this->setCarrier(NULL); 75 75 } 76 76 77 77 if(this->pickupIdentifier_ != NULL) 78 78 this->pickupIdentifier_->destroy(); 79 79 } 80 80 81 81 /** 82 82 @brief … … 91 91 if(this->used_ == used) 92 92 return false; 93 93 94 94 COUT(4) << "Pickupable (&" << this << ") set to used " << used << "." << std::endl; 95 95 96 96 this->used_ = used; 97 97 this->changedUsed(); … … 100 100 return true; 101 101 } 102 102 103 103 /** 104 104 @brief … … 115 115 return this->isTarget(carrier->getIdentifier()); 116 116 } 117 117 118 118 /** 119 119 @brief … … 134 134 return false; 135 135 } 136 136 137 137 /** 138 138 @brief … … 147 147 return this->addTarget(target->getIdentifier()); 148 148 } 149 149 150 150 /** 151 151 @brief … … 160 160 if(this->isTarget(target)) //!< If the input target is already present in the list of targets. 161 161 return false; 162 162 163 163 COUT(4) << "Target " << target->getName() << " added to Pickupable (&" << this << ")." << std::endl; 164 164 this->targets_.push_back(target); 165 165 return true; 166 166 } 167 168 /** 169 @brief 167 168 /** 169 @brief 170 170 Sets the Pickupable to picked up. 171 171 This method will be called by the PickupCarrier picking the Pickupable up. … … 179 179 if(this->isPickedUp()) //!< If the Pickupable is already picked up. 180 180 return false; 181 181 182 182 COUT(4) << "Pickupable (&" << this << ") got picked up by a PickupCarrier (&" << carrier << ")." << std::endl; 183 183 this->setCarrier(carrier); … … 185 185 return true; 186 186 } 187 187 188 188 /** 189 189 @brief … … 198 198 if(this->pickedUp_ == pickedUp) 199 199 return false; 200 200 201 201 COUT(4) << "Pickupable (&" << this << ") set to pickedUp " << pickedUp << "." << std::endl; 202 202 203 203 this->pickedUp_ = pickedUp; 204 204 this->changedPickedUp(); … … 206 206 return true; 207 207 } 208 208 209 209 /** 210 210 @brief … … 217 217 if(this->carrier_ == carrier) 218 218 return false; 219 219 220 220 COUT(4) << "Pickupable (&" << this << ") changed Carrier (& " << carrier << ")." << std::endl; 221 221 222 222 this->carrier_ = carrier; 223 223 this->changedCarrier(); … … 226 226 return true; 227 227 } 228 229 /** 230 @brief 228 229 /** 230 @brief 231 231 Sets the Pickupable to not picked up or dropped. 232 232 This method will be called by the PickupCarrier dropping the Pickupable. … … 238 238 if(!this->isPickedUp()) //!< If the Pickupable is not picked up. 239 239 return false; 240 240 241 241 COUT(4) << "Pickupable (&" << this << ") got dropped up by a PickupCarrier (&" << this->getCarrier() << ")." << std::endl; 242 242 this->setUsed(false); 243 243 this->setPickedUp(false); 244 244 245 245 bool created = this->createSpawner(); 246 246 247 247 this->setCarrier(NULL); 248 248 249 249 if(!created) 250 250 { 251 251 this->destroy(); 252 252 } 253 254 return true; 255 } 256 253 254 return true; 255 } 256 257 257 /** 258 258 @brief … … 265 265 OrxonoxClass* item = NULL; 266 266 this->clone(item); 267 267 268 268 Pickupable* pickup = dynamic_cast<Pickupable*>(item); 269 269 270 270 COUT(4) << "Pickupable (&" << this << ") cloned. Clone is new Pickupable (&" << pickup << ")." << std::endl; 271 271 return pickup; 272 272 } 273 273 274 274 /** 275 275 @brief … … 299 299 return carrier->pickup(this); 300 300 } 301 301 302 302 } -
code/branches/presentation3/src/orxonox/interfaces/Pickupable.h
r7094 r7127 45 45 namespace orxonox // tolua_export 46 46 { // tolua_export 47 47 48 48 /** 49 49 @brief … … 57 57 protected: 58 58 Pickupable(); //!< Default constructor. 59 59 60 60 public: 61 61 virtual ~Pickupable(); //!< Default destructor. 62 62 63 63 /** 64 64 @brief Get whether the pickup is currently in use or not. … … 71 71 */ 72 72 virtual void changedUsed(void) {} 73 73 74 74 /** 75 75 @brief Get the carrier of the pickup. … … 83 83 */ 84 84 virtual void changedCarrier(void) {} 85 85 86 86 /** 87 87 @brief Returns whether the Pickupable is currently picked up. … … 94 94 */ 95 95 virtual void changedPickedUp(void) {} 96 96 97 97 bool pickedUp(PickupCarrier* carrier); //!< Sets the Pickupable to picked up. 98 98 bool dropped(void); //!< Sets the Pickupable to not picked up or dropped. 99 99 100 100 virtual bool isTarget(PickupCarrier* carrier) const; //!< Get whether the given PickupCarrier is a target of this pickup. 101 101 bool isTarget(const Identifier* identifier) const; //!< Get whether a given class, represented by the input Identifier, is a target of this Pickupable. 102 102 bool addTarget(PickupCarrier* target); //!< Add a PickupCarrier as target of this pickup. 103 103 bool addTarget(Identifier* identifier); //!< Add a class, representetd by the input Identifier, as target of this pickup. 104 104 105 105 Pickupable* clone(void); //!< Creates a duplicate of the Pickupable. 106 106 virtual void clone(OrxonoxClass*& item); //!< Creates a duplicate of the input OrxonoxClass. 107 107 108 108 /** 109 109 @brief Get the PickupIdentifier of this Pickupable. … … 112 112 virtual const PickupIdentifier* getPickupIdentifier(void) 113 113 { return this->pickupIdentifier_; } 114 114 115 115 bool setUsed(bool used); //!< Sets the Pickupable to used or unused, depending on the input. 116 116 bool setPickedUp(bool pickedUp); //!< Helper method to set the Pickupable to either picked up or not picked up. 117 117 bool setCarrier(PickupCarrier* carrier, bool tell = false); //!< Sets the carrier of the pickup. 118 118 119 119 protected: 120 120 /** … … 122 122 */ 123 123 void initializeIdentifier(void) {} 124 124 125 125 /** 126 126 @brief Facilitates the creation of a PickupSpawner upon dropping of the Pickupable. … … 131 131 */ 132 132 virtual bool createSpawner(void) = 0; 133 133 134 134 PickupIdentifier* pickupIdentifier_; //!< The PickupIdentifier of this Pickupable. 135 135 136 136 private: 137 137 138 138 bool used_; //!< Whether the pickup is currently in use or not. 139 139 bool pickedUp_; //!< Whether the pickup is currently picked up or not. 140 140 141 141 PickupCarrier* carrier_; //!< The carrier of the pickup. 142 142 std::list<Identifier*> targets_; //!< The possible targets of this pickup. … … 147 147 148 148 }; // tolua_export 149 149 150 150 SUPER_FUNCTION(10, Pickupable, changedUsed, false); 151 151 SUPER_FUNCTION(12, Pickupable, changedCarrier, false); -
code/branches/presentation3/src/orxonox/interfaces/RadarViewable.cc
r7045 r7127 65 65 RadarViewable::~RadarViewable() 66 66 { 67 67 68 68 if( this->bInitialized_ ) 69 69 { … … 109 109 } 110 110 } 111 111 112 112 void RadarViewable::settingsChanged() 113 113 { -
code/branches/presentation3/src/orxonox/interfaces/RadarViewable.h
r7045 r7127 88 88 89 89 inline void setRadarVisibility(bool b) 90 { 90 { 91 91 if(b!=this->bVisibility_) 92 92 { -
code/branches/presentation3/src/orxonox/pickup/PickupIdentifier.cc
r6725 r7127 39 39 namespace orxonox 40 40 { 41 41 42 42 /** 43 43 @brief … … 47 47 { 48 48 RegisterRootObject(PickupIdentifier); 49 49 50 50 if(pickup == NULL) 51 51 COUT(1) << "Error, PickupIdentifier was created without a valid Pickupable." << std::endl; 52 52 53 53 this->pickup_ = pickup; 54 54 } 55 55 56 56 PickupIdentifier::~PickupIdentifier() 57 57 { 58 58 59 59 } 60 60 61 61 /** 62 62 @brief … … 74 74 COUT(1) << "Error in PickupIdentifier::compare: Input Identifier is NULL." << std::endl; 75 75 } 76 76 77 77 if(identifier->pickup_ == NULL && this->pickup_ == NULL) 78 78 { … … 80 80 COUT(1) << "Error in PickupIdentifier::compare: Pickup stored by Identifier is NULL." << std::endl; 81 81 } 82 82 83 83 if(identifier->pickup_ == NULL) 84 84 { … … 86 86 COUT(1) << "Error in PickupIdentifier::compare: Pickup stored by Identifier is NULL." << std::endl; 87 87 } 88 88 89 89 if(this->pickup_ == NULL) 90 90 { … … 92 92 COUT(1) << "Error in PickupIdentifier::compare: Pickup stored by Identifier is NULL." << std::endl; 93 93 } 94 94 95 95 //! If the classIdentifiers are not the same (meaning the PickupIdentifiers identify different classes), the obviously the two Pickupables identified by the PickupIdentifiers cannot be the same. An ordering is established through the alphabetical ordering of the respective classnames. 96 96 if(!identifier->pickup_->getIdentifier()->isExactlyA(this->pickup_->getIdentifier())) 97 97 return this->pickup_->getIdentifier()->getName().compare(identifier->pickup_->getIdentifier()->getName()); 98 98 99 99 //! If the class is the same for both PickupIdentifiers we go on to check the parameters of the class. 100 100 //! If the two have a different number of parameters then obviusly something is very wrong. … … 104 104 return this->parameters_.size()-identifier->parameters_.size(); 105 105 } 106 106 107 107 //! We iterate through all parameters and compar their values (which are strings). The first parameter is the most significant. The ordering is once again established by the alphabetical comparison of the two value strings. 108 108 for(std::map<std::string, std::string>::const_iterator it = this->parameters_.begin(); it != this->parameters_.end(); it++) … … 117 117 return it->second.compare(identifier->parameters_.find(it->first)->second); 118 118 } 119 119 120 120 return 0; 121 121 } 122 122 123 123 /** 124 124 @brief … … 134 134 { 135 135 COUT(4) << "PickupIdentifier " << name << ", " << value << std::endl; 136 136 137 137 if(!(this->parameters_.find(name) == this->parameters_.end())) 138 138 { … … 140 140 return false; 141 141 } 142 142 143 143 this->parameters_[name] = value; 144 144 145 145 return true; 146 146 } 147 147 148 148 } -
code/branches/presentation3/src/orxonox/pickup/PickupIdentifier.h
r6540 r7127 41 41 #include "core/Identifier.h" 42 42 43 #include "core/OrxonoxClass.h" 43 #include "core/OrxonoxClass.h" 44 44 45 45 namespace orxonox 46 46 { 47 47 48 48 /** 49 49 @brief … … 57 57 class _OrxonoxExport PickupIdentifier : virtual public OrxonoxClass 58 58 { 59 59 60 60 public: 61 61 PickupIdentifier(Pickupable* pickup); //!< Constructor. 62 62 ~PickupIdentifier(); //!< Destructor. 63 63 64 64 virtual int compare(const PickupIdentifier* identifier) const; //!< Compares two PickupIdentifiers and returns 0 if a == b, <0 if a < b and >0 if a > b for a.compare(b). 65 65 66 66 bool addParameter(std::string & name, std::string & value); //!< Add a parameter to the PickupIdentifier. 67 67 68 68 private: 69 69 Pickupable* pickup_; //!< The Pickupable the PickupIdentififer is for. 70 70 std::map<std::string, std::string> parameters_; //!< The parameters identifying the type of the pickup beyond the class. 71 71 72 72 }; 73 73 74 74 /** 75 75 @brief … … 81 81 { return lhs->compare(rhs) < 0; } 82 82 }; 83 83 84 84 } 85 85 -
code/branches/presentation3/src/orxonox/worldentities/Drone.h
r7060 r7127 53 53 virtual void tick(float dt); //!< Defines which actions the Drone has to take in each tick. 54 54 55 55 56 56 virtual void moveFrontBack(const Vector2& value); 57 57 virtual void moveRightLeft(const Vector2& value); … … 61 61 virtual void rotatePitch(const Vector2& value); 62 62 virtual void rotateRoll(const Vector2& value); 63 63 64 64 /** 65 65 @brief Moves the Drone in the Front/Back-direction by the specifed amount. … … 80 80 inline void moveUpDown(float value) 81 81 { this->moveUpDown(Vector2(value, 0)); } 82 82 83 83 /** 84 84 @brief Rotates the Drone around the y-axis by the specifed amount. … … 99 99 inline void rotateRoll(float value) 100 100 { this->rotateRoll(Vector2(value, 0)); } 101 101 102 102 /** 103 103 @brief Sets the primary thrust to the input amount. … … 105 105 */ 106 106 inline void setPrimaryThrust( float thrust ) 107 { this->primaryThrust_=thrust; } 107 { this->primaryThrust_=thrust; } 108 108 inline void setAuxilaryThrust( float thrust ) 109 { this->auxilaryThrust_=thrust; } 109 { this->auxilaryThrust_=thrust; } 110 110 inline void setRotationThrust( float thrust ) 111 { this->rotationThrust_=thrust; } 111 { this->rotationThrust_=thrust; } 112 112 inline void setMaxDistanceToOwner( float distance) 113 113 { this->maxDistanceToOwner_=distance; } … … 117 117 { this->maxShootingRange_=distance; } 118 118 119 119 120 120 /** 121 121 @brief Gets the primary thrust to the input amount. … … 134 134 inline float getMaxShootingRange() 135 135 { return this->maxShootingRange_; } 136 136 137 137 private: 138 138 DroneController *myController_; //!< The controller of the Drone. 139 139 140 140 btVector3 localLinearAcceleration_; //!< The linear acceleration that is used to move the Drone the next tick. 141 141 btVector3 localAngularAcceleration_; //!< The linear angular acceleration that is used to move the Drone the next tick. 142 float primaryThrust_; //!< The amount of primary thrust. This is just used, when moving forward. 142 float primaryThrust_; //!< The amount of primary thrust. This is just used, when moving forward. 143 143 float auxilaryThrust_; //!< The amount of auxilary thrust. Used for all other movements (except for rotations). 144 144 float rotationThrust_; //!< The amount of rotation thrust. Used for rotations only. -
code/branches/presentation3/src/orxonox/worldentities/WorldEntity.cc
r6524 r7127 81 81 this->node_->setPosition(Vector3::ZERO); 82 82 this->node_->setOrientation(Quaternion::IDENTITY); 83 83 84 84 // Activity and visibility memory. 85 85 this->bActiveMem_ = true; … … 205 205 registerVariable(this->parentID_, VariableDirection::ToClient, new NetworkCallback<WorldEntity>(this, &WorldEntity::networkcallback_parentChanged)); 206 206 } 207 207 208 208 /** 209 209 @brief … … 213 213 { 214 214 SUPER(WorldEntity, changedActivity); 215 215 216 216 for (std::set<WorldEntity*>::const_iterator it = this->getAttachedObjects().begin(); it != this->getAttachedObjects().end(); it++) 217 217 { … … 227 227 } 228 228 } 229 229 230 230 /** 231 231 @brief … … 235 235 { 236 236 SUPER(WorldEntity, changedVisibility); 237 237 238 238 for (std::set<WorldEntity*>::const_iterator it = this->getAttachedObjects().begin(); it != this->getAttachedObjects().end(); it++) 239 239 { -
code/branches/presentation3/src/orxonox/worldentities/WorldEntity.h
r6524 r7127 105 105 static const Vector3 DOWN; 106 106 static const Vector3 UP; 107 107 108 108 virtual void changedActivity(void); 109 109 virtual void changedVisibility(void); … … 234 234 std::set<WorldEntity*> children_; 235 235 bool bDeleteWithParent_; 236 236 237 237 bool bActiveMem_; 238 238 bool bVisibleMem_;
Note: See TracChangeset
for help on using the changeset viewer.