1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-20 05:23:04 +01:00
Commit Graph

100 Commits

Author SHA1 Message Date
Duncan
d76611e0f2 Actually allocate a banner when using GetOrCreateBanner
When importing a file this function is used to create a banner at a certain index. Previously this was not assigning the id to the banner id. Luckily as banner id is a new field this did not cause any issues except in the nsf which does use the banner id more extensively
2021-07-27 19:58:09 +02:00
Duncan
e9eb1b8304 Banner Refactor from NSF (#14788)
* Banner refactor

* Fix mistake in fix_duplicated_banners

* Reduce limit back

* Fix export

* Free banner on delete

* Increment network version

* Fix potential banner pointer crashes

Co-authored-by: Ted John <ted@brambles.org>
2021-07-27 10:25:58 +01:00
Duncan
8f59fe91cb BannerSceneryEntry Refactor (#14810)
* Refactor BannerSceneryEntry to enforce type

* Remove old comment

* Fix incorrect renameing
2021-06-03 21:43:30 +01:00
Duncan
425f968a67 Rearrange WallSceneryEntry to enforce types (#14808)
* Rearrange WallSceneryEntry to enforce types

* Clang format

Correct inverted nullptr check
2021-06-03 13:26:00 +01:00
Michael Steenbeek
7344b7fbfd Use 16-bit ride_id_t thoughout and raise RIDE_ID_NULL (#14411)
* Replace RIDE_ENTRY_INDEX_NULL with OBJECT_ENTRY_INDEX_NULL

Ride entries are objects like any other, so there is little point having separate constants.

* Use ride_id_t in many more places

* Change RIDE_ID_NULL to 0xFFFF

* Increment network version

* Update replays

Co-authored-by: duncanspumpkin <duncans_pumpkin@hotmail.co.uk>
2021-04-01 16:02:57 +01:00
Gymnasiast
56399e7188 Use the RTD instead of ride_type_has_flag() 2021-02-24 14:10:30 +01:00
Gymnasiast
841d6a5f24 Avoid truncating banner index; check for NULL 2021-02-10 15:22:49 +01:00
Gymnasiast
2aae1cb84e Fix #13235: NPE in fix_duplicated_banners()
Co-authored-by: IntelOrca <ted@brambles.org>
2021-02-10 15:14:46 +01:00
Michael Steenbeek
1b686816db Move tile element banner functions to methods 2021-01-02 11:28:39 +01:00
Ted John
17edaae02b Improve banner formatting fix 2020-11-29 01:19:51 +00:00
Ted John
699103fe86 Fix banner text formatting, import / export 2020-11-28 16:52:19 +00:00
Ted John
b6a688e540 Refactor format tokens 2020-11-27 18:54:57 +00:00
Vinicius Sa
d583911997 Avoid variable shadowing in derived struct RCT12BannerElement
Give a more meaningful name to its private member that caused the
shadowing, as well as in the struct BannerElement.

Reported by PVS-Studio (Warning: V703).

Fix 3/7.

Issue: 12523
2020-10-06 18:21:19 -03:00
Matt
2639349925 Move storage into Formatter class and refactor usage 2020-09-17 22:14:36 +03:00
Aaron van Geffen
7b5087f057 Update copyright year to 2020 2020-07-21 15:04:34 +02:00
frutiemax
32c342e88d Part of #11389: Remove FormatTexto that take void* in banner struct (#12034) 2020-06-23 14:50:56 +01:00
Breno Rodrigues Guimarães
374b744477 Use Formatter to handle argument formatting for tooltips (#11379) 2020-04-21 12:38:59 +02:00
Breno Rodrigues Guimarães
2479256bc1 Adjust Formatter function names according to coding style (#11378) 2020-04-20 18:55:15 -03:00
Breno Rodrigues Guimarães
d4a2a98e20 Replacing set_format_arg_on macro in favor of a more C++zy solution (#11350) 2020-04-20 07:10:33 +02:00
Breno Rodrigues Guimarães
3c1bdcd201 Create a compile-time table for converting color codepoints to utf8 (#11349)
For this to be possible, the function to convert a codepoint to urf8 was
moved to the header and made constexpr.

Now it's not necessary to store a std::string just to serve as a buffer
for holding this string. All the computation is done at compile time.
2020-04-19 15:51:01 +02:00
Tulio Leao
64e4a8420e Use named casts on openrct2/world (#11141) 2020-04-17 21:08:22 +02:00
Gymnasiast
edd31d9f16 Move flags to RideTypeDescriptors 2020-04-17 17:03:33 +02:00
Breno Guimaraes
347c402984 Fix #11286: Fix coloring of banners on tooltip
This patch moves the function that adds coloring to the buffer text into the Buffer struct with a flag.
It also changes both Banner printing and Banner tooltip to use the colored version
2020-04-16 08:06:07 -03:00
Gymnasiast
1e6efa6eb4 Extend BannerIndex to 16 bits 2020-02-15 10:37:34 +01:00
Michael Steenbeek
d16fbb0cd2 Change ride->overall_view to CoordsXY (#10673) 2020-02-08 17:19:59 +01:00
Tulio Leao
49bd8e0c67 Use CoordsXYZ on banner_get_ride_index_at() 2020-01-19 13:28:24 -03:00
Tulio Leao
5a74d057b0 Use CoordsXY on banner_get_closest_ride_index() 2020-01-19 13:28:24 -03:00
duncanspumpkin
58339cff2b Prepare overall_view for type change 2019-12-24 08:39:20 +00:00
Gymnasiast
62fcbb07ca Rename methods to GetBaseZ/GetClearanceZ 2019-12-23 20:08:37 +01:00
Gymnasiast
7d11858dbe Create getter for GetBaseHeight()/GetClearanceHeight() 2019-12-23 20:05:24 +01:00
Tulio Leao
a2c7ecc6e5 Make Map::map_get_first_element_at() use CoordsXY (#10413)
* Make Map::map_get_first_element_at() use CoordsXY

* Fix clang-format on ClearAction.hpp

* Prefer TileDIrectionDelta over hardcoded delta on RideConstruction

* Use named Direction constants

* Make Compat::map_get_first_element_at() use CoordsXY
2019-12-23 07:35:41 +00:00
Michael Steenbeek
a2b9598341 Modify code using Location8 to use isNull()/setNull() (#10403) 2019-12-21 11:34:46 +01:00
Tulio Leao
b793d7e79a Avoid dereferencing map_get_first_element_at nullptr on libopenrct2 (#10013)
* Avoid dereferencing map_get_first_element_at nullptr on Map.cpp

* Avoid dereferencing map_get_first_element_at nullptr on MapAnimation.cpp

Returning true or internal control variable, based on what was seen on `map_animation_invalidate_track_onridephoto`

* Avoid dereferencing map_get_first_element_at nullptr on Park.cpp

* Avoid dereferencing map_get_first_element_at nullptr on Scenery.cpp

* Avoid dereferencing map_get_first_element_at nullptr on Sprite.cpp

* Avoid dereferencing map_get_first_element_at nullptr on TileInspector.cpp

* Avoid dereferencing map_get_first_element_at nullptr on Wall.cpp

* Avoid dereferencing map_get_first_element_at nullptr on Fountain.cpp

* Avoid dereferencing map_get_first_element_at nullptr on Footpath.cpp

* Avoid dereferencing map_get_first_element_at nullptr on Entrance.cpp

* Avoid dereferencing map_get_first_element_at nullptr on Banner.cpp

* Avoid dereferencing map_get_first_element_at nullptr on Vehicle.cpp

* Avoid dereferencing map_get_first_element_at nullptr on TrackDesignSave.cpp

* Avoid dereferencing map_get_first_element_at nullptr on TrackDesign.cpp

* Avoid dereferencing map_get_first_element_at nullptr on Track.cpp

* Avoid dereferencing map_get_first_element_at nullptr on Station.cpp

* Avoid dereferencing map_get_first_element_at nullptr on RideRatings.cpp

* Avoid dereferencing map_get_first_element_at nullptr on Ride.cpp

* Avoid dereferencing map_get_first_element_at nullptr on S4Importer.cpp

* Avoid dereferencing map_get_first_element_at nullptr on Staff.cpp

* Avoid dereferencing map_get_first_element_at nullptr on Peep.cpp

* Avoid dereferencing map_get_first_element_at nullptr on GuestPathfinding.cpp

* Avoid dereferencing map_get_first_element_at nullptr on Guest.cpp

* Avoid dereferencing map_get_first_element_at nullptr on VirtualFloor.cpp

* Avoid dereferencing map_get_first_element_at nullptr on Paint.TileElement.cpp

* Fix issues raised on review

* Fix remaining review issues.

* Early exit on loops if tileElement is nullptr

* Fix clang-format issues
2019-10-09 15:02:21 +01:00
Ted John
ab7b17fc4e Add nullptr checks for get_ride in libopenrct2 (#9788) 2019-08-08 22:58:56 +01:00
Ted John
a863c7ae50 Remove rest of FOR_ALL_RIDES instances 2019-08-04 16:44:17 +01:00
Ted John
61d64ab8c5 Do not use user strings for banners 2019-07-29 19:18:16 +01:00
Ted John
0b4d989a67 Rename get_banner to GetBanner 2019-07-26 17:24:19 +01:00
Ted John
3bff25ab22 Use TileCoordsXY 2019-07-26 17:14:09 +01:00
Ted John
5c07c53faf Refactor get banner 2019-07-25 22:21:19 +01:00
Ted John
85543bd1c8 Separate RCT2 and OpenRCT2 banner struct 2019-07-25 22:21:19 +01:00
duncanspumpkin
65c0b0591d Fix build for gcc
Invalid cast to int32_t that had been left in after refactoring months ago. Latest version of gcc flags this as the cast made this a comparison between a signed and unsigned value.
2019-06-20 19:27:56 +01:00
James Warwood
67f1359936 Fix: Unable to change colours of scrolling wall banner sign via sign dialog (#9303)
1. Check in SignSetStlyeAction query was accidentally inverting value of
   wallFound boolean
2. Code in action execution was not looping through the tile elements to find
   the correct wall piece like the query did (which meant just fixing 1. would
   cause a segfault)

Moved code to find relevant wall tile element into new helper function
banner_get_scrolling_wall_tile_element() in Banner; use in both query and action
to avoid any duplication of search logic.
2019-05-30 10:33:13 +02:00
Filip Gawin
6833da77e3 Simplify boolean expresions 2019-05-10 22:00:38 +02:00
duncanspumpkin
f6b610c325 Implement Banner Place/Remove Actions 2019-05-02 17:47:01 +01:00
duncanspumpkin
aa65e25c6b Implement banner set style action 2019-04-07 10:10:36 +01:00
duncanspumpkin
3593366e95 Implement banner set colour action 2019-04-07 09:22:39 +01:00
Aaron van Geffen
2af13904c5 Update copyright notices for 2019. (#8903) 2019-03-17 07:16:15 +00:00
duncanspumpkin
112b40910b Pass a bool to the set function. Make review changes 2019-02-25 20:44:12 +00:00
duncanspumpkin
737c308e4e Use IsGhost() to access ghost state
Added set and clear ghost to further prevent direct access to flags
2019-02-25 15:12:35 +00:00
Ted John
8701286772 Use new ride_id_t typedef (#8561) 2019-01-12 10:11:55 +00:00