Cultures stop being static one-per-continent blocs. Culture identities are now stateful: the list is append-only (seeded once at the dawn, schism children appended later, records frozen after creation) and the per-settlement culture is mutable state. - stepCulture(year) in the yearly tick (pure hashes, no RNG): assimilation (a conquered settlement adopts its ruler's culture, which drops the Step-5 revolt cultBonus -> assimilation pacifies provinces), border conversion (population x trade-prestige pressure; realm capitals exempt), schism (a far-flung coherent cluster -- typically overseas colonies -- breaks away as a new people with a local-bank NameGen name and ethos/faith re-derived from its own lands). - computeCultures() became a pure derived refresh (seeds only when the list is empty); seedCultures() reproduces the old per-continent peoples byte-identically for the dawn and pre-v23 loads. - Colonies inherit the founder's culture at founding; the Step-3 mono-cultural vassalage rule is culture-matched (regionId fallback) so schism clusters found their own realms -> colonial independence wars. - Per-cell culture view colours by the owning settlement's culture, so a conquered city keeps its colour until it assimilates. - Save v23: culture identities + sSettleCulture + next-id counter, also in the step-back frames; snapshots rewind via truncate-and-replay. Pre-v23 saves re-seed on the next refresh. - Kind-7 world events; Cultures tab hides extinct peoples and shows a schism child's founding year. Knobs cult* in planet.cfg. - New test_cultevo.cpp (30 checks); all 15 existing suites still pass. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
94 lines
2.8 KiB
CMake
94 lines
2.8 KiB
CMake
cmake_minimum_required(VERSION 3.16)
|
|
project(PlanetSim CXX)
|
|
|
|
set(CMAKE_CXX_STANDARD 17)
|
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
|
|
include(FetchContent)
|
|
FetchContent_Declare(
|
|
raylib
|
|
GIT_REPOSITORY https://github.com/raysan5/raylib.git
|
|
GIT_TAG 5.5
|
|
)
|
|
# Build raylib as a static lib, no examples.
|
|
set(BUILD_EXAMPLES OFF CACHE BOOL "" FORCE)
|
|
set(BUILD_GAMES OFF CACHE BOOL "" FORCE)
|
|
FetchContent_MakeAvailable(raylib)
|
|
|
|
set(SIM_SOURCES
|
|
src/sim/IcoSphere.cpp
|
|
src/sim/Planet.cpp
|
|
src/sim/PlanetTectonics.cpp
|
|
src/sim/PlanetDrift.cpp
|
|
src/sim/PlanetErosion.cpp
|
|
src/sim/PlanetHydrology.cpp
|
|
src/sim/PlanetBiomes.cpp
|
|
src/sim/PlanetClimate.cpp
|
|
src/sim/PlanetLive.cpp
|
|
src/sim/PlanetOcean.cpp
|
|
src/sim/PlanetWeather.cpp
|
|
src/sim/PlanetVolcano.cpp
|
|
src/sim/PlanetBiota.cpp
|
|
src/sim/PlanetFloraGen.cpp
|
|
src/sim/PlanetFaunaGen.cpp
|
|
src/sim/PlanetFungiGen.cpp
|
|
src/sim/NameGen.cpp
|
|
src/sim/PlanetGeography.cpp
|
|
src/sim/PlanetEcoregions.cpp
|
|
src/sim/PlanetCiv.cpp
|
|
src/sim/PlanetNation.cpp
|
|
src/sim/PlanetCulture.cpp
|
|
src/sim/PlanetConflict.cpp
|
|
src/sim/PlanetTrade.cpp
|
|
src/sim/PlanetIO.cpp
|
|
)
|
|
|
|
set(RENDER_SOURCES
|
|
src/render/Colors.cpp
|
|
src/render/Map2D.cpp
|
|
src/render/Overlays.cpp
|
|
src/render/Picking.cpp
|
|
src/render/Panels.cpp
|
|
src/render/Viewer.cpp
|
|
src/render/ViewerInput.cpp
|
|
src/render/ViewerRender.cpp
|
|
)
|
|
|
|
add_library(planetsim_sim STATIC ${SIM_SOURCES})
|
|
target_include_directories(planetsim_sim PUBLIC src/sim)
|
|
|
|
add_executable(planetsim
|
|
src/main.cpp
|
|
${RENDER_SOURCES}
|
|
)
|
|
# Flat includes ("Planet.hpp", "Viewer.hpp", ...) resolve across both folders.
|
|
target_include_directories(planetsim PRIVATE src/sim src/render)
|
|
target_link_libraries(planetsim PRIVATE planetsim_sim raylib)
|
|
|
|
# OpenMP parallelizes the per-cell passes in Planet::step(). Optional: without
|
|
# it the #pragma omp lines are ignored and the sim runs (correctly) serial.
|
|
find_package(OpenMP)
|
|
if(OpenMP_CXX_FOUND)
|
|
target_link_libraries(planetsim_sim PUBLIC OpenMP::OpenMP_CXX)
|
|
endif()
|
|
|
|
# Linux system libs raylib needs at link time.
|
|
if(UNIX AND NOT APPLE)
|
|
target_link_libraries(planetsim PRIVATE m pthread dl)
|
|
endif()
|
|
|
|
enable_testing()
|
|
foreach(test_name logic biota ocean live weather volcano geography ecoregions civ nation culture conflict diplomacy trade colony cultevo)
|
|
add_executable(test_${test_name} test_${test_name}.cpp)
|
|
target_link_libraries(test_${test_name} PRIVATE planetsim_sim)
|
|
add_test(NAME ${test_name} COMMAND test_${test_name})
|
|
endforeach()
|
|
|
|
add_executable(test_events test_events.cpp ${RENDER_SOURCES})
|
|
target_include_directories(test_events PRIVATE src/sim src/render)
|
|
target_link_libraries(test_events PRIVATE planetsim_sim raylib)
|
|
if(UNIX AND NOT APPLE)
|
|
target_link_libraries(test_events PRIVATE m pthread dl)
|
|
endif()
|
|
add_test(NAME events COMMAND test_events)
|