Fix NukeLaunch being displayed too early

Adding it to ScreenMap from the ctor unconditionally didn't mesh well with potentially being added to world with a delay.
This commit is contained in:
reaperrr
2017-12-22 00:02:50 +01:00
committed by Pavel Penev
parent 028f7c6546
commit 41dd7ca428

View File

@@ -37,6 +37,7 @@ namespace OpenRA.Mods.Common.Effects
WPos pos;
int ticks;
bool isAddedToScreenMap;
public NukeLaunch(Player firedBy, string name, WeaponInfo weapon, string weaponPalette, string upSequence, string downSequence,
WPos launchPos, WPos targetPos, WDist velocity, int delay, bool skipAscent, string flashType)
@@ -64,12 +65,16 @@ namespace OpenRA.Mods.Common.Effects
if (skipAscent)
ticks = turn;
firedBy.World.ScreenMap.Add(this, pos, anim.Image);
}
public void Tick(World world)
{
if (!isAddedToScreenMap)
{
world.ScreenMap.Add(this, pos, anim.Image);
isAddedToScreenMap = true;
}
anim.Tick();
if (ticks == turn)