mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-16 11:33:03 +01:00
Merge pull request #4372 from janisozaur/news-items
Integrate news items
This commit is contained in:
@@ -25,7 +25,7 @@
|
||||
#include "../util/util.h"
|
||||
#include "news_item.h"
|
||||
|
||||
rct_news_item *gNewsItems = RCT2_ADDRESS(RCT2_ADDRESS_NEWS_ITEM_LIST, rct_news_item);
|
||||
rct_news_item gNewsItems[MAX_NEWS_ITEMS];
|
||||
|
||||
/** rct2: 0x0097BE7C */
|
||||
const uint8 news_type_properties[] = {
|
||||
@@ -46,7 +46,7 @@ static int news_item_get_new_history_slot();
|
||||
|
||||
bool news_item_is_valid_idx(int index)
|
||||
{
|
||||
if (index > MAX_NEWS_ITEMS) {
|
||||
if (index >= MAX_NEWS_ITEMS) {
|
||||
log_error("Tried to get news item past MAX_NEWS.");
|
||||
return false;
|
||||
}
|
||||
@@ -144,7 +144,7 @@ void news_item_update_current()
|
||||
void news_item_close_current()
|
||||
{
|
||||
int i;
|
||||
rct_news_item *newsItems = RCT2_ADDRESS(RCT2_ADDRESS_NEWS_ITEM_LIST, rct_news_item);
|
||||
rct_news_item *newsItems = gNewsItems;
|
||||
|
||||
// Check if there is a current message
|
||||
if (news_item_is_queue_empty())
|
||||
@@ -157,7 +157,7 @@ void news_item_close_current()
|
||||
newsItems[i] = newsItems[0];
|
||||
|
||||
// Set the end of the end of the history list
|
||||
if (i < MAX_NEWS_ITEMS)
|
||||
if (i < MAX_NEWS_ITEMS - 1)
|
||||
newsItems[i + 1].type = NEWS_ITEM_NULL;
|
||||
|
||||
// Invalidate the news window
|
||||
@@ -280,7 +280,7 @@ void news_item_get_subject_location(int type, int subject, int *x, int *y, int *
|
||||
*/
|
||||
void news_item_add_to_queue(uint8 type, rct_string_id string_id, uint32 assoc)
|
||||
{
|
||||
utf8 *buffer = RCT2_ADDRESS(0x0141EF68, char);
|
||||
utf8 buffer[256];
|
||||
void *args = gCommonFormatArgs;
|
||||
|
||||
format_string(buffer, string_id, args); // overflows possible?
|
||||
@@ -289,7 +289,7 @@ void news_item_add_to_queue(uint8 type, rct_string_id string_id, uint32 assoc)
|
||||
|
||||
void news_item_add_to_queue_raw(uint8 type, const utf8 *text, uint32 assoc)
|
||||
{
|
||||
rct_news_item *newsItem = RCT2_ADDRESS(RCT2_ADDRESS_NEWS_ITEM_LIST, rct_news_item);
|
||||
rct_news_item *newsItem = gNewsItems;
|
||||
|
||||
// find first open slot
|
||||
while (newsItem->type != NEWS_ITEM_NULL) {
|
||||
@@ -402,7 +402,7 @@ void news_item_disable_news(uint8 type, uint32 assoc)
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 11; i <= MAX_NEWS_ITEMS; i++) {
|
||||
for (int i = 11; i < MAX_NEWS_ITEMS; i++) {
|
||||
if (!news_item_is_empty(i)) {
|
||||
rct_news_item * const newsItem = news_item_get(i);
|
||||
if (type == newsItem->type && assoc == newsItem->assoc) {
|
||||
@@ -417,7 +417,7 @@ void news_item_disable_news(uint8 type, uint32 assoc)
|
||||
|
||||
void news_item_add_to_queue_custom(rct_news_item *newNewsItem)
|
||||
{
|
||||
rct_news_item *newsItem = RCT2_ADDRESS(RCT2_ADDRESS_NEWS_ITEM_LIST, rct_news_item);
|
||||
rct_news_item *newsItem = gNewsItems;
|
||||
|
||||
// Find first open slot
|
||||
while (newsItem->type != NEWS_ITEM_NULL) {
|
||||
|
||||
@@ -57,9 +57,9 @@ typedef struct rct_news_item {
|
||||
assert_struct_size(rct_news_item, 12 + 256);
|
||||
#pragma pack(pop)
|
||||
|
||||
#define MAX_NEWS_ITEMS 60
|
||||
#define MAX_NEWS_ITEMS 61
|
||||
|
||||
extern rct_news_item *gNewsItems;
|
||||
extern rct_news_item gNewsItems[MAX_NEWS_ITEMS];
|
||||
|
||||
void news_item_init_queue();
|
||||
void news_item_update_current();
|
||||
|
||||
@@ -979,8 +979,8 @@ void S4Importer::ImportParkFlags()
|
||||
}
|
||||
|
||||
// News items
|
||||
rct_news_item *newsItems = RCT2_ADDRESS(RCT2_ADDRESS_NEWS_ITEM_LIST, rct_news_item);
|
||||
for (int i = 0; i < 61; i++)
|
||||
rct_news_item *newsItems = gNewsItems;
|
||||
for (int i = 0; i < MAX_NEWS_ITEMS; i++)
|
||||
{
|
||||
newsItems[i] = _s4.messages[i];
|
||||
}
|
||||
|
||||
@@ -321,7 +321,7 @@ typedef struct rct_s6_data {
|
||||
uint8 next_weather_gloom;
|
||||
uint8 current_rain_level;
|
||||
uint8 next_rain_level;
|
||||
rct_news_item news_items[61];
|
||||
rct_news_item news_items[MAX_NEWS_ITEMS];
|
||||
uint8 pad_13CE730[64];
|
||||
uint32 rct1_scenario_flags;
|
||||
uint16 wide_path_tile_loop_x;
|
||||
|
||||
Reference in New Issue
Block a user