Ai* Ai::Create(TCODZip& zip) { ai_type type = (ai_type)zip.getInt(); Ai* ai = nullptr; switch(type) { case AI_TYPE_PLAYER: { ai = new PlayerAi(); } break; case AI_TYPE_ORC: { ai = new OrcAi(); } break; case AI_TYPE_ORC_BEG_FOR_MERCY: { ai = new OrcAiBegForMercy(nullptr); } break; } ai->Load(zip); return(ai); }
Ai *Ai::Create(TCODZip &zip) { AiType type = (AiType) zip.getInt(); Ai *ai = NULL; switch(type) { case PLAYER: ai = new PlayerAi(); break; case MONSTER: ai = new MonsterAi(); break; case CONFUSED_MONSTER: ai = new ConfusedMonsterAi(0, NULL); break; } if (ai != NULL) { ai->Load(zip); } return ai; }