1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-27 08:45:00 +01:00
Commit Graph

108 Commits

Author SHA1 Message Date
Matt
efa1db826e Refactor invalidation logic to be generic to the callee 2021-01-02 16:22:28 +02:00
Matt
cb719a6e10 Add missing case statements for entity scripting 2021-01-02 15:31:26 +02:00
Matt
5f2945d238 Refactor MISC_SPRITE to strong enum 2021-01-02 15:30:44 +02:00
ju-pinheiro
a31c958004 Adding missing SpriteIdentifier enumerations to switch statements 2020-10-27 18:52:56 -03:00
ju-pinheiro
bb16ca075b Close #12450: Refactor SPRITE_IDENTIFIER to use strong enum 2020-10-27 13:26:27 -03:00
Duncan
6d11825e1a Reduce the use of rct_sprite (#12530)
* Reduce the use of rct_sprite

* Pass the correct types in S4 importer

* Add additional nullptr checks

* Simplify the viewport interaction

* Apply review comments

* Small cleanup of GetEntity

* Fix test paint
2020-08-01 11:29:54 +01:00
Duncan
3de2de9814 Reduce use of get_sprite (#12382)
* Reduce use of get_sprite

* Update src/openrct2/world/Sprite.cpp

Co-authored-by: Michael Steenbeek <m.o.steenbeek@gmail.com>

Co-authored-by: Michael Steenbeek <m.o.steenbeek@gmail.com>
2020-07-25 18:03:14 +01:00
Aaron van Geffen
7b5087f057 Update copyright year to 2020 2020-07-21 15:04:34 +02:00
Duncan
4dc4bbea92 Improve Sprite Misc Update (#12191)
* Use better types for SpriteMiscUpdate

* Change all sprite misc update functions to member functions
2020-07-10 14:16:03 +01:00
Duncan
94b3598102 Tiny GetEntity Refactor (#12124)
* Use default template parameter instead of specialising

* Fix null deref issues
2020-07-06 22:02:25 +01:00
duncanspumpkin
57d2877e67 Provide accesor function for get entity list count 2020-07-05 07:28:38 +01:00
duncanspumpkin
e51bbeed23 Convert SPRITE_LIST to an enum class 2020-07-04 07:38:11 +01:00
duncanspumpkin
2d28ca3b28 Remove broken check_for_spatial_index_cycles
There were a number of issues with this function. It was calling index_is_in_list with invalid SPRITE_LISTs. The spatial index is no longer needed to be correct on save/load as it is rebuilt so that it is kept in order.
2020-07-04 07:38:11 +01:00
Tulio Leao
3c75481d8a Make litter_can_be_at use CoordsXYZ 2020-06-21 14:32:01 -03:00
Tulio Leao
40a7dfbb24 Make litter_create use CoordsXYZD 2020-06-21 14:32:01 -03:00
Tulio Leao
7622ca513e Make litter_remove_at use CoordsXYZ 2020-06-21 14:06:56 -03:00
Tulio Leao
e24de95b82 Make sprite_get_first_in_quadrant use CoordsXY 2020-06-21 14:03:35 -03:00
Tulio Leao
f329644dd5 Make sprite_misc_explosion_flare_create use CoordsXYZ 2020-06-21 14:00:37 -03:00
Tulio Leao
2e31a7d64d Make sprite_misc_explosion_cloud_create use CoordsXYZ 2020-06-21 13:58:13 -03:00
Tulio Leao
ae1e9b75ed Make sprite_set_coordinates use CoordsXYZ 2020-06-21 13:50:54 -03:00
duncanspumpkin
c45a0536eb Use new class 2020-06-16 20:27:40 +01:00
duncanspumpkin
133d8c4a0a 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:25:03 +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
hdpoliveira
a3fe90c250 Create SpriteBase::Invalidate methods (#11948) 2020-06-14 15:18:07 -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
f732c2f1cd Rename Peep::window_invalidate_flags to use TitleCase 2020-06-08 22:25:54 -03:00
duncanspumpkin
5c48e5f0bb Remove AsPeep 2020-06-06 11:36:48 +01:00
duncanspumpkin
bee424585a Remove AsDuck 2020-06-06 11:36:48 +01:00
duncanspumpkin
6e78d8d654 Remove AsBalloon 2020-06-06 11:36:48 +01:00
duncanspumpkin
517ed57593 Remove IsPeep 2020-06-06 11:36:48 +01:00
duncanspumpkin
881afc7579 Remove IsMoneyEffect 2020-06-06 11:36:48 +01:00
duncanspumpkin
f5772fae48 Remove IsDuck 2020-06-06 11:36:47 +01:00
duncanspumpkin
4485937560 Remove IsBalloon 2020-06-06 11:36:47 +01:00
duncanspumpkin
1758f2a133 Implement As and Is functions for SpriteBase 2020-06-06 11:36:42 +01:00
Gymnasiast
11472f909d Convert sprite_move to method 2020-05-13 10:47:32 +02:00
duncanspumpkin
fed148648c Use IsPeep in more places 2020-04-28 07:57:47 +01:00
duncanspumpkin
63549dee57 Ensure move_sprite_to_list only used in sprite.cpp
After an entity is created it should never need to call this function. This will be important in later changes when the lists are changed to vectors
2020-04-28 07:27:05 +01:00
duncanspumpkin
5b07a76f05 Use sprite_identifier when identifying entitys
The linked list index is only meant to be used for accessing the linked lists. Using the wrong variable is unlikely to cause issues for this exact case but it makes things cleaner.
2020-04-27 18:47:51 +01:00
Michał Janiszewski
2323cc1596 Use named casts instead of old-style casts
Change prepared with clang-tidy and google-readability-casting check
2020-04-22 17:09:29 +02:00
Tulio Leao
64e4a8420e Use named casts on openrct2/world (#11141) 2020-04-17 21:08:22 +02:00
Duncan
fdf98060cf Change the spatial insert to make it ordered (#11252)
* Change the spatial insert to make it ordered

This is so that the spatial index can be rebuilt and gauranteed to be in the correct order

* Increment Network Version

* Make review changes

* Remove the gSpriteSpatialIndex from the network

* Use safer get function

* Final little tweak
2020-04-09 10:46:26 +01:00
Duncan
f64ea65d03 Rename SPRITE_LIST_TRAIN_HEAD to reduce car head confusion (#11105)
A single car on a coaster can comprise of multiple vehicles. One of those vehicles will be the car head vehicle. The train can comprise of multiple cars. Therefore not all vehicle->IsHead 's will be in SPRITE_LIST_TRAIN_HEAD. This rename makes that slightly more clear
2020-03-29 09:23:24 +01:00
Michael Steenbeek
ef1906d452 Use constants for max sprites and spatial index (#10983) 2020-03-20 20:16:38 +01:00
jeysbach
568b19e7b3 Feature #10637: Console command for removing floating objects 2020-03-16 09:48:26 +01:00
Gymnasiast
cded8313d7 Replace many occurrences of LocationXY16 2020-03-01 22:15:28 +01:00
Michał Janiszewski
d3db4f5cf8 Fix GCC10 warnings (#10703)
The warnings reported were:
```
../src/openrct2/peep/GuestPathfinding.cpp: In function ‘Direction peep_pathfind_choose_direction(TileCoordsXYZ, Peep*)’:
../src/openrct2/peep/GuestPathfinding.cpp:1371:81: error: ‘void* memset(void*, int, size_t)’ writing to an object of non-trivial type ‘struct<unnamed>’; use assignment instead [-Werror=class-memaccess]
 1371 |             std::memset(_peepPathFindHistory, 0xFF, sizeof(_peepPathFindHistory));
      |                                                                                 ^
../src/openrct2/peep/GuestPathfinding.cpp:35:1: note: ‘struct<unnamed>’ declared here
   35 | {
      | ^

../src/openrct2/world/Sprite.cpp: In function ‘void reset_sprite_list()’:
../src/openrct2/world/Sprite.cpp:152:52: error: ‘void* memset(void*, int, size_t)’ clearing an object of non-trivial type ‘union rct_sprite’; use assignment or value-initialization instead [-Werror=class-memaccess]
  152 |     std::memset(_spriteList, 0, sizeof(_spriteList));
      |                                                    ^
In file included from ../src/openrct2/world/Sprite.cpp:10:
../src/openrct2/world/Sprite.h:117:7: note: ‘union rct_sprite’ declared here
  117 | union rct_sprite
      |       ^~~~~~~~~~
```
2020-02-18 00:00:19 +01:00
Michael Steenbeek
6d97601d6f Replace hardcoded occurrences of maximum map size (#10696) 2020-02-13 20:27:13 +01:00
duncanspumpkin
28565b370d Fix clang format 2020-01-19 17:19:45 +00:00
duncanspumpkin
272e4f29a3 Further minor refactors 2020-01-19 17:16:42 +00:00
duncanspumpkin
08ea5585ee Small refactors and cleanups 2020-01-19 17:16:42 +00:00