finished the bulk of game

This commit is contained in:
2024-07-14 21:32:41 -04:00
parent b3475b7530
commit af8bc4112c
110 changed files with 1876 additions and 1481 deletions

View File

@ -1,14 +1,16 @@
#include "potion.h"
#include "constants.h"
potion::potion(const potion_type type, const int duration, const position &pos):
type{type}, remaining_duration{duration}, pos{pos} {}
potion_type potion::get_type() const {
return type;
return type;
}
int potion::get_duration() const {
return remaining_duration;
return remaining_duration;
}
position potion::get_pos() const {
@ -44,3 +46,16 @@ potion &potion::operator=(potion &&p) {
void potion::print(display *out) {
out->print_char(pos, 'P', COLOR_PAIR(COLOR_GREEN));
}
potion *get_potion_at(const position &pos, potion_list &plist) {
potion *ret = nullptr;
for (size_t i = 0; i < plist.size(); ++i)
if (plist[i]->get_pos() == pos) {
ret = plist[i];
plist.erase(plist.begin() + i);
return ret;
}
return ret;
}