What line does it bring you to?
I am makeing a menu, and have fixed all the errors, except for two errors I never heard of, and can't find any help with on the web.
[PHP]void MRender(int ix, int iy,D3DCOLOR i_color){
PrintText(ix+10, iy-10,_O_,pFont, "MenuTestV1.0");
int ai=0;
int i=0;
while(ai<MMI){
if(MENU[i].typ==(char)"FOLDER"){
ai++;
i_color=_R_;
int val=(MENU[ai].var)?(*MENU[ai].var);
PrintText(ix+10, iy-(15+(ai*8)), i_color,pFont, MENU[ai].txt);
PrintText(ix+75, iy-(15+(ai*8)), i_color,pFont, MENU[ai].opt[MENU[ai].var]);
}
else{
if(MENU[i].cm>0){
ai++;
int value=MENU[i].var;
if(value==0){
i_color=_B_;
}
else{
i_color=_G_;
}
int item_num = MENU[i].var;
PrintText((int)ix+25, (int)iy-(15+(ai*8)),i_color, pFont, MENU[i].txt);
PrintText((int)ix+75, (int)iy-(15+(ai*8)),i_color, pFont, MENU[i].opt[item_num]);
}
}
drawBox(ix, iy, 80, (ai*8),i_color,pDevice);
}
}[/PHP]
and:
[PHP]char *_Folder[]={"<+>","<->"};
char *_on_off[]={"DISABLED","ENABLED"};
char *_1to5[]={"DISABLED","2","3","4","5"};
char *_off_2[]={"DISABLED","OPK","TELE"};
char *_act_1[]={"INACTIVE","ACTIVE"};
char *_color_[]={"Red","Blue","Green","Orange","Yellow","White"," Black"};[/PHP]in my menu I assign _Menu[Item].opt to one of these And what I am trying to do is print the item of the option that is corresponding to the variable _Menu[Item].var
This is the error I get:
Can anyone tell me what is the problem, am I just missing something obvious, or is the code wrong?Code:error C2109: subscript requires array or pointer type
I get it twice, once for each time that appears.Code:PrintText(ix+75, iy-(15+(ai*8)), i_color,pFont, MENU[ai].opt[MENU[ai].var]);
This could be the problem.
Code:if(MENU[i].typ==(char)"FOLDER"){
no, the .typ variable is not even used in any lines near the line causeing the problem, the problem is either that it is not reconiseing MENU[ai].var as an int or that it is not reconiseing MENU[ai].opt as an array.
Nevermind, I figured it out, fairly simple, I was just missing somethingobvious, here was my problem:
and:Code:struct{ char typ; char *txt; char opt; int var; int cm; } _Menu[MMI];
the problem was I was assigneing it to "int", I fixed it by just swiching it to "int**"Code:addItem((char*)"No Flare",(char**)_on_off,&nFFlare,(char)"ITEM",&Visual);
Thank you anyways though.
Last edited by DreadKyller; 10-31-2010 at 04:07 PM.