File diff r9198:e5a298cd150f → r9199:7d9724de3af0
src/news_gui.cpp
Show inline comments
 
@@ -75,26 +75,17 @@ static NewsID _forced_news = INVALID_NEW
 
static uint _total_news = 0; ///< Number of news items in FIFO queue @see _news_items
 

	
 
void DrawNewsNewVehicleAvail(Window *w, const NewsItem *ni);
 
void DrawNewsBankrupcy(Window *w, const NewsItem *ni);
 
static void MoveToNextItem();
 

	
 
StringID GetNewsStringNewVehicleAvail(const NewsItem *ni);
 
StringID GetNewsStringBankrupcy(const NewsItem *ni);
 

	
 
static DrawNewsCallbackProc * const _draw_news_callback[] = {
 
	DrawNewsNewVehicleAvail,  ///< DNC_VEHICLEAVAIL
 
	DrawNewsBankrupcy,        ///< DNC_BANKRUPCY
 
};
 

	
 
extern GetNewsStringCallbackProc * const _get_news_string_callback[];
 
GetNewsStringCallbackProc * const _get_news_string_callback[] = {
 
	GetNewsStringNewVehicleAvail,  ///< DNC_VEHICLEAVAIL
 
	GetNewsStringBankrupcy,        ///< DNC_BANKRUPCY
 
};
 

	
 
/** Initialize the news-items data structures */
 
void InitNewsItemStructs()
 
{
 
	free(_news_items);
 
	_max_news_items = max(ScaleByMapSize(30), 30U);
 
	_news_items = CallocT<NewsItem>(_max_news_items);
 
@@ -604,18 +595,14 @@ static NewsID getNews(NewsID i)
 
 */
 
static void DrawNewsString(int x, int y, uint16 color, const NewsItem *ni, uint maxw)
 
{
 
	char buffer[512], buffer2[512];
 
	StringID str;
 

	
 
	if (ni->display_mode == NM_CALLBACK) {
 
		str = _get_news_string_callback[ni->callback](ni);
 
	} else {
 
		CopyInDParam(0, ni->params, lengthof(ni->params));
 
		str = ni->string_id;
 
	}
 
	CopyInDParam(0, ni->params, lengthof(ni->params));
 
	str = ni->string_id;
 

	
 
	GetString(buffer, str, lastof(buffer));
 
	/* Copy the just gotten string to another buffer to remove any formatting
 
	 * from it such as big fonts, etc. */
 
	const char *ptr = buffer;
 
	char *dest = buffer2;