Skip to content

Commit 1df27a3

Browse files
committed
planer: dont check unique building when planer not active
1 parent 474bbf6 commit 1df27a3

File tree

2 files changed

+18
-18
lines changed

2 files changed

+18
-18
lines changed

src/building/construction/build_planner.cpp

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -983,6 +983,10 @@ void build_planner::update_special_case_orientations_check() {
983983
}
984984

985985
void build_planner::update_unique_only_one_check() {
986+
if (!build_type) {
987+
return;
988+
}
989+
986990
bool unique_already_placed = false;
987991

988992
const auto &params = building_impl::params(build_type);
@@ -1000,12 +1004,9 @@ void build_planner::update_unique_only_one_check() {
10001004
case BUILDING_TEMPLE_COMPLEX_BAST:
10011005
// case BUILDING_TEMPLE_COMPLEX_ALTAR:
10021006
// case BUILDING_TEMPLE_COMPLEX_ORACLE:
1003-
if (city_buildings_has_temple_complex() && !config_get(CONFIG_GP_CH_MULTIPLE_TEMPLE_COMPLEXES))
1007+
if (g_city.buildings.has_temple_complex() && !config_get(CONFIG_GP_CH_MULTIPLE_TEMPLE_COMPLEXES))
10041008
unique_already_placed = true;
10051009
break;
1006-
1007-
default:
1008-
; // nothing
10091010
}
10101011

10111012
if (unique_already_placed) {
@@ -1292,14 +1293,6 @@ void build_planner::construction_finalize() { // confirm final placement
12921293
// update city building info with newly created
12931294
// building for special/unique constructions
12941295
switch (build_type) {
1295-
case BUILDING_TEMPLE_COMPLEX_OSIRIS:
1296-
case BUILDING_TEMPLE_COMPLEX_RA:
1297-
case BUILDING_TEMPLE_COMPLEX_PTAH:
1298-
case BUILDING_TEMPLE_COMPLEX_SETH:
1299-
case BUILDING_TEMPLE_COMPLEX_BAST:
1300-
city_buildings_add_temple_complex(last_created_building);
1301-
break;
1302-
13031296
case BUILDING_FERRY:
13041297
should_recalc_ferry_routes = true;
13051298
break;
@@ -1342,6 +1335,7 @@ void build_planner::construction_finalize() { // confirm final placement
13421335
map_tiles_update_region_empty_land(false, start.shifted(-2, -2), end.shifted(size.x + 2, size.y + 2));
13431336
map_routing_update_land();
13441337
map_routing_update_walls();
1338+
building_menu_update_temple_complexes();
13451339

13461340
if (should_recalc_ferry_routes) {
13471341
map_routing_update_ferry_routes();

src/core/custom_span.hpp

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,17 @@ class custom_span {
4040
}
4141

4242
template <std::size_t N>
43-
constexpr custom_span(element_type (&arr)[N]) noexcept
43+
constexpr custom_span(element_type (arr)[N]) noexcept
4444
: m_storage(arr),
4545
m_size(N) {
4646
}
4747

48+
template <std::size_t N>
49+
constexpr custom_span(const element_type (&arr)[N]) noexcept
50+
: m_storage((element_type*)arr),
51+
m_size(N) {
52+
}
53+
4854
template <typename U, std::size_t N>
4955
constexpr custom_span(std::array<U, N>& arr) noexcept
5056
: m_storage(arr.begin()),
@@ -83,27 +89,27 @@ template<typename T>
8389
using span_const = const custom_span<T>;
8490

8591
template <typename T, std::size_t N>
86-
inline constexpr auto make_span(T (&arr)[N]) {
92+
inline constexpr custom_span<T> make_span(T (&arr)[N]) {
8793
return custom_span<T>(arr);
8894
}
8995

9096
template <typename T, std::size_t N>
91-
inline constexpr auto make_span(const T (&arr)[N]) {
97+
inline constexpr span_const<T> make_span(const T (&arr)[N]) {
9298
return span_const<T>(arr);
9399
}
94100

95101
template <typename T>
96-
inline constexpr auto make_span(T* arr, size_t N) {
102+
inline constexpr custom_span<T> make_span(T* arr, size_t N) {
97103
return custom_span<T>(arr, N);
98104
}
99105

100106
template <typename T>
101-
inline constexpr auto make_span(T &arr) {
107+
inline constexpr custom_span<T> make_span(T &arr) {
102108
return custom_span<T>(arr.data(), arr.size());
103109
}
104110

105111
template <typename T, std::size_t N>
106-
inline constexpr auto make_span(const std::array<T, N> arr) {
112+
inline constexpr span_const<T> make_span(const std::array<T, N> arr) {
107113
return span_const<T>((T*)arr.data(), arr.size());
108114
}
109115

0 commit comments

Comments
 (0)