- Timestamp:
- Jul 24, 2005, 12:36:58 PM (19 years ago)
- Location:
- orxonox/trunk/src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/util/fast_factory.cc
r4941 r4950 18 18 #include "compiler.h" 19 19 #include "debug.h" 20 #include "string.h" 20 21 21 22 using namespace std; … … 83 84 /** 84 85 * searches for a FastFactory 85 * @param factoryName the Name of the Factory to search for (not used)86 86 * @param classID the ClassID of the FastFactory to search for 87 87 * @returns true if found, false otherwise. 88 88 */ 89 FastFactory* FastFactory::searchFastFactory(ClassID classID , const char* fastFactoryName)89 FastFactory* FastFactory::searchFastFactory(ClassID classID) 90 90 { 91 91 if (FastFactory::first == NULL) … … 97 97 { 98 98 if (tmpFac->storedClassID == classID) 99 return tmpFac; 100 tmpFac = tmpFac->next; 101 } 102 } 103 return NULL; 104 } 105 106 /** 107 * searches for a FastFactory 108 * @param classID the ClassID of the FastFactory to search for 109 * @returns true if found, false otherwise. 110 */ 111 FastFactory* FastFactory::searchFastFactory(const char* fastFactoryName) 112 { 113 if (FastFactory::first == NULL) 114 return NULL; 115 else 116 { 117 FastFactory* tmpFac = FastFactory::first; 118 while (tmpFac != NULL) 119 { 120 if (strcmp(tmpFac->getName(), fastFactoryName)) 99 121 return tmpFac; 100 122 tmpFac = tmpFac->next; -
orxonox/trunk/src/util/fast_factory.h
r4947 r4950 66 66 inline static FastFactory* getFirst() { return FastFactory::first; }; 67 67 68 static FastFactory* searchFastFactory(ClassID classID, const char* fastFactoryName = NULL); 68 static FastFactory* searchFastFactory(ClassID classID); 69 static FastFactory* searchFastFactory(const char* fastFactoryName); 70 71 ClassID getStoredID() const { return this->storedClassID; }; 69 72 70 73 protected: … … 135 138 tFastFactory<T>* tmpFac = NULL; 136 139 if (FastFactory::getFirst() != NULL) 137 tmpFac = static_cast<tFastFactory<T>*>(FastFactory::getFirst()->searchFastFactory(classID , fastFactoryName));140 tmpFac = static_cast<tFastFactory<T>*>(FastFactory::getFirst()->searchFastFactory(classID)); 138 141 139 142 if (tmpFac != NULL) -
orxonox/trunk/src/world_entities/weapons/weapon.cc
r4949 r4950 96 96 * sets the Projectile to use for this weapon. 97 97 * @param projectile The ID of the Projectile to use 98 * @returns true, if it was sucessfull, false on error 98 99 * 99 100 * be aware, that this function does not create Factories, as this is job of Bullet-classes. … … 117 118 } 118 119 }; 120 121 /** 122 * @see bool Weapon::setProjectile(ClassID projectile) 123 * @param projectile the Name of the Projectile. 124 * @return true if 125 */ 126 bool Weapon::setProjectile(const char* projectile) 127 { 128 if (projectile == NULL) 129 return false; 130 FastFactory* tmpFac = FastFactory::searchFastFactory(projectile); 131 if (tmpFac != NULL) 132 { 133 this->setProjectile(tmpFac->getStoredID()); 134 } 135 } 119 136 120 137 /** -
orxonox/trunk/src/world_entities/weapons/weapon.h
r4949 r4950 95 95 // FUNCTIONS TO SET THE WEAPONS PROPERTIES. 96 96 bool setProjectile(ClassID projectile); 97 bool setProjectile(const char* projectile); 97 98 /** @returns The projectile's classID */ 98 99 inline ClassID getProjectile() { return this->projectile; }; -
orxonox/trunk/src/world_entities/weapons/weapon_manager.h
r4949 r4950 85 85 { 86 86 int number; 87 bool occupied;88 87 long capability; 89 88
Note: See TracChangeset
for help on using the changeset viewer.