.. _program_listing_file_src_misc_utilities.h: Program Listing for File utilities.h ==================================== |exhale_lsh| :ref:`Return to documentation for file ` (``src/misc/utilities.h``) .. |exhale_lsh| unicode:: U+021B0 .. UPWARDS ARROW WITH TIP LEFTWARDS .. code-block:: cpp #pragma once #include #include #include "misc/types.h" #include "primitives/pentagon.h" #include "ridge_impl/hill_mesh.h" #include "ridge_impl/mountain_mesh.h" #include "ridge_impl/plain_mesh.h" #include "ridge_impl/ridge_mesh.h" #include "ridge_impl/water_mesh.h" #include "tal/godot_core.h" #include "tal/reference.h" #include "tile_mesh.h" namespace sota { bool is_water_mesh(TileMesh* mesh); bool is_plain_mesh(TileMesh* mesh); bool is_hill_mesh(TileMesh* mesh); bool is_mountain_mesh(TileMesh* mesh); std::optional get_biome(TileMesh* mesh); template Ref create_mesh_impl(POLY polygon, PAR params) { if constexpr (std::is_same_v) { return make_ridge_hex_mesh(polygon, params); } else { return make_ridge_pentagon_mesh(polygon, params); } } template Ref create_ridge_mesh(Biome biome, POLY polygon, PAR params) { switch (biome) { case Biome::MOUNTAIN: return create_mesh_impl(polygon, params); case Biome::PLAIN: return create_mesh_impl(polygon, params); case Biome::HILL: return create_mesh_impl(polygon, params); case Biome::WATER: return create_mesh_impl(polygon, params); default: printerr("Unreachable biome"); } // Unreachable, prevent "control reached end of non-void funcion" warning return Ref(); } } // namespace sota