Changeset View
Standalone View
source/tools/atlas/GameInterface/Handlers/MapHandlers.cpp
Context not available. | |||||
const int offsetZ = ((m_NewPatches - m_OldPatches) / 2 + m_OffsetY) * PATCH_SIZE * TERRAIN_TILE_SIZE; | const int offsetZ = ((m_NewPatches - m_OldPatches) / 2 + m_OffsetY) * PATCH_SIZE * TERRAIN_TILE_SIZE; | ||||
const CFixedVector3D offset = CFixedVector3D(fixed::FromInt(offsetX), fixed::FromInt(0), fixed::FromInt(offsetZ)); | const CFixedVector3D offset = CFixedVector3D(fixed::FromInt(offsetX), fixed::FromInt(0), fixed::FromInt(offsetZ)); | ||||
const CSimulation2::InterfaceListUnordered& ents = sim.GetEntitiesWithInterfaceUnordered(IID_Selectable); | SComponentDataGenerator* ents = sim.GetEntitiesWithInterfaceUnordered(IID_Selectable); | ||||
for (const std::pair<const entity_id_t, IComponent*>& ent : ents) | while(IComponent* cmp = ents->Next()) | ||||
Stan: wrong indent? Can it be made iterable like a range loop? | |||||
Done Inline ActionsFixed the indentation, sorry about wasting your time with all that, ill try to do better in the future. I think in order to use ranged based loop syntax the generator would have to be rewritten as an iterator. I didn't do it that way because I suspect the result would be about 10% slower and 5 times as many lines of code. But we could try it and see. My opinion is that low level code should be written in C because C is a good language for the task and taking a simple C algorithm and contorting it into compatibility with STL is only worth doing if you are using the functionality of STL. Mercury: Fixed the indentation, sorry about wasting your time with all that, ill try to do better in the… | |||||
Done Inline ActionsMy experience with low level C code and 0 A.D. isn't that great ^^ Lots of heated discussions weird bugs and stuff. So when we can use the STL it's nice to do so :) But I understand if it's not possible Stan: My experience with low level C code and 0 A.D. isn't that great ^^ Lots of heated discussions… | |||||
Not Done Inline ActionsOk, Ill try to make a more STLified alternative patch. Mercury: Ok, Ill try to make a more STLified alternative patch. | |||||
{ | { | ||||
const entity_id_t entityId = ent.first; | const entity_id_t entityId = cmp->GetEntityId(); | ||||
CmpPtr<ICmpPosition> cmpPosition(sim, entityId); | CmpPtr<ICmpPosition> cmpPosition(sim, entityId); | ||||
if (cmpPosition && cmpPosition->IsInWorld() && Within(cmpPosition->GetPosition(), mapCenterX, mapCenterZ, radiusInTerrainUnits)) | if (cmpPosition && cmpPosition->IsInWorld() && Within(cmpPosition->GetPosition(), mapCenterX, mapCenterZ, radiusInTerrainUnits)) | ||||
Context not available. |
wrong indent? Can it be made iterable like a range loop?