Pickable *Pickable::Create(TCODZip &zip) { PickableType type = (PickableType) zip.getInt(); Pickable *pickable = NULL; switch(type) { case HEALER: pickable = new Healer(0); break; case LIGHTNING_BOLT: pickable = new LightningBolt(0, 0); break; case CONFUSER: pickable = new Confuser(0, 0); break; case FIREBALL: pickable = new Fireball(0, 0); break; } if (pickable != NULL) { pickable->Load(zip); } return pickable; }
Pickable* Pickable::Create(TCODZip& zip) { pickable_type type = (pickable_type)zip.getInt(); Pickable* pickable = nullptr; switch(type) { case PICKABLE_TYPE_HEALER: { pickable = new Healer(0); } break; case PICKABLE_TYPE_LIGHTNING_BOLT: { pickable = new LightningBolt(0, 0); } break; case PICKABLE_TYPE_FIREBALL: { pickable = new Fireball(0, 0); } break; } pickable->Load(zip); return(pickable); }