void killQuest::printQuestRequirements() { enemy *temp_enm = getEnemy(enemyID); assert(temp_enm != NULL); printf("%s (Kill Quest)\n", name); printf("===============================\n"); printf("Target: %s\n", temp_enm->getName()); delete temp_enm; printf("Kills: %d/%d\n", kills, killNum); printf("Reward: %d gold", gold_reward); if (item_reward != 0) { item *temp_itm = getItem(item_reward); assert(temp_itm); printf(", %d %s(s)", item_stk, temp_itm->getName()); delete temp_itm; } printf("\n"); printf("Requments Met: "); if (reqs_met) printf("Yes\n"); else printf("No\n"); printf("\n"); }
void ListEnemies::handleEnnemy(const uint8_t id, const uint8_t life, const uint8_t type, const uint16_t x, const uint16_t y) { Enemy_SharedPtr e; if ((e = getEnemy(id)) == nullptr) { e = std::make_shared<Enemy>(id, life, type); addEnemy(e); } e->setX(x); e->setY(y); }
void killQuest::printDescription() { enemy *temp_enm = getEnemy(enemyID); assert(temp_enm != NULL); printf("'%s' Description:\n", name); printf("------------------------\n"); printf("Find and kill %d %s(s) to complete this quest.\n\n", killNum, temp_enm->getName()); delete temp_enm; }
const Enemy_SharedPtr DynamicLibUnix::getEnemy(const std::string &func) const { IPlugin *(*plugin)(); if (!(plugin = reinterpret_cast<IPlugin *(*)()>(dlsym(_lib, func.c_str())))) { std::cerr << "Can't get symbol " << func << " : " << dlerror() << std::endl; return (nullptr); } else { auto e = plugin(); return ((e) ? (e->getEnemy()) : (nullptr)); } }