Switch case question
Posted: Thu Feb 09, 2012 2:25 pm
Hi just need a bit of help but I'm not too sure how to explain it.
I'll start with what I have
In create actor is this call (ObjectText is a local actor string)
getObj gives the Object's text based on the animindex
Now my problem is I may want to change the animnames in the anim index so how can I make it so it actually searches for the animation name in the switch statement. So my statement would look like the following
I know I could use a #define method for a similar effect but that's not what I'm after
I'll start with what I have
In create actor is this call (ObjectText is a local actor string)
- Code: Select all
strcpy(ObjectText, getObj(animindex));
getObj gives the Object's text based on the animindex
- Code: Select all
Char * getObj(int ThisObject) //Return the name of the object based on the anim index image
{
switch (ThisObject)
{
case 0: return "Object text 1";
case 1: return "Object text 2";
case 2: return "Object text 3";
case default: return "No Object";
}
return NULL;
}
Now my problem is I may want to change the animnames in the anim index so how can I make it so it actually searches for the animation name in the switch statement. So my statement would look like the following
- Code: Select all
switch (ThisObject)
{
case Anim1: return "Object text 1";
case Anim2: return "Object text 2";
case Anim3: return "Object text 3";
case default: return "No Object";
}
I know I could use a #define method for a similar effect but that's not what I'm after