- Timestamp:
- Jan 28, 2007, 2:09:09 PM (18 years ago)
- Location:
- trunk/src/world_entities
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/world_entities/mount_point.cc
r10437 r10440 21 21 #include "util/loading/load_param_xml.h" 22 22 23 23 #include "weapons/weapon_slot.h" 24 24 25 25 #include "mount_point.h" … … 178 178 this->_mount->toList( (OM_LIST)(this->getOMListNumber()+1)); 179 179 } 180 else if( obj->isA( WeaponSlot::staticClassID())) 181 { 182 PRINTF(0)("=========+>we got a weapon slot\n"); 183 } 180 184 } 181 185 else -
trunk/src/world_entities/npcs/npc.cc
r10439 r10440 34 34 #include "debug.h" 35 35 #include "loading/load_param.h" 36 #include "util/loading/load_param_xml.h" 36 37 #include "track/track.h" 37 38 … … 58 59 59 60 this->toList(OM_GROUP_01); 61 this->bAIEnabled = false; 60 62 61 63 if( root != NULL) 62 this->loadParams(root); 63 64 std::cout << "Team Number: " << teamNumber << "\n"; 65 std::cout << "Swarm Number:" << swarmNumber << "\n"; 66 67 //add to track 68 if(this->entityTrack) 69 this->setParent(this->entityTrack->getTrackNode()); 70 else 71 AIEngine::getInstance()->addAI(teamNumber,swarmNumber,(WorldEntity*)this,maxSpeed,attackDistance); 64 this->loadParams(root); 65 66 if( this->bAIEnabled) 67 { 68 std::cout << "Team Number: " << teamNumber << "\n"; 69 std::cout << "Swarm Number:" << swarmNumber << "\n"; 70 71 if( this->entityTrack) 72 this->setParent(this->entityTrack->getTrackNode()); 73 else 74 AIEngine::getInstance()->addAI(teamNumber,swarmNumber,(WorldEntity*)this,maxSpeed,attackDistance); 75 } 72 76 73 77 this->bFire = false; … … 123 127 124 128 125 129 126 130 127 131 } … … 144 148 WorldEntity::loadParams(root); 145 149 150 LoadParam(root, "enableAI", this, NPC, enableAI) 151 .describe("enables the AI algorithms"); 152 146 153 LoadParam(root, "team", this, NPC, setTeamNumber) 147 154 .describe("this sets the team number") … … 159 166 .describe("this sets the NPC distance to target") 160 167 .defaultValues(0); 168 169 170 // Track 171 LoadParamXML(root, "Weapons", this, NPC, addWeapons) 172 .describe("creates and adds weapons"); 173 } 174 175 176 void NPC::addWeapons(const TiXmlElement* root) 177 { 178 if( root == NULL) 179 return; 180 181 LOAD_PARAM_START_CYCLE(root, element); 182 { 183 PRINTF(0)("got weapon: %s\n", element->Value()); 184 BaseObject* obj = Factory::fabricate(element); 185 if( obj != NULL && obj->isA( Weapon::staticClassID())) 186 { 187 PRINTF(0)("created a weapon\n"); 188 } 189 } 190 LOAD_PARAM_END_CYCLE(element); 161 191 } 162 192 -
trunk/src/world_entities/npcs/npc.h
r10376 r10440 20 20 21 21 22 void addWeapons(const TiXmlElement* root); 22 23 bool addWeapon(Weapon* weapon, int configID = -1, int slotID = -1); 23 24 void removeWeapon(Weapon* weapon); … … 31 32 inline void fire(){ this->bFire=true;} 32 33 33 34 inline void enableAI() { this->bAIEnabled = true; } 34 35 35 36 private: … … 51 52 52 53 AIModule* aiModule; 54 55 bool bAIEnabled; //!< true is AI enabled 53 56 }; 54 57 -
trunk/src/world_entities/weapons/weapon_slot.cc
r10437 r10440 19 19 #include "weapon_slot.h" 20 20 #include "util/loading/factory.h" 21 #include "util/loading/load_param.h" 21 22 22 23 … … 27 28 { 28 29 this->registerObject(this, WeaponSlot::_objectList); 29 30 30 } 31 31 … … 34 34 this->registerObject(this, WeaponSlot::_objectList); 35 35 36 if( root != NULL) 37 this->loadParams( root); 36 38 } 37 39 … … 39 41 WeaponSlot::~WeaponSlot() 40 42 {} 43 44 45 46 void WeaponSlot::loadParams(const TiXmlElement* root) 47 { 48 PNode::loadParams( root); 49 50 // now check for the orx class to create 51 LoadParam(root, "WeaponClass", this, WeaponSlot, setWeaponClass) 52 .describe("Sets the class this mount points should host"); 53 } 54 55 56 57 58 void WeaponSlot::setWeaponClass() 59 { 60 61 } 62 -
trunk/src/world_entities/weapons/weapon_slot.h
r10438 r10440 23 23 virtual ~WeaponSlot(); 24 24 25 virtual void loadParams(const TiXmlElement* root); 26 27 void setWeaponClass(); 25 28 26 29 long getCapability() { return this->capability; }
Note: See TracChangeset
for help on using the changeset viewer.