Archived

This topic is now archived and is closed to further replies.

Drakon

Evil Error

Recommended Posts

I have these two errors: --------------------Configuration: 3dMaze5 - Win32 Debug-------------------- Compiling... Main.cpp C:\3dMaze5\Main.cpp(95) : warning C4018: ''<'' : signed/unsigned mismatch C:\3dMaze5\Main.cpp(211) : error C2446: ''<'' : no conversion from ''double *'' to ''double'' There is no context in which this conversion is possible C:\3dMaze5\Main.cpp(211) : error C2115: ''<'' : incompatible types Error executing cl.exe. 3dMaze5.exe - 2 error(s), 1 warning(s) ---------------------------------------------------------------- These are my declarations: double MaxX; double MaxY; double MinX; double MinY; double MaxX2[1]; double MaxY2[1]; double MinX2[1]; double MinY2[1]; These are how they are used: MaxY = posx + 1; MinX = posx - 1; MaxY = posz + 1; MinY = posz - 1; MaxX2[0] = 22.5;MaxY2[0] = 16;MaxX2[0] = 22.5;MinY2[0] = 16.5; MaxX2[1] = 22.5;MaxY2[1] = 16;MaxX2[1] = 22.5;MinY2[1] = 16.5; for(Num = 0;Num == 1; Num = Num + 1){ if(MaxY > MinY2[Num] && MinY < MaxY2[Num] && MaxX > MinX2[Num] && MinX < MaxX2){ Collision = true; } }

Share this post


Link to post
Share on other sites
At the end of the condition you''ve forgotten to bracket the array: MinX < MaxX2 - looks like it should be MinX < MaxX2[num]



Share this post


Link to post
Share on other sites
Your IF statment is not orginized....


    
if (( [condition1] ) && ( [condition2] ))


EDIT: Your compiler does not know which statment to test, use '(' and ')' to seperate conditions.
_____________________________________________________

ICQ #: 149510932
Google - OpenGL - DirectX - Windows Guide Network - MSDN - Symantec Virus Info
"Imagination is more important than knowledge." - Albert Einstein



[edited by - Programmer One on March 19, 2002 8:56:14 PM]

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Check out this line:

if(MaxY > MinY2[Num] && MinY < MaxY2[Num] && MaxX > MinX2[Num] && MinX < MaxX2){

MaxX2 should be MaxX2[num]

Pointers are unsigned while doubles are signed, hence the error.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
As soon as you said MaxX2[1] = 22.5; there is a problem. You only have 1 element in all of your arrays, which is at index 0. So this MaxX2[1] (and the others) is out of bounds.

Share this post


Link to post
Share on other sites
quote:
Original post by Drakon
for(Num = 0;Num == 1; Num = Num + 1){
// whatever was here...
}



Don't forget the errors it doesn't tell you about... The body of the for loop will never be executed. Try Num <= 1 instead of Num == 1.

[edit 1]:

// Here is how it _should_ be... (assuming your logic is correct)

double MaxX2[2]; // note it isn't [1] anymore
double MaxY2[2];
double MinX2[2];
double MinY2[2];

These are how they are used:

for(Num = 0;Num <= 1; Num = Num + 1) // Num <= 1 not Num == 1
{
if(MaxY > MinY2[Num] && MinY < MaxY2[Num] && MaxX > MinX2[Num] && MinX < MaxX2[Num]) // note MaxX2 now is MaxX2[Num]
{
Collision = true;
}
}


- mongrelprogrammer

[edited by - mongrelprogrammer on March 19, 2002 9:31:27 PM]

[edited by - mongrelprogrammer on March 19, 2002 9:32:37 PM]

Share this post


Link to post
Share on other sites
quote:
Original post by Programmer One
Your IF statment is not orginized....
if (( [condition1] ) && ( [condition2] ))
EDIT: Your compiler does not know which statment to test, use '(' and ')' to seperate conditions.



That's not true, order of operations denotes the && operator to be applied lastly. Parenthesis are not necessary.

--------------------
Matthew Calabrese
Realtime 3D Orchestra:
Programmer, Composer,
and 3D Artist/Animator
"I can see the music..."

[edited by - Matt Calabrese on March 19, 2002 9:22:36 PM]

Share this post


Link to post
Share on other sites