Commit d2478d0708 made support for C++17 fallthrough mandatory, and
should have deleted this test. Delete it now.
Fixes: d2478d0708 ("Require support for C++17 attribute [[fallthrough]]")
Win32 aliases `size_t` to `unsigned int`, causing
`static_cast<size_t>(V)` to be a useless cast when `V` has type
`unsigned int`. Switch to using direct initialization, which is not a
cast and so does not trigger a warning, but does produce the correct
type. This form disallows narrowing, so inputs that might change in
value as a result of the conversion are an error. Since this is a
sanity checking macro, that is a useful safety measure.
Reported-by: AlumiuN <https://github.com/dxx-rebirth/dxx-rebirth/issues/678#issue-1437577368>
bmread.cpp uses PRIuFAST32, so it should include inttypes.h to get the
definition of this macro. Some platforms happened to include inttypes.h
as an implementation detail, but for portability, it needs to be
included explicitly in this file.
Reported-by: AlumiuN <https://github.com/dxx-rebirth/dxx-rebirth/issues/678#issuecomment-1304962448>
This never worked, but was committed to git in the hope it would be
useful for someone who wanted to finish it. In the 5.5 years since
then, the closest to that has been one user who requested Visual Studio
2019 support[1], but went silent after reporting that unspecified errors
occurred. The error messages were never shared.
Remove these project files, since they are not useful, and have caused
at least one report where the reporter incorrectly attached the stub
Visual Studio 2017 dxxsconf.h, instead of attaching the dxxsconf.h
generated by the build for which the reporter wanted assistance.
[1]: https://github.com/dxx-rebirth/dxx-rebirth/issues/607
The documentation for `strcpy` states in part:
```
The strings may not overlap
```
However, for this use, the strings do overlap. Switch to `std::move`,
which is documented to handle this so long as the destination iterator
is outside the source range, which it will be for this use.
Previously, the `strcpy` would preserve the `:`, but overwrite the ` `.
This is probably not what the player wants, since the first `": "` in
the line can direct a message to specific recipients, but a bare `":"`
will not. As a result, the old system would send the first part
privately, but then mangle the directed-message prefix such that
subsequent parts were sent publicly. Switch to preserve the trailing
space so that the `": "` retains its special meaning in subsequent
messages.
`object_create_explosion` delegated to
`object_create_explosion_without_damage`, adding one parameter that
callers ought to provide instead. Inline `object_create_explosion` into
callers and change them to provide `Vclip`.
Commit 0512ea8d65 changed the value of the tracker_ upid codes when
they were converted from `#define` statements with explicit values to
`enum` members with implicit values. The tracker program is maintained
separately, and continues to use the old values, so games with this
commit use the wrong numbers when requesting service from the tracker.
Switch the upid codes back to their previous values, and add a warning
comment about the special compatibility concerns for tracker upid
codes, relative to game-to-game codes.
Fixes: 0512ea8d65 ("Use enum class for upid")
Apple clang is currently version 14, but Apple's libc++ is version 13,
and so lacks even more std::ranges support than previously reported.
Add more stub backports to work around this.
The cockpit graphic is not scaled in the SDL build, so it is only
meaningful to show when the game window dimensions match the graphic's
dimensions. Prior to 4a8d7c7574, this worked, because the
`initial_large_game_screen_mode` was the same as the graphic's
dimensions. That commit changed `initial_large_game_screen_mode` to
prefer a larger screen resolution for new users. It should have
retained the original dimensions for this test. Make that change here.
Fixes: 4a8d7c7574 ("Default to 1024x768 for new users, not 640x480")
The Rebirth main screen grd_curscreen borrows the memory allocated by
SDL_CreateRGBSurface to store its data. Store the pointer to that
surface inside grd_curscreen and make grd_curscreen responsible for
freeing the surface.
Per the header comments, passing nullptr for source or destination
copies the entire region. Use that instead of explicitly requesting the
entire region. This should be more efficient, since it bypasses the
source rectangle clipping code that SDL would otherwise run.
OS X still uses clang-14, which lacks sufficient std::ranges support for
recent Rebirth changes.
- Rewrite uses of std::ranges::SYMBOL to ranges::SYMBOL
- Add a stub header that, on gcc, provides for each SYMBOL a statement
`using std::ranges::SYMBOL;`, to delegate back to the standard library
implementation.
- On clang, define a minimal implementation of the required symbols,
without constraint enforcement. Compile-testing with gcc will catch
constraint violations.
Once OS X clang ships a standard library with the required features,
this stub header will be removed and the uses changed back to their full
names.
gcc reports:
```
ISO C++ says that these are ambiguous, even though the worst conversion for the first is better than the worst conversion for the second
```
Fix the ambiguity by using an unsigned integer constant.
Change from rewriting the object in place to byte-swap it, then copying
the byte-swapped values into the long term object to instead copy the
values into the object and perform byte-swapping as needed during the
copy.