I believe it won't work. This works about the same as #define WEAPON_GARAND 2, you can't do things like array["WEAPON_GARAND"].
Unfortunataly, the long if else block looks like the way to go. On Mon, 2002-05-06 at 23:20, Mugsy _ wrote: > > It doesnt have to be a define, it can be an enumerated variable. ( since > #define names would probably be tossed in a compiled version ) > > enum > { > WEAPON_GARAND = 2 > }; > > >From: "Mugsy _" <[EMAIL PROTECTED]> > >Reply-To: [EMAIL PROTECTED] > >To: [EMAIL PROTECTED] > >Subject: [hlcoders] string to #define > >Date: Mon, 06 May 2002 19:17:02 -0700 > > > >This is more general C++, but its for a HL mod so.. > > > >If I have a string, is there a way to convert it to integer with a > >previously enumerated value? > > > >eg, > >#define WEAPON_GARAND 2 > > > >then if I read in a string, and it happens to be "WEAPON_GARAND" can I know > >that that symbol is defined as 2? Obviously without doing an enormous > >if/else strcmp block.. > > > >Mugsy > >Day of Defeat mod > > > >_________________________________________________________________ > >Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp. > > > >_______________________________________________ > >To unsubscribe, edit your list preferences, or view the list archives, > >please visit: > >http://list.valvesoftware.com/mailman/listinfo/hlcoders > > > > > _________________________________________________________________ > Chat with friends online, try MSN Messenger: http://messenger.msn.com > > _______________________________________________ > To unsubscribe, edit your list preferences, or view the list archives, please visit: > http://list.valvesoftware.com/mailman/listinfo/hlcoders > _______________________________________________ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders