Problem with Array[][][] RESOLVED...±

Non-platform specific questions.

Problem with Array[][][] RESOLVED...±

Postby equinox » Mon Apr 27, 2009 12:31 pm

HI at ALL,

in this code,

NOME[0][0][15] = sprintf(getclone2(A.name, 2)->text ,"m %s", NOME[0][rt + 2]);
,,,,,,but to print should be NOME[1][0][15],,,I do not understand where I am wrong.

and when print over the index..the GE no indicates error.


char NOME[2][2][15] = 2 ACTOR, with 2 ITEM--->15 char x name item !!


int rt = 0;
char NOME[2][2][15];

strcpy(NOME[0][0], "TIME A");
strcpy(NOME[0][1], "TIME b");

strcpy(NOME[1][0], " ITEM A");
strcpy(NOME[1][1], " ITEM B");

sprintf(getclone2(A.name, 0)->text ,"m %s", NOME[0][rt + 0]); <---print TIME A
sprintf(getclone2(A.name, 1)->text ,"m %s", NOME[0][rt + 1]);<---print TIME B
sprintf(getclone2(A.name, 2)->text ,"m %s", NOME[0][rt + 2]);<---print ITEM A
sprintf(getclone2(A.name, 3)->text ,"m %s", NOME[0][rt + 3]);<---print ITEM A

////////////////////////////
in 2 example NEW: I want alone printer NOME[][],,,, but prints also the STRING[][]. this is weird

strcpy(NOME[0][0], "TIME 1");
strcpy(NOME[0][1], "TIME 2");
strcpy(NOME[0][2], "TIME 3");
strcpy(NOME[0][3], "TIME 4");

strcpy(STRING[0][0], "TIME 55");

sprintf(getclone2(A.name, 0)->text ,"m %s", NOME[0][rt + 0]);// a
sprintf(getclone2(A.name, 1)->text ,"m %s", NOME[0][rt + 1]);// b
sprintf(getclone2(A.name, 2)->text ,"m %s", NOME[0][rt + 2]);// d
sprintf(getclone2(A.name, 3)->text ,"m %s", NOME[0][rt + 3]);// d

...and rt = 4--->print STRING[0][0], "TIME 55"); THis is weird!!

sprintf(getclone2(A.name, 4)->text ,"rt:%d", rt);// d
Attachments
PUNTATORI_NEW.rar
(1.84 KiB) Downloaded 86 times
PUNTATORI.rar
(2.26 KiB) Downloaded 89 times
Last edited by equinox on Wed Apr 29, 2009 11:57 am, edited 1 time in total.
User avatar
equinox
 
Posts: 118
Joined: Tue Jan 29, 2008 3:38 pm
Score: 0 Give a positive score

Re: Problem with Array[][][]

Postby skydereign » Tue Apr 28, 2009 12:34 am

Can you explain what you are trying to accomplish, and what you are getting as of now? Also, you did not include the data file holding verdana.TTF. I had to use another font and rename it.
Syntactically this is wrong, not sure if this was meant to be a part of your code or not.
Code: Select all
print STRING[0][0], "TIME 55");
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Re: Problem with Array[][][]

Postby equinox » Tue Apr 28, 2009 2:45 pm

Well,

i create char NOME[2][10][8] = 2 Heroe x 10 ITEM x 8 len of string

NOME[0][0] = "ITEM 00" (HEROE 0
.....
NOME[1][0] = "WATER 00" (HEROE 1
.......

when print in video NOME[0][0] ....NOME[0][7] for HEROE 0,, IT OK..... But

...if I try to print over the limit arrays NOME[0][12........30], I print the values of the NOME[1][INDI], this is wrong,,,,

and indicates no error.
My example:

press 1 and 2 for create NOME[0][][] AND NOME[1][][]
press S for NOME[0][][],,press X print in video the val of NOME[0][][]....but when rt == 7....print val of NOME[1][][]:

this should not happen. at least by other editors would give this error.

Tnk1000 for reply.
Attachments
PUNTATORI_NEW.rar
(280.68 KiB) Downloaded 89 times
User avatar
equinox
 
Posts: 118
Joined: Tue Jan 29, 2008 3:38 pm
Score: 0 Give a positive score

Re: Problem with Array[][][]

Postby skydereign » Tue Apr 28, 2009 11:45 pm

Do you mean that when going beyond the arrays access, it will show random bits of memory instead of giving an error? Eventually gameEditor will terminate, depending on what is shown in memory. This only happens with char[]s... I think. If that was what you are talking about, just set a variable limit, so you cannot pass the desired array range.
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Re: Problem with Array[][][]

Postby equinox » Wed Apr 29, 2009 11:56 am

...If that was what you are talking about, just set a variable limit, so you ....

exactly !!!

Tnk1000

score++
User avatar
equinox
 
Posts: 118
Joined: Tue Jan 29, 2008 3:38 pm
Score: 0 Give a positive score


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest

cron