1
0
forked from mirrors/0ad

Fix includes in source/simulation2

Make include-what-you-use happy with some files in source/simulation2
and fix what needs to be fixed.

Ref: #8086
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
This commit is contained in:
Ralph Sennhauser
2025-08-07 19:53:23 +02:00
parent b066bb0b99
commit 2bad15b4c2
57 changed files with 428 additions and 158 deletions
-1
View File
@@ -63,7 +63,6 @@
#include <fstream>
#include <iomanip>
#include <js/CallArgs.h>
#include <js/PropertyAndElement.h>
#include <js/RootingAPI.h>
#include <memory>
#include <set>
@@ -66,7 +66,6 @@
#include <iterator>
#include <limits>
#include <map>
#include <new>
#include <set>
#include <string>
#include <type_traits>
+32 -18
View File
@@ -18,31 +18,45 @@
#ifndef INCLUDED_CCMPUNITMOTION
#define INCLUDED_CCMPUNITMOTION
#include "simulation2/system/Component.h"
#include "ICmpUnitMotion.h"
#include "simulation2/components/CCmpUnitMotionManager.h"
#include "simulation2/components/ICmpObstruction.h"
#include "simulation2/components/ICmpObstructionManager.h"
#include "simulation2/components/ICmpOwnership.h"
#include "simulation2/components/ICmpPosition.h"
#include "simulation2/components/ICmpPathfinder.h"
#include "simulation2/components/ICmpRangeManager.h"
#include "simulation2/components/ICmpValueModificationManager.h"
#include "simulation2/components/ICmpVisual.h"
#include "simulation2/helpers/Geometry.h"
#include "simulation2/helpers/Render.h"
#include "simulation2/MessageTypes.h"
#include "simulation2/serialization/SerializedPathfinder.h"
#include "simulation2/serialization/SerializedTypes.h"
#include "graphics/Color.h"
#include "graphics/Overlay.h"
#include "lib/debug.h"
#include "lib/types.h"
#include "maths/Fixed.h"
#include "maths/FixedVector2D.h"
#include "maths/FixedVector3D.h"
#include "maths/MathUtil.h"
#include "ps/CLogger.h"
#include "ps/Profile.h"
#include "renderer/Scene.h"
#include "simulation2/MessageTypes.h"
#include "simulation2/components/CCmpUnitMotionManager.h"
#include "simulation2/components/ICmpObstruction.h"
#include "simulation2/components/ICmpObstructionManager.h"
#include "simulation2/components/ICmpPathfinder.h"
#include "simulation2/components/ICmpPosition.h"
#include "simulation2/components/ICmpUnitMotion.h"
#include "simulation2/components/ICmpUnitMotionManager.h"
#include "simulation2/components/ICmpValueModificationManager.h"
#include "simulation2/components/ICmpVisual.h"
#include "simulation2/helpers/Geometry.h"
#include "simulation2/helpers/PathGoal.h"
#include "simulation2/helpers/Pathfinding.h"
#include "simulation2/helpers/Position.h"
#include "simulation2/helpers/Render.h"
#include "simulation2/serialization/SerializeTemplates.h"
#include "simulation2/serialization/SerializedPathfinder.h"
#include "simulation2/serialization/SerializedTypes.h"
#include "simulation2/system/Component.h"
#include "simulation2/system/Entity.h"
#include "simulation2/system/Message.h"
#include <algorithm>
#include <cstddef>
#include <cstdint>
#include <string>
#include <utility>
#include <vector>
// NB: this implementation of ICmpUnitMotion is very tightly coupled with UnitMotionManager.
// As such, both are compiled in the same TU.
@@ -18,12 +18,13 @@
#ifndef INCLUDED_CCMPUNITMOTIONMANAGER
#define INCLUDED_CCMPUNITMOTIONMANAGER
#include "simulation2/system/Component.h"
#include "ICmpUnitMotionManager.h"
#include "simulation2/MessageTypes.h"
#include "simulation2/components/ICmpPosition.h"
#include "simulation2/components/ICmpTerrain.h"
#include "simulation2/components/ICmpUnitMotionManager.h"
#include "simulation2/helpers/Grid.h"
#include "simulation2/helpers/Position.h"
#include "simulation2/system/Component.h"
#include "simulation2/system/EntityMap.h"
class CCmpUnitMotion;
@@ -17,42 +17,57 @@
#include "precompiled.h"
#include "simulation2/system/Component.h"
#include "ICmpVisual.h"
#include "simulation2/MessageTypes.h"
#include "simulation2/serialization/SerializedTypes.h"
#include "ICmpFootprint.h"
#include "ICmpIdentity.h"
#include "ICmpMirage.h"
#include "ICmpOwnership.h"
#include "ICmpPlayer.h"
#include "ICmpPlayerManager.h"
#include "ICmpPosition.h"
#include "ICmpTemplateManager.h"
#include "ICmpTerrain.h"
#include "ICmpUnitMotion.h"
#include "ICmpUnitRenderer.h"
#include "ICmpValueModificationManager.h"
#include "ICmpVisibility.h"
#include "ICmpSound.h"
#include "graphics/Color.h"
#include "graphics/Decal.h"
#include "graphics/HeightMipmap.h"
#include "graphics/Model.h"
#include "graphics/ModelAbstract.h"
#include "graphics/ObjectBase.h"
#include "graphics/ObjectEntry.h"
#include "graphics/Unit.h"
#include "graphics/UnitAnimation.h"
#include "graphics/UnitManager.h"
#include "lib/debug.h"
#include "lib/path.h"
#include "lib/types.h"
#include "lib/utf8.h"
#include "maths/BoundingBoxAligned.h"
#include "maths/BoundingBoxOriented.h"
#include "maths/BoundingSphere.h"
#include "maths/Frustum.h"
#include "maths/Fixed.h"
#include "maths/FixedVector3D.h"
#include "maths/Matrix3D.h"
#include "maths/Vector3D.h"
#include "ps/algorithm.h"
#include "ps/CLogger.h"
#include "ps/GameSetup/Config.h"
#include "ps/CStr.h"
#include "ps/algorithm.h"
#include "renderer/Scene.h"
#include "simulation2/MessageTypes.h"
#include "simulation2/components/ICmpFootprint.h"
#include "simulation2/components/ICmpIdentity.h"
#include "simulation2/components/ICmpMirage.h"
#include "simulation2/components/ICmpOwnership.h"
#include "simulation2/components/ICmpPlayerManager.h"
#include "simulation2/components/ICmpPosition.h"
#include "simulation2/components/ICmpSound.h"
#include "simulation2/components/ICmpTemplateManager.h"
#include "simulation2/components/ICmpUnitRenderer.h"
#include "simulation2/components/ICmpValueModificationManager.h"
#include "simulation2/components/ICmpVisibility.h"
#include "simulation2/helpers/Player.h"
#include "simulation2/helpers/Position.h"
#include "simulation2/serialization/SerializeTemplates.h"
#include "simulation2/serialization/SerializedTypes.h"
#include "simulation2/system/Component.h"
#include "simulation2/system/Message.h"
#include <cstddef>
#include <map>
#include <memory>
#include <string>
#include <utility>
class CCmpVisualActor final : public ICmpVisual
{
@@ -1,4 +1,4 @@
/* Copyright (C) 2011 Wildfire Games.
/* Copyright (C) 2025 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@@ -18,8 +18,12 @@
#ifndef INCLUDED_ICMPAIINTERFACE
#define INCLUDED_ICMPAIINTERFACE
#include "simulation2/system/Component.h"
#include "simulation2/system/Interface.h"
#include <js/TypeDecls.h>
#include <js/Value.h>
class ICmpAIInterface : public IComponent
{
public:
@@ -1,4 +1,4 @@
/* Copyright (C) 2017 Wildfire Games.
/* Copyright (C) 2025 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@@ -18,9 +18,15 @@
#ifndef INCLUDED_ICMPAIMANAGER
#define INCLUDED_ICMPAIMANAGER
#include "simulation2/helpers/Player.h"
#include "simulation2/system/Component.h"
#include "simulation2/system/Interface.h"
#include "simulation2/helpers/Player.h"
#include <cstdint>
#include <js/Value.h>
#include <string>
class ScriptInterface;
class ICmpAIManager : public IComponent
{
+4 -1
View File
@@ -1,4 +1,4 @@
/* Copyright (C) 2020 Wildfire Games.
/* Copyright (C) 2025 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@@ -19,8 +19,11 @@
#define INCLUDED_ICMPATTACK
#include "ps/CStr.h"
#include "simulation2/system/Component.h"
#include "simulation2/system/Interface.h"
#include <js/Value.h>
#include <string>
#include <vector>
class ICmpAttack : public IComponent
+4 -1
View File
@@ -1,4 +1,4 @@
/* Copyright (C) 2010 Wildfire Games.
/* Copyright (C) 2025 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@@ -18,8 +18,11 @@
#ifndef INCLUDED_ICMPDECAY
#define INCLUDED_ICMPDECAY
#include "simulation2/system/Component.h"
#include "simulation2/system/Interface.h"
#include <js/Value.h>
/**
* Animated corpse-decay.
*/
+4 -2
View File
@@ -1,4 +1,4 @@
/* Copyright (C) 2015 Wildfire Games.
/* Copyright (C) 2025 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@@ -18,9 +18,11 @@
#ifndef INCLUDED_ICMPFOGGING
#define INCLUDED_ICMPFOGGING
#include "simulation2/helpers/Player.h"
#include "simulation2/system/Component.h"
#include "simulation2/system/Interface.h"
#include "simulation2/helpers/Player.h"
#include <js/Value.h>
/**
* Handles the fogging of out-of-sight enemy entities, by creating mirage
@@ -1,4 +1,4 @@
/* Copyright (C) 2017 Wildfire Games.
/* Copyright (C) 2025 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@@ -18,9 +18,12 @@
#ifndef INCLUDED_ICMPFOOTPRINT
#define INCLUDED_ICMPFOOTPRINT
#include "simulation2/helpers/Position.h"
#include "simulation2/system/Component.h"
#include "simulation2/system/Entity.h"
#include "simulation2/system/Interface.h"
#include "simulation2/helpers/Position.h"
#include <js/Value.h>
class CFixedVector3D;
@@ -1,4 +1,4 @@
/* Copyright (C) 2021 Wildfire Games.
/* Copyright (C) 2025 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@@ -18,8 +18,11 @@
#ifndef INCLUDED_ICMPGARRISONHOLDER
#define INCLUDED_ICMPGARRISONHOLDER
#include "simulation2/system/Component.h"
#include "simulation2/system/Entity.h"
#include "simulation2/system/Interface.h"
#include <js/Value.h>
#include <vector>
class ICmpGarrisonHolder : public IComponent
@@ -1,4 +1,4 @@
/* Copyright (C) 2021 Wildfire Games.
/* Copyright (C) 2025 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@@ -18,8 +18,13 @@
#ifndef INCLUDED_ICMPGUIINTERFACE
#define INCLUDED_ICMPGUIINTERFACE
#include "simulation2/system/Component.h"
#include "simulation2/system/Interface.h"
#include <js/TypeDecls.h>
#include <js/Value.h>
#include <string>
class ICmpGuiInterface : public IComponent
{
public:
+5 -1
View File
@@ -1,4 +1,4 @@
/* Copyright (C) 2022 Wildfire Games.
/* Copyright (C) 2025 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@@ -18,8 +18,12 @@
#ifndef INCLUDED_ICMPIDENTITY
#define INCLUDED_ICMPIDENTITY
#include "simulation2/system/Component.h"
#include "simulation2/system/Interface.h"
#include <js/Value.h>
#include <string>
/**
* Identity data.
* (This interface only includes the functions needed by native code for entity selection)
+5 -3
View File
@@ -1,4 +1,4 @@
/* Copyright (C) 2022 Wildfire Games.
/* Copyright (C) 2025 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@@ -18,10 +18,12 @@
#ifndef INCLUDED_ICMPMINIMAP
#define INCLUDED_ICMPMINIMAP
#include "lib/types.h"
#include "simulation2/helpers/Position.h"
#include "simulation2/system/Component.h"
#include "simulation2/system/Interface.h"
#include "simulation2/helpers/Position.h"
#include <js/Value.h>
#include <string>
/**
+6 -2
View File
@@ -1,4 +1,4 @@
/* Copyright (C) 2014 Wildfire Games.
/* Copyright (C) 2025 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@@ -18,9 +18,13 @@
#ifndef INCLUDED_ICMPMIRAGE
#define INCLUDED_ICMPMIRAGE
#include "simulation2/helpers/Player.h"
#include "simulation2/helpers/Player.h"
#include "simulation2/system/Component.h"
#include "simulation2/system/Interface.h"
#include "simulation2/system/Interface.h"
#include "simulation2/helpers/Player.h"
#include <js/Value.h>
/**
* Component allowing mirage entities to communicate with their parent entity.
@@ -1,4 +1,4 @@
/* Copyright (C) 2021 Wildfire Games.
/* Copyright (C) 2025 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@@ -18,9 +18,18 @@
#ifndef INCLUDED_ICMPOBSTRUCTION
#define INCLUDED_ICMPOBSTRUCTION
#include "simulation2/components/ICmpObstructionManager.h"
#include "simulation2/helpers/Position.h"
#include "simulation2/system/Component.h"
#include "simulation2/system/Entity.h"
#include "simulation2/system/Interface.h"
#include "simulation2/components/ICmpObstructionManager.h"
#include <cstdint>
#include <js/Value.h>
#include <string>
#include <vector>
class CFixedVector2D;
/**
* Flags an entity as obstructing movement for other units,
@@ -18,20 +18,24 @@
#ifndef INCLUDED_ICMPOBSTRUCTIONMANAGER
#define INCLUDED_ICMPOBSTRUCTIONMANAGER
#include "simulation2/system/Interface.h"
#include "lib/debug.h"
#include "lib/types.h"
#include "maths/Fixed.h"
#include "maths/FixedVector2D.h"
#include "simulation2/helpers/Position.h"
#include "simulation2/system/Component.h"
#include "simulation2/system/Entity.h"
#include "simulation2/system/Interface.h"
#include <js/Value.h>
#include <vector>
class IObstructionTestFilter;
template<typename T>
class Grid;
struct GridUpdateInformation;
using NavcellData = u16;
class PathfinderPassability;
struct GridUpdateInformation;
template<typename T> class Grid;
using NavcellData = u16;
/**
* Obstruction manager: provides efficient spatial queries over objects in the world.
@@ -1,4 +1,4 @@
/* Copyright (C) 2017 Wildfire Games.
/* Copyright (C) 2025 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@@ -18,8 +18,11 @@
#ifndef INCLUDED_ICMPOWNERSHIP
#define INCLUDED_ICMPOWNERSHIP
#include "simulation2/system/Interface.h"
#include "simulation2/helpers/Player.h"
#include "simulation2/system/Component.h"
#include "simulation2/system/Interface.h"
#include <js/Value.h>
/**
* Player ownership.
@@ -1,4 +1,4 @@
/* Copyright (C) 2013 Wildfire Games.
/* Copyright (C) 2025 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@@ -18,8 +18,11 @@
#ifndef INCLUDED_ICMPPARTICLEMANAGER
#define INCLUDED_ICMPPARTICLEMANAGER
#include "simulation2/system/Component.h"
#include "simulation2/system/Interface.h"
#include <js/Value.h>
/**
* Minimal interface for particle rendering
*/
+10 -6
View File
@@ -18,21 +18,25 @@
#ifndef INCLUDED_ICMPPATHFINDER
#define INCLUDED_ICMPPATHFINDER
#include "simulation2/system/Interface.h"
#include "lib/types.h"
#include "simulation2/components/ICmpObstruction.h"
#include "simulation2/helpers/Pathfinding.h"
#include "simulation2/helpers/Position.h"
#include "simulation2/system/Component.h"
#include "simulation2/system/Entity.h"
#include "simulation2/system/Interface.h"
#include <js/Value.h>
#include <map>
#include <string>
#include <vector>
class CFixedVector2D;
class IObstructionTestFilter;
class PathGoal;
struct GridUpdateInformation;
template<typename T> class Grid;
// Returned by asynchronous workers, used to send messages in the main thread.
struct WaypointPath;
struct PathResult
{
PathResult() = default;
@@ -1,4 +1,4 @@
/* Copyright (C) 2022 Wildfire Games.
/* Copyright (C) 2025 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@@ -19,9 +19,12 @@
#include "ICmpVisibility.h"
#include "ps/CLogger.h"
#include "simulation2/scripting/ScriptComponent.h"
#include "simulation2/system/InterfaceScripted.h"
#include <string>
BEGIN_INTERFACE_WRAPPER(Visibility)
END_INTERFACE_WRAPPER(Visibility)
@@ -1,4 +1,4 @@
/* Copyright (C) 2020 Wildfire Games.
/* Copyright (C) 2025 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@@ -18,9 +18,12 @@
#ifndef INCLUDED_ICMPVISIBILITY
#define INCLUDED_ICMPVISIBILITY
#include "simulation2/components/ICmpRangeManager.h"
#include "simulation2/helpers/Player.h"
#include "simulation2/system/Component.h"
#include "simulation2/system/Interface.h"
#include "simulation2/components/ICmpRangeManager.h"
#include <js/Value.h>
/**
* The Visibility component is a scripted component that allows any part of the simulation to
+4 -2
View File
@@ -1,4 +1,4 @@
/* Copyright (C) 2017 Wildfire Games.
/* Copyright (C) 2025 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@@ -18,9 +18,11 @@
#ifndef INCLUDED_ICMPVISION
#define INCLUDED_ICMPVISION
#include "simulation2/helpers/Position.h"
#include "simulation2/system/Component.h"
#include "simulation2/system/Interface.h"
#include "simulation2/helpers/Position.h"
#include <js/Value.h>
/**
* Vision range interface
@@ -1,4 +1,4 @@
/* Copyright (C) 2021 Wildfire Games.
/* Copyright (C) 2025 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@@ -18,9 +18,11 @@
#ifndef INCLUDED_ICMPWATERMANAGER
#define INCLUDED_ICMPWATERMANAGER
#include "simulation2/helpers/Position.h"
#include "simulation2/system/Component.h"
#include "simulation2/system/Interface.h"
#include "simulation2/helpers/Position.h"
#include <js/Value.h>
class ICmpWaterManager : public IComponent
{
@@ -34,7 +34,6 @@
#include "simulation2/serialization/StdSerializer.h"
#include "simulation2/system/Component.h"
#include <js/PropertyAndElement.h>
#include <js/RootingAPI.h>
#include <js/TypeDecls.h>
#include <js/Value.h>
+7 -4
View File
@@ -1,4 +1,4 @@
/* Copyright (C) 2017 Wildfire Games.
/* Copyright (C) 2025 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@@ -19,16 +19,19 @@
#include "CinemaPath.h"
#include <sstream>
#include <string>
#include "graphics/Camera.h"
#include "lib/debug.h"
#include "maths/MathUtil.h"
#include "maths/Matrix3D.h"
#include "maths/Quaternion.h"
#include "maths/Vector3D.h"
#include "ps/CLogger.h"
#include "ps/CStr.h"
#include <cmath>
#include <string>
#include <vector>
CCinemaPath::CCinemaPath(const CCinemaData& data, const TNSpline& spline, const TNSpline& targetSpline)
: CCinemaData(data), TNSpline(spline), m_TargetSpline(targetSpline), m_TimeElapsed(0.f)
{
@@ -26,7 +26,6 @@
#include "lib/types.h"
#include "ps/CLogger.h"
#include "renderer/TerrainOverlay.h"
#include "simulation2/helpers/Grid.h"
#include <cstddef>
#include <limits>
@@ -39,6 +38,7 @@
class CSimContext;
class PathGoal;
struct SOverlayLine;
template <typename T> class Grid;
/**
* Hierarchical pathfinder.
+12 -4
View File
@@ -19,13 +19,21 @@
#include "LongPathfinder.h"
#include "graphics/SColor.h"
#include "lib/bits.h"
#include "ps/Profile.h"
#include "Geometry.h"
#include "HierarchicalPathfinder.h"
#include "maths/Fixed.h"
#include "maths/FixedVector2D.h"
#include "ps/CLogger.h"
#include "ps/Profiler2.h"
#include "renderer/TerrainOverlay.h"
#include "simulation2/helpers/HierarchicalPathfinder.h"
#include "simulation2/helpers/Pathfinding.h"
#include <algorithm>
#include <cmath>
#include <cstddef>
#include <mutex>
#include <utility>
namespace
{
+12 -4
View File
@@ -1,4 +1,4 @@
/* Copyright (C) 2021 Wildfire Games.
/* Copyright (C) 2025 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@@ -20,13 +20,21 @@
#include "Pathfinding.h"
#include "graphics/Overlay.h"
#include "renderer/Scene.h"
#include "renderer/TerrainOverlay.h"
#include "lib/code_generation.h"
#include "lib/debug.h"
#include "lib/types.h"
#include "simulation2/helpers/Grid.h"
#include "simulation2/helpers/PathGoal.h"
#include "simulation2/helpers/Position.h"
#include "simulation2/helpers/PriorityQueue.h"
#include <atomic>
#include <functional>
#include <map>
#include <memory>
#include <new>
#include <queue>
#include <vector>
/**
* Represents the 2D coordinates of a tile.
+6 -4
View File
@@ -1,4 +1,4 @@
/* Copyright (C) 2018 Wildfire Games.
/* Copyright (C) 2025 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@@ -19,10 +19,12 @@
#include "PathGoal.h"
#include "graphics/Terrain.h"
#include "Pathfinding.h"
#include "lib/code_annotation.h"
#include "maths/MathUtil.h"
#include "simulation2/helpers/Geometry.h"
#include "simulation2/helpers/Pathfinding.h"
#include "Geometry.h"
#include <algorithm>
static bool NavcellContainsCircle(int i, int j, fixed x, fixed z, fixed r, bool inside)
{
+2 -1
View File
@@ -1,4 +1,4 @@
/* Copyright (C) 2018 Wildfire Games.
/* Copyright (C) 2025 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@@ -18,6 +18,7 @@
#ifndef INCLUDED_PATHGOAL
#define INCLUDED_PATHGOAL
#include "maths/Fixed.h"
#include "maths/FixedVector2D.h"
#include "simulation2/helpers/Position.h"
+6 -3
View File
@@ -1,4 +1,4 @@
/* Copyright (C) 2021 Wildfire Games.
/* Copyright (C) 2025 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@@ -19,10 +19,13 @@
#include "Pathfinding.h"
#include "graphics/Terrain.h"
#include "lib/debug.h"
#include "maths/FixedVector2D.h"
#include "ps/CLogger.h"
#include "simulation2/helpers/Grid.h"
#include "simulation2/system/ParamNode.h"
#include "simulation2/system/Component.h"
#include <string>
namespace Pathfinding
{
+8 -5
View File
@@ -1,4 +1,4 @@
/* Copyright (C) 2022 Wildfire Games.
/* Copyright (C) 2025 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@@ -19,16 +19,19 @@
#define INCLUDED_PATHFINDING
#include "graphics/Terrain.h"
#include "lib/types.h"
#include "maths/Fixed.h"
#include "maths/MathUtil.h"
#include "simulation2/helpers/PathGoal.h"
#include "simulation2/helpers/Position.h"
#include "simulation2/system/Entity.h"
#include "PathGoal.h"
#include <vector>
class CParamNode;
template<typename T> class Grid;
typedef u16 pass_class_t;
template<typename T>
class Grid;
struct LongPathRequest
{
+5 -1
View File
@@ -1,4 +1,4 @@
/* Copyright (C) 2015 Wildfire Games.
/* Copyright (C) 2025 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@@ -19,9 +19,13 @@
#include "Rasterize.h"
#include "maths/Fixed.h"
#include "maths/FixedVector2D.h"
#include "simulation2/helpers/Geometry.h"
#include "simulation2/helpers/Pathfinding.h"
#include <limits>
void SimRasterize::RasterizeRectWithClearance(Spans& spans,
const ICmpObstructionManager::ObstructionSquare& shape,
entity_pos_t clearance, entity_pos_t cellSize)
+4 -1
View File
@@ -1,4 +1,4 @@
/* Copyright (C) 2012 Wildfire Games.
/* Copyright (C) 2025 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@@ -23,9 +23,12 @@
* Helper functions related to rasterizing geometric shapes to grids.
*/
#include "lib/types.h"
#include "simulation2/components/ICmpObstructionManager.h"
#include "simulation2/helpers/Position.h"
#include <vector>
namespace SimRasterize
{
+4 -3
View File
@@ -19,14 +19,15 @@
#define INCLUDED_SELECTION
#include "ps/Profiler2.h"
#include "simulation2/helpers/Player.h"
#include "simulation2/Simulation2.h"
#include "simulation2/helpers/Player.h"
#include "simulation2/system/Component.h"
#include "simulation2/system/Entity.h"
#include "simulation2/system/IComponent.h"
#include <string>
#include <utility>
#include <vector>
class CSimulation2;
class CCamera;
bool CheckEntityInRect(CEntityHandle handle, const CCamera& camera, int sx0, int sy0, int sx1, int sy1, bool allowEditorSelectables);
@@ -1,4 +1,4 @@
/* Copyright (C) 2015 Wildfire Games.
/* Copyright (C) 2025 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@@ -21,6 +21,12 @@
#include "scriptinterface/ScriptTypes.h"
#include "simulation2/helpers/Player.h"
#include <js/RootingAPI.h>
#include <js/TypeDecls.h>
#include <js/Value.h>
struct JSContext;
/**
* Simulation command, typically received over the network in multiplayer games.
*/
+5
View File
@@ -18,8 +18,13 @@
#ifndef INCLUDED_SPATIAL
#define INCLUDED_SPATIAL
#include "maths/FixedVector2D.h"
#include "maths/MathUtil.h"
#include "simulation2/helpers/Position.h"
#include "simulation2/serialization/SerializeTemplates.h"
#include <vector>
/**
* A very basic subdivision scheme for finding items in ranges.
* Items are stored in lists in dynamic-sized divisions.
@@ -34,16 +34,24 @@
#include "VertexPathfinder.h"
#include "lib/timer.h"
#include "ps/Profile.h"
#include "graphics/Color.h"
#include "lib/code_generation.h"
#include "lib/debug.h"
#include "maths/MathUtil.h"
#include "ps/Profiler2.h"
#include "renderer/Scene.h"
#include "simulation2/components/ICmpObstructionManager.h"
#include "simulation2/helpers/Grid.h"
#include "simulation2/helpers/PathGoal.h"
#include "simulation2/helpers/Position.h"
#include "simulation2/helpers/PriorityQueue.h"
#include "simulation2/helpers/Render.h"
#include "simulation2/system/SimContext.h"
#include <algorithm>
#include <cmath>
#include <cstddef>
#include <mutex>
#include <queue>
namespace
{
+10 -2
View File
@@ -1,4 +1,4 @@
/* Copyright (C) 2021 Wildfire Games.
/* Copyright (C) 2025 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@@ -19,12 +19,20 @@
#define INCLUDED_VERTEXPATHFINDER
#include "graphics/Overlay.h"
#include "lib/types.h"
#include "maths/Fixed.h"
#include "maths/FixedVector2D.h"
#include "simulation2/helpers/Pathfinding.h"
#include "simulation2/system/CmpPtr.h"
#include "simulation2/system/Component.h"
#include <atomic>
#include <vector>
class ICmpObstructionManager;
class PathGoal;
class SceneCollector;
template <typename T> class Grid;
// A vertex around the corners of an obstruction
// (paths will be sequences of these vertexes)
struct Vertex
@@ -51,7 +51,6 @@
#include <array>
#include <cstddef>
#include <fstream>
#include <js/PropertyAndElement.h>
#include <js/RootingAPI.h>
#include <js/TypeDecls.h>
#include <js/Value.h>
@@ -16,9 +16,29 @@
*/
#include "precompiled.h"
#include "ps/CLogger.h"
#include "scriptinterface/ScriptConversions.h"
#include "maths/Fixed.h"
#include "ps/CLogger.h"
#include "ps/CStr.h"
#include "scriptinterface/ScriptRequest.h"
#include "simulation2/MessageTypes.h"
#include "simulation2/helpers/Player.h"
#include "simulation2/helpers/Position.h"
#include "simulation2/system/Entity.h"
#include "simulation2/system/Message.h"
#include <array>
#include <cstddef>
#include <cstdint>
#include <js/PropertyAndElement.h>
#include <js/RootingAPI.h>
#include <js/TypeDecls.h>
#include <js/Value.h>
#include <jsapi.h>
#include <memory>
#include <string>
#include <vector>
#define TOJSVAL_SETUP() \
JS::RootedObject obj(rq.cx, JS_NewPlainObject(rq.cx)); \
@@ -1,4 +1,4 @@
/* Copyright (C) 2024 Wildfire Games.
/* Copyright (C) 2025 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@@ -21,11 +21,13 @@
#include "scriptinterface/FunctionWrapper.h"
#include "scriptinterface/JSON.h"
#include "scriptinterface/ScriptInterface.h"
#include "scriptinterface/Object.h"
#include "simulation2/serialization/ISerializer.h"
#include "simulation2/serialization/IDeserializer.h"
#include "simulation2/system/ComponentManager.h"
#include "simulation2/system/Component.h"
#include "simulation2/system/Message.h"
#include <string>
class ScriptInterface;
CComponentTypeScript::CComponentTypeScript(const ScriptInterface& scriptInterface, JS::HandleValue instance) :
m_ScriptInterface(scriptInterface), m_Instance(instance)
@@ -19,15 +19,36 @@
#include "BinarySerializer.h"
#include "lib/alignment.h"
#include "lib/utf8.h"
#include "ps/CLogger.h"
#include "scriptinterface/FunctionWrapper.h"
#include "scriptinterface/JSON.h"
#include "scriptinterface/ScriptExtraHeaders.h"
#include "scriptinterface/ScriptRequest.h"
#include "scriptinterface/JSON.h"
#include "simulation2/serialization/SerializedScriptTypes.h"
#include "SerializedScriptTypes.h"
#include <cmath>
#include <js/Array.h>
#include <js/ArrayBuffer.h>
#include <js/Class.h>
#include <js/ComparisonOperators.h>
#include <js/Conversions.h>
#include <js/ForOfIterator.h>
#include <js/GCAPI.h>
#include <js/MapAndSet.h>
#include <js/Object.h>
#include <js/PropertyAndElement.h>
#include <js/PropertyDescriptor.h>
#include <js/ScalarType.h>
#include <js/String.h>
#include <js/Value.h>
#include <js/experimental/TypedData.h>
#include <jsapi.h>
#include <jspubtd.h>
#include <mozilla/HashTable.h>
#include <mozilla/Maybe.h>
class JSObject;
static u8 GetArrayType(js::Scalar::Type arrayType)
{
@@ -21,13 +21,27 @@
#include "ISerializer.h"
#include "lib/byte_order.h"
#include "lib/code_annotation.h"
#include "lib/debug.h"
#include "lib/types.h"
#include "maths/Fixed.h"
#include "scriptinterface/ScriptExtraHeaders.h"
#include "scriptinterface/ScriptForward.h"
#include "simulation2/system/Component.h"
#include <cstddef>
#include <cstdint>
#include <js/AllocPolicy.h>
#include <js/GCHashTable.h>
#include <js/Id.h>
#include <js/RootingAPI.h>
#include <js/TypeDecls.h>
#include <memory>
#include <ostream>
#include <streambuf>
#include <string>
class JSTracer;
class ScriptInterface;
class ScriptRequest;
/**
* Wrapper for redirecting ostream writes to CBinarySerializer's impl
@@ -1,4 +1,4 @@
/* Copyright (C) 2021 Wildfire Games.
/* Copyright (C) 2025 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@@ -19,17 +19,18 @@
#include "DebugSerializer.h"
#include "lib/debug.h"
#include "lib/secure_crt.h"
#include "ps/CStr.h"
#include "scriptinterface/FunctionWrapper.h"
#include "scriptinterface/JSON.h"
#include "scriptinterface/Object.h"
#include "scriptinterface/ScriptRequest.h"
#include "scriptinterface/JSON.h"
#include "lib/secure_crt.h"
#include "lib/utf8.h"
#include "ps/CStr.h"
#include <sstream>
#include <iomanip>
#include <js/RootingAPI.h>
#include <js/Value.h>
#include <sstream>
/*
* The output format here is intended to be compatible with YAML,
@@ -1,4 +1,4 @@
/* Copyright (C) 2017 Wildfire Games.
/* Copyright (C) 2025 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@@ -20,6 +20,19 @@
#include "ISerializer.h"
#include "simulation2/system/Component.h"
#include "lib/code_annotation.h"
#include "lib/types.h"
#include "maths/Fixed.h"
#include <js/TypeDecls.h>
#include <cstddef>
#include <cstdint>
#include <iosfwd>
#include <string>
class ScriptInterface;
/**
* Serialize to a human-readable YAML-like format.
*/
@@ -1,4 +1,4 @@
/* Copyright (C) 2017 Wildfire Games.
/* Copyright (C) 2025 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@@ -19,6 +19,10 @@
#include "HashSerializer.h"
#include "simulation2/serialization/BinarySerializer.h"
class ScriptInterface;
CHashSerializer::CHashSerializer(const ScriptInterface& scriptInterface) :
CBinarySerializer<CHashSerializerImpl>(scriptInterface)
{
@@ -18,9 +18,13 @@
#ifndef INCLUDED_HASHSERIALIZER
#define INCLUDED_HASHSERIALIZER
#include "BinarySerializer.h"
#include "lib/types.h"
#include "maths/MD5.h"
#include "simulation2/serialization/BinarySerializer.h"
#include <cstddef>
class ScriptInterface;
class CHashSerializerImpl
{
@@ -18,11 +18,23 @@
#ifndef INCLUDED_STDDESERIALIZER
#define INCLUDED_STDDESERIALIZER
#include "IDeserializer.h"
#include "lib/code_annotation.h"
#include "lib/types.h"
#include "simulation2/system/Component.h"
#include <cstddef>
#include <iosfwd>
#include <js/Id.h>
#include <js/TypeDecls.h>
#include <js/Value.h>
#include <string>
#include <vector>
class JSObject;
class JSTracer;
class ScriptInterface;
namespace JS { template <typename T> class Heap; }
class CStdDeserializer : public IDeserializer
{
NONCOPYABLE(CStdDeserializer);
@@ -1,4 +1,4 @@
/* Copyright (C) 2017 Wildfire Games.
/* Copyright (C) 2025 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@@ -19,6 +19,10 @@
#include "StdSerializer.h"
#include "simulation2/serialization/BinarySerializer.h"
class ScriptInterface;
CStdSerializerImpl::CStdSerializerImpl(std::ostream& stream) :
m_Stream(stream)
{
@@ -18,10 +18,14 @@
#ifndef INCLUDED_STDSERIALIZER
#define INCLUDED_STDSERIALIZER
#include "BinarySerializer.h"
#include "lib/code_annotation.h"
#include "lib/types.h"
#include "simulation2/serialization/BinarySerializer.h"
#include <cstring>
#include <memory>
#include <ostream>
class ScriptInterface;
#define DEBUG_SERIALIZER_ANNOTATE 0 // annotate the stream to help debugging if you're reading the output in a hex editor
@@ -43,7 +43,6 @@
#include <fmt/format.h>
#include <iterator>
#include <js/GCAPI.h>
#include <js/PropertyAndElement.h>
#include <js/TracingAPI.h>
#include <js/ValueArray.h>
#include <stdexcept>
+11 -3
View File
@@ -1,4 +1,4 @@
/* Copyright (C) 2023 Wildfire Games.
/* Copyright (C) 2025 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@@ -17,9 +17,17 @@
#ifndef INCLUDED_ENTITYMAP
#define INCLUDED_ENTITYMAP
#include "Entity.h"
#include "lib/debug.h"
#include "lib/types.h"
#include "simulation2/serialization/SerializeTemplates.h"
#include "simulation2/system/Component.h"
#include "simulation2/system/Entity.h"
#include <cstddef>
#include <cstdint>
#include <cstdlib>
#include <iterator>
#include <new>
/**
* A fast replacement for map<entity_id_t, T>.
+5
View File
@@ -21,6 +21,11 @@
#include "lib/code_annotation.h"
#include "scriptinterface/ScriptTypes.h"
#include <js/RootingAPI.h>
#include <js/TypeDecls.h>
#include <js/Value.h>
#include <memory>
class ScriptRequest;
class CMessage
@@ -17,8 +17,6 @@
#include "lib/self_test.h"
#include "simulation2/system/ComponentManager.h"
#include "graphics/Terrain.h"
#include "lib/file/file_system.h"
#include "lib/file/vfs/vfs.h"