Commit Graph
100 Commits
Author SHA1 Message Date
froschandPeter Nelson 4339bf3dc7 Codechange: Use attribute syntax for debug_inline, so clang-format understands it. 2025-12-07 13:10:40 +00:00
froschandrubidium42 66b775016a Fix: Original graphics' tycoon-of-the-century sprite assumes a black background. 2025-08-08 18:15:24 +02:00
froschandfrosch 2926179d02 Fix: Restore the behaviour when entering numbers in query windows: clamp integers out of range to the maximum valid value. 2025-05-20 12:57:30 +02:00
froschandfrosch c1389c77b2 Codechange: ParseInteger optionally clamps out-of-range values, instead of treating them as invalid. 2025-05-20 12:57:30 +02:00
froschandGitHub a62081d79e Fix #14251: Out-of-bounds writes via TextRefStack. (#14255) 2025-05-12 13:59:33 +02:00
froschandGitHub c037722cb5 Fix 51a7edd: NewGRF debug sprite picker was broken. (#14246) 2025-05-10 20:27:43 +02:00
froschandGitHub 228f9ca941 Fix #13854: 40bpp-anim blitter recolouring failed for 32bpp pixels without mask channel. (#14242) 2025-05-09 17:16:29 +02:00
froschandfrosch a277cb2b4c Change: [NewGRF] Increase the textstack for all callbacks to 16 registers. 2025-05-09 12:39:11 +02:00
froschandfrosch c6fa5022cb Add: [NewGRF] All callbacks returning D0xx strings, have now the option to return any string id via register 0x100. 2025-05-09 12:39:11 +02:00
froschandfrosch 84bc78fd8f Add: [NewGRF] Special value 0x7FFE for VarAction2 results specifying 'return calculated result'. 2025-05-09 12:38:58 +02:00
froschandfrosch 9d32087236 Add: [NewGRF] Special value 0x7FFF for Action2 references specifying explicit 'callback/sprite-resolving failed'. 2025-05-09 12:38:58 +02:00
froschandfrosch d00196cd65 Change: Rearrange buttons in the intro screen, remove unnecessary ones. 2025-05-07 18:41:48 +02:00
froschandfrosch 4111ce2698 Add: WWT_IMGTEXTBTN, WWT_PUSHIMGTEXTBTN 2025-05-07 18:41:48 +02:00
froschandfrosch 22fedca77e Codechange: Integrate ResolverObject::ResetState() into DoResolve(), no need to call it manually. 2025-05-06 22:24:41 +02:00
froschandfrosch f8c928ed98 Codechange: Make temporary storage a member of ResolverObject. 2025-05-06 22:24:41 +02:00
froschandfrosch eb9bbb2456 Codechange: Remove direct access to temporary storage from TextRefStack. 2025-05-06 22:24:41 +02:00
froschandfrosch 6faa667644 Codechange: Remove global GetRegister(), instead return 100+ registers directly from GetXxxCallback(). 2025-05-06 22:24:41 +02:00
froschandfrosch f59cf73b88 Codechange: Access temporary storage through ResolverObject during sprite layout preprocessing. 2025-05-06 22:24:41 +02:00
froschandfrosch 85be7a4d92 Codechange: Access temporary storage through ResolverObject during Resolve. 2025-05-06 22:24:41 +02:00
froschandfrosch 99d7a775ad Codechange: Make GetRegister return a signed integer, matching the underlying TemporaryStorageArray. 2025-05-06 22:24:41 +02:00
froschandfrosch 74030a63e6 Codechange: Move SpriteLayoutProcessor's operations closer to the ResolverObject. 2025-05-06 22:24:41 +02:00
froschandGitHub cd7ac64f9d Codefix: Fix compilation with DEBUG_DUMP_COMMANDS. (#14228) 2025-05-06 21:11:30 +02:00
froschandfrosch 592cc49b62 Codechange: Turn _grow_town_result into a local variable in GrowTownAtRoad. 2025-05-06 20:58:17 +02:00
froschandfrosch 5af877d12d Codechange: Do not assign _grow_town_result in GrowTownInTile, instead return the new value. 2025-05-06 20:58:17 +02:00
froschandfrosch 22af391064 Codechange: Move _grow_town_result out of GrowTownWithExtraHouse, GrowTownWithRoad, GrowTownWithBridge and GrowTownWithTunnel. 2025-05-06 20:58:17 +02:00
froschandfrosch 8bbfbd0347 Codechange: Move spritelayout preprocessing to a separate class, which owns the heap allocations involved. 2025-05-06 18:30:42 +02:00
froschandfrosch d9c43e7fda Codechange: Make TileLayoutSpriteGroup::ProcessRegisters return a DrawTileSpriteSpan on the stack, instead of a reference to a global. 2025-05-06 18:30:42 +02:00
froschandfrosch 51a7edd941 Codechange: Remove _input_events_this_tick. 2025-05-06 18:29:41 +02:00
froschandfrosch 42f9312f71 Codechange: Make station variable cache a member of StationScopeResolver. 2025-05-06 18:29:41 +02:00
froschandfrosch b20b6da937 Codechange: The compiler ensures static variables are initialised only once, no need to track that manually. 2025-05-06 18:29:41 +02:00
froschandfrosch 75a775e59d Codechange: Make GetCurrentLocale return a std::string instead of a reference to a static buffer.
For win32 this is even a fix, because the static buffer was only updated once. Later calls discarded the determined locale.
2025-05-06 18:29:41 +02:00
froschandfrosch 0d5b3ebd7f Codechange: Declare all IntervalTimers const, which can be const. 2025-05-06 18:29:41 +02:00
froschandfrosch 61cec33be2 Codechange: Add 'const' to static variables, which are only initialised once. 2025-05-06 18:29:41 +02:00
froschandfrosch 1900125c98 Codechange: Use string_view for FileExists. 2025-05-06 18:29:41 +02:00
froschandGitHub 13349254ea Fix #14216, d030d17: RealSpriteGroups referencing CallbackResultSpriteGroups were always treated as callback-failure. (#14218) 2025-05-05 16:13:41 +02:00
froschandfrosch 8571af9833 Codechange: Turn ZoomLevel into enum class. 2025-05-03 23:21:09 +02:00
froschandfrosch c0d4ab69d0 Codechange: Add a container to index data by zoom level. 2025-05-03 23:21:09 +02:00
froschandfrosch 7055ea0aee Codechange: Define sequential operators for ZoomLevel. 2025-05-03 23:21:09 +02:00
froschandfrosch bbfda39ac3 Codechange: Add ZoomLevels bit set. 2025-05-03 23:21:09 +02:00
froschandfrosch 48d09af039 Codechange: Simplify weird range check. 2025-05-03 23:21:09 +02:00
froschandfrosch 518a34c286 Codechange: Use std::byte for generic buffers. 2025-05-03 18:43:20 +02:00
froschandfrosch 02082a0211 Codechange: Deduplicate array lookup. 2025-05-03 18:43:20 +02:00
froschandfrosch bb767608de Codechange: Pass SpriteType as direct parameter to SpriteEncoder::Encoder. 2025-05-03 18:43:20 +02:00
froschandGitHub c3aa3f140c Codechange: Use more std::string_view. (#14197) 2025-05-03 18:40:37 +02:00
froschandGitHub 74a275f37b Add: [NewGRF] Add purchase list Action3 CID for houses, industries, industry tiles, airports and airport tiles. (#14121) 2025-05-03 17:50:20 +02:00
froschandGitHub 9ac9798d7f Codechange: Remove usages of stoi and stol. (#14196) 2025-05-03 17:46:30 +02:00
froschandGitHub a80c11a6e8 Fix 66733e2a: Textbuf was broken, and did not insert any input. (#14173) 2025-04-30 19:31:52 +00:00
froschandfrosch 316279f4b4 Codechange: Use more std::string_view. 2025-04-30 19:33:56 +02:00
froschandfrosch 9cf36dac39 Codechange: Use data() instead of c_str(), if no NUL termination is needed. 2025-04-30 19:33:56 +02:00
froschandfrosch 9e90d4ed79 Codefix: Do not assign nullptr to std::string_view. 2025-04-30 19:33:56 +02:00
froschandfrosch 36ce1f890a Codechange: Remove c_str, if std::string_view is already accepted. 2025-04-30 19:33:56 +02:00
froschandfrosch b564fbb5e6 Codechange: Use StringConsumer to parse hotkeys. 2025-04-30 19:33:56 +02:00
froschandfrosch 66733e2a50 Codechange: Use std::string_view in IME input handling. 2025-04-30 19:33:56 +02:00
froschandfrosch 6db13df3b5 Add: [BaseSet] Allow basesets to set minor and patch versions in obg/obs/obm files. 2025-04-30 15:23:27 +02:00
froschandfrosch d30fee4a99 Codechange: Improve debug/error messages when reading baseset metadata. 2025-04-30 15:23:27 +02:00
froschandfrosch d030d17bd6 Codechange: Do not use a mutable global to return calculated VarAction2 results. 2025-04-29 20:35:46 +02:00
froschandfrosch e90b68d504 Codechange: Pass SpriteGroup as reference to ResolveReal. 2025-04-29 20:35:46 +02:00
froschandfrosch 7c946d97da Codefix: Build with OPTION_DEDICATED=OFF and CMAKE_DISABLE_PRECOMPILE_HEADERS=ON. 2025-04-29 20:26:23 +02:00
froschandfrosch afe3dfb3a4 Codechange: Use format instead of to_string. 2025-04-29 20:26:23 +02:00
froschandfrosch fda93b6f35 Codechange: Add format_append as short-hand to format_to + back_inserter. 2025-04-29 20:26:23 +02:00
froschandfrosch 98481ecc01 Codechange: Replace strtol, strtoll, stroul and strtoull with ParseInteger. 2025-04-29 20:14:56 +02:00
froschandfrosch cdafc50c94 Codechange: Replace atoi and atoll with ParseInteger. 2025-04-29 20:14:56 +02:00
froschandfrosch 3973199879 Change: ParseInteger now checks for trailing junk chars. 2025-04-29 20:14:56 +02:00
froschandfrosch 79b2202f2e Codechange: Use StringConsumer for parsing more strings. 2025-04-29 20:14:56 +02:00
froschandfrosch e7d758c82a Codechange: Replace sscanf with StringConsumer. 2025-04-29 20:14:56 +02:00
froschandfrosch 8027e31f47 Codechange: Remove virtual functions SpriteGroup::GetResult and GetNumResults. They are only implemented in and called via ResultSpriteGroup. 2025-04-29 10:35:10 +02:00
froschandfrosch 010b944173 Codechange: Move SpriteGroup cast from callers into Resolve. 2025-04-29 10:35:10 +02:00
froschandfrosch 47b5ca6115 Fix: [NewGRF] Computed VarAction2 callback results were not always properly masked to 15 bit results. 2025-04-28 23:25:31 +02:00
froschandfrosch d90f6f01cc Codechange: CALLBACK_FAILED is an internal constant, do not use it as numeric value in VA2 computations. 2025-04-28 23:25:31 +02:00
froschandGitHub 30b1eb6e5f Fix: [NewGRF] The result of Action123 evaluation affected rerandomisation in a weird corner case. (#14139)
Rerandomisation does not care about the Resolve result.
But we skipped it, in case of 'invalid SpriteGroup reference'.
2025-04-28 23:24:42 +02:00
froschandfrosch b281c5616e Change: [NewGRF] If Action123 does not resolve in a valid SpriteSet, prefer drawing the default sprite instead of an invalid sprite. 2025-04-28 22:20:54 +02:00
froschandfrosch 7b08170ac8 Codechange: Replace a magic value with a maybe less magical constant. 2025-04-28 22:20:54 +02:00
froschandfrosch f5a9eae8b1 Fix: [NewGRF] AI station construction callback did not work for stations with ID >= 0x100. 2025-04-28 20:50:13 +02:00
froschandfrosch e2084bbdcd Codechange: Replace out parameters with result tuples. 2025-04-28 20:50:13 +02:00
froschandfrosch 0c6426cb2d Fix: Out-of-bounds read, if NewGRF stations provided no spritesets. 2025-04-28 20:49:20 +02:00
froschandfrosch 0f1ef96ca1 Codechange: Road stops do not use RealSpriteGroup, ResolveReal is never called. 2025-04-28 20:49:20 +02:00
froschandfrosch b7e7f08f78 Codechange: Simplify usage of GRFFileProps by adding some common helper methods. 2025-04-28 13:44:46 +02:00
froschandfrosch 46494c6d44 Codechange: Rename GRFFileProps to SubstituteGRFFileProps. 2025-04-28 13:44:46 +02:00
froschandfrosch e1859df1c0 Codechange: Use enums as keys for the spritegroups in FixedGRFFileProps. 2025-04-27 19:50:51 +02:00
froschandfrosch 05504ec463 Codechange: Use SingleGRFFileProps, if the feature has no spritegroup keys. 2025-04-27 19:50:51 +02:00
froschandfrosch 41a20e512d Codechange: Use proper enum type to index sprite groups in VariableGRFFileProps. 2025-04-27 19:50:51 +02:00
froschandfrosch 893aa0fb91 Codechange: Add an explicit enum member for the default spritegroup of badges. 2025-04-27 19:50:51 +02:00
froschandGitHub 55fad9c78a Add: Limit height of settings description, and add scrollbar. (#14102) 2025-04-26 22:34:18 +02:00
froschandGitHub d85f6dccc5 Fix 5575379: Crash with default airports. (#14120) 2025-04-26 22:29:01 +02:00
froschandGitHub f62f728187 Codechange: Move usage of ResolverObjects to newgrf_xxx.cpp (#14116) 2025-04-26 20:53:50 +02:00
froschandfrosch be39a05327 Fix: Road vehicle blocking and train collissions used slightly inconsistent distance thresholds. 2025-04-26 19:32:59 +02:00
froschandfrosch 3a70d1e2f7 Codechange: Pass the max-distance as parameter to VehiclesNearTileXY. 2025-04-26 19:32:59 +02:00
froschandfrosch 2df1233f1f Codechange: Clamp the search area to valid values for the hash bucket selection.
The bucket selection uses a truncating division instead of a flooring division, so it does not work for negative positions.
Anyhow, there are no negative tile coordinates, so just clamp the search area.
2025-04-26 19:32:59 +02:00
froschandfrosch 0f76ba122c Codefix: VehiclesNearTileXY yielded all vehicles with matching hashes, even if they are far away. 2025-04-26 19:32:59 +02:00
froschandfrosch c14e4a6db1 Codefix: Rect::Contains did not consider the bottom/right edges as inside. 2025-04-26 19:32:59 +02:00
froschandfrosch ce2155ab27 Codechange: Remove unused FindVehicleOnPosXY/HasVehicleOnPosXY. 2025-04-26 16:54:56 +02:00
froschandfrosch 98ac75e74f Codechange: Replace FindVehicleOnPosXY/HasVehicleOnPosXY with VehiclesNearTileXY/HasVehicleNearTileXY. 2025-04-26 16:54:56 +02:00
froschandfrosch 9f1c04c0e1 Codechange: Add VehiclesNearTileXY and HasVehicleNearTileXY to iterate over/check for ground vehicles near a tile coordinate. 2025-04-26 16:54:56 +02:00
froschandfrosch ac3ed9f3ad Codechange: Deduplicate and simplify tile hash arithmetic. 2025-04-26 16:54:56 +02:00
froschandGitHub 398524e49a Add: [NewGRF] Provide random bits in var10 of house callback 1C 'construction stage changed'. (#14095) 2025-04-26 15:58:44 +02:00
froschandGitHub 55753795bf Fix: [NewGRF] Cargo-types for airport-tile animation-triggers were not properly translated. (#14092) 2025-04-26 15:58:30 +02:00
froschandGitHub 1ea1dbd19e Add: [NewGRF] Station/roadstop animation-triggers 'tile loop' (bit 7) and 'path reservation' (bit 8). (#14080) 2025-04-26 14:44:55 +02:00
froschandGitHub d3ae6bc9a8 Fix: [NewGRF] For animation-triggers which do not supply a cargo-type in var18, the var18 bits should remain empty. (#14091) 2025-04-26 14:44:07 +02:00
froschandGitHub 0d9074769d Change: [NewGRF] Animation-trigger 'construction stage changed' of houses and industries now also triggers at construction start. (#14089) 2025-04-26 14:42:49 +02:00
froschandGitHub 4a09860c53 Fix: Focus settings filter box (only) when the tab becomes active. (#14100) 2025-04-25 12:04:26 +02:00