Balaras
29-07-2005, 01:57 PM
Hi,
I'm converting some cpp code to work in my pascal project.
(BjA¬?rn BergstrA¬?m's recursive shadowcasting (http://www.roguelikedevelopment.org/php/category/showCategory.php?path=development/&category=LOS))
The following line that casts from integer to double to integer, where xCenter is an integer:
int xStart=(int)((double)xCenter + 0.5 - (startSlope * distance));
xStart := Integer( Double(xCenter) + 0.5 - (startSlope * distance) ) yields an invalid typecast error.
So I though about doing something like this:
xStart := Round( xCenter + 0.5 - (StartSlope * distance) );
Would this give the correct result ?
Thanks,
Balaras
I'm converting some cpp code to work in my pascal project.
(BjA¬?rn BergstrA¬?m's recursive shadowcasting (http://www.roguelikedevelopment.org/php/category/showCategory.php?path=development/&category=LOS))
The following line that casts from integer to double to integer, where xCenter is an integer:
int xStart=(int)((double)xCenter + 0.5 - (startSlope * distance));
xStart := Integer( Double(xCenter) + 0.5 - (startSlope * distance) ) yields an invalid typecast error.
So I though about doing something like this:
xStart := Round( xCenter + 0.5 - (StartSlope * distance) );
Would this give the correct result ?
Thanks,
Balaras