hmm

a possible idea could be a string table maybe

an array of string/code structs, like

typedef struct
{
    char cStringId[256];
    int iId;
}weaponchar_id_t;

then you could perhaps have like

weaponchar_id_t WeaponCodes[] = {
    { "WEAPON_GARAND",2 },
    { "WEAPON_1911", 1},
    NULL,
    // etc
};

then have a support function or two to grab the string/int and compare in
this array
this could be more work, who knows, but here it looks a bit easier to just
reference similar items in an array

----- Original Message -----
From: "Dynerman David M" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, May 06, 2002 11:10 PM
Subject: RE: [hlcoders] string to #define


> Well they say when you're not sure try..so I did and Leon's right (at
> least with VC++)
>
> I'm not sure where I saw/read that it would scan quotes, but the define
> didn't work for me (it would just print out WEAPON_GARAND instead of 2)
>
> Looks like we're stuck defining string literals or numbers, but not
> mixing & matching.
>
> david
>
> -----Original Message-----
> From: Leon Hartwig [mailto:[EMAIL PROTECTED]]
> Sent: Monday, May 06, 2002 9:50 PM
> To: '[EMAIL PROTECTED]'
> Subject: RE: [hlcoders] string to #define
>
> I'm sure it depends on which preprocessor is being used, but I doubt
> most
> modern ones do this.
>
>
> > -----Original Message-----
> > From: Dynerman David M [mailto:[EMAIL PROTECTED]]
> > Sent: Monday, May 06, 2002 7:35 PM
> > To: [EMAIL PROTECTED]
> > Subject: RE: [hlcoders] string to #define
> >
> >
> > The pre-processors scan through source files replacing the define with
> > the value.
> >
> > I'm not 100% sure, but about 95% that it looks in strings as well, so
> >
> > someFuncThatTakesAString("WEAPON_GARAND");
> >
> > will get changed to
> >
> > someFuncThatTakesAString("2"); //constant string 2\0
> >
> > before its compiled.
> _______________________________________________
> 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
>

_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives, please visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders

Reply via email to