finished the bulk of game
This commit is contained in:
@ -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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user