- fix bugs found by ASan

This commit is contained in:
Ilya Shurumov 2020-08-13 22:08:42 +06:00
parent 9c86706bd9
commit 3b66b96e7e
3 changed files with 23 additions and 16 deletions

View File

@ -5207,14 +5207,17 @@ void AttemptUnPark(_CAR_DATA *cp)
bVar1 = cp->ai.c.currentLane;
cp->ai.c.currentLane = CheckChangeLanes(straight, curve, cp->ai.c.targetRoute[0].distAlongSegment, cp, 0);
if (((bVar1 == cp->ai.c.currentLane) ||
(straight != NULL && ((straight->AILanes >> ((cp->ai.c.currentLane >> 1) & 0x1f) & 1U) == 0))) ||
(curve != NULL && ((curve->AILanes >> ((cp->ai.c.currentLane >> 1) & 0x1f) & 1U) == 0)))
if (straight && curve)
{
cp->ai.c.thrustState = 3;
cp->ai.c.ctrlState = 7;
cp->ai.c.currentLane = CheckChangeLanes(straight, curve, cp->ai.c.targetRoute[0].distAlongSegment, cp, 0);
if (((bVar1 == cp->ai.c.currentLane) ||
(straight != NULL && ((straight->AILanes >> ((cp->ai.c.currentLane >> 1) & 0x1f) & 1U) == 0))) ||
(curve != NULL && ((curve->AILanes >> ((cp->ai.c.currentLane >> 1) & 0x1f) & 1U) == 0)))
{
cp->ai.c.thrustState = 3;
cp->ai.c.ctrlState = 7;
}
}
}

View File

@ -2707,6 +2707,7 @@ void DrawCompass(void)
lineg2 = (LINE_G2 *)current->primptr;
setLineG2(lineg2);
setSemiTrans(lineg2, 1);
lineg2->x0 = position[1].vx;
lineg2->y0 = position[1].vz;
@ -2723,7 +2724,7 @@ void DrawCompass(void)
lineg2->g1 = 0;
lineg2->b1 = 0;
setSemiTrans(lineg2, 1);
addPrim(potz, lineg2);
@ -2817,14 +2818,14 @@ void DrawBigCompass(VECTOR *root, int angle)
i = 0;
pPosition = position + 2;
do {
pPosition++;
lineg2 = (LINE_G2 *)current->primptr;
setLineG2(lineg2);
setSemiTrans(lineg2, 1);
lineg2->x0 = position[0].vx;
lineg2->y0 = position[0].vy;
lineg2->x0 = position[1].vx;
lineg2->y0 = position[1].vy;
lineg2->x1 = pPosition->vx;
lineg2->y1 = pPosition->vy;
@ -2839,6 +2840,9 @@ void DrawBigCompass(VECTOR *root, int angle)
DrawPrim(lineg2);
pPosition++;
//current->primptr += sizeof(LINE_G2);
i++;
} while (i < 3);

View File

@ -852,7 +852,7 @@ void SetChannelPosition3(int channel, VECTOR *position, long *velocity, int volu
/* WARNING: Unknown calling convention yet parameter storage is locked */
static __pauseinfo musps;
static int music_pause_max;
// [D]
void PauseXM(void)
@ -862,12 +862,12 @@ void PauseXM(void)
if (music_paused == 0)
{
musps.max = 0;
music_pause_max = 0;
fade = 96;
do {
bVar1 = fade < 0;
fade+= 96;
fade += 96;
} while (bVar1);
if (Song_ID != -1) // [A] bug fix
@ -1072,8 +1072,8 @@ void UnPauseXM(void)
fade = 96;
do {
bVar1 = fade < musps.max;
fade = fade + 96;
bVar1 = fade < music_pause_max;
fade += 96;
} while (bVar1);
XM_Restart(Song_ID);