Commit Graph

467 Commits

Author SHA1 Message Date
Peter Nelson a617d009cc Codechange: Dereference with x-> instead of (*x). (#14700) 2025-10-05 15:47:33 +01:00
Peter Nelson ff674829f5 Codechange: Replace Rect CentreTo with CentreToHeight. (#14675)
So far all callers only need to centre vertically, so not having to provide the existing width simplifies calls.
2025-09-28 13:09:36 +00:00
Peter Nelson 6d3f39609f Codechange: Add WithX/WithY methods to Rect.
This simplifies creating a new Rect with specific horizontal or vertical coordinates.
2025-09-28 00:31:23 +01:00
Peter Nelson bfe5fb7339 Codechange: FlatSet's contains() should be const. (#14665)
This function does not modify contents, so should be marked const.
2025-09-27 18:10:39 +01:00
Peter Nelson 13ab9c1adc Fix 6e90b828c6: Off-by-one in Rect::CentreTo. (#14643)
* Rect right/bottom are inclusive so -1 must be taken from width/height.
* Misnamed variable, `new_right` is actually `new_top`.
2025-09-21 13:41:23 +01:00
Rubidium 7c0f69a8fe Codefix: typos in comments and strings 2025-08-31 10:30:37 +02:00
Peter Nelson 921d83c324 Codechange: Unify structures with sprite sub-tile bounds and simplify bounding boxes. (#14424)
Lots of different structs contain variations on sub-tile bounds with different naming. Unify into a single struct that can be inherited and passed directly to AddSortableSpriteToDraw.

At the same time, offsets now work more logically: sub-tile bounds now specify the bounding box, and an offset can be applied to the sprite.
2025-07-22 00:02:00 +01:00
Jonathan G Rennison cbdd358ae8 Codechange: Allow SmallStack Titem type to be non-structural 2025-07-20 16:06:03 +02:00
Peter Nelson 1ddc03b916 Codechange: Give FlatSet insert() a return value.
This now returns an iterator, and whether an insert was performed.

Allows the caller to know if the item was already in the FlatSet without explicitly checking first.
2025-06-26 08:33:34 +01:00
Jonathan G Rennison d3e4e07daa Codechange: Remove ReferenceThroughBaseContainer 2025-06-12 18:50:49 +01:00
Jonathan G Rennison d0e49a297f Codechange: Add TypedIndexContainer adapter type
This is equivalent in functionality to ReferenceThroughBaseContainer,
except only for the correct index type, instead of any type matching
ConvertibleThroughBase.
The also serves to unambiguously document the index type at the
point of definition of the container.
2025-06-12 18:50:49 +01:00
Peter Nelson 6e90b828c6 Codechange: Add CentreTo Rect method. 2025-05-25 09:13:05 +01:00
frosch c1389c77b2 Codechange: ParseInteger optionally clamps out-of-range values, instead of treating them as invalid. 2025-05-20 12:57:30 +02:00
Peter Nelson c8a336f760 Codechange: Move GetNthSetBit() to BaseBitSet.
This now returns the correct type, or std::nullopt instead of -1.
2025-05-14 07:22:12 +01:00
Peter Nelson 66c16a1d1f Codechange: Add Count() method to BaseBitSet. 2025-05-14 07:22:12 +01:00
glx22 1d18b4a80b Codechange: remove core/mem_func.hpp 2025-05-08 09:33:18 +02:00
Peter Nelson e0dbbbb032 Codechange: Add Reset() and missing &=/|= operators for BaseBitSet. 2025-05-07 17:31:29 +01:00
Rubidium d70aeb72a7 Codechange: C++ initialise LanguageHeaderPack 2025-05-06 20:03:35 +02:00
Peter Nelson 6070f8d4f3 Codechange: Add FlatSet implementation.
This is a flat set implemented using a sorted vector for storage.
2025-05-05 14:00:38 +01:00
Rubidium 4255a94779 Codechange: use std::span over char* for writing the buffers 2025-05-04 15:32:52 +02:00
Rubidium 6caa08098c Codechange: remove char* StringConsumer 2025-05-04 15:32:52 +02:00
frosch 7055ea0aee Codechange: Define sequential operators for ZoomLevel. 2025-05-03 23:21:09 +02:00
Rubidium 414f6a3067 Codechange: add support for parsing octal numbers 2025-05-03 15:57:53 +02:00
frosch fda93b6f35 Codechange: Add format_append as short-hand to format_to + back_inserter. 2025-04-29 20:26:23 +02:00
frosch 3973199879 Change: ParseInteger now checks for trailing junk chars. 2025-04-29 20:14:56 +02:00
Rubidium af25eecc15 Codechange: use const for std::string_view where appropriate 2025-04-29 10:15:18 +02:00
Rubidium 49ef3eee13 Codechange: replace char* with std::string_view 2025-04-27 20:08:02 +02:00
frosch c14e4a6db1 Codefix: Rect::Contains did not consider the bottom/right edges as inside. 2025-04-26 19:32:59 +02:00
frosch 2a62eea005 Codefix: Comment style. (#14064) 2025-04-21 17:25:09 +02:00
frosch 8aa2f6b8a6 Codefix: StringConsumer integer parsing failed for the most negative value, which has no positive equivalent. (#14048) 2025-04-20 22:20:53 +02:00
frosch 461b73e21b Codefix: stdafx.h and safeguards.h should be the first and last include in every source file, and not appear in any header file. 2025-04-20 22:06:18 +02:00
frosch 7cbf4f5560 Codechange: Expand the single usage of the macro CLRBITS. 2025-04-18 17:16:48 +02:00
Peter Nelson fa0814e257 Codefix: Codestyle consistency fixes. (#14008) 2025-04-15 20:57:13 +00:00
Peter Nelson 5008568dfc Codechange: Rename CenterBounds to CentreBounds and move to geometry header. (#14002) 2025-04-14 23:55:40 +01:00
frosch d2c9828b4c Codechange: Move IsUtf8Part to only file using it. 2025-04-14 18:56:23 +02:00
frosch dc21fae18e Codechange: Add InPlaceReplacement to couple StringConsumer and Builder on the same buffer. 2025-04-14 18:07:23 +02:00
frosch 800d6e339d Codechange: Add StringConsumer. 2025-04-13 21:59:10 +02:00
frosch ad8e9634ec Codechange: Generalize StringBuilder. 2025-04-08 23:10:58 +02:00
frosch b19e43ae99 Add: Utf8View and iterator. 2025-04-03 18:43:41 +02:00
Peter Nelson 79ef4e98fe Codechange: Use std::swap() instead of Swap() (#13883) 2025-03-24 23:47:34 +00:00
Rubidium a908c7bed0 Codechange: remove uses of MemCmpT (and MemMoveT) 2025-03-18 21:18:37 +01:00
Rubidium b4e5b12047 Codechange: remove unneeded locking from SmallStack 2025-03-16 14:13:51 +01:00
Peter Nelson 62b8b93476 Codechange: Add default initialisation for Rect to remove MemSetT. 2025-03-15 20:09:38 +00:00
Peter Nelson 91d22f7617 Codechange: Use EnumBitSet for VehStates. (#13755)
Renamed from VehStatus because pluralising that is weird.
2025-03-08 18:24:21 +00:00
Rubidium c9624cef7c Codechange: remove MallocT, CallocT and ReallocT 2025-03-04 00:10:01 +01:00
Rubidium 09716dba75 Codechange: do not use MallocT for the pool
Needed to make the placement new operator use Tindex over size_t because of
ambiguity for the delete operator variant that also has the size.
2025-02-28 20:15:42 +01:00
Rubidium 426b03b31a Codechange: do not zero pool item upon allocation any more 2025-02-28 20:15:42 +01:00
Rubidium 15dcf56dad Codechange: remove ZeroedMemoryAllocator 2025-02-28 20:12:44 +01:00
Rubidium 5cee804f98 Codechange: remove ZeroedMemoryAllocator from NWidgetBase 2025-02-22 14:38:33 +01:00
Jonathan G Rennison 8566030c53 Cleanup: Adjustments to comments to match code changes (#13636) 2025-02-22 13:28:35 +00:00