Don't hard-code player max inventory size at all use points

This commit is contained in:
2016-08-31 15:55:19 -04:00
parent 077d188cdd
commit 0a5a9c089d
17 changed files with 289 additions and 291 deletions

View File

@@ -69,18 +69,18 @@ bool handle_action(sf::Event event) {
break;
}
}
for(short i = 0; i < 24; i++)
for(short i = 0; i < univ.party[current_active_pc].items.size(); i++) {
if((the_point.in(item_string_rects[i][1])) && // drop item
univ.party[current_active_pc].items[i].variety != eItemType::NO_ITEM) {
flash_rect(item_string_rects[i][1]);
univ.party[current_active_pc].take_item(i);
}
for(short i = 0; i < 24; i++)
if((the_point.in(item_string_rects[i][2])) && // identify item
univ.party[current_active_pc].items[i].variety != eItemType::NO_ITEM) {
flash_rect(item_string_rects[i][2]);
univ.party[current_active_pc].items[i].ident = true;
}
}
return to_return;
}

View File

@@ -329,7 +329,7 @@ void draw_items() {
return; // If PC is dead, it has no items
}
sf::Texture& invenbtn_gworld = *ResMgr::get<ImageRsrc>("invenbtns");
for(short i = 0; i < 24; i++) // Loop through items and draw each
for(short i = 0; i < univ.party[current_active_pc].items.size(); i++) // Loop through items and draw each
if(univ.party[current_active_pc].items[i].variety != eItemType::NO_ITEM) { // i.e. does item exist
std::string to_draw = std::to_string(i + 1) + ". ";
if(!univ.party[current_active_pc].items[i].ident)