Commit Graph

269 Commits

Author SHA1 Message Date
ryan-bello 54a33cbde8 renamed StaffType to AssignedStaffType 2020-08-17 20:16:09 -04:00
Aaron van Geffen be626d0b7c Refactor Editor*, Finances, Guest* to use MakeTab 2020-08-17 20:59:17 +02:00
Jonathan van Tuijl 4117965a4a Fix Z coordinate in guest debug tab 2020-08-11 03:37:34 +02:00
Jonathan van Tuijl dcdc782361 Increase minimum window size so pathfind history doesn’t spill out 2020-08-11 03:35:24 +02:00
Duncan 0809069e74
Fix #12577: Mistake made in refactor #12538 (#12579)
Loop called the peep window open only when nullptr. Added extra checks for nullptr on window open
2020-08-03 20:09:24 -03:00
Duncan 733bc5a981
Close #12518: Viewport Refactor (#12541)
* Remove viewport pointer from get_map_coordinates_from_pos

* Removed viewport from get_window

* Return a InteractionInfo from get_map_coord...

* Remove viewport_interaction_info struct

* Add Entity union to simplify code

* Name the enum used for viewport interaction

* Simplify functions further by returning the info struct

* Add default switches
2020-08-02 08:32:59 +01:00
Aaron van Geffen b34b573ad9
Refactor more widget definitions (#12354)
* Refactor Dropdown

* Refactor EditorMain

* Refactor EditorScenarioOptions

* Refactor InstallTrack

Increased window height to 460 (was 448); one line of text was overflowing.

* Refactor Guest

* Refactor LandRights

* Refactor LoadSave

* Refactor Main

* Refactor Map

* Add extra constants to EditorScenarioOptions
2020-07-27 19:54:22 -03:00
Duncan 8a378ad236
Remove uses of GET_PEEP macro and replace with GetEntity (#12467)
* Use TryGetEntity and GetEntity instead of macro

* Use GetEntity for ui guest window

* Remove final GET_PEEP macro uses

* Fix remaining issues
2020-07-26 17:42:02 +01:00
Matt fa2bd4cad6 Refactor PeepType to use strong enum 2020-07-25 11:54:37 +02:00
frutiemax 0e96674a46
Part of #12096: ScreenRect w/ gfx_fill_rect in libopenrct2ui (#12188) 2020-07-10 13:59:08 -03:00
Gymnasiast e8d6383f57
Clean up voucher arguments 2020-07-07 21:13:40 +02:00
frutiemax 4661262572
Fix #12085: Use ScreenCoordsXY on clip_drawpixelinfo (#12105) 2020-07-02 14:06:28 -03:00
Aaron van Geffen 2e153a7e95 Introduce widget::midX and widget::midY helper functions 2020-06-25 10:31:15 +02:00
Aaron van Geffen 681b8d7938
Introduce widget::width and widget::height helper functions (#12053) 2020-06-24 22:44:00 -03:00
frutiemax 14a07359b3
Part of #11389: Use formatter class for Ride::FormatNameTo (#12041) 2020-06-24 21:02:08 -03:00
TomasZilinek 9d965ccfb6
Part of #12017 - create gfx_draw_sprite overload (#12026)
* Part of #12017 - create gfx_draw_sprite overload

Part 1. Creates the overload and replaces about a half of the calls since there are too many for one PR.

Co-authored-by: Tulio Leao <tupaschoal@gmail.com>
2020-06-23 18:32:34 -03:00
frutiemax 6e47385b90
Part of #11389 : in peep class, FormatTo* use Formatter class (#12035) 2020-06-23 14:52:08 +01:00
TomasZilinek 2264c5f7f1
Part of #11571 - Use gfx_draw_string_left with ScreenCoordsXY (#12008) 2020-06-20 11:56:36 -03:00
Duncan 33298d2bde
Fix peep pickup. Mistake made during refactor. (#11978)
PeepPickupAction assumed that all locations that are passed into the function would be valid locations or null locations. This is not the case when picking up as a dummy value is passed into the function. The caller was fixed by passing a null location as expected by PeepPickupAction.
2020-06-17 21:11:50 +01:00
duncanspumpkin 904e6c6987 Implement GetSprite and use it in a number of places
This will eventually replace all of the get_sprite and try_get_sprite calls

Further use of GetSprite

Use GetSprite in all remaining easy to use functions

Correct formatting

Rename GetSprite to GetEntity

Make suggested changes

Remove const to allow for building

Fix crashes due to next sprite
2020-06-16 20:21:56 +01:00
Tulio Leao 13df05ce32 Part of #11564: Use ScreenCoordsXY instead of <x,y> 2020-06-14 12:51:06 -03:00
Tulio Leao 613cec3f7a Part of #11564: gfx_draw_string_centred_clipped with ScreenCoordsXY 2020-06-14 12:26:53 -03:00
Tulio Leao e54a3d89f2
Rename some Peep member variables to use TitleCase (#11931)
* Rename Peep::destination_tolerance to use TitleCase

* Rename Peep::destination_y to use TitleCase

* Rename Peep::destination_x to use TitleCase

* Rename Peep::trousers_colour to use Title Case

* Rename Peep::tshirt_colour to use TitleCase

* Rename Peep::no_of_rides to use Title Case

* Rename Peep::staff_type to use TitleCase

* Rename Peep::type to use TitleCase

* Rename Peep::sprite_type to use TitleCase

* Rename Peep::sub_state to use TitleCase

* Rename Peep::state to use TitleCase

* Rename Peep::outside_of_park to use TitleCase

* Rename Peep::next_flags to use TitleCase

* Rename Peep::name to use TitleCase

* Rename Peep::NoOfRides to GuestNoOfRides

* Rename Peep::Type to AssignedPeepType

* Rename Peep::GuestNoOfRides to GuestNumRides
2020-06-14 06:31:08 +01:00
Tulio Leao a993ad8408 Rename Peep::energy to Energy 2020-06-08 23:34:35 -03:00
Tulio Leao 92fbb9fc04 Rename Peep::happiness to Happiness 2020-06-08 23:30:27 -03:00
Tulio Leao e387539802 Rename Peep::nausea to Nausea 2020-06-08 23:25:37 -03:00
Tulio Leao 533695cbe6 Rename Peep::hunger to Hunger 2020-06-08 23:18:12 -03:00
Tulio Leao aad80d3390 Rename Peep::thirst to Thirst 2020-06-08 23:12:38 -03:00
Tulio Leao 3dd4adeb81 Rename Peep::toilet to Toilet 2020-06-08 23:10:18 -03:00
Tulio Leao 4f9227fd83 Rename Peep::intensity to Intensity 2020-06-08 22:55:07 -03:00
Tulio Leao f1337768f5 Rename Peep::nausea_tolerance to use TitleCase 2020-06-08 22:41:15 -03:00
Tulio Leao f732c2f1cd Rename Peep::window_invalidate_flags to use TitleCase 2020-06-08 22:25:54 -03:00
Tulio Leao 1c566eebcb Rename Peep::paid_on_drink to PaidOnDrink 2020-06-08 20:23:14 -03:00
Tulio Leao 1ee5653c8c Rename Peep::photo2_ride_ref to use TitleCase 2020-06-08 17:36:35 -03:00
Tulio Leao 397c1137db Rename Peep::photo3_ride_ref to use TitleCase 2020-06-08 17:36:35 -03:00
Tulio Leao df87daaa6e Rename Peep::photo4_ride_ref to use TitleCase 2020-06-08 17:36:35 -03:00
Tulio Leao 77af2326ff Rename Peep::cash_in_pocket to CashInPocket 2020-06-06 11:53:50 -03:00
Tulio Leao 0fc7bd1afd Rename Peep::cash_spent to CashSpent 2020-06-06 11:26:04 -03:00
Tulio Leao cf4b052cd4 Rename Peep::time_in_park to TimeInPark 2020-06-06 11:26:04 -03:00
Tulio Leao e08c1b44b2 Rename Peep::thoughts to Thoughts 2020-06-06 10:03:58 -03:00
Michael Steenbeek 4efd3dbfbf
Merge pull request #11866 from Gymnasiast/refactor/set_format_arg_be_gone
Move calls to set_format_arg to Formatter::Common()
2020-06-04 23:20:37 +02:00
Tulio Leao 7357eeca60
Rename Peep::photo1_ride_ref to Photo1RideRef 2020-06-04 19:16:11 +02:00
Tulio Leao a2a0fad886
Rename Peep::peep_flags to PeepFlags 2020-06-04 19:16:11 +02:00
Tulio Leao 53bff03a3f
Rename Peep::pathfind_goal to PathfindGoal 2020-06-04 19:16:11 +02:00
Tulio Leao cad809275e
Rename Peep::pathfind_history to PathfindHistory 2020-06-04 19:16:11 +02:00
Michael Steenbeek 0ba02dd91c
Fix suggestion 2020-06-04 12:41:03 +02:00
Michael Steenbeek f9417cc5de
Apply suggestion from code review
Co-authored-by: Tulio Leao <tupaschoal@gmail.com>
2020-06-04 10:16:23 +02:00
Gymnasiast 66a71e009d
Create Rewind method on Formatter 2020-06-03 14:49:04 +02:00
Gymnasiast 02338ffc5c
Migrate 50 more calls to set_format_arg() 2020-06-03 14:49:04 +02:00
Gymnasiast f640446d58
Migrate 40 calls to set_format_arg() 2020-06-03 14:49:04 +02:00
Tulio Leao e18abc7e3d Rename NoOf... to AmountOf... on Peep 2020-05-31 09:13:56 -03:00
Tulio Leao a987a9ee5e Rename Peep::paid_to_enter to PaidToEnter 2020-05-30 20:35:06 -03:00
Tulio Leao 3f091d33e2 Rename Peep::paid_on_rides to PaidOnRides 2020-05-30 20:35:05 -03:00
Tulio Leao 414cff9b91 Rename Peep::paid_on_food to PaidOnFood 2020-05-30 20:35:05 -03:00
Tulio Leao c2f7efa328 Rename Peep::paid_on_souvenirs to PaidOnSouvenirs 2020-05-30 20:35:05 -03:00
Tulio Leao a729ac1589 Rename Peep::no_of_food to NoOfFood 2020-05-30 20:35:04 -03:00
Tulio Leao bc7ea40c4b Rename Peep::no_of_drinks to NoOfDrinks 2020-05-30 20:35:04 -03:00
Tulio Leao 625f7859a4 Rename Peep::no_of_souvenirs to NoOfSouvenirs 2020-05-30 20:35:04 -03:00
Tulio Leao fd71b1b009 Rename Peep::voucher_type to VoucherType 2020-05-30 20:35:04 -03:00
Tulio Leao bf228abf55 Rename Peep::voucher_arguments to VoucherArguments 2020-05-30 20:35:03 -03:00
Sohil Adwani d2565af867
Part of #11562: gfx_draw_string_left_wrapped() overload (#11784) 2020-05-19 21:57:11 -03:00
TusharSariya 2cf95adc4b
Fix #11565: gfx_draw_string_left_clipped to use ScreenCoordsXY (#11765)
* Issue #11565, created overload for gfx_draw_string_left_clipped

Co-authored-by: Tushar <tushar.97@hotmail.com>
Co-authored-by: Tulio Leao <tupaschoal@gmail.com>
2020-05-17 19:30:58 -03:00
Tulio Leao 128c1993c1 Rename Peep::balloon_colour to BalloonColour 2020-05-13 23:16:43 -03:00
Tulio Leao 6c57f33dc9 Rename Peep::umbrella_colour to UmbrellaColour 2020-05-13 23:14:45 -03:00
Tulio Leao 222f8df6cb Rename Peep::hat_colour to HatColour 2020-05-13 23:11:28 -03:00
Tulio Leao 3b632fcf95 Rename Peep::favourite_ride to FavouriteRide 2020-05-13 23:06:40 -03:00
TomasZilinek 9fde6a74c3
Close #11561: Use ScreenCoordsXY in gfx_draw_string()
* Fix #11572 create gfx_draw_string() overload

created the overload and changed all calls of the old function to the new (using const ScreenCoordsXY&)

...
2020-05-10 09:49:15 -03:00
Gymnasiast f8aeb70398
Apply review requests 2020-05-09 18:07:16 +02:00
Gymnasiast 43556d2dec
Remove ifdefs for LEFT_CLOSEBOX - for now 2020-05-09 18:07:16 +02:00
Gymnasiast 9e4c664944
Replace defines with constexpr 2020-05-09 18:07:16 +02:00
Gymnasiast 96fe3d3b3c
Make WINDOW_SKELETON take a title, height and width 2020-05-09 18:07:16 +02:00
tassaron2 559ede5d14
Add compile option to move close box to the left 2020-05-09 18:07:16 +02:00
Ted John 7b8ffdb865 Refactor peep.intensity into new strict struct 2020-05-09 12:37:51 +01:00
Ted John d34dec9c27 Create ZoomLevel struct to add two new zoom levels 2020-03-23 15:54:03 +00:00
Gymnasiast 7759b54c2f
Make PeepPickupAction *actually* take a CoordsXYZ 2020-03-07 21:34:04 +01:00
Gymnasiast 8883f428ba Clean up window vars 2020-03-05 08:03:38 -03:00
Tulio Leao 724a6d4dcf Make rct_window use ScreenCoordsXY 2020-03-02 20:51:01 -03:00
Tulio Leao 87f724d038 Use Coords objects for viewport_create() 2020-03-02 20:49:59 -03:00
Tulio Leao 9bcd20e0e6 Prefer const ref to send ScreenCoordsXY over 2020-02-29 08:25:48 -03:00
Duncan b8b539c16e
Modify next_x/y/z to become a CoordsXYZ (#10680)
* Modify next_x/y/z to become a CoordsXYZ

Should be further scope for refactoring from this.

* Make suggested changes

* Fix default construct issues
2020-02-11 22:01:14 +00:00
Tulio Leao 201d13577e Use CoordsXY for footpath_get_coordinates_from_pos() 2020-01-12 22:20:29 -03:00
Tulio Leao 47935288d0 Remove raw coordinates overload of get_map_coordinates_from_pos 2019-11-25 17:45:02 -03:00
Tulio Leao fe3d6f6faf Use ScreenCoordsXY for scroll_mouse* functions 2019-11-14 08:40:40 -03:00
Tulio Leao 5e888747de Use mapCoords instead of ScreenCoords 2019-11-12 20:13:14 -03:00
Tulio Leao 892c084cd8 Use ScreenCoordsXY for windows/Footpath 2019-11-11 23:10:51 -03:00
Tulio Leao afc14183e7 Use ScreenCoordsXY for tool_* functions 2019-10-29 19:02:58 -03:00
Matt cc6321048f
Refactor window_invalidate to use rct_window::Invalidate 2019-08-11 17:22:00 +02:00
Matt 2053ecb688
Refactor window_scroll_to_viewport to use rct_window::ScrollToViewport 2019-08-11 17:22:00 +02:00
Ted John 93789b9034
Add nullptr checks for get_ride in libopenrct2ui (#9795) 2019-08-09 08:06:25 +01:00
Ted John 414b53b56d Remove ride classifications 2019-08-04 16:43:50 +01:00
Ted John a3fe00f0a3 Refactor ride list to a manager with iterator 2019-08-04 16:43:50 +01:00
Ted John 40d49b93d3 Do not use user strings for peep names 2019-07-29 19:18:16 +01:00
Ted John 3f45976009 Fix openrct2ui errors 2019-07-29 19:18:16 +01:00
Ted John 3155c661fa Refactor format peep action 2019-07-29 19:18:16 +01:00
Ted John 6fff2079f9 Refactor ride name to dynamic args and std::string 2019-07-29 19:18:16 +01:00
Ted John 5733d666b3 Do not store park name as a user string 2019-07-21 11:33:15 +02:00
duncanspumpkin b896f07687 Add PeepPickupAction
Move Guest and Staff pickup to the new game action. Rework the game
action so that only one game action is required for the two game
commands. Remove the final game command with a callback.
2019-06-20 19:34:02 +01:00
nexgenration 46889b5381 Implement #9231: Add sprite_index to Guest Debug Tab 2019-05-27 22:39:03 +02:00
nexgenration 6b232f7e53 Fix#9197: Peep insert new thought (#9230)
Improve the readability of the codebase by moving functions into the relevant structures.
- Change name of peep_insert_new_thought to InsertNewThought.
- Update InsertNewThought definition to Guest::InsertNewThought.
2019-05-18 09:47:25 +01:00
Ted John a22f0a53fb Use localised strings for guest debug tab 2019-05-04 21:48:02 +00:00
Ted John f50695fc9b Refactor guest window resize 2019-05-04 16:23:29 +00:00
Ted John a90a86562d Refactor guest widget lists 2019-05-04 15:01:51 +00:00
Ted John 7c2708746e Re-draw debug tab every tick 2019-05-04 14:53:25 +00:00
Ted John c13bd04954 Refactor invalidate methods 2019-05-04 14:40:45 +00:00
Ted John 1d296242b4 Improve text colour 2019-05-04 14:09:15 +00:00
Ted John b4a2a94520 Fix build 2019-05-04 14:08:37 +00:00
Richard Fine 480f19c0c6 Add parens to fix operator precedence issue
I missed one... thankfully the CI did not.
2019-05-04 14:08:37 +00:00
Richard Fine 9bb68a7151 Pull window width into temporary variable
As suggested in review, it's a little easier to read this way.
2019-05-04 14:08:37 +00:00
Richard Fine b714f7b0e2 Use constexpr instead of const
For a static constant integer value, it's stylistically clearer to use constexpr instead of const. The resulting variable is implicitly const, but is also guaranteed to have a compile-time-computable value.
2019-05-04 14:08:37 +00:00
Richard Fine 97bcc53637 Eliminate itoa and use correct format specifiers
Use snprintf instead of _itoa as it's not available on all platforms. Also change the format specifies for unsigned variables to %u instead of %i, to be more correct...
2019-05-04 14:08:37 +00:00
Richard Fine 397b044588 Use safe_strcat instead of strcat_s
strcat_s is not available on all platforms, and we have a utility in the codebase that does basically the same thing already.
2019-05-04 14:08:37 +00:00
Richard Fine cfda3fb8f7 Use sizeof(buffer) instead of hardcoded size
Use sizeof(buffer) instead of repeating 4096 in a bunch of places. Also, 4096 was maybe a bit overkill, drop it down to 512 instead.
2019-05-04 14:08:37 +00:00
Richard Fine 8bf72ceadb More peep pathing info
Show more peep debug data in the Guest debug tab, mostly to help with understanding pathfinding behaviour.
2019-05-04 14:08:37 +00:00
Richard Fine 7300a38ce6 Show peep coordinates in debug tab
As a first debug stat to show, display a peep's current coordinates in the debug tab
2019-05-04 14:08:37 +00:00
Richard Fine 70c61d5ac6 Fix guest window width for debugging tab
Introduce a named constant for the width of a tab in the Guest window, and touch the places that set the window width to add it to the minimum window width when the debugging tab is enabled, so that the tab doesn't render off the side of the window.
2019-05-04 14:08:37 +00:00
Richard Fine 5ef07ab936 Formatting 2019-05-04 14:08:37 +00:00
Richard Fine fa63691d17 Disable guest debug tab when debug tools not turned on
Disable the debug tab in the guest window when the debugging tools are not turned on, causing it to be completely hidden from view.
2019-05-04 14:08:37 +00:00
Richard Fine c4a449f47d Add new debugging tab to the Guest window
Add a new tab to the Guest window which we can use to display debug information and tools for guests. At the moment it's blank and always visible; next step is to make it only show up when debugging tools are enabled.
2019-05-04 14:08:37 +00:00
Michael Steenbeek c8df801e66
Create ShopItemDescriptor 2019-04-26 20:25:11 +02:00
Florian Will 0d3f287447 Add changelog entry, minor code improvements 2019-04-15 19:11:30 +02:00
Florian Will eb6ea8e81d Fix #5893: Invalidate widget only if it's visible
Remove the widget_invalidate() call after changing a guest's
guest_heading_to_ride_id, because that call fails a debug assertion if
the guest window is open and the currently active tab is not the
"overview" tab. In Release builds (if assertion is disabled),
widget_invalidate() might access the widgets array out of bounds.

Instead, introduce a new flag PEEP_INVALIDATE_PEEP_ACTION for
window_invalidate_flags in the peep struct and set that flag. The guest
window update function then makes sure to invalidate the label if the
flag is set.

The flag could be used in other places to reduce libopenrct2 dependency
on window_*() calls (see #6808), but this commit only cares about cases
where the assertion would fail.
2019-04-15 14:26:33 +02:00
Matt 57283a4e2b Fix #8900: Implement GuestSetFlagsAction. 2019-03-17 22:17:04 +01:00
Aaron van Geffen 2af13904c5 Update copyright notices for 2019. (#8903) 2019-03-17 07:16:15 +00:00
Ted John ca023f7c5e Fix #8829: invalid read in window_guest_open 2019-03-09 13:05:12 +00:00
Ted John cdec457abd Refactor peep struct 2019-02-28 20:28:58 +01:00
Ted John 8701286772
Use new ride_id_t typedef (#8561) 2019-01-12 10:11:55 +00:00
Matt 862ef3018c Use gCurrentRealTimeTicks whenever appropriate. 2018-12-01 17:00:11 +01:00
Michael Steenbeek f8add7f62e
Rename rct_tile_element to TileElement 2018-11-01 13:53:50 +01:00
Gymnasiast 45b8ca9421 Remove more strings, fix error 2018-08-12 15:56:47 +02:00
moTechPlz 8784dfbf41 Fix #7462: Guest window goes beyond the map edge on a spiral slide. (#7752) 2018-08-07 16:20:51 +02:00
clang-format b02dfdbc93 Binpack function arguments together
Previously when the arguments of a function wouldn't fit on a single line, clang-format would put each argument on its own line instead. By enabling the binpack parameter setting, it tried to fit as many on one line as possible instead.

Co-authored-by: Hielke Morsink <hielke.morsink@gmail.com>
2018-07-23 16:00:22 +02:00
clang-format 95ce592579 Enforce not breaking before assignments and function names
Co-authored-by: Hielke Morsink <hielke.morsink@gmail.com>
2018-07-23 16:00:19 +02:00
clang-format e558660860 clang-format UI windows 2018-07-23 16:00:14 +02:00
Michael Steenbeek 1b08fb4e69 Replace our own integer types with standard ones 2018-06-20 17:30:40 +02:00
Ted John 26666b1da9 Remove empty function: viewport_update_pointers 2018-06-15 23:15:52 +01:00
Hielke Morsink 0cf256ac9e Ready copyright notice for clang-format
Clang-format sees the text behind `#pragma region` as code and formats it. Instead of stating the copyright and date there, it's now in the comment block right below it. The text "Copyright" is left in the `#pragma region` line, as clang-format sees it as a single identifier.

I took the opportunity to normalize the dates, and add the copyright notice to the source files where it was missing them (except for third-party and the generated resources.h file).
2018-06-15 14:07:34 +02:00
Ted John 86ca6be58b Fix #7674: Rides show up as random numbers in guest's ride list 2018-06-13 18:32:00 +01:00
Ted John dea935314e Add null check for showing guest's favourite ride 2018-06-13 18:27:32 +01:00
Hielke Morsink 8aa122f54e Use empty initializer lists in the openrct2ui project 2018-06-05 14:37:24 +02:00
Michał Janiszewski a2ef4bd699
Exclude pre-formatted blocks from clang-format (#7520)
[ci skip]
2018-05-16 20:41:29 +02:00
Michael Steenbeek fcf507e051
Spin off shop item stuff to separate files 2018-05-14 19:21:43 +02:00
Hielke Morsink 6e02d6af4c Make peep_has_food, has_item and has_drink member functions 2018-05-05 11:13:22 +01:00
duncanspumpkin 765500adfa Label offsets and functions
Actually save before commiting

Label more peep vars.

Remove unread var

Further refactoring

Fix mistake in map element type
2018-04-11 18:16:09 +01:00
Michał Janiszewski cd065d4f41 Reduce includes in common header 2018-03-20 00:27:58 +01:00
Marijn van der Werf 4c956def67 Update UI imports 2018-01-18 22:57:55 +01:00
ZehMatt 84f2917f59 Use const and constexpr whenever possible. 2018-01-11 22:29:08 +01:00
Michael Steenbeek cd5a1ba888 Compile files in world folder as C++ 2018-01-11 13:25:09 +01:00
Michał Janiszewski 469e142c7b Change casing of header files 2018-01-11 09:30:09 +01:00
Michael Steenbeek 857e64590d Name some rct(1)_peep fields 2018-01-09 10:35:07 +01:00
Aaron van Geffen fad8494ccc Rename WWT_12 to WWT_LABEL_CENTRED.
This is used for centred textual labels.
2018-01-07 23:54:51 +01:00