Changeset 6089 in orxonox.OLD for branches/objectmanager/src/util/object_manager.cc
- Timestamp:
- Dec 13, 2005, 2:58:57 PM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/objectmanager/src/util/object_manager.cc
r5828 r6089 19 19 #include "class_list.h" 20 20 21 #include "p_node.h"22 21 #include "world_entity.h" 23 #include "list.h"24 22 25 23 using namespace std; … … 49 47 ObjectManager::singletonRef = NULL; 50 48 } 49 50 51 /** 52 * @brief moves an Entity from an old list to a new One 53 * @param entity the entity to move. 54 * @param omList the new List to move the entity to. 55 * 56 * this will erase the entity from the old list 57 */ 58 void ObjectManager::toList (WorldEntity* entity, OM_LIST omList) 59 { 60 if (likely(entity->getOMListNumber() != OM_INIT)) 61 this->objectLists[entity->getOMListNumber()].erase(entity->getEntityIterator()); 62 63 if (likely(omList != OM_INIT)) 64 { 65 this->objectList[omList].push_back(entity); 66 entity->getOMListNumber() = omList; 67 } 68 } 69 70 71 /** 72 * @see ObjectManager::toList(WorldEntity* OM_LIST) 73 * @param entity the entity to move. 74 * @param omList the new List to move the entity to. 75 * 76 * this function also does a transformation from omList as char* to OM_LIST. 77 */ 78 void ObjectManager::toList (WorldEntity* entity, const char* omList) 79 { 80 this->toList(entity, ObjectManager::StringToOMList( omList)); 81 } 82 83 51 84 52 85 /** … … 68 101 return NULL; 69 102 } 103 104 105 106 107 108 /** 109 * @brief transforms an omList into a String (usefull for debugging). 110 * @param omList the OM_LIST to be transformed into a String. 111 * @returns the String transformed from omList. 112 */ 113 const char* ObjectManager::StringToOMList(OM_LIST omList) 114 { 115 switch (omList) 116 { 117 case OM_DEAD: 118 return "dead"; 119 case OM_ENVIRON_NOTICK: 120 return "environ-notick"; 121 case OM_ENVIRON: 122 return "environ"; 123 case OM_COMMON: 124 return "common"; 125 case OM_GROUP_00: 126 return "group00"; 127 case OM_GROUP_00_PROJ: 128 return "group00-proj"; 129 case OM_GROUP_01: 130 return "group01"; 131 case OM_GROUP_01_PROJ: 132 return "group01-proj"; 133 case OM_GROUP_02: 134 return "group02"; 135 case OM_GROUP_02_PROJ: 136 return "group02-proj"; 137 case OM_GROUP_03: 138 return "group03"; 139 case OM_GROUP_03_PROJ: 140 return "group03-proj"; 141 case OM_GROUP_04: 142 return "group04"; 143 case OM_GROUP_04_PROJ: 144 return "group04-proj"; 145 case OM_GROUP_05: 146 return "group05"; 147 case OM_GROUP_05_PROJ: 148 return "group05-proj"; 149 case OM_GROUP_06: 150 return "group06"; 151 case OM_GROUP_06_PROJ: 152 return "group06-proj"; 153 case OM_GROUP_07: 154 return "group07"; 155 case OM_GROUP_07_PROJ: 156 return "group07-proj"; 157 case OM_GROUP_08: 158 return "group08"; 159 case OM_GROUP_08_PROJ: 160 return "group08-proj"; 161 case OM_GROUP_09: 162 return "group09"; 163 case OM_GROUP_09_PROJ: 164 return "group09-proj"; 165 case OM_GROUP_10: 166 return "group10"; 167 case OM_GROUP_10_PROJ: 168 return "group10-proj"; 169 case OM_GROUP_11: 170 return "group11"; 171 case OM_GROUP_11_PROJ: 172 return "group11-proj"; 173 case OM_GROUP_12: 174 return "group11"; 175 case OM_GROUP_12_PROJ: 176 return "group12-proj"; 177 case OM_GROUP_13: 178 return "group03"; 179 case OM_GROUP_13_PROJ: 180 return "group13-proj"; 181 case OM_GROUP_14: 182 return "group14"; 183 case OM_GROUP_14_PROJ: 184 return "group14-proj"; 185 case OM_GROUP_15: 186 return "group15"; 187 case OM_GROUP_15_PROJ: 188 return "group15-proj"; 189 default: 190 return "null"; 191 } 192 193 } 194 195 196 197 OM_LIST ObjectManager::StringToOMList(const char* listName) 198 { 199 if (unlikely(listName == NULL)) return OM_DEFAULT_LIST; 200 201 if (!strcmp(listName, "dead")) return OM_DEAD; 202 if (!strcmp(listName, "environ-notick")) return OM_ENVIRON_NOTICK; 203 if (!strcmp(listName, "environ")) return OM_ENVIRON; 204 if (!strcmp(listName, "common")) return OM_COMMON; 205 206 if (!strcmp(listName, "group00")) return OM_GROUP_00; 207 if (!strcmp(listName, "group00-proj")) return OM_GROUP_00_PROJ; 208 if (!strcmp(listName, "group01")) return OM_GROUP_01; 209 if (!strcmp(listName, "group01-proj")) return OM_GROUP_01_PROJ; 210 if (!strcmp(listName, "group02")) return OM_GROUP_02; 211 if (!strcmp(listName, "group02-proj")) return OM_GROUP_02_PROJ; 212 if (!strcmp(listName, "group03")) return OM_GROUP_03; 213 if (!strcmp(listName, "group03-proj")) return OM_GROUP_03_PROJ; 214 if (!strcmp(listName, "group04")) return OM_GROUP_04; 215 if (!strcmp(listName, "group04-proj")) return OM_GROUP_04_PROJ; 216 if (!strcmp(listName, "group05")) return OM_GROUP_05; 217 if (!strcmp(listName, "group05-proj")) return OM_GROUP_05_PROJ; 218 if (!strcmp(listName, "group06")) return OM_GROUP_06; 219 if (!strcmp(listName, "group06-proj")) return OM_GROUP_06_PROJ; 220 if (!strcmp(listName, "group07")) return OM_GROUP_07; 221 if (!strcmp(listName, "group07-proj")) return OM_GROUP_07_PROJ; 222 if (!strcmp(listName, "group08")) return OM_GROUP_08; 223 if (!strcmp(listName, "group08-proj")) return OM_GROUP_08_PROJ; 224 if (!strcmp(listName, "group09")) return OM_GROUP_09; 225 if (!strcmp(listName, "group09-proj")) return OM_GROUP_09_PROJ; 226 if (!strcmp(listName, "group10")) return OM_GROUP_10; 227 if (!strcmp(listName, "group10-proj")) return OM_GROUP_10_PROJ; 228 if (!strcmp(listName, "group11")) return OM_GROUP_11; 229 if (!strcmp(listName, "group11-proj")) return OM_GROUP_11_PROJ; 230 if (!strcmp(listName, "group12")) return OM_GROUP_12; 231 if (!strcmp(listName, "group12-proj")) return OM_GROUP_12_PROJ; 232 if (!strcmp(listName, "group13")) return OM_GROUP_13; 233 if (!strcmp(listName, "group13-proj")) return OM_GROUP_13_PROJ; 234 if (!strcmp(listName, "group14")) return OM_GROUP_14; 235 if (!strcmp(listName, "group14-proj")) return OM_GROUP_14_PROJ; 236 if (!strcmp(listName, "group15")) return OM_GROUP_15; 237 if (!strcmp(listName, "group15-proj")) return OM_GROUP_15_PROJ; 238 239 return OM_DEFAULT_LIST; 240 } 241
Note: See TracChangeset
for help on using the changeset viewer.