This check looks for unused return values on a variety of C library
functions.
I resolved most of the warnings by printing out some kind of error
message in the event that the function failed.
Many of them are low-level things whose failure indicates some sort of
serious problem, so the errors are simply printed to stderr, because our
usual error reporting infrastructure might not be available.
* Encapsulate map::drawsq() arguments and clarify their meaning
* Split map memory into submap-sized chunks
Note: this naive implementation significantly lowers FPS
* Optimize map memory access
Move memorized submaps that would be
affected during drawing into a 2d array.
* Save/load memorized submaps; migrate old mm file
* Remove leftovers from map memory limit
* Some map memory cleanup
* Don't save empty mm submaps
* Deallocate far-away mm submaps on save; report save failure
* Rework tests for map memory
* Don't re-allocate region if old region contains required submaps
* Remove map_memory.h from avatar.h
* Rename memorized_submap -> mm_submap
* Rename mm_submap::clean -> mm_submap::empty, add comments.
* Improve drawsq_params interface
* Remove map_memory.h from lru_cache.cpp
* Add function for rectangle overlapping
* Save mm_submaps in regions
* Fix save/load not using avatar's global pos, improve docs.
* When saving, compress mm_submaps using RLE
* Simplify map rendering in ascii mode
Collect map::draw code in one place, simplify indexing/bound checks.
Remove the "batch drawing" optimization: it doesn't help with drawing, but harms code clarity. Instead, convert all relevant draw methods to use 'wputch' and rely on caller to position the cursor properly.
* Memorize off-screen tiles in ascii mode
* Fix copypasted code
* Fix tile memory saving code, minor cleanup.
* Add debug logging for tile memory operations
* Fix broken saving for tile memory submaps with z != 0
* Lazy allocation for tile memory submaps
Co-authored-by: olanti-p <olanti-p@yandex.ru>
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.
When investigating a savegame corruption issue, it transpired that digit
separators were being inserted into the integer coordinates of point and
tripoint objects when converted to string. This caused non-UTF-8
characters to appear in a log message, which corrupted the savegame.
Luckily, it only affected saves where the player had travelled more than
1000 submaps from the origin, so it hasn't been a huge issue.
Fix this and add tests to point_test.cpp.
* 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++
To make rectangle and cuboid work more smoothly with the new point
types, make their point type a template argument, and update uses
accordingly.
The new flexibility for these types is used in overmap and overmap_ui.
Turns out box is the name of an ncurses function, so we can't have a
class template with the same name. Before I can change cox to a class
template, need to either rename it or put it in a namespace.
Chose to go with renaming it to cuboid.
Previously we had separate functions closest_points_first and
closest_tripoints_first. We'd like to extend this functionality to
coord_point, but it's easier to do if both the raw underlying functions
have the same name (so the generic wrapper can be the same).
To that end, rename closest_tripoints_first to closest_points_first
(they are chosen between based on overload resolution), and add a
wrapper to allow coord_point to be used similarly.
Previously rectangle and box were just a min and max. Determining
whether the upper bound should be considered to be inclusive was done by
which function was called on it.
I now regret that design choice, and am changing it. Now the inclusive
vs half-open is part of the rectangle or box type, and the functions are
generic.
This leads to less repetition in the code.
Also, the next step is to make it possible to iterate over rectangles
(to simplify a bunch of our nested for loops), and this design fits much
better for that.
* 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>
* Add simple unit tests for `closest_points` functions
* Minor simplification and optimization of `closest_points` functions
* Allow specifying minimal distance in `closest_points` functions
* Use `closest_points` functions for overmap buffer search
* Initial version of UseNamedPointConstantsCheck
This is intended to convert hand-rolled point constants like
point( 0, 0 ) into point_zero.
* Apply refactoring pass
* Manual fixup of refactored code
Add various manual tweaks to the automatically refactored code where I
think it makes sense.
* Remove some unnecessary initializations
Rather than having a free function for generic_inbounds, have two member
functions on each of rectangle and box to test bounds.
Rather than having an optional 'clearance' parameter, have two names for
the two common bounds types (inclusive and half-open ranges).
Refactor all uses to this new API.
The main goal here is to make it easier to use these bounds tests in
fewer lines of code for common cases. I also think the member function
form reads more smoothly in code.