project-navigation
Personal tools

Author Topic: How to loop trough (owned) inventory-items.  (Read 4374 times)

Hoehrer

  • Guest
How to loop trough (owned) inventory-items.
« 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

Offline Mattn

  • Administrator
  • PHALANX Commander
  • *****
  • Posts: 4831
  • https://github.com/mgerhardy/vengi
    • View Profile
    • Vengi Voxel Tools
How to loop trough (owned) inventory-items.
« Reply #1 on: March 29, 2006, 06:06:58 pm »
we have no inventory in bases - just a global inventory...

Hoehrer

  • Guest
How to loop trough (owned) inventory-items.
« Reply #2 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

Offline Mattn

  • Administrator
  • PHALANX Commander
  • *****
  • Posts: 4831
  • https://github.com/mgerhardy/vengi
    • View Profile
    • Vengi Voxel Tools
How to loop trough (owned) inventory-items.
« Reply #3 on: March 29, 2006, 06:28:33 pm »
ccs.eCampaign and ccs.eMarket
both contains a int var num

Hoehrer

  • Guest
How to loop trough (owned) inventory-items.
« Reply #4 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

Hoehrer

  • Guest
How to loop trough (owned) inventory-items.
« Reply #5 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