- Code: Select all
//FOR LOOP FOR SPLITTING LONG ITEM NAMES INTO TWO LINES
for(i = 0; i < (sizeof(myActor->ItemName)/sizeof(char)-1); i++)
{
//NEVER RUNS??
if(i >= ( ( sizeof(myActor->ItemName)/sizeof(char)-1 )/2 )
&& myActor->ItemName[i] == ' ')
{
description[i] = newline[0];
i++;
}
description[i] = myActor->ItemName[i];
}
I was able to get this to work if I look for two specific character in the string using this loop:
if(myActor->ItemName[i+1] == 'o' && myActor->ItemName[i+2] == 'f')
But the problem is I need it to separate once it reaches a certain point. I can think of many work arounds but I want this to work a specific way so that I don't have to have strict string lengths.
I, also, know that this specific code should turn all spaces after half the length into newline character. I just want it to run once and I will get it to do that after I can figure out why it never even runs this loop once.