Page 1 of 1

VS2010 Unable to compile world

Posted: Sat Nov 09, 2013 1:37 pm
by John Adams
I know we had a problem with your fancy algorithms in Linux, but this is the first time I've seen another Windows box fail.
1> Combat.cpp
1>..\..\source\WorldServer\Combat.cpp(211): error C2668: 'floor' : ambiguous call to overloaded function
1> C:\Program Files\Microsoft Visual Studio 10.0\VC\include\math.h(567): could be 'long double floor(long double)'
1> C:\Program Files\Microsoft Visual Studio 10.0\VC\include\math.h(519): or 'float floor(float)'
1> C:\Program Files\Microsoft Visual Studio 10.0\VC\include\math.h(136): or 'double floor(double)'
1> while trying to match the argument list '(int8)'
1>..\..\source\WorldServer\Combat.cpp(313): error C2668: 'floor' : ambiguous call to overloaded function
1> C:\Program Files\Microsoft Visual Studio 10.0\VC\include\math.h(567): could be 'long double floor(long double)'
1> C:\Program Files\Microsoft Visual Studio 10.0\VC\include\math.h(519): or 'float floor(float)'
1> C:\Program Files\Microsoft Visual Studio 10.0\VC\include\math.h(136): or 'double floor(double)'
1> while trying to match the argument list '(int8)'
The EQ2TC box won't compile after the last pull from SVN. Any ideas?

btw, doesn't seem to be a problem in VS2012

Re: VS2010 Unable to compile world

Posted: Sat Nov 09, 2013 1:57 pm
by Jabantiz
Looks like floor will only take a type of "long double", "float", or "double" and we are passing it an "int8", so find the call to floor in combat.cpp and cast the params to a float, if we need the result as an int8 then cast the floor to an int8.

Example:

Code: Select all

int8 y = 0;
int8 x = (int8)floor((float)y);

Re: VS2010 Unable to compile world

Posted: Sat Nov 09, 2013 2:00 pm
by John Adams
Sorry, I should have posted the code too.

Code: Select all

				int8 automatic_multi = floor((int8)(multi_attack / 100));
				chance = (multi_attack - (floor((float) ((multi_attack / 100) * 100))));
It's the top line that's throwing the error, but it does this twice in this function. I thought it looked okay, but you know...


Hey, this worked!

Code: Select all

				int8 automatic_multi = (int8)floor((float)(multi_attack / 100));
Just not sure what this will do to the calc? lol