Changeset View
Changeset View
Standalone View
Standalone View
source/graphics/MapWriter.cpp
/* Copyright (C) 2019 Wildfire Games. | /* Copyright (C) 2020 Wildfire Games. | |||||||||
* This file is part of 0 A.D. | * This file is part of 0 A.D. | |||||||||
* | * | |||||||||
* 0 A.D. is free software: you can redistribute it and/or modify | * 0 A.D. is free software: you can redistribute it and/or modify | |||||||||
* it under the terms of the GNU General Public License as published by | * it under the terms of the GNU General Public License as published by | |||||||||
* the Free Software Foundation, either version 2 of the License, or | * the Free Software Foundation, either version 2 of the License, or | |||||||||
* (at your option) any later version. | * (at your option) any later version. | |||||||||
* | * | |||||||||
* 0 A.D. is distributed in the hope that it will be useful, | * 0 A.D. is distributed in the hope that it will be useful, | |||||||||
Show All 24 Lines | ||||||||||
#include "ps/Loader.h" | #include "ps/Loader.h" | |||||||||
#include "ps/Filesystem.h" | #include "ps/Filesystem.h" | |||||||||
#include "ps/XML/XMLWriter.h" | #include "ps/XML/XMLWriter.h" | |||||||||
#include "renderer/PostprocManager.h" | #include "renderer/PostprocManager.h" | |||||||||
#include "renderer/SkyManager.h" | #include "renderer/SkyManager.h" | |||||||||
#include "renderer/WaterManager.h" | #include "renderer/WaterManager.h" | |||||||||
#include "simulation2/Simulation2.h" | #include "simulation2/Simulation2.h" | |||||||||
#include "simulation2/components/ICmpCinemaManager.h" | #include "simulation2/components/ICmpCinemaManager.h" | |||||||||
#include "simulation2/components/ICmpGarrisonHolder.h" | ||||||||||
#include "simulation2/components/ICmpObstruction.h" | #include "simulation2/components/ICmpObstruction.h" | |||||||||
#include "simulation2/components/ICmpOwnership.h" | #include "simulation2/components/ICmpOwnership.h" | |||||||||
#include "simulation2/components/ICmpPosition.h" | #include "simulation2/components/ICmpPosition.h" | |||||||||
#include "simulation2/components/ICmpTemplateManager.h" | #include "simulation2/components/ICmpTemplateManager.h" | |||||||||
#include "simulation2/components/ICmpVisual.h" | #include "simulation2/components/ICmpVisual.h" | |||||||||
#include "simulation2/components/ICmpWaterManager.h" | #include "simulation2/components/ICmpWaterManager.h" | |||||||||
/////////////////////////////////////////////////////////////////////////////////////////////////// | /////////////////////////////////////////////////////////////////////////////////////////////////// | |||||||||
▲ Show 20 Lines • Show All 286 Lines • ▼ Show 20 Lines | if (!sim.GetStartupScript().empty()) | |||||||||
entityTag.Attribute("uid", ent); | entityTag.Attribute("uid", ent); | |||||||||
entityTag.Setting("Template", cmpTemplateManager->GetCurrentTemplateName(ent)); | entityTag.Setting("Template", cmpTemplateManager->GetCurrentTemplateName(ent)); | |||||||||
CmpPtr<ICmpOwnership> cmpOwnership(sim, ent); | CmpPtr<ICmpOwnership> cmpOwnership(sim, ent); | |||||||||
if (cmpOwnership) | if (cmpOwnership) | |||||||||
entityTag.Setting("Player", static_cast<int>(cmpOwnership->GetOwner())); | entityTag.Setting("Player", static_cast<int>(cmpOwnership->GetOwner())); | |||||||||
CmpPtr<ICmpGarrisonHolder> cmpGarrisonHolder(sim, ent); | ||||||||||
if (cmpGarrisonHolder) | ||||||||||
{ | ||||||||||
std::set<entity_id_t> garrison = cmpGarrisonHolder->GetEntities(); | ||||||||||
XMLWriter_Element garrisonTag(xmlMapFile, "Garrison"); | ||||||||||
for (std::set<entity_id_t>::iterator garr_ent_id = garrison.begin(); garr_ent_id != garrison.end(); ++garr_ent_id) | ||||||||||
{ | ||||||||||
XMLWriter_Element garrisonedEntityTag(xmlMapFile, "GarrisonedEntity"); | ||||||||||
garrisonedEntityTag.Attribute("gid", static_cast<int>(*garr_ent_id)); | ||||||||||
garrisonedEntityTag.Setting("Location", cmpGarrisonHolder->GetVisibleGarrisonPoint(*garr_ent_id)); | ||||||||||
} | ||||||||||
StanUnsubmitted Done Inline Actions
Stan: | ||||||||||
} | ||||||||||
CmpPtr<ICmpPosition> cmpPosition(sim, ent); | CmpPtr<ICmpPosition> cmpPosition(sim, ent); | |||||||||
if (cmpPosition) | if (cmpPosition) | |||||||||
Not Done Inline ActionsDo you need the cast? Stan: Do you need the cast? | ||||||||||
Not Done Inline ActionsOther places seem to do it as well (not only GarrisonHolder, which I wrote also). Freagarach: Other places seem to do it as well (not only GarrisonHolder, which I wrote also). | ||||||||||
{ | { | |||||||||
CFixedVector3D pos; | CFixedVector3D pos; | |||||||||
if (cmpPosition->IsInWorld()) | if (cmpPosition->IsInWorld()) | |||||||||
pos = cmpPosition->GetPosition(); | pos = cmpPosition->GetPosition(); | |||||||||
CFixedVector3D rot = cmpPosition->GetRotation(); | CFixedVector3D rot = cmpPosition->GetRotation(); | |||||||||
{ | { | |||||||||
XMLWriter_Element positionTag(xmlMapFile, "Position"); | XMLWriter_Element positionTag(xmlMapFile, "Position"); | |||||||||
▲ Show 20 Lines • Show All 125 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator