So right now I’m working on a small light rework so that flags like LIGHT_4 actually have an effect without needing to be hacked into the game, but I’ve run into a small problem.
Here is the important part of my code right now:
[code] std::vector<item*> inv_active = inv.active_items();
for (std::vector<item*>::iterator iter = inv_active.begin(); iter != inv_active.end(); ++iter)
{
item *tmp_it = *iter;
temp_lumination = 0;
if (tmp_it->has_flag("LIGHT_4")) {temp_lumination = 20;}
int charges = active_item_charges("flashlight_on");
if (tmp_it->has_flag("LIGHT_CHARGES_5") && charges * 5 < temp_lumination) {temp_lumination = charges * 5;}
if (temp_lumination > lumination) {lumination = temp_lumination;}
}[/code]
The code above should iterate through a list of all of the active items, determine the current light value based on the iteration item, and then if that is above the current maximum it sets it as the new maximum. The problem comes in: active_item_charges("flashlight_on");
This line should use the current iteration item’s id, however I am unable to figure out how to retrieve the iteration item’s id. If anybody has a pointer method that will solve this problem (or an alternate method to get the charges of the iteration item) I would be very grateful for some advice.