Skip to content

Commit

Permalink
Parse scorers from file (#1657)
Browse files Browse the repository at this point in the history
* Parse scorers from file

* Add tests

* Clang

* Use vanilla name for scorers file

* Clang
  • Loading branch information
cetvrtak authored Nov 13, 2023
1 parent 4ab3bd8 commit d28f4c8
Show file tree
Hide file tree
Showing 26 changed files with 937 additions and 0 deletions.
17 changes: 17 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,10 @@ set(HOI4WORLD_PLANE_DESIGNS_SOURCES ${HOI4WORLD_PLANE_DESIGNS_SOURCES} "${PROJEC
set(HOI4WORLD_REGIONS_SOURCES ${HOI4WORLD_REGIONS_SOURCES} "${PROJECT_SOURCE_DIR}/src/HOI4World/Regions/RegionFactory.cpp")
set(HOI4WORLD_REGIONS_SOURCES ${HOI4WORLD_REGIONS_SOURCES} "${PROJECT_SOURCE_DIR}/src/HOI4World/Regions/Regions.cpp")
set(HOI4WORLD_REGIONS_SOURCES ${HOI4WORLD_REGIONS_SOURCES} "${PROJECT_SOURCE_DIR}/src/HOI4World/Regions/RegionsFactory.cpp")
set(HOI4WORLD_SCORERS_SOURCES ${HOI4WORLD_SCORERS_SOURCES} "${PROJECT_SOURCE_DIR}/src/HOI4World/Scorers/Scorer.cpp")
set(HOI4WORLD_SCORERS_SOURCES ${HOI4WORLD_SCORERS_SOURCES} "${PROJECT_SOURCE_DIR}/src/HOI4World/Scorers/ScorerFactory.cpp")
set(HOI4WORLD_SCORERS_SOURCES ${HOI4WORLD_SCORERS_SOURCES} "${PROJECT_SOURCE_DIR}/src/HOI4World/Scorers/Scorers.cpp")
set(HOI4WORLD_SCORERS_SOURCES ${HOI4WORLD_SCORERS_SOURCES} "${PROJECT_SOURCE_DIR}/src/HOI4World/Scorers/ScorersFactory.cpp")
set(HOI4WORLD_SCRIPTED_EFFECTS_SOURCES ${HOI4WORLD_SCRIPTED_EFFECTS_SOURCES} "${PROJECT_SOURCE_DIR}/src/HOI4World/ScriptedEffects/ScriptedEffectFactory.cpp")
set(HOI4WORLD_SCRIPTED_EFFECTS_SOURCES ${HOI4WORLD_SCRIPTED_EFFECTS_SOURCES} "${PROJECT_SOURCE_DIR}/src/HOI4World/ScriptedEffects/ScriptedEffectFile.cpp")
set(HOI4WORLD_SCRIPTED_EFFECTS_SOURCES ${HOI4WORLD_SCRIPTED_EFFECTS_SOURCES} "${PROJECT_SOURCE_DIR}/src/HOI4World/ScriptedEffects/ScriptedEffects.cpp")
Expand Down Expand Up @@ -277,6 +281,8 @@ set(OUTHOI4_PEACECONFERENCE_SOURCES ${OUTHOI4_PEACECONFERENCE_SOURCES} "${PROJEC
set(OUTHOI4_PLANE_DESIGNS_SOURCES ${OUTHOI4_PLANE_DESIGNS_SOURCES} "${PROJECT_SOURCE_DIR}/src/OutHoi4/PlaneDesigns/OutPlaneDesign.cpp")
set(OUTHOI4_PLANE_DESIGNS_SOURCES ${OUTHOI4_PLANE_DESIGNS_SOURCES} "${PROJECT_SOURCE_DIR}/src/OutHoi4/PlaneDesigns/OutPlaneDesigns.cpp")
set(OUTHOI4_PLANE_DESIGNS_SOURCES ${OUTHOI4_PLANE_DESIGNS_SOURCES} "${PROJECT_SOURCE_DIR}/src/OutHoi4/PlaneDesigns/OutPlaneModules.cpp")
set(OUTHOI4_SCORERS_SOURCES ${OUTHOI4_SCORERS_SOURCES} "${PROJECT_SOURCE_DIR}/src/OutHoi4/Scorers/OutScorers.cpp")
set(OUTHOI4_SCORERS_SOURCES ${OUTHOI4_SCORERS_SOURCES} "${PROJECT_SOURCE_DIR}/src/OutHoi4/Scorers/OutScorer.cpp")
set(OUTHOI4_SCRIPTED_EFFECTS_SOURCES ${OUTHOI4_SCRIPTED_EFFECTS_SOURCES} "${PROJECT_SOURCE_DIR}/src/OutHoi4/ScriptedEffects/OutScriptedEffects.cpp")
set(OUTHOI4_SCRIPTED_EFFECTS_SOURCES ${OUTHOI4_SCRIPTED_EFFECTS_SOURCES} "${PROJECT_SOURCE_DIR}/src/OutHoi4/ScriptedEffects/OutScriptedEffect.cpp")
file(GLOB OUTHOI4_SCRIPTED_LOCALISATIONS_SOURCES "${PROJECT_SOURCE_DIR}/src/OutHoi4/ScriptedLocalisations/*.cpp")
Expand Down Expand Up @@ -345,6 +351,7 @@ list(APPEND ALL_HOI4_FILES
${OUTHOI4_PEACECONFERENCE_SOURCES}
${OUTHOI4_PLANE_DESIGNS_SOURCES}
${OUTHOI4_NAVIES_SOURCES}
${OUTHOI4_SCORERS_SOURCES}
${OUTHOI4_SCRIPTED_EFFECTS_SOURCES}
${OUTHOI4_SCRIPTED_LOCALISATIONS_SOURCES}
${OUTHOI4_SCRIPTED_TRIGGERS_SOURCES}
Expand Down Expand Up @@ -423,6 +430,7 @@ list(APPEND ALL_HOI4_FILES
${HOI4WORLD_PEACECONFERENCES_SOURCES}
${HOI4WORLD_PLANE_DESIGNS_SOURCES}
${HOI4WORLD_REGIONS_SOURCES}
${HOI4WORLD_SCORERS_SOURCES}
${HOI4WORLD_SCRIPTED_EFFECTS_SOURCES}
${HOI4WORLD_SCRIPTED_LOCALISATIONS_SOURCES}
${HOI4WORLD_SCRIPTED_TRIGGERS_SOURCES}
Expand Down Expand Up @@ -634,6 +642,10 @@ set(HOI4WORLD_PLANE_DESIGNS_TESTS_SOURCES ${HOI4WORLD_PLANE_DESIGNS_TESTS_SOURCE
set(HOI4WORLD_PLANE_DESIGNS_TESTS_SOURCES ${HOI4WORLD_PLANE_DESIGNS_TESTS_SOURCES} "${PROJECT_SOURCE_DIR}/src/HOI4World/PlaneDesigns/PossiblePlaneDesignsTests.cpp")
set(HOI4WORLD_REGIONS_TESTS_SOURCES ${HOI4WORLD_REGIONS_TESTS_SOURCES} "${PROJECT_SOURCE_DIR}/src/HOI4World/Regions/RegionTests.cpp")
set(HOI4WORLD_REGIONS_TESTS_SOURCES ${HOI4WORLD_REGIONS_TESTS_SOURCES} "${PROJECT_SOURCE_DIR}/src/HOI4World/Regions/RegionsTests.cpp")
set(HOI4WORLD_SCORERS_TESTS_SOURCES ${HOI4WORLD_SCORERS_TESTS_SOURCES} "${PROJECT_SOURCE_DIR}/src/HOI4World/Scorers/ScorerFactoryTests.cpp")
set(HOI4WORLD_SCORERS_TESTS_SOURCES ${HOI4WORLD_SCORERS_TESTS_SOURCES} "${PROJECT_SOURCE_DIR}/src/HOI4World/Scorers/ScorerTests.cpp")
set(HOI4WORLD_SCORERS_TESTS_SOURCES ${HOI4WORLD_SCORERS_TESTS_SOURCES} "${PROJECT_SOURCE_DIR}/src/HOI4World/Scorers/ScorersFactoryTests.cpp")
set(HOI4WORLD_SCORERS_TESTS_SOURCES ${HOI4WORLD_SCORERS_TESTS_SOURCES} "${PROJECT_SOURCE_DIR}/src/HOI4World/Scorers/ScorersTests.cpp")
set(HOI4WORLD_SCRIPTED_EFFECTS_TESTS_SOURCES ${HOI4WORLD_SCRIPTED_EFFECTS_TESTS_SOURCES} "${PROJECT_SOURCE_DIR}/src/HOI4World/ScriptedEffects/ScriptedEffectTests.cpp")
set(HOI4WORLD_SCRIPTED_EFFECTS_TESTS_SOURCES ${HOI4WORLD_SCRIPTED_EFFECTS_TESTS_SOURCES} "${PROJECT_SOURCE_DIR}/src/HOI4World/ScriptedEffects/ScriptedEffectFileTests.cpp")
set(HOI4WORLD_SCRIPTED_LOCALISATIONS_TESTS_SOURCES ${HOI4WORLD_SCRIPTED_LOCALISATIONS_TESTS_SOURCES} "${PROJECT_SOURCE_DIR}/src/HOI4World/ScriptedLocalisations/ScriptedLocalisationTests.cpp")
Expand Down Expand Up @@ -768,6 +780,7 @@ list(APPEND ALL_HOI4_TESTS_FILES
${HOI4WORLD_PEACECONFERENCES_TESTS_SOURCES}
${HOI4WORLD_PLANE_DESIGNS_TESTS_SOURCES}
${HOI4WORLD_REGIONS_TESTS_SOURCES}
${HOI4WORLD_SCORERS_TESTS_SOURCES}
${HOI4WORLD_SCRIPTED_EFFECTS_TESTS_SOURCES}
${HOI4WORLD_SCRIPTED_LOCALISATIONS_TESTS_SOURCES}
${HOI4WORLD_SCRIPTED_TRIGGERS_TESTS_SOURCES}
Expand Down Expand Up @@ -896,6 +909,7 @@ configure_file("data/test_files/operations.txt" "${TEST_OUTPUT_DIRECTORY}/blankm
configure_file("data/test_files/regions.txt" "${TEST_OUTPUT_DIRECTORY}/Configurables/Map/regions.txt" COPYONLY)
configure_file("data/test_files/ReadMe.txt" "${TEST_OUTPUT_DIRECTORY}/Vic2Windows/ReadMe.txt" COPYONLY)
configure_file("data/test_files/ReadMe.txt" "${TEST_OUTPUT_DIRECTORY}/Vic2Linux/ReadMe.txt" COPYONLY)
configure_file("data/test_files/Scorers.txt" "${TEST_OUTPUT_DIRECTORY}/Configurables/Scorers/generic_platonic_scorers.txt" COPYONLY)
configure_file("data/test_files/ScriptedEffects/effects_file.txt" "${TEST_OUTPUT_DIRECTORY}/ScriptedEffects/effects_file.txt" COPYONLY)
configure_file("data/test_files/ScriptedEffects/empty_effects_file.txt" "${TEST_OUTPUT_DIRECTORY}/ScriptedEffects/empty_effects_file.txt" COPYONLY)
configure_file("data/test_files/Sounds/CultureToVoiceMappings.txt" "${TEST_OUTPUT_DIRECTORY}/Configurables/Sounds/CultureToVoiceMappings.txt" COPYONLY)
Expand Down Expand Up @@ -1034,6 +1048,7 @@ add_library(run_clang_tidy
${HOI4WORLD_OPERATIVE_NAMES_SOURCES}
${HOI4WORLD_PEACECONFERENCES_SOURCES}
${HOI4WORLD_REGIONS_SOURCES}
${HOI4WORLD_SCORERS_SOURCES}
${HOI4WORLD_SCRIPTED_EFFECTS_SOURCES}
${HOI4WORLD_SCRIPTED_LOCALISATIONS_SOURCES}
${HOI4WORLD_SCRIPTED_TRIGGERS_SOURCES}
Expand Down Expand Up @@ -1095,6 +1110,7 @@ add_library(run_clang_tidy
${OUTHOI4_OPERATIVE_SOURCES}
${OUTHOI4_NAVIES_SOURCES}
${OUTHOI4_PEACECONFERENCE_SOURCES}
${OUTHOI4_SCORERS_SOURCES}
${OUTHOI4_SCRIPTED_EFFECTS_SOURCES}
${OUTHOI4_SCRIPTED_LOCALISATIONS_SOURCES}
${OUTHOI4_SCRIPTED_TRIGGERS_SOURCES}
Expand Down Expand Up @@ -1133,6 +1149,7 @@ add_library(run_clang_tidy
${HOI4WORLD_PEACECONFERENCES_TESTS_SOURCES}
${HOI4WORLD_PLANE_DESIGNS_TESTS_SOURCES}
${HOI4WORLD_REGIONS_TESTS_SOURCES}
${HOI4WORLD_SCORERS_TESTS_SOURCES}
${HOI4WORLD_SCRIPTED_EFFECTS_TESTS_SOURCES}
${HOI4WORLD_SCRIPTED_LOCALISATIONS_TESTS_SOURCES}
${HOI4WORLD_SCRIPTED_TRIGGERS_TESTS_SOURCES}
Expand Down
10 changes: 10 additions & 0 deletions Vic2ToHoI4Tests.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,10 @@
<ClCompile Include="src\HOI4World\PlaneDesigns\PossiblePlaneDesignsTests.cpp" />
<ClCompile Include="src\HOI4World\Regions\RegionsTests.cpp" />
<ClCompile Include="src\HOI4World\Regions\RegionTests.cpp" />
<ClCompile Include="src\HOI4World\Scorers\ScorerFactoryTests.cpp" />
<ClCompile Include="src\HOI4World\Scorers\ScorerTests.cpp" />
<ClCompile Include="src\HOI4World\Scorers\ScorersFactoryTests.cpp" />
<ClCompile Include="src\HOI4World\Scorers\ScorersTests.cpp" />
<ClCompile Include="src\HOI4World\ScriptedEffects\ScriptedEffectFileTests.cpp" />
<ClCompile Include="src\HOI4World\ScriptedEffects\ScriptedEffectTests.cpp" />
<ClCompile Include="src\HOI4World\ScriptedLocalisations\ScriptedLocalisationsTests.cpp" />
Expand Down Expand Up @@ -452,6 +456,12 @@
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)/configurables/Localisations</DestinationFolders>
</CopyFileToFolders>
</ItemGroup>
<ItemGroup>
<CopyFileToFolders Include="data\test_files\Scorers.txt">
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)/configurables/Scorers/</DestinationFolders>
<DestinationFileName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">generic_platonic_scorers%(Extension)</DestinationFileName>
</CopyFileToFolders>
</ItemGroup>
<ItemGroup>
<CopyFileToFolders Include="data\test_files\ScriptedEffects\empty_effects_file.txt">
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)/ScriptedEffects</DestinationFolders>
Expand Down
18 changes: 18 additions & 0 deletions Vic2ToHoI4Tests.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -634,6 +634,18 @@
<ClCompile Include="src\V2World\Pops\PopFactoryTests.cpp">
<Filter>src\V2World\Pops</Filter>
</ClCompile>
<ClCompile Include="src\HOI4World\Scorers\ScorerFactoryTests.cpp">
<Filter>src\HOI4World\Scorers</Filter>
</ClCompile>
<ClCompile Include="src\HOI4World\Scorers\ScorerTests.cpp">
<Filter>src\HOI4World\Scorers</Filter>
</ClCompile>
<ClCompile Include="src\HOI4World\Scorers\ScorersFactoryTests.cpp">
<Filter>src\HOI4World\Scorers</Filter>
</ClCompile>
<ClCompile Include="src\HOI4World\Scorers\ScorersTests.cpp">
<Filter>src\HOI4World\Scorers</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<Filter Include="src">
Expand Down Expand Up @@ -1059,6 +1071,9 @@
<Filter Include="src\HOI4World\FocusTrees">
<UniqueIdentifier>{0f64a54e-5b9c-47ae-89cd-58afdec9b5cc}</UniqueIdentifier>
</Filter>
<Filter Include="src\HOI4World\Scorers">
<UniqueIdentifier>{c7079fbb-9df6-467f-a26e-cbfcf59b89a3}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<None Include="TestFiles\World\merge_nations.txt">
Expand Down Expand Up @@ -1393,6 +1408,9 @@
<CopyFileToFolders Include="data\test_files\regions.txt">
<Filter>data\test_files</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="data\test_files\Scorers.txt">
<Filter>data\test_files</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="data\test_files\v2game">
<Filter>data\test_files</Filter>
</CopyFileToFolders>
Expand Down
12 changes: 12 additions & 0 deletions Vic2ToHoI4lib.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,10 @@
<ClCompile Include="src\HOI4World\Regions\RegionFactory.cpp" />
<ClCompile Include="src\HOI4World\Regions\Regions.cpp" />
<ClCompile Include="src\HOI4World\Regions\RegionsFactory.cpp" />
<ClCompile Include="src\HOI4World\Scorers\Scorer.cpp" />
<ClCompile Include="src\HOI4World\Scorers\ScorerFactory.cpp" />
<ClCompile Include="src\HOI4World\Scorers\Scorers.cpp" />
<ClCompile Include="src\HOI4World\Scorers\ScorersFactory.cpp" />
<ClCompile Include="src\HOI4World\ScriptedEffects\ScriptedEffectFactory.cpp" />
<ClCompile Include="src\HOI4World\ScriptedEffects\ScriptedEffectFile.cpp" />
<ClCompile Include="src\HOI4World\ScriptedEffects\ScriptedEffects.cpp" />
Expand Down Expand Up @@ -300,6 +304,8 @@
<ClCompile Include="src\OutHoi4\PlaneDesigns\OutPlaneDesign.cpp" />
<ClCompile Include="src\OutHoi4\PlaneDesigns\OutPlaneDesigns.cpp" />
<ClCompile Include="src\OutHoi4\PlaneDesigns\OutPlaneModules.cpp" />
<ClCompile Include="src\OutHoi4\Scorers\OutScorer.cpp" />
<ClCompile Include="src\OutHoi4\Scorers\OutScorers.cpp" />
<ClCompile Include="src\OutHoi4\ScriptedEffects\OutScriptedEffect.cpp" />
<ClCompile Include="src\OutHoi4\ScriptedEffects\OutScriptedEffects.cpp" />
<ClCompile Include="src\OutHoi4\ScriptedLocalisations\OutScriptedLocalisation.cpp" />
Expand Down Expand Up @@ -548,6 +554,10 @@
<ClInclude Include="src\HOI4World\Regions\RegionFactory.h" />
<ClInclude Include="src\HOI4World\Regions\Regions.h" />
<ClInclude Include="src\HOI4World\Regions\RegionsFactory.h" />
<ClInclude Include="src\HOI4World\Scorers\Scorer.h" />
<ClInclude Include="src\HOI4World\Scorers\ScorerFactory.h" />
<ClInclude Include="src\HOI4World\Scorers\Scorers.h" />
<ClInclude Include="src\HOI4World\Scorers\ScorersFactory.h" />
<ClInclude Include="src\HOI4World\ScriptedEffects\ScriptedEffect.h" />
<ClInclude Include="src\HOI4World\ScriptedEffects\ScriptedEffectFactory.h" />
<ClInclude Include="src\HOI4World\ScriptedEffects\ScriptedEffectFile.h" />
Expand Down Expand Up @@ -735,6 +745,8 @@
<ClInclude Include="src\OutHoi4\PlaneDesigns\OutPlaneDesign.h" />
<ClInclude Include="src\OutHoi4\PlaneDesigns\OutPlaneDesigns.h" />
<ClInclude Include="src\OutHoi4\PlaneDesigns\OutPlaneModules.h" />
<ClInclude Include="src\OutHoi4\Scorers\OutScorer.h" />
<ClInclude Include="src\OutHoi4\Scorers\OutScorers.h" />
<ClInclude Include="src\OutHoi4\ScriptedEffects\OutScriptedEffect.h" />
<ClInclude Include="src\OutHoi4\ScriptedEffects\OutScriptedEffects.h" />
<ClInclude Include="src\OutHoi4\ScriptedLocalisations\OutScriptedLocalisation.h" />
Expand Down
42 changes: 42 additions & 0 deletions Vic2ToHoI4lib.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,12 @@
<Filter Include="external\bitmap">
<UniqueIdentifier>{3b5bae8f-1a84-4852-b2b3-1024028d64d8}</UniqueIdentifier>
</Filter>
<Filter Include="src\HoI4World\Scorers">
<UniqueIdentifier>{c7817af0-36c6-489a-b034-64638a55d80f}</UniqueIdentifier>
</Filter>
<Filter Include="src\OutHoi4\Scorers">
<UniqueIdentifier>{e4d5ceee-934a-4813-8a4f-2c6e321263b5}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="src\Configuration.cpp">
Expand Down Expand Up @@ -1416,6 +1422,24 @@
<ClCompile Include="src\V2World\World\WorldFactory.cpp">
<Filter>src\V2World\World</Filter>
</ClCompile>
<ClCompile Include="src\HOI4World\Scorers\ScorerFactory.cpp">
<Filter>src\HoI4World\Scorers</Filter>
</ClCompile>
<ClCompile Include="src\HOI4World\Scorers\Scorers.cpp">
<Filter>src\HoI4World\Scorers</Filter>
</ClCompile>
<ClCompile Include="src\HOI4World\Scorers\ScorersFactory.cpp">
<Filter>src\HoI4World\Scorers</Filter>
</ClCompile>
<ClCompile Include="src\HOI4World\Scorers\Scorer.cpp">
<Filter>src\HoI4World\Scorers</Filter>
</ClCompile>
<ClCompile Include="src\OutHoi4\Scorers\OutScorer.cpp">
<Filter>src\OutHoi4\Scorers</Filter>
</ClCompile>
<ClCompile Include="src\OutHoi4\Scorers\OutScorers.cpp">
<Filter>src\OutHoi4\Scorers</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="src\Configuration.h">
Expand Down Expand Up @@ -2780,5 +2804,23 @@
<ClInclude Include="external\bitmap\bitmap_image.hpp">
<Filter>external\bitmap</Filter>
</ClInclude>
<ClInclude Include="src\HOI4World\Scorers\Scorer.h">
<Filter>src\HoI4World\Scorers</Filter>
</ClInclude>
<ClInclude Include="src\HOI4World\Scorers\ScorerFactory.h">
<Filter>src\HoI4World\Scorers</Filter>
</ClInclude>
<ClInclude Include="src\HOI4World\Scorers\Scorers.h">
<Filter>src\HoI4World\Scorers</Filter>
</ClInclude>
<ClInclude Include="src\HOI4World\Scorers\ScorersFactory.h">
<Filter>src\HoI4World\Scorers</Filter>
</ClInclude>
<ClInclude Include="src\OutHoi4\Scorers\OutScorer.h">
<Filter>src\OutHoi4\Scorers</Filter>
</ClInclude>
<ClInclude Include="src\OutHoi4\Scorers\OutScorers.h">
<Filter>src\OutHoi4\Scorers</Filter>
</ClInclude>
</ItemGroup>
</Project>
Loading

0 comments on commit d28f4c8

Please sign in to comment.