#include "backend/print.h" #include "backend/ListIterator.h" #include "../GameController.h" #include "../strings.h" using namespace std; FollowupAction GameController::cmd_equip(string & target_name) { for (Object * object : this->player.inventory) { if (str_lower(object->get_name().c_str()) != str_lower(target_name)) continue; WeaponObject * weapon = dynamic_cast(object); if (weapon != nullptr) { this->player.inventory.remove(weapon); this->player.equip(weapon); return FollowupAction::UPDATE; } ArmorObject * armor = dynamic_cast(object); if (armor != nullptr) { this->player.inventory.remove(armor); this->player.equip(armor); return FollowupAction::UPDATE; } lprtf("Object %s is niet draagbaar.\n", target_name.c_str()); return FollowupAction::NONE; } lprtf("Object \"%s\" niet gevonden.\n", target_name.c_str()); return FollowupAction::NONE; }