integrate new events into this function, and no longer worry about syncing with the enum list
| 223 | using namespace EventManager::EventType; |
| 224 | // integrate new events into this function, and no longer worry about syncing with the enum list |
| 225 | handler_t getManager(EventType t) { |
| 226 | switch (t) { |
| 227 | case TICK: |
| 228 | return nullptr; |
| 229 | case JOB_INITIATED: |
| 230 | return ev_mng_jobInitiated; |
| 231 | case JOB_STARTED: |
| 232 | return ev_mng_jobStarted; |
| 233 | case JOB_COMPLETED: |
| 234 | return ev_mng_jobCompleted; |
| 235 | case UNIT_NEW_ACTIVE: |
| 236 | return ev_mng_unitNewActive; |
| 237 | case UNIT_DEATH: |
| 238 | return ev_mng_unitDeath; |
| 239 | case ITEM_CREATED: |
| 240 | return ev_mng_itemCreate; |
| 241 | case BUILDING: |
| 242 | return ev_mng_building; |
| 243 | case CONSTRUCTION: |
| 244 | return ev_mng_construction; |
| 245 | case SYNDROME: |
| 246 | return ev_mng_syndrome; |
| 247 | case INVASION: |
| 248 | return ev_mng_invasion; |
| 249 | case INVENTORY_CHANGE: |
| 250 | return ev_mng_inventory; |
| 251 | case REPORT: |
| 252 | return ev_mng_report; |
| 253 | case UNIT_ATTACK: |
| 254 | return ev_mng_unitAttack; |
| 255 | case UNLOAD: |
| 256 | return ev_mng_unload; |
| 257 | case INTERACTION: |
| 258 | return ev_mng_interaction; |
| 259 | case EVENT_MAX: |
| 260 | return nullptr; |
| 261 | //default: |
| 262 | //we don't do this... because then the compiler wouldn't error for missing cases in the enum |
| 263 | } |
| 264 | return nullptr; |
| 265 | } |
| 266 | |
| 267 | std::array<handler_t,EventManager::EventType::EVENT_MAX> compileEventHandlerArray() { |
| 268 | std::array<handler_t, EventManager::EventType::EVENT_MAX> managers{}; |
no outgoing calls
no test coverage detected