Vegastrike 0.5.1 rc1  1.0
Original sources for Vegastrike Evolved
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
macosx_math.h File Reference

Go to the source code of this file.

Functions

int float_to_int (float)
 works on any float... INF is 0x7ffffff and -INF is -(1<<31) NaN is 0 More...
 
int double_to_int (float)
 

Function Documentation

int double_to_int ( float  )
int float_to_int ( float  )

works on any float... INF is 0x7ffffff and -INF is -(1<<31) NaN is 0

Definition at line 85 of file macosx_math.cpp.

References int.

Referenced by AddSubUnits(), Picker::cellForMouse(), Orders::FireAt::ChooseTargets(), Unit::DamageRandSys(), RText::draw_text(), NewButton::drawCycleBorder(), Mesh::getLOD(), Unit::ImportPartList(), Beam::Init(), InList(), Unit::Kill(), Slider::processMouseDrag(), Picker::recalcDisplay(), Picker::scrollToCell(), Slider::setMaxMin(), and WarpPursuit().

86 {
87  int maxint = 0x7ffffff;
88  int minint = -0x8000000;
89  if ( (a < maxint) && (a > minint) ) return int(a);
90  if (a > 0) return maxint;
91  if (a < 0) return minint;
92  return 0;
93 }