Our string_id constants were a mixture of temporaries, locals, and
globals. Pull them all out as globals, for consistency and efficiency.
The efficiency comes from the fact that each string_id instance caches
its respective int_id, and sharing one instance means that value need
not be recomputed.
Catch2 provides a customization point for converting our types to
strings by specializing the StringMaker template.
We have some specializations in stringmaker.h, but this feature was only
working intermittently. I finally figured out that was due to an ODR
violation. The test files that didn't include stringmaker.h were
compiling a different specialization than the ones that did.
Re-jig the test includes so that any file including catch.hpp also
includes stringmaker.h, thereby ensuring that the custom
specializations are used everywhere and there is no ODR violation.
I achieved this by adding a new cata_catch.h header and making all
existing headers include catch.hpp via the new header.
* Change _ctype.h and __locale to cctype and clocale
* Change _wctype.h to cwctype in game.cpp
* Change __functional_base to functional
* Remove libcxx internal headers
* Remove UNIX system headers
* Fix clang-tidy error with -nostdinc++
event_field_transformation functions shouldn't need to be written
defensively against invalid inputs. So, pre-check the arguments and
don't call the function if an argument is invalid and non-empty.
We're already relying on them supporting empty arguments, so we can't
filter those out. Maybe in the future those empty arguments should be
replaced by null instead.
* why brew why
* Add a number of event_subscriber tests
Helped to characterize a bizarre polymorphic dispatch bug that only seems to occur with XCode 10.1
* Set XCode version to 10.2
This version is not subject to the event_subscriber dispatch issue.
itype_id is (presumably) one of the oldest type ids in the game. In
particular, it predates string_id, and was simply a typedef of
std::string.
This is bad for type safety.
Make it be a string_id specialization instead, and update the rest of
the code accordingly.
* Helper script to run IWYU
* Run IWYU
* Update deprecated headers
* Run IWYU again
* Re-suppress cxxabi.h
This pragma got accidentally removed because it was deemed to be a
comment attached to a #include.
* Remove extra SDL header includes
* Fix ime.cpp headers
Some tweaks to help IWYU not break this file by messing with
platform-specific stuff not relevant on Linux.
* Update game.h
* Move new point.h includes inside #ifdef
* Re-add platform_win.h to mapsharing.cpp
* Apply suggestions from code review
Co-authored-by: ZhilkinSerg <ZhilkinSerg@users.noreply.github.com>
Create a new memorial_logger class responsible for the memorial file
(previously this responsibility lay with player).
Have this new class be a member of game, and subscribe to the event bus.
Nearly all memorial messages are now triggered by events, rather than
written directly in the places where the game logic is implemented.
This is intended to:
- Improve separation of concerns.
- Provide a much more thorough test of the event bus.
Some other changes that come along with this:
- Many more cata_variant types.
- Many many more event types.
- Added Character::get_bionics.
A handful of memorial messages are still sent directly to the
memorial_logger, rather than through the event bus. These are the ones
that seem less significant, and I didn't think they were worth creating
an event for.
Make two kill events: one for Character victims and one for monster
victims.
Update their content to contain what's needed for the kill information
the game currently tracks.
Stop including the event name in the event_spec; plan to put that
elsewhere later.
This is intended to support loosely coupled interactions, in particular
for a scores / achievements system.
For now it's just a proof of concept with a single event type.
I'm using a generic event type with variants rather than explicit event
classes to simplify serialization, versioning, and generic queries. For
example, I want to be able to define achievements in json based on
string field lookups. This approach should make it straightforward to
define an achievement like "killed 100 skeletal juggernauts" without
hardcoding anything specific to that achievement.