Permalink
Browse files

Fix compilation with C++0x compilers.

Can't use nullptr, until switching to C++0x.
  • Loading branch information...
1 parent 3761632 commit 733ab6e9119f056a7472b1d4166f00dc3a35da17 @Cyp Cyp committed Feb 15, 2011
Showing with 15 additions and 15 deletions.
  1. +3 −3 lib/netplay/nettypes.cpp
  2. +2 −2 src/pointtree.cpp
  3. +1 −1 src/raycast.cpp
  4. +8 −8 src/terrain.cpp
  5. +1 −1 src/visibility.cpp
View
@@ -83,7 +83,7 @@ static void queue(const Q &q, uint8_t &v)
template<class Q>
static void queue(const Q &q, uint16_t &v)
{
- uint8_t b[2] = {v>>8, v};
+ uint8_t b[2] = {uint8_t(v>>8), uint8_t(v)};
queue(q, b[0]);
queue(q, b[1]);
if (Q::Direction == Q::Read)
@@ -124,7 +124,7 @@ static void queue(const Q &q, uint32_t &vOrig)
template<class Q>
static void queueLarge(const Q &q, uint32_t &v)
{
- uint16_t b[2] = {v>>16, v};
+ uint16_t b[2] = {uint16_t(v>>16), uint16_t(v)};
queue(q, b[0]);
queue(q, b[1]);
if (Q::Direction == Q::Read)
@@ -136,7 +136,7 @@ static void queueLarge(const Q &q, uint32_t &v)
template<class Q>
static void queue(const Q &q, uint64_t &v)
{
- uint32_t b[2] = {v>>32, v};
+ uint32_t b[2] = {uint32_t(v>>32), uint32_t(v)};
queue(q, b[0]);
queue(q, b[1]);
if (Q::Direction == Q::Read)
View
@@ -236,8 +236,8 @@ PointTree::ResultVector &PointTree::queryMaybeFilter(Filter &filter, int32_t x,
for (int r = 0; r != numRanges; ++r)
{
// Find range of points which may be close enough. Range is [i1 ... i2 - 1]. The pointers are ignored when searching.
- unsigned i1 = std::lower_bound(points.begin(), points.end(), Point(ranges[r].a, NULL), pointTreeSortFunction) - points.begin();
- unsigned i2 = std::upper_bound(points.begin() + i1, points.end(), Point(ranges[r].z, NULL), pointTreeSortFunction) - points.begin();
+ unsigned i1 = std::lower_bound(points.begin(), points.end(), Point(ranges[r].a, (void *)NULL), pointTreeSortFunction) - points.begin();
+ unsigned i2 = std::upper_bound(points.begin() + i1, points.end(), Point(ranges[r].z, (void *)NULL), pointTreeSortFunction) - points.begin();
for (unsigned i = current<IsFiltered>(filter.data, i1); i < i2; i = current<IsFiltered>(filter.data, i + 1))
{
View
@@ -123,7 +123,7 @@ static bool getTileHeightCallback(Vector3i pos, int32_t dist, void *data)
void getBestPitchToEdgeOfGrid(UDWORD x, UDWORD y, uint16_t direction, uint16_t *pitch)
{
- HeightCallbackHelp_t help = { map_Height(x,y), 0.0f };
+ HeightCallbackHelp_t help = {map_Height(x,y), 0};
rayCast(Vector3i(x, y, 0), direction, 5430, getTileHeightCallback, &help); // FIXME Magic value
View
@@ -1077,8 +1077,8 @@ void drawTerrain(void)
int layer;
int offset, size;
float xPos, yPos, distance;
- const GLfloat paramsX[4] = {1.0/world_coord(mapWidth)*((float)mapWidth/lightmapWidth), 0, 0, 0};
- const GLfloat paramsY[4] = {0, 0, -1.0/world_coord(mapHeight)*((float)mapHeight/lightmapHeight), 0};
+ const GLfloat paramsX[4] = {1.0f/world_coord(mapWidth)*((float)mapWidth/lightmapWidth), 0, 0, 0};
+ const GLfloat paramsY[4] = {0, 0, -1.0f/world_coord(mapHeight)*((float)mapHeight/lightmapHeight), 0};
///////////////////////////////////
// set up the lightmap texture
@@ -1280,8 +1280,8 @@ void drawTerrain(void)
// draw each layer separately
for (layer = 0; layer < numGroundTypes; layer++)
{
- const GLfloat paramsX[4] = {0, 0, -1.0/world_coord(psGroundTypes[layer].textureSize), 0};
- const GLfloat paramsY[4] = {1.0/world_coord(psGroundTypes[layer].textureSize), 0, 0, 0};
+ const GLfloat paramsX[4] = {0, 0, -1.0f/world_coord(psGroundTypes[layer].textureSize), 0};
+ const GLfloat paramsY[4] = {1.0f/world_coord(psGroundTypes[layer].textureSize), 0, 0, 0};
// load the texture
texPage = iV_GetTexture(psGroundTypes[layer].textureName);
@@ -1400,10 +1400,10 @@ void drawTerrain(void)
void drawWater(void)
{
int x, y;
- const GLfloat paramsX[4] = {0, 0, -1.0/world_coord(4), 0};
- const GLfloat paramsY[4] = {1.0/world_coord(4), 0, 0, 0};
- const GLfloat paramsX2[4] = {0, 0, -1.0/world_coord(5), 0};
- const GLfloat paramsY2[4] = {1.0/world_coord(5), 0, 0, 0};
+ const GLfloat paramsX[4] = {0, 0, -1.0f/world_coord(4), 0};
+ const GLfloat paramsY[4] = {1.0f/world_coord(4), 0, 0, 0};
+ const GLfloat paramsX2[4] = {0, 0, -1.0f/world_coord(5), 0};
+ const GLfloat paramsY2[4] = {1.0f/world_coord(5), 0, 0, 0};
const GLfloat white[4] = {1.0f, 1.0f, 1.0f, 1.0f};
const GLfloat fogColour[4] = {pie_GetFogColour().byte.r/255.f,
pie_GetFogColour().byte.g/255.f,
View
@@ -126,7 +126,7 @@ static inline void visMarkTile(int mapX, int mapY, MAPTILE *psTile, int rayPlaye
{
if (psTile->watchers[rayPlayer] < UBYTE_MAX && *lastRecordTilePos < MAX_SEEN_TILES)
{
- TILEPOS tilePos = {mapX, mapY};
+ TILEPOS tilePos = {uint8_t(mapX), uint8_t(mapY)};
psTile->watchers[rayPlayer]++; // we see this tile
psTile->sensorBits |= (1 << rayPlayer); // mark it as being seen
recordTilePos[*lastRecordTilePos] = tilePos; // record having seen it

0 comments on commit 733ab6e

Please sign in to comment.