1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-18 04:23:20 +01:00

Remove 256 text length constraint

This commit is contained in:
Ted John
2017-01-17 17:19:03 +00:00
parent 8b46b32031
commit 94cb5818b7
3 changed files with 7 additions and 12 deletions

View File

@@ -734,7 +734,7 @@ void game_convert_strings_to_utf8()
NewsItem *newsItem = news_item_get(i);
if (!str_is_null_or_empty(newsItem->Text)) {
rct2_to_utf8_self(newsItem->Text, 256);
rct2_to_utf8_self(newsItem->Text, sizeof(newsItem->Text));
}
}
}
@@ -763,7 +763,7 @@ void game_convert_strings_to_rct2(rct_s6_data *s6)
rct12_news_item *newsItem = &s6->news_items[i];
if (!str_is_null_or_empty(newsItem->Text)) {
utf8_to_rct2_self(newsItem->Text, 256);
utf8_to_rct2_self(newsItem->Text, sizeof(newsItem->Text));
}
}
}

View File

@@ -305,13 +305,12 @@ void news_item_add_to_queue_raw(uint8 type, const utf8 *text, uint32 assoc)
newsItem->Ticks = 0;
newsItem->MonthYear = gDateMonthsElapsed;
newsItem->Day = ((days_in_month[(newsItem->MonthYear & 7)] * gDateMonthTicks) >> 16) + 1;
safe_strcpy(newsItem->Text, text, 255);
newsItem->Text[254] = 0;
safe_strcpy(newsItem->Text, text, sizeof(newsItem->Text));
// blatant disregard for what happens on the last element.
// Change this when we implement the queue ourselves.
newsItem++;
newsItem->Type = 0;
newsItem->Type = NEWS_ITEM_NULL;
}
/**
@@ -428,5 +427,5 @@ void news_item_add_to_queue_custom(NewsItem *newNewsItem)
*newsItem = *newNewsItem;
newsItem++;
newsItem->Type = 0;
newsItem->Type = NEWS_ITEM_NULL;
}

View File

@@ -295,12 +295,8 @@ static void window_news_scrollpaint(rct_window *w, rct_drawpixelinfo *dpi, sint3
gfx_draw_string_left(dpi, STR_NEWS_DATE_FORMAT, gCommonFormatArgs, COLOUR_WHITE, 4, y);
// Item text
utf8 buffer[400];
utf8 *ch = buffer;
ch = utf8_write_codepoint(ch, FORMAT_SMALLFONT);
memcpy(ch, newsItem->Text, 256);
ch = buffer;
gfx_draw_string_left_wrapped(dpi, &ch, 2, y + 10, 325, STR_STRING, COLOUR_BRIGHT_GREEN);
utf8 *text = newsItem->Text;
gfx_draw_string_left_wrapped(dpi, &text, 2, y + 10, 325, STR_BOTTOM_TOOLBAR_NEWS_TEXT, COLOUR_BRIGHT_GREEN);
// Subject button
if ((news_type_properties[newsItem->Type] & NEWS_TYPE_HAS_SUBJECT) && !(newsItem->Flags & 1)) {