1
0
forked from 0ad/0ad

Return the correct projectile id to fix serialization test failure.

This was SVN commit r16363.
This commit is contained in:
leper 2015-02-21 01:41:09 +00:00
parent 8ecfa6cf7c
commit 0da0b062e1
2 changed files with 5 additions and 5 deletions

View File

@ -513,7 +513,7 @@ Attack.prototype.PerformAttack = function(type, target)
var cmpProjectileManager = Engine.QueryInterface(SYSTEM_ENTITY, IID_ProjectileManager);
var id = cmpProjectileManager.LaunchProjectileAtPoint(this.entity, realTargetPosition, horizSpeed, gravity);
var playerId = Engine.QueryInterface(this.entity, IID_Ownership).GetOwner()
var playerId = Engine.QueryInterface(this.entity, IID_Ownership).GetOwner();
var cmpTimer = Engine.QueryInterface(SYSTEM_ENTITY, IID_Timer);
cmpTimer.SetTimeout(this.entity, IID_Attack, "MissileHit", timeToTarget*1000, {"type": type, "target": target, "position": realTargetPosition, "direction": missileDirection, "projectileId": id, "playerId":playerId});
}

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2012 Wildfire Games.
/* Copyright (C) 2015 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@ -176,7 +176,7 @@ uint32_t CCmpProjectileManager::LaunchProjectile(entity_id_t source, CFixedVecto
// If the actor was actually loaded, complain that it doesn't have a projectile
if (!cmpSourceVisual->GetActorShortName().empty())
LOGERROR("Unit with actor '%s' launched a projectile but has no actor on 'projectile' attachpoint", utf8_from_wstring(cmpSourceVisual->GetActorShortName()));
return 0;
return currentId;
}
Projectile projectile;
@ -191,7 +191,7 @@ uint32_t CCmpProjectileManager::LaunchProjectile(entity_id_t source, CFixedVecto
// If there's no explicit launch point, take a guess based on the entity position
CmpPtr<ICmpPosition> sourcePos(GetSimContext(), source);
if (!sourcePos)
return 0;
return currentId;
projectile.origin = sourcePos->GetPosition();
projectile.origin.Y += 3.f;
}
@ -199,7 +199,7 @@ uint32_t CCmpProjectileManager::LaunchProjectile(entity_id_t source, CFixedVecto
std::set<CStr> selections;
projectile.unit = GetSimContext().GetUnitManager().CreateUnit(name, m_ActorSeed++, selections);
if (!projectile.unit) // The error will have already been logged
return 0;
return currentId;
projectile.pos = projectile.origin;
CVector3D offset(targetPoint);