Changeset 2640 in orxonox.OLD for orxonox/trunk/src/world.h
- Timestamp:
- Oct 25, 2004, 2:01:06 PM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/world.h
r2636 r2640 68 68 int debugWorldNr; 69 69 70 WorldEntity* localPlayer; 71 70 72 void mainLoop(); 71 73 void synchronize(); … … 74 76 void collision(); 75 77 void display(); 78 void debug(); 76 79 }; 77 80 … … 89 92 template<typename T> T* World::spawn(Location* loc = NULL, WorldEntity* owner = NULL) 90 93 { 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 94 Location zeroloc; 95 T* entity = new T(); 96 entities->add ((WorldEntity*)entity, LIST_ADD_NEXT); 97 if( loc == NULL) 98 { 99 zeroloc.dist = 0; 100 zeroloc.part = 0; 101 zeroloc.pos = Vector(); 102 zeroloc.rot = Quaternion(); 103 loc = &zeroloc; 104 } 105 entity->init (loc, owner); 106 if (entity->bFree) 107 { 108 track[loc->part].map_coords( loc, entity->get_placement()); 109 } 110 entity->post_spawn (); 111 return entity; 109 112 } 110 113 … … 123 126 template<typename T> T* World::spawn(Placement* plc, WorldEntity* owner = NULL) 124 127 { 125 126 127 128 129 130 131 132 133 134 135 128 T* entity = new T(); 129 entities->add ((WorldEntity*)entity, LIST_ADD_NEXT); 130 entity->init (plc, owner); 131 if (!entity->bFree) 132 { 133 printf("Can't spawn unfree entity with placement\n"); 134 entities->remove( (WorldEntity*)entity, LIST_FIND_FW); 135 return NULL; 136 } 137 entity->post_spawn (); 138 return entity; 136 139 } 137 140
Note: See TracChangeset
for help on using the changeset viewer.