mirror of
https://gitea.wildfiregames.com/0ad/0ad.git
synced 2026-09-21 20:06:40 +00:00
Refactored actor variation system, and added support for entity-level selections (controlled by the current animation).
Avoided tooltip error message. Avoided noisy warnings when textures fail to load. This was SVN commit r3653.
This commit is contained in:
@@ -119,14 +119,24 @@ CUnit* CUnitManager::PickUnit(const CVector3D& origin, const CVector3D& dir) con
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// CreateUnit: create a new unit and add it to the world
|
||||
CUnit* CUnitManager::CreateUnit(const CStr& actorName, CEntity* entity)
|
||||
CUnit* CUnitManager::CreateUnit(const CStr& actorName, CEntity* entity, const std::set<CStrW>& selections)
|
||||
{
|
||||
CObjectEntry* obj = g_ObjMan.FindObject(actorName);
|
||||
CObjectBase* base = g_ObjMan.FindObjectBase(actorName);
|
||||
|
||||
if (! base)
|
||||
return NULL;
|
||||
|
||||
std::set<CStrW> actorSelections = base->CalculateRandomVariation(selections);
|
||||
|
||||
std::vector<std::set<CStrW> > selectionsVec;
|
||||
selectionsVec.push_back(actorSelections);
|
||||
|
||||
CObjectEntry* obj = g_ObjMan.FindObjectVariation(base, selectionsVec);
|
||||
|
||||
if (! obj)
|
||||
return NULL;
|
||||
|
||||
CUnit* unit = new CUnit(obj, obj->m_Model->Clone(), entity);
|
||||
CUnit* unit = new CUnit(obj, entity, actorSelections);
|
||||
AddUnit(unit);
|
||||
return unit;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user