View Single Post
  #9  
Old 05-19-2004, 11:34 AM
m0oni9
Hill Giant
 
Join Date: Dec 2003
Posts: 166
Default

Right now there are some things defined as such:
Code:
#define STAT_STR 0
#define STAT_STA 1
#define STAT_AGI 2
etc..
So instead of
Code:
mob->CastToClient()->SetStat(0,70); 
mob->CastToClient()->SetStat(1,75);
Use
Code:
mob->CastToClient()->SetStat(STAT_STR,70); 
mob->CastToClient()->SetStat(STAT_STA,75);
IMO those defines should be changed to use an enum (assuming they are just used for internal purposes). ie:
Code:
enum {
  STAT_STR,
  STAT_STA,
  etc...,
  STAT_MAX
};
I was just mentioning flags in case someone wanted to rewrite SetStat(). Normally, flags are done using bitwise operations. They tell the function to perform certain operations, return certain values, etc. Normally they are done like this:
Code:
#define FLAG1 0x01
#define FLAG2 0x02
#define FLAG3 0x04
Then, within some function..
Code:
if (flags & FLAG1)
  ... code ...
if (flags & FLAG2)
  ... code ...
if (flags & FLAG3)
  ... code ...
Reply With Quote