1 /*****************************************************************************
2  * Copyright (c) 2014-2020 OpenRCT2 developers
3  *
4  * For a complete list of all authors, please refer to contributors.md
5  * Interested in contributing? Visit https://github.com/OpenRCT2/OpenRCT2
6  *
7  * OpenRCT2 is licensed under the GNU General Public License version 3.
8  *****************************************************************************/
9 
10 #pragma once
11 
12 #include "../common.h"
13 #include "../ride/RideTypes.h"
14 #include "Location.hpp"
15 
16 #include <string>
17 
18 class Formatter;
19 struct TileElement;
20 struct WallElement;
21 
22 using BannerIndex = uint16_t;
23 
24 constexpr ObjectEntryIndex BANNER_NULL = OBJECT_ENTRY_INDEX_NULL;
25 constexpr size_t MAX_BANNERS = 250;
26 constexpr BannerIndex BANNER_INDEX_NULL = static_cast<BannerIndex>(-1);
27 
28 constexpr uint8_t SCROLLING_MODE_NONE = 255;
29 
30 struct Banner
31 {
32     BannerIndex id = BANNER_INDEX_NULL;
33     ObjectEntryIndex type = BANNER_NULL;
34     uint8_t flags{};
35     std::string text;
36     uint8_t colour{};
37     ride_id_t ride_index{};
38     uint8_t text_colour{};
39     TileCoordsXY position;
40 
IsNullBanner41     bool IsNull() const
42     {
43         return type == BANNER_NULL;
44     }
45 
46     std::string GetText() const;
47     void FormatTextTo(Formatter&, bool addColour) const;
48     void FormatTextTo(Formatter&) const;
49 };
50 
51 enum BANNER_FLAGS
52 {
53     BANNER_FLAG_NO_ENTRY = (1 << 0),
54     BANNER_FLAG_IS_LARGE_SCENERY = (1 << 1),
55     BANNER_FLAG_LINKED_TO_RIDE = (1 << 2),
56     BANNER_FLAG_IS_WALL = (1 << 3)
57 };
58 
59 void banner_init();
60 TileElement* banner_get_tile_element(BannerIndex bannerIndex);
61 WallElement* banner_get_scrolling_wall_tile_element(BannerIndex bannerIndex);
62 ride_id_t banner_get_closest_ride_index(const CoordsXYZ& mapPos);
63 void banner_reset_broken_index();
64 void fix_duplicated_banners();
65 void UnlinkAllRideBanners();
66 void UnlinkAllBannersForRide(ride_id_t rideId);
67 Banner* GetBanner(BannerIndex id);
68 Banner* GetOrCreateBanner(BannerIndex id);
69 Banner* CreateBanner();
70 void DeleteBanner(BannerIndex id);
71 void TrimBanners();
72 size_t GetNumBanners();
73 bool HasReachedBannerLimit();
74