[-] Fixed crash when no file was used for missile
This commit is contained in:
parent
b29331a933
commit
0ec029274b
2 changed files with 4 additions and 2 deletions
src
|
@ -536,7 +536,9 @@ void Missile::DrawMissile(const CViewport &vp) const
|
|||
CLabel(GetGameFont()).DrawClip(screenPixelPos.x, screenPixelPos.y, this->Damage);
|
||||
break;
|
||||
default:
|
||||
this->Type->DrawMissileType(this->SpriteFrame, screenPixelPos);
|
||||
if (Type->G) {
|
||||
this->Type->DrawMissileType(this->SpriteFrame, screenPixelPos);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -303,7 +303,7 @@ void PlayUnitSound(const CUnit &unit, CSound *sound)
|
|||
*/
|
||||
void PlayMissileSound(const Missile &missile, CSound *sound)
|
||||
{
|
||||
int stereo = ((missile.position.x + missile.Type->G->Width / 2 -
|
||||
int stereo = ((missile.position.x + (missile.Type->G ? missile.Type->G->Width / 2 : 0) +
|
||||
UI.SelectedViewport->MapPos.x * PixelTileSize.x) * 256 /
|
||||
((UI.SelectedViewport->MapWidth - 1) * PixelTileSize.x)) - 128;
|
||||
clamp(&stereo, -128, 127);
|
||||
|
|
Loading…
Add table
Reference in a new issue