Commit graph

138 commits

Author SHA1 Message Date
Kp 70505e69d0 Use enum class for delta_light_index 2022-11-07 01:59:34 +00:00
Kp 6ca3a1ba99 Define operator<=> for dl_index 2022-10-09 23:15:21 +00:00
Kp 26ab08d55f Add stub definitions of enum vertnum_t,wallnum_t
Given this code:

```
enum class X : unsigned;
X a{1};
```

gdb has an unfortunate behavior of reporting "incomplete type" and
refusing to show the underlying value of `a`, even when `a` is in scope.
Adding `enum class X : unsigned {}` fixes this and allows gdb to show
the value.
2022-08-22 01:24:49 +00:00
Kp dc674eafe8 Replace various uses of std::enable_if with C++20 requires()
Compiler error messages are generally better when reporting a misuse
that fails a requires() versus reporting a misuse that fails a
std::enable_if.  In some cases, this also makes the code clearer, and
avoids the need for dummy template parameters as a place to invoke
std::enable_if.
2022-07-30 17:42:59 +00:00
Kp e25b476de7 Use enum for segnum_t
Add checked conversions for sites which load from external integers.
2022-07-02 18:10:45 +00:00
Kp 86a32dd0ff Change enum sidenum_t to enum class sidenum_t 2022-06-05 17:44:52 +00:00
Kp bbd49251cf Simplify susegment constructor overloads
Use a single constructor that accepts anything convertible to both of
the required types, rather than special constructors for:
- Accepting a qualified_segment
- Accepting a variant of susegment with compatible const qualifiers
- Accepting a type T that converts to qualified_segment

This reduces the number of constructors to consider, which improves
error messages when an invalid input is used.
2022-04-17 22:27:19 +00:00
Kp 68268e9a1f Use sidenum_t in more places 2022-02-19 14:52:17 +00:00
Kp 2fe9a16613 Use dedicated type for mask of segment side numbers 2022-02-19 14:52:17 +00:00
Kp 636e1b6d5e Use enumerated_array for unique_side::uvls 2022-01-15 20:39:10 +00:00
Kp 075495aa8b Use enumerated_array for d_level_unique_automap_state::Automap_visited 2022-01-15 20:39:10 +00:00
Kp a7c9a04c20 Use enumerated_array for shared_segment::children 2022-01-15 20:39:10 +00:00
Kp 4a6a4c4646 Use enumerated_array for unique_segment::sides 2022-01-15 20:39:10 +00:00
Kp 1c57e1032d Use enumerated_array for shared_segment::sides 2022-01-15 20:39:10 +00:00
Kp 78d4a36bb4 Explicitly require support for C++11 constructor inheritance
Parts of the code already used the C++11 syntax, so compilers without it
were already unsupported.  Expand the remaining uses to the standard
syntax.
2022-01-09 15:25:42 +00:00
Kp 6cdc181218 Use enum class for segment_relative_vertnum 2022-01-09 15:25:42 +00:00
Kp 078a9affa0 Make MAX_SIDES_PER_SEGMENT an iterable range
Iterating over it returns each side number in turn.  This allows
converting many loops of the form:

```
	for (int i = 0; i < MAX_SIDES_PER_SEGMENT; ++i)
```

to the compact form:

```
	for (const auto i : MAX_SIDES_PER_SEGMENT)
```

The compact form brings the usual benefit of range-based for: delegating
iteration to the compiler prevents the loop body from skipping a step,
and makes clear in the code that this is the case.
2022-01-09 15:25:42 +00:00
Kp 3004dd16e5 Convert some bare integers to sidenum_t 2022-01-09 15:25:42 +00:00
Kp 795b0e9111 Use enum class for station_number 2021-11-01 03:37:20 +00:00
Kp 3e02f99bcd Use enum class for materialization_center_number 2021-11-01 03:37:20 +00:00
Kp 3862edfb6c Use enum class for segment_special 2021-11-01 03:37:19 +00:00
Kp faa4d2ce34 Use enum class for vertnum_t 2020-12-26 21:17:29 +00:00
Kp 70d55c010d Move Num_vertices into if(DXX_USE_EDITOR)
Non-editor builds only need Num_vertices as a local during mine loading.
2020-12-26 21:17:29 +00:00
Kp 61f186bc18 Use enum class for texture1_value 2020-09-11 03:08:02 +00:00
Kp 6d3dce4e16 Use enum class for tmap_num2
Define separate enum values for rotation data in both the high bits,
where it is usually kept, and the low bits, where it is sometimes used
for math or comparisons.

Define an enum value to represent the composite of the index and the
rotation, since the composite is not suitable for use as an array
subscript.  Add helper functions to extract the component pieces.
2020-08-24 01:31:28 +00:00
Kp d738f6c21e Change enum side_type to enum class side_type 2020-07-16 02:31:04 +00:00
Kp a4f2edfaa9 Move LevelSharedVertexState into d_level_shared_segment_state 2020-05-17 23:35:25 +00:00
Kp 53761500f1 Qualify uses of std::array 2020-05-02 21:18:42 +00:00
Kp 3eedd9234e Add susegment to pair references to shared_segment/unique_segment
Various functions need to access both `shared_segment` and
`unique_segment` data.  Using `segment &` for this blocks eliminating
the `segment` type.  Add `susegment` and type aliases to it.
`susegment` records a reference to a `shared_segment` and a
`unique_segment` together, so that users cannot accidentally mismatch
`shared_segment` #1 with `unique_segment` #2 when passing references
down to a function which needs both `shared_segment` and
`unique_segment`.
2019-12-22 05:34:08 +00:00
Kp 4b0f797d7e Move Secret_return_orient to d_level_shared_segment_state 2019-08-06 02:59:41 +00:00
Kp ad16d90dd5 Move Secret_return_segment to d_level_shared_segment_state 2019-08-06 02:59:41 +00:00
Kp de77d2412b Move Automap_visited to d_level_unique_automap_state 2019-08-06 02:59:40 +00:00
Kp 340dc79bec Fix check_header_includes=1 build 2019-05-04 18:27:37 +00:00
Kp b3cd7588ef Move Delta_lights into d_level_shared_destructible_light_state 2018-12-30 00:43:58 +00:00
Kp 46644b4e91 Move Dl_indices into d_level_shared_destructible_light_state 2018-12-30 00:43:58 +00:00
Kp e7e4970ba5 Move Vertex_active out of global scope 2018-12-30 00:43:57 +00:00
Kp 1a5844e218 Move Vertices out of global scope 2018-12-30 00:43:57 +00:00
Kp 317c56d683 Expand Highest_vertex_index inline
This will make future conversions easier.
2018-12-30 00:43:57 +00:00
Kp 65225680c1 Move Num_vertices into d_level_shared_vertex_state 2018-12-30 00:43:57 +00:00
Kp d550cfe680 Remove struct side 2018-12-13 02:31:38 +00:00
Kp 706a704c6d Move unique_side to unique_segment 2018-12-13 02:31:38 +00:00
Kp 1d550ec0df Fix check_header_includes=1 build 2018-12-13 02:31:38 +00:00
Kp f7ad4d9b1a Pass segments to find_point_seg 2018-09-19 02:13:30 +00:00
Kp c2944896de Pass vertex factory to create_shortpos_native 2018-09-19 02:13:30 +00:00
Kp 01512015a8 Move Num_segments to new d_level_shared_segment_state 2018-09-19 02:13:29 +00:00
Kp 0c3e99f14c Split side uses based on shared vs unique 2018-06-24 05:06:15 +00:00
Kp 6d0d68d188 Split some segment uses based on shared vs unique
Leave `sides` in `shared_segment` to minimize churn.  Parts of it must
move to `unique_segment` before this project finishes.
2018-06-24 05:06:14 +00:00
Kp 93789f0666 Use valptridx for Dl_indices 2018-06-06 04:53:45 +00:00
Kp 90d2a61c1d Simplify visited_segment_mask_t 2018-04-09 00:58:28 +00:00
Kp 5eec2a5ce5 Use valptridx for Vertices 2017-08-11 23:43:54 +00:00