Skip to content

Commit

Permalink
Fix int overflow in radar blip drawing. Closes ticket:2731, reviewed …
Browse files Browse the repository at this point in the history
…by Safety0ff.
  • Loading branch information
perim committed May 22, 2011
1 parent 8aca943 commit 10249e5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 2 additions & 0 deletions lib/ivis_opengl/piedraw.cpp
Expand Up @@ -477,6 +477,8 @@ void pie_Draw3DShape(iIMDShape *shape, int frame, int team, PIELIGHT colour, int

pieCount++;

ASSERT(frame >= 0, "Negative frame %d", frame);
ASSERT(team >= 0, "Negative team %d", team);
if (frame == 0)
{
frame = team;
Expand Down
4 changes: 1 addition & 3 deletions src/component.cpp
Expand Up @@ -992,7 +992,6 @@ void displayComponentButtonObject(DROID *psDroid, Vector3i *Rotation, Vector3i *
void displayComponentObject(DROID *psDroid)
{
Vector3i position, rotation;
SDWORD frame;
UDWORD tileX,tileY;
MAPTILE *psTile;
Spacetime st = interpolateObjectSpacetime(psDroid, graphicsTime);
Expand Down Expand Up @@ -1060,9 +1059,8 @@ void displayComponentObject(DROID *psDroid)
psTile = mapTile(tileX,tileY);
if (terrainType(psTile) != TER_WATER)
{
frame = gameTime/BLIP_ANIM_DURATION + psDroid->id; //visible[selectedPlayer];
int frame = gameTime/BLIP_ANIM_DURATION + psDroid->id % 8192; // de-sync the blip effect, but don't overflow the int
pie_Draw3DShape(getImdFromIndex(MI_BLIP), frame, 0, WZCOL_WHITE, pie_ADDITIVE, psDroid->visible[selectedPlayer] / 2);
/* set up all the screen coords stuff - need to REMOVE FROM THIS LOOP */
}
}
}
Expand Down

0 comments on commit 10249e5

Please sign in to comment.