Rulzy 发表于 2008-4-27 19:02:37

回复: 插件编写的小问题(关于#define)

#define ADMIN_IMMUNITY(1<<0) /* flag "a" */
#define ADMIN_RESERVATION (1<<1) /* flag "b" */
#define ADMIN_KICK(1<<2) /* flag "c" */
#define ADMIN_BAN(1<<3) /* flag "d" */
#define ADMIN_SLAY(1<<4) /* flag "e" */
#define ADMIN_MAP(1<<5) /* flag "f" */
#define ADMIN_CVAR(1<<6) /* flag "g" */
#define ADMIN_CFG(1<<7) /* flag "h" */
#define ADMIN_CHAT(1<<8) /* flag "i" */
#define ADMIN_VOTE(1<<9) /* flag "j" */
#define ADMIN_PASSWORD(1<<10) /* flag "k" */
#define ADMIN_RCON(1<<11) /* flag "l" */
#define ADMIN_LEVEL_A(1<<12) /* flag "m" */
#define ADMIN_LEVEL_B(1<<13) /* flag "n" */
#define ADMIN_LEVEL_C(1<<14) /* flag "o" */
#define ADMIN_LEVEL_D(1<<15) /* flag "p" */
#define ADMIN_LEVEL_E(1<<16) /* flag "q" */
#define ADMIN_LEVEL_F(1<<17) /* flag "r" */
#define ADMIN_LEVEL_G(1<<18) /* flag "s" */
#define ADMIN_LEVEL_H(1<<19) /* flag "t" */
#define ADMIN_MENU(1<<20) /* flag "u" */
#define ADMIN_ADMIN(1<<24) /* flag "y" */
#define ADMIN_USER(1<<25) /* flag "z" */
/* Menu keys */
#define MENU_KEY_1(1<<0)
#define MENU_KEY_2(1<<1)
#define MENU_KEY_3(1<<2)
#define MENU_KEY_4(1<<3)
#define MENU_KEY_5(1<<4)
#define MENU_KEY_6(1<<5)
#define MENU_KEY_7(1<<6)
#define MENU_KEY_8(1<<7)
#define MENU_KEY_9(1<<8)
#define MENU_KEY_0(1<<9)
像这种情况,比直接用整数就好识别多了,而且你定义的时候,也不容易出错。
页: 1 [2]
查看完整版本: 插件编写的小问题(关于#define)