Changeset 11673 for code/branches/ScriptableController_HS17/src/orxonox/scriptablecontroller/scriptable_controller.cc
- Timestamp:
- Dec 14, 2017, 4:04:14 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/ScriptableController_HS17/src/orxonox/scriptablecontroller/scriptable_controller.cc
r11662 r11673 50 50 } 51 51 52 // Reme ber the api52 // Remember the api 53 53 this->apis_.push_back(std::unique_ptr<ScriptableControllerAPI>(api)); 54 54 … … 73 73 void ScriptableController::registerPawn(std::string id, Pawn *pawn) 74 74 { 75 this->worldEntities_[id] = pawn;76 75 this->pawns_[id] = pawn; 77 76 this->pawnsReverse_[pawn] = id; … … 87 86 } 88 87 89 for(auto &api : this->apis_) 90 api->pawnKilled(pawn_id_iter->second, pawn); 91 88 // The ID of the pawn should already be invalid when we call the callback 89 std::string id = pawn_id_iter->second; 92 90 this->pawns_.erase(pawn_id_iter->second); 93 91 this->pawnsReverse_.erase(pawn_id_iter); 92 93 for(auto &api : this->apis_) 94 api->pawnKilled(id, pawn); 94 95 } 95 96 … … 110 111 } 111 112 112 void ScriptableController::killPawn(std::string id)113 {114 auto pawn = this->getPawnByID(id);115 if(pawn == nullptr)116 {117 orxout(user_warning) << "Tried to destroy unknown pawn " << id << std::endl;118 return;119 }120 121 pawn->kill();122 }123 124 113 WorldEntity *ScriptableController::getWorldEntityByID(std::string id) const 125 114 { … … 138 127 auto entity = this->mobileEntities_.find(id); 139 128 return entity != this->mobileEntities_.end() ? entity->second : nullptr; 140 141 129 } 142 130
Note: See TracChangeset
for help on using the changeset viewer.