- Timestamp:
- Nov 25, 2005, 2:14:02 AM (19 years ago)
- Location:
- trunk/src/lib
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/event/event_handler.h
r5388 r5776 14 14 // FORWARD DECLARATION 15 15 class EventListener; 16 template<class T> class tList;17 16 template<class T> class tStack; 18 17 class IniParser; -
trunk/src/lib/graphics/render2D/render_2d.h
r5420 r5776 10 10 #include "element_2d.h" 11 11 // FORWARD DECLARATION 12 template <class T> class tList;13 12 14 13 //! A default singleton class. -
trunk/src/lib/physics/physics_engine.cc
r5652 r5776 34 34 this->setClassID(CL_PHYSICS_ENGINE, "PhysicsEngine"); 35 35 this->setName("PhysicsEngine"); 36 this->connections = new tList<PhysicsConnection>;37 this->fields = new tList<Field>;38 36 this->interfaces = NULL; 39 37 } … … 51 49 { 52 50 // delete all PhysicsConnections that are still in existence 53 tIterator<PhysicsConnection>* itPC = this->connections->getIterator(); 54 PhysicsConnection* enumPC = itPC->firstElement(); 55 while (enumPC) 56 { 57 delete enumPC; 58 enumPC = itPC->nextElement(); 59 } 60 delete itPC; 61 delete this->connections; 51 list<PhysicsConnection*>::iterator pc; 52 for (pc = this->connections.begin(); pc != this->connections.end(); pc++) 53 delete (*pc); 62 54 // 63 55 // // delete all PhysicsInterfaces, still in existence (this could be dangerous) … … 82 74 // } 83 75 // delete itF; 84 delete this->fields;85 86 76 87 77 PhysicsEngine::singletonRef = NULL; … … 161 151 void PhysicsEngine::addField(Field* field) 162 152 { 163 this->fields ->add(field);153 this->fields.push_back(field); 164 154 } 165 155 … … 172 162 void PhysicsEngine::removeField(Field* field) 173 163 { 174 this->fields ->remove(field);164 this->fields.remove(field); 175 165 } 176 166 … … 181 171 Field* PhysicsEngine::getFieldByName(const char* FieldName) const 182 172 { 183 tIterator<Field>* tmpIt = fields->getIterator(); 184 Field* tmpField = tmpIt->firstElement(); 185 while(tmpField) 186 { 187 if (!strcmp(FieldName, tmpField->getName())) 188 { 189 delete tmpIt; 190 return tmpField; 191 } 192 tmpField = tmpIt->nextElement(); 193 } 194 delete tmpIt; 173 list<Field*>::const_iterator field; 174 for (field = this->fields.begin(); field != this->fields.end(); field++) 175 if (!strcmp(FieldName, (*field)->getName())) 176 return (*field); 195 177 return NULL; 196 178 } … … 206 188 void PhysicsEngine::addConnection(PhysicsConnection* connection) 207 189 { 208 this->connections ->add(connection);190 this->connections.push_back(connection); 209 191 } 210 192 … … 217 199 void PhysicsEngine::removeConnection(PhysicsConnection* connection) 218 200 { 219 this->connections ->remove(connection);201 this->connections.remove(connection); 220 202 } 221 203 … … 226 208 PhysicsConnection* PhysicsEngine::getPhysicsConnectionByName(const char* physicsConnectionName) const 227 209 { 228 tIterator<PhysicsConnection>* tmpIt = connections->getIterator(); 229 PhysicsConnection* tmpConn = tmpIt->firstElement(); 230 while(tmpConn) 231 { 232 if (!strcmp(physicsConnectionName, tmpConn->getName())) 233 { 234 delete tmpIt; 235 return tmpConn; 236 } 237 tmpConn = tmpIt->nextElement(); 238 } 239 delete tmpIt; 210 list<PhysicsConnection*>::const_iterator pc; 211 for (pc = this->connections.begin(); pc != this->connections.end(); pc++) 212 if (!strcmp(physicsConnectionName, (*pc)->getName())) 213 delete (*pc); 240 214 return NULL; 241 215 } … … 253 227 /* go through all the PhysicsInterface(s) and tick them, 254 228 meaning let the fields work */ 255 tIterator<PhysicsConnection>* itPC = this->connections->getIterator(); 256 PhysicsConnection* enumPC = itPC->firstElement(); 257 while (enumPC) 258 { 259 enumPC->apply(); 260 261 enumPC = itPC->nextElement(); 262 } 263 delete itPC; 229 list<PhysicsConnection*>::iterator pc; 230 for (pc = this->connections.begin(); pc != this->connections.end(); pc++) 231 (*pc)->apply(); 264 232 265 233 /* actually tick all the PhysicsInterfaces. Move the objects around */ … … 291 259 if (this->interfaces != NULL) 292 260 PRINT(0)(" number of Interfaces: %d\n", this->interfaces->getSize()); 293 PRINT(0)(" number of Fields: %d\n", this->fields ->getSize());294 PRINT(0)(" number of Connections: %d\n", this->connections ->getSize());261 PRINT(0)(" number of Fields: %d\n", this->fields.size()); 262 PRINT(0)(" number of Connections: %d\n", this->connections.size()); 295 263 296 264 PRINT(0)("==============================PHYS==\n"); -
trunk/src/lib/physics/physics_engine.h
r5217 r5776 13 13 #include "physics_interface.h" 14 14 #include "field.h" 15 #include <list> 16 15 17 16 18 // Forward Declaration … … 51 53 static PhysicsEngine* singletonRef; //!< the singleton reference of the PhysicsEngine 52 54 53 tList<Field>*fields; //!< a list of physicsl fields.54 tList<PhysicsConnection>*connections; //!< a list of physical connections.55 std::list<Field*> fields; //!< a list of physicsl fields. 56 std::list<PhysicsConnection*> connections; //!< a list of physical connections. 55 57 const tList<BaseObject>* interfaces; //!< The list of physical interfaces. 56 58 };
Note: See TracChangeset
for help on using the changeset viewer.