Skip to content
Snippets Groups Projects
Commit 554f701b authored by Jake Feddersen's avatar Jake Feddersen
Browse files

Better picking up of objects

parent 85f8c314
No related branches found
No related tags found
No related merge requests found
......@@ -252,14 +252,15 @@ int player_character::pick_up(std::vector<item *> &floor) {
if (floor.size() == 0) {
mvaddstr(7, (80 - strlen(pickup_no_items)) / 2, pickup_no_items);
} else {
int missing_top = std::max(0, k - 2);
int top = std::max(0, k-2);
top = std::min(top, std::max(0, (int)floor.size()-5));
int bottom = std::min((int)floor.size()-1, top + 4);
int missing_top = top;
if (missing_top > 0) {
mvprintw(7, 38, "(+%d)", missing_top);
}
int top = std::max(0, k-2);
int bottom = std::min((int)floor.size()-1, top + 5);
int missing_bottom = floor.size() - 1 - bottom;
if (missing_bottom > 0) {
mvprintw(19, 38, "(+%d)", missing_bottom);
......@@ -278,7 +279,7 @@ int player_character::pick_up(std::vector<item *> &floor) {
}
}
char c = getch();
int c = getch();
if (c == 'q' || c == 'Q') {
shouldExit = 1;
......@@ -300,7 +301,16 @@ int player_character::pick_up(std::vector<item *> &floor) {
}
if (c == ',') {
for (i = 0; i <
for (i = 0; i < 10; i++) {
if (!inventory[i]) {
inventory[i] = floor[k];
floor.erase(floor.begin() + k);
break;
}
}
break;
}
}
return shouldExit;
......
......@@ -14,7 +14,7 @@
#define MAX_ROOMS 12
#define MIN_ROOMS 6
#define ITEMS_PER_LEVEL 15
#define ITEMS_PER_LEVEL 2000
class character;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment