Skip to content

Commit

Permalink
Move generic utility types and functions to a util directory
Browse files Browse the repository at this point in the history
  • Loading branch information
MHeasell committed Mar 29, 2023
1 parent 4aafdf7 commit e95167b
Show file tree
Hide file tree
Showing 73 changed files with 85 additions and 85 deletions.
20 changes: 10 additions & 10 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,6 @@ set(SOURCE_FILES
src/rwe/ImGuiContext.h
src/rwe/InGameSoundsInfo.cpp
src/rwe/InGameSoundsInfo.h
src/rwe/Index.h
src/rwe/LoadingNetworkService.cpp
src/rwe/LoadingNetworkService.h
src/rwe/LoadingScene.cpp
Expand All @@ -274,10 +273,6 @@ set(SOURCE_FILES
src/rwe/MeshService.h
src/rwe/MovementClassCollisionService.cpp
src/rwe/MovementClassCollisionService.h
src/rwe/OpaqueField.h
src/rwe/OpaqueId.h
src/rwe/OpaqueId_io.h
src/rwe/OpaqueUnit.h
src/rwe/Particle.cpp
src/rwe/Particle.h
src/rwe/PathMapping.cpp
Expand All @@ -292,7 +287,6 @@ set(SOURCE_FILES
src/rwe/RadiansAngle.h
src/rwe/RenderService.cpp
src/rwe/RenderService.h
src/rwe/Result.h
src/rwe/SceneContext.h
src/rwe/SceneTime.cpp
src/rwe/SceneTime.h
Expand All @@ -301,7 +295,6 @@ set(SOURCE_FILES
src/rwe/SelectionMesh.h
src/rwe/ShaderService.cpp
src/rwe/ShaderService.h
src/rwe/SharedHandle.h
src/rwe/SideData.cpp
src/rwe/SideData.h
src/rwe/SoundClass.cpp
Expand All @@ -310,7 +303,6 @@ set(SOURCE_FILES
src/rwe/TextureService.h
src/rwe/UiRenderService.cpp
src/rwe/UiRenderService.h
src/rwe/UniqueHandle.h
src/rwe/UnitDatabase.cpp
src/rwe/UnitDatabase.h
src/rwe/UnitPieceMeshInfo.cpp
Expand Down Expand Up @@ -433,7 +425,6 @@ set(SOURCE_FILES
src/rwe/io_utils.h
src/rwe/ip_util.cpp
src/rwe/ip_util.h
src/rwe/match.h
src/rwe/math/Matrix4f.h
src/rwe/math/Matrix4x.h
src/rwe/math/Vector2f.h
Expand Down Expand Up @@ -589,6 +580,15 @@ set(SOURCE_FILES
src/rwe/ui/events.h
src/rwe/util.cpp
src/rwe/util.h
src/rwe/util/Index.h
src/rwe/util/OpaqueField.h
src/rwe/util/OpaqueId.h
src/rwe/util/OpaqueId_io.h
src/rwe/util/OpaqueUnit.h
src/rwe/util/Result.h
src/rwe/util/SharedHandle.h
src/rwe/util/UniqueHandle.h
src/rwe/util/match.h
src/rwe/vertex_height.cpp
src/rwe/vertex_height.h
src/rwe/vfs/AbstractVirtualFileSystem.h
Expand Down Expand Up @@ -780,7 +780,6 @@ endif()
set(TEST_FILES
src/rwe/BoxTreeSplit.test.cpp
src/rwe/GameHash_util.test.cpp
src/rwe/Result.test.cpp
src/rwe/SideData.test.cpp
src/rwe/Viewport.test.cpp
src/rwe/cob/cob_util.test.cpp
Expand Down Expand Up @@ -819,6 +818,7 @@ set(TEST_FILES
src/rwe/sim/UnitState_util.test.cpp
src/rwe/sim/util.test.cpp
src/rwe/util.test.cpp
src/rwe/util/Result.test.cpp
)

add_executable(rwe_test src/test.cpp ${TEST_FILES})
Expand Down
2 changes: 1 addition & 1 deletion src/cob_test.cpp
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#include <fstream>
#include <iomanip>
#include <iostream>
#include <rwe/Index.h>
#include <rwe/cob/CobOpCode.h>
#include <rwe/io/_3do/_3do.h>
#include <rwe/io/cob/Cob.h>
#include <rwe/optional_io.h>
#include <rwe/util/Index.h>
#include <vector>

namespace rwe
Expand Down
2 changes: 1 addition & 1 deletion src/hpi_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#include <iostream>
#include <memory>
#include <rwe/io/hpi/HpiArchive.h>
#include <rwe/match.h>
#include <rwe/util/match.h>
#include <string>

namespace fs = boost::filesystem;
Expand Down
2 changes: 1 addition & 1 deletion src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
#include <rwe/MainMenuScene.h>
#include <rwe/PathMapping.h>
#include <rwe/PlayerColorIndex.h>
#include <rwe/Result.h>
#include <rwe/SceneContext.h>
#include <rwe/SdlContextManager.h>
#include <rwe/ShaderService.h>
Expand All @@ -27,6 +26,7 @@
#include <rwe/sim/Metal.h>
#include <rwe/ui/UiFactory.h>
#include <rwe/util.h>
#include <rwe/util/Result.h>
#include <rwe/vfs/CompositeVirtualFileSystem.h>
#include <spdlog/spdlog.h>

Expand Down
2 changes: 1 addition & 1 deletion src/rwe/GameHash.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#pragma once

#include <cstdint>
#include <rwe/OpaqueId.h>
#include <rwe/util/OpaqueId.h>

namespace rwe
{
Expand Down
2 changes: 1 addition & 1 deletion src/rwe/GameHash_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

#include <cstdint>
#include <rwe/GameHash.h>
#include <rwe/match.h>
#include <rwe/sim/GameSimulation.h>
#include <rwe/util/match.h>

namespace rwe
{
Expand Down
2 changes: 1 addition & 1 deletion src/rwe/GameHash_util.test.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include <catch2/catch.hpp>
#include <rwe/GameHash_util.h>
#include <rwe/OpaqueId_io.h>
#include <rwe/util/OpaqueId_io.h>

namespace rwe
{
Expand Down
4 changes: 2 additions & 2 deletions src/rwe/GameNetworkService.cpp
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#include "GameNetworkService.h"
#include <boost/range/adaptors.hpp>
#include <rwe/GameHash.h>
#include <rwe/Index.h>
#include <rwe/OpaqueId_io.h>
#include <rwe/network_util.h>
#include <rwe/proto/serialization.h>
#include <rwe/range_util.h>
#include <rwe/sim/SimTicksPerSecond.h>
#include <rwe/util/Index.h>
#include <rwe/util/OpaqueId_io.h>
#include <spdlog/spdlog.h>
#include <thread>

Expand Down
4 changes: 2 additions & 2 deletions src/rwe/GameNetworkService.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@
#include <network.pb.h>
#include <random>
#include <rwe/GameHash.h>
#include <rwe/OpaqueId.h>
#include <rwe/OpaqueUnit.h>
#include <rwe/PlayerCommand.h>
#include <rwe/PlayerCommandService.h>
#include <rwe/rwe_time.h>
#include <rwe/sim/GameTime.h>
#include <rwe/sim/PlayerId.h>
#include <rwe/util/OpaqueId.h>
#include <rwe/util/OpaqueUnit.h>

namespace rwe
{
Expand Down
4 changes: 2 additions & 2 deletions src/rwe/GameScene.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@
#include <functional>
#include <rwe/CroppedViewport.h>
#include <rwe/GameScene_util.h>
#include <rwe/Index.h>
#include <rwe/Mesh.h>
#include <rwe/camera_util.h>
#include <rwe/dump_util.h>
#include <rwe/io/featuretdf/FeatureTdf.h>
#include <rwe/match.h>
#include <rwe/matrix_util.h>
#include <rwe/resource_io.h>
#include <rwe/sim/SimTicksPerSecond.h>
#include <rwe/sim/UnitBehaviorService.h>
#include <rwe/sim/cob.h>
#include <rwe/ui/UiStagedButton.h>
#include <rwe/util/Index.h>
#include <rwe/util/match.h>
#include <spdlog/spdlog.h>

namespace rwe
Expand Down
2 changes: 1 addition & 1 deletion src/rwe/GameScene_util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#include <algorithm>
#include <boost/algorithm/string/predicate.hpp>
#include <rwe/Index.h>
#include <rwe/util/Index.h>

namespace rwe
{
Expand Down
2 changes: 1 addition & 1 deletion src/rwe/LoadingNetworkService.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "LoadingNetworkService.h"
#include <algorithm>
#include <rwe/Index.h>
#include <rwe/network_util.h>
#include <rwe/util/Index.h>
#include <spdlog/spdlog.h>

namespace rwe
Expand Down
2 changes: 1 addition & 1 deletion src/rwe/LoadingScene.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
#include <boost/interprocess/streams/bufferstream.hpp>
#include <rwe/FeatureMediaInfo.h>
#include <rwe/GameNetworkService.h>
#include <rwe/Index.h>
#include <rwe/MapTerrainGraphics.h>
#include <rwe/atlas_util.h>
#include <rwe/collections/SimpleVectorMap.h>
Expand All @@ -16,6 +15,7 @@
#include <rwe/pathfinding/PathFindingService.h>
#include <rwe/sim/FeatureDefinitionId.h>
#include <rwe/ui/UiLabel.h>
#include <rwe/util/Index.h>

namespace rwe
{
Expand Down
2 changes: 1 addition & 1 deletion src/rwe/MainMenuScene.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#include "MainMenuScene.h"
#include <rwe/Index.h>
#include <rwe/LoadingScene.h>
#include <rwe/MainMenuModel.h>
#include <rwe/camera_util.h>
Expand All @@ -9,6 +8,7 @@
#include <rwe/io/tdf/tdf.h>
#include <rwe/resource_io.h>
#include <rwe/ui/UiSurface.h>
#include <rwe/util/Index.h>

namespace rwe
{
Expand Down
2 changes: 1 addition & 1 deletion src/rwe/Particle.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "Particle.h"
#include <rwe/match.h>
#include <rwe/util/match.h>

namespace rwe
{
Expand Down
2 changes: 1 addition & 1 deletion src/rwe/PlayerColorIndex.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#pragma once

#include <rwe/OpaqueId.h>
#include <rwe/util/OpaqueId.h>

namespace rwe
{
Expand Down
2 changes: 1 addition & 1 deletion src/rwe/RadiansAngle.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#pragma once

#include <rwe/OpaqueId.h>
#include <rwe/util/OpaqueId.h>

namespace rwe
{
Expand Down
2 changes: 1 addition & 1 deletion src/rwe/SceneTime.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#pragma once

#include <rwe/OpaqueUnit.h>
#include <rwe/util/OpaqueUnit.h>

namespace rwe
{
Expand Down
4 changes: 2 additions & 2 deletions src/rwe/atlas_util.cpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#include "atlas_util.h"
#include <boost/interprocess/streams/bufferstream.hpp>
#include <rwe/BoxTreeSplit.h>
#include <rwe/Index.h>
#include <rwe/io/gaf/GafArchive.h>
#include <rwe/match.h>
#include <rwe/util/Index.h>
#include <rwe/util/match.h>

namespace rwe
{
Expand Down
2 changes: 1 addition & 1 deletion src/rwe/cob/CobAngle.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#pragma once

#include <rwe/OpaqueUnit.h>
#include <rwe/sim/SimAngle.h>
#include <rwe/util/OpaqueUnit.h>

namespace rwe
{
Expand Down
2 changes: 1 addition & 1 deletion src/rwe/cob/CobAngularSpeed.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#pragma once

#include <cstdint>
#include <rwe/OpaqueId.h>
#include <rwe/sim/SimScalar.h>
#include <rwe/util/OpaqueId.h>

namespace rwe
{
Expand Down
2 changes: 1 addition & 1 deletion src/rwe/cob/CobPosition.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#pragma once

#include <rwe/OpaqueId.h>
#include <rwe/util/OpaqueId.h>

namespace rwe
{
Expand Down
2 changes: 1 addition & 1 deletion src/rwe/cob/CobSleepDuration.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#pragma once

#include <rwe/OpaqueId.h>
#include <rwe/util/OpaqueId.h>

namespace rwe
{
Expand Down
2 changes: 1 addition & 1 deletion src/rwe/cob/CobSpeed.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#pragma once

#include <rwe/OpaqueId.h>
#include <rwe/util/OpaqueId.h>

namespace rwe
{
Expand Down
2 changes: 1 addition & 1 deletion src/rwe/cob/CobTime.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#pragma once

#include <rwe/OpaqueUnit.h>
#include <rwe/util/OpaqueUnit.h>

namespace rwe
{
Expand Down
2 changes: 1 addition & 1 deletion src/rwe/collections/SimpleVectorMap.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#include <deque>
#include <optional>
#include <rwe/OpaqueId.h>
#include <rwe/util/OpaqueId.h>
#include <utility>

namespace rwe
Expand Down
4 changes: 2 additions & 2 deletions src/rwe/collections/VectorMap.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
#include <deque>
#include <functional>
#include <optional>
#include <rwe/OpaqueId.h>
#include <rwe/match.h>
#include <rwe/util/OpaqueId.h>
#include <rwe/util/match.h>
#include <stdexcept>
#include <utility>
#include <variant>
Expand Down
4 changes: 2 additions & 2 deletions src/rwe/collections/VectorMap.test.cpp
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#include <catch2/catch.hpp>
#include <rapidcheck.h>
#include <rapidcheck/catch.h>
#include <rwe/OpaqueId.h>
#include <rwe/OpaqueId_io.h>
#include <rwe/collections/VectorMap.h>
#include <rwe/optional_io.h>
#include <rwe/rc_gen_optional.h>
#include <rwe/util/OpaqueId.h>
#include <rwe/util/OpaqueId_io.h>

namespace rwe
{
Expand Down
2 changes: 1 addition & 1 deletion src/rwe/dump_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

#include <cstdint>
#include <nlohmann/json.hpp>
#include <rwe/OpaqueId.h>
#include <rwe/sim/GameSimulation.h>
#include <rwe/util/OpaqueId.h>
#include <string>
#include <utility>

Expand Down
2 changes: 1 addition & 1 deletion src/rwe/grid/Grid.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
#include <cassert>
#include <functional>
#include <optional>
#include <rwe/Index.h>
#include <rwe/grid/DiscreteRect.h>
#include <rwe/util/Index.h>
#include <stdexcept>
#include <vector>

Expand Down
Loading

0 comments on commit e95167b

Please sign in to comment.