Advertisement
Guest User

Untitled

a guest
Jun 16th, 2013
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.38 KB | None | 0 0
  1. enum SystemFacFlag {
  2.     SFF_MINERALS = 1,
  3.     SFF_ORGANICS = 2,
  4.     SFF_RADIOACTIVES = 4
  5. };
  6.  
  7. for (int f = 0; f <= (SFF_MINERALS | SFF_ORGANICS | SFF_RADIOACTIVES); ++f) {
  8.     // do stuff with f, including indexing an array with it;
  9.     if (f & SFF_MINERALS) { /* more stuff */ }
  10.     if (f & SFF_ORGANICS) { /* still more stuff */ }
  11.     if (f & SFF_RADIOACTIVES) { /* even more stuff */ }
  12. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement