mirror of https://github.com/OpenTTD/OpenTTD
(svn r25769) -Fix (r25344): Drawing of broken goal references was broken
parent
e2c618eaba
commit
541fe1775a
|
@ -3027,6 +3027,7 @@ STR_STORY_BOOK_PREV_PAGE :{BLACK}Previous
|
||||||
STR_STORY_BOOK_PREV_PAGE_TOOLTIP :{BLACK}Go to previous page
|
STR_STORY_BOOK_PREV_PAGE_TOOLTIP :{BLACK}Go to previous page
|
||||||
STR_STORY_BOOK_NEXT_PAGE :{BLACK}Next
|
STR_STORY_BOOK_NEXT_PAGE :{BLACK}Next
|
||||||
STR_STORY_BOOK_NEXT_PAGE_TOOLTIP :{BLACK}Go to next page
|
STR_STORY_BOOK_NEXT_PAGE_TOOLTIP :{BLACK}Go to next page
|
||||||
|
STR_STORY_BOOK_INVALID_GOAL_REF :{RED}Invalid goal reference
|
||||||
|
|
||||||
# Station list window
|
# Station list window
|
||||||
STR_STATION_LIST_TOOLTIP :{BLACK}Station names - click on name to centre main view on station. Ctrl+Click opens a new viewport on station location
|
STR_STATION_LIST_TOOLTIP :{BLACK}Station names - click on name to centre main view on station. Ctrl+Click opens a new viewport on station location
|
||||||
|
|
|
@ -367,9 +367,10 @@ protected:
|
||||||
* @param width Width of the region available for drawing.
|
* @param width Width of the region available for drawing.
|
||||||
* @param line_height Height of one line of text.
|
* @param line_height Height of one line of text.
|
||||||
* @param action_sprite The sprite to draw.
|
* @param action_sprite The sprite to draw.
|
||||||
|
* @param string_id The string id to draw.
|
||||||
* @return the number of lines.
|
* @return the number of lines.
|
||||||
*/
|
*/
|
||||||
void DrawActionElement(int &y_offset, int width, int line_height, SpriteID action_sprite) const
|
void DrawActionElement(int &y_offset, int width, int line_height, SpriteID action_sprite, StringID string_id = STR_JUST_RAW_STRING) const
|
||||||
{
|
{
|
||||||
Dimension sprite_dim = GetSpriteSize(action_sprite);
|
Dimension sprite_dim = GetSpriteSize(action_sprite);
|
||||||
uint element_height = max(sprite_dim.height, (uint)line_height);
|
uint element_height = max(sprite_dim.height, (uint)line_height);
|
||||||
|
@ -378,7 +379,7 @@ protected:
|
||||||
uint text_top = y_offset + (element_height - line_height) / 2;
|
uint text_top = y_offset + (element_height - line_height) / 2;
|
||||||
|
|
||||||
DrawSprite(action_sprite, PAL_NONE, 0, sprite_top);
|
DrawSprite(action_sprite, PAL_NONE, 0, sprite_top);
|
||||||
DrawString(sprite_dim.width + WD_FRAMETEXT_LEFT, width, text_top, STR_JUST_RAW_STRING, TC_BLACK);
|
DrawString(sprite_dim.width + WD_FRAMETEXT_LEFT, width, text_top, string_id, TC_BLACK);
|
||||||
|
|
||||||
y_offset += element_height;
|
y_offset += element_height;
|
||||||
}
|
}
|
||||||
|
@ -523,12 +524,9 @@ public:
|
||||||
|
|
||||||
case SPET_GOAL: {
|
case SPET_GOAL: {
|
||||||
Goal *g = Goal::Get((GoalID) pe->referenced_id);
|
Goal *g = Goal::Get((GoalID) pe->referenced_id);
|
||||||
if (g != NULL) {
|
StringID string_id = g == NULL ? STR_STORY_BOOK_INVALID_GOAL_REF : STR_JUST_RAW_STRING;
|
||||||
SetDParamStr(0, g->text);
|
if (g != NULL) SetDParamStr(0, g->text);
|
||||||
DrawActionElement(y_offset, right - x, line_height, GetPageElementSprite(*pe));
|
DrawActionElement(y_offset, right - x, line_height, GetPageElementSprite(*pe), string_id);
|
||||||
} else {
|
|
||||||
y_offset += line_height;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue