From 41435742430ddcbdffc609df6bf90709cff2870a Mon Sep 17 00:00:00 2001 From: Jackson Davis Date: Sun, 5 Apr 2015 07:55:04 -0700 Subject: [PATCH] Rename and clean up --- src/management/news_item.c | 12 +++++++----- src/management/news_item.h | 2 +- src/peep/peep.c | 4 ++-- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/management/news_item.c b/src/management/news_item.c index d326b79623..e1be0d3572 100644 --- a/src/management/news_item.c +++ b/src/management/news_item.c @@ -28,6 +28,8 @@ #include "../world/sprite.h" #include "news_item.h" +rct_news_item *newsItems = RCT2_ADDRESS(RCT2_ADDRESS_NEWS_ITEM_LIST, rct_news_item); + void window_game_bottom_toolbar_invalidate_news_item(); static int news_item_get_new_history_slot(); @@ -348,10 +350,10 @@ void news_item_open_subject(int type, int subject) /** * rct2: 0x0066E407 */ -void news_item_peep_removed(uint8 type, uint32 sprite_index) { - rct_news_item* newsItem = RCT2_ADDRESS(RCT2_ADDRESS_NEWS_ITEM_LIST, rct_news_item); +void news_item_disable_news(uint8 type, uint32 assoc) { + rct_news_item* newsItem = newsItems; while (newsItem->type != NEWS_ITEM_NULL) { - if (type == newsItem->type && sprite_index == newsItem->assoc) { + if (type == newsItem->type && assoc == newsItem->assoc) { newsItem->flags |= 0x1; if (newsItem == RCT2_ADDRESS(RCT2_ADDRESS_NEWS_ITEM_LIST, rct_news_item)) { window_game_bottom_toolbar_invalidate_news_item(); @@ -360,9 +362,9 @@ void news_item_peep_removed(uint8 type, uint32 sprite_index) { newsItem++; } - newsItem = RCT2_ADDRESS(0x013CB2D8, rct_news_item); + newsItem = &newsItems[11]; //0x13CB2D8 while (newsItem->type != NEWS_ITEM_NULL) { - if (type == newsItem->type && sprite_index == newsItem->assoc) { + if (type == newsItem->type && assoc == newsItem->assoc) { newsItem->flags |= 0x1; window_invalidate_by_class(WC_RECENT_NEWS); } diff --git a/src/management/news_item.h b/src/management/news_item.h index 27a824ef41..83ddd57d90 100644 --- a/src/management/news_item.h +++ b/src/management/news_item.h @@ -58,6 +58,6 @@ void news_item_close_current(); void news_item_get_subject_location(int type, int subject, int *x, int *y, int *z); void news_item_add_to_queue(uint8 type, rct_string_id string_id, uint32 assoc); void news_item_open_subject(int type, int subject); -void news_item_peep_removed(uint8 type, uint32 sprite_index); +void news_item_disable_news(uint8 type, uint32 assoc); #endif diff --git a/src/peep/peep.c b/src/peep/peep.c index 3d1d3a347e..e092a88240 100644 --- a/src/peep/peep.c +++ b/src/peep/peep.c @@ -567,7 +567,7 @@ void peep_sprite_remove(rct_peep* peep){ if (peep->type == PEEP_TYPE_GUEST){ window_invalidate_by_class(WC_GUEST_LIST); - news_item_peep_removed(NEWS_ITEM_PEEP_ON_RIDE, peep->sprite_index); + news_item_disable_news(NEWS_ITEM_PEEP_ON_RIDE, peep->sprite_index); } else{ window_invalidate_by_class(WC_STAFF_LIST); @@ -577,7 +577,7 @@ void peep_sprite_remove(rct_peep* peep){ sub_6C0C3F(); peep->type = PEEP_TYPE_STAFF; - news_item_peep_removed(NEWS_ITEM_PEEP, peep->sprite_index); + news_item_disable_news(NEWS_ITEM_PEEP, peep->sprite_index); } sprite_remove((rct_sprite*)peep); }