How to sort out Cumulative Flag Values?

Post new mods and scenarios here
Post Reply
User avatar
76mm
Posts: 4765
Joined: Sun May 02, 2004 4:26 am
Location: Washington, DC

How to sort out Cumulative Flag Values?

Post by 76mm »

OK, still making good progress on the eqp files, but have a basic question: I'm trying to build in a filter for equipment by flag values, but now see that many flags contain "cumulative" flag values, ie equipment can have a FLAG0 has a value of 12, which I guess means that they are both Active Defenders (4) and Recon Capable (8). Other equipment has a FLAG0 value of 14, so I guess Active Defenders (4), Recon Capable (8), and Armored (2)...

I've seen this kind of stuff before, so am guessing that there must be a standard formula or algorithm for figuring out what combination is represented by the various numbers? Can anyone point me towards this formula/algorithm or even tell me what this formula/algorithm/process is called so that I can Google it?
User avatar
76mm
Posts: 4765
Joined: Sun May 02, 2004 4:26 am
Location: Washington, DC

RE: How to sort out Cumulative Flag Values?

Post by 76mm »

hmmm after a bit of Googling it looks like I need to be looking at "bitwise operators" and "flag attributes"...
cathar1244
Posts: 1162
Joined: Sat Sep 05, 2009 2:16 am

RE: How to sort out Cumulative Flag Values?

Post by cathar1244 »

Rusty here, but IIRC the "mod" or "modulus" operator can help here.

Flag_value mod 128 should return the remainder, then proceed down the power-of-two chain.

Cheers
User avatar
76mm
Posts: 4765
Joined: Sun May 02, 2004 4:26 am
Location: Washington, DC

RE: How to sort out Cumulative Flag Values?

Post by 76mm »

ORIGINAL: cathar1244

Rusty here, but IIRC the "mod" or "modulus" operator can help here.

Flag_value mod 128 should return the remainder, then proceed down the power-of-two chain.
Thanks, I've got about a dozen tabs open with various Google results on this stuff, should be able to figure it out--hopefully! [8D]
Post Reply

Return to “Mods and Scenarios”