Changeset View
Changeset View
Standalone View
Standalone View
source/graphics/MapWriter.cpp
/* Copyright (C) 2021 Wildfire Games. | /* Copyright (C) 2022 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 20 Lines • Show All 304 Lines • ▼ Show 20 Lines | XMLWriter_File xmlMapFile; | ||||
{ | { | ||||
XMLWriter_Element entitiesTag(xmlMapFile, "Entities"); | XMLWriter_Element entitiesTag(xmlMapFile, "Entities"); | ||||
CmpPtr<ICmpTemplateManager> cmpTemplateManager(sim, SYSTEM_ENTITY); | CmpPtr<ICmpTemplateManager> cmpTemplateManager(sim, SYSTEM_ENTITY); | ||||
ENSURE(cmpTemplateManager); | ENSURE(cmpTemplateManager); | ||||
// This will probably need to be changed in the future, but for now we'll | // This will probably need to be changed in the future, but for now we'll | ||||
// just save all entities that have a position | // just save all entities that have a position | ||||
CSimulation2::InterfaceList ents = sim.GetEntitiesWithInterface(IID_Position); | CSimulation2::InterfaceList comps = sim.GetComponentsByInterface(IID_Position); | ||||
for (CSimulation2::InterfaceList::const_iterator it = ents.begin(); it != ents.end(); ++it) | for (CSimulation2::InterfaceList::const_iterator it = comps.begin(); it != comps.end(); ++it) | ||||
Stan: Can we use a const iterator here? | |||||
Done Inline ActionsWe already are? Mercury: We already are? | |||||
Done Inline ActionsSorry meant range loop Stan: Sorry meant range loop | |||||
{ | { | ||||
entity_id_t ent = it->first; | entity_id_t ent = it->first; | ||||
// Don't save local entities (placement previews etc) | // Don't save local entities (placement previews etc) | ||||
if (ENTITY_IS_LOCAL(ent)) | if (ENTITY_IS_LOCAL(ent)) | ||||
continue; | continue; | ||||
XMLWriter_Element entityTag(xmlMapFile, "Entity"); | XMLWriter_Element entityTag(xmlMapFile, "Entity"); | ||||
▲ Show 20 Lines • Show All 174 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator
Can we use a const iterator here?