UFO:Alien Invasion

Development => Coding => Topic started by: Hoehrer on March 29, 2006, 05:58:45 pm

Title: How to loop trough (owned) inventory-items.
Post by: Hoehrer on March 29, 2006, 05:58:45 pm
Yet again a questiona bout finding data.

What i need a list/loop of all items (objDef_t) that are owend by me (in base/on soldiers). What i don't need: A list of all possible items .. this i already know ;)

I hope s/b can help me again.

Thanks,
Werner
Title: How to loop trough (owned) inventory-items.
Post by: Mattn on March 29, 2006, 06:06:58 pm
we have no inventory in bases - just a global inventory...
Title: How to loop trough (owned) inventory-items.
Post by: Hoehrer on March 29, 2006, 06:10:59 pm
Quote from: "Mattn"
we have no inventory in bases - just a global inventory...

And how(where) is determined what i own (and how many of it) and what not?

Thanks,
Werner
Title: How to loop trough (owned) inventory-items.
Post by: Mattn on March 29, 2006, 06:28:33 pm
ccs.eCampaign and ccs.eMarket
both contains a int var num
Title: How to loop trough (owned) inventory-items.
Post by: Hoehrer on March 29, 2006, 06:35:00 pm
Quote from: "Mattn"
ccs.eCampaign and ccs.eMarket
both contains a int var num


Ah. perfect. Many thanks for the fast answer :D

Werner
Title: How to loop trough (owned) inventory-items.
Post by: Hoehrer on March 29, 2006, 06:38:33 pm
Quote from: "Mattn"
ccs.eCampaign and ccs.eMarket
both contains a int var num


Just one small thing left:
items in eMarket are the ones i can buy, but do not yet own, am i right?

EDIT this is the function i'm currently using
Code: [Select]

/*======================
RS_MarkCollected

Marks all techs if an item they 'provide' have been collected.
Should be run after items have been collected/looted from the battlefield (cl_campaign.c -> "CL_CollectItems") and after techtree/inventory init (for all).
======================*/
void RS_MarkCollected ( void )
{
int i;

for ( i=0; i < MAX_OBJDEFS; i++ ) {
if ( ccs.eCampaign.num[i] ) {
RS_MarkOneCollected( csi.ods[i].kurz );
}
}
}


Werner