mirror of
https://gitea.wildfiregames.com/0ad/0ad.git
synced 2026-09-21 20:06:40 +00:00
Support garrisoned enitites defined in map files.
This is adding support to handle garrisoned entities defined in map files by game engine and atlas allowing future extension for atlas ui and solving recreation of entites on init in D1958. Also solving deepfreeze described in D2562. Differential Revision; https://code.wildfiregames.com/D2597 Ticket: #3008 Patch by: Freagarach Comments by: elexis This was SVN commit r23529.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2019 Wildfire Games.
|
||||
/* Copyright (C) 2020 Wildfire Games.
|
||||
* This file is part of 0 A.D.
|
||||
*
|
||||
* 0 A.D. is free software: you can redistribute it and/or modify
|
||||
@@ -39,6 +39,7 @@
|
||||
#include "renderer/WaterManager.h"
|
||||
#include "simulation2/Simulation2.h"
|
||||
#include "simulation2/components/ICmpCinemaManager.h"
|
||||
#include "simulation2/components/ICmpGarrisonHolder.h"
|
||||
#include "simulation2/components/ICmpObstruction.h"
|
||||
#include "simulation2/components/ICmpOwnership.h"
|
||||
#include "simulation2/components/ICmpPosition.h"
|
||||
@@ -341,6 +342,19 @@ void CMapWriter::WriteXML(const VfsPath& filename,
|
||||
if (cmpOwnership)
|
||||
entityTag.Setting("Player", static_cast<int>(cmpOwnership->GetOwner()));
|
||||
|
||||
CmpPtr<ICmpGarrisonHolder> cmpGarrisonHolder(sim, ent);
|
||||
if (cmpGarrisonHolder)
|
||||
{
|
||||
XMLWriter_Element garrisonTag(xmlMapFile, "Garrison");
|
||||
std::vector<entity_id_t> garrison = cmpGarrisonHolder->GetEntities();
|
||||
for (const entity_id_t garr_ent_id : garrison)
|
||||
{
|
||||
XMLWriter_Element garrisonedEntityTag(xmlMapFile, "GarrisonedEntity");
|
||||
garrisonedEntityTag.Attribute("uid", static_cast<int>(garr_ent_id));
|
||||
// ToDo: We can store turret position as well.
|
||||
}
|
||||
}
|
||||
|
||||
CmpPtr<ICmpPosition> cmpPosition(sim, ent);
|
||||
if (cmpPosition)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user