1
0
Fork 0

Compare commits

...

3 Commits

4 changed files with 10 additions and 5 deletions

View File

@ -52,7 +52,12 @@ struct EndGameHighScoreBaseWindow : Window {
/* Standard background slices are 50 pixels high, but it's designed
* for 480 pixels total. 96% of 500 is 480. */
Dimension dim = GetSpriteSize(this->background_img);
Point pt = this->GetTopLeft(dim.width, dim.height * 96 / 10);
auto total_height = dim.height * 96 / 10;
Point pt = this->GetTopLeft(dim.width, total_height);
/* Original graphics contain some transparency, which assumes a black background. */
GfxFillRect(pt.x, pt.y, pt.x + dim.width - 1, pt.y + total_height - 1, PC_BLACK);
/* Center Highscore/Endscreen background */
for (uint i = 0; i < 10; i++) { // the image is split into 10 50px high parts
DrawSprite(this->background_img + i, PAL_NONE, pt.x, pt.y + (i * dim.height));

View File

@ -476,7 +476,7 @@ CommandCost GetErrorMessageFromLocationCallbackResult(uint16_t cb_res, std::span
/* If this error isn't for the local player then it won't be seen, so don't bother encoding anything. */
if (IsLocalCompany()) {
StringID stringid = GetGRFStringID(grffile->grfid, text_id);
auto params = GetGRFSringTextStackParameters(grffile, stringid, textstack);
auto params = GetGRFStringTextStackParameters(grffile, stringid, textstack);
res.SetEncodedMessage(GetEncodedStringWithArgs(stringid, params));
}

View File

@ -973,7 +973,7 @@ static void HandleNewGRFStringControlCodes(std::string_view str, TextRefStack &s
* @param textstack Text parameter stack.
* @returns Parameters for GRF string.
*/
std::vector<StringParameter> GetGRFSringTextStackParameters(const GRFFile *grffile, StringID stringid, std::span<const int32_t> textstack)
std::vector<StringParameter> GetGRFStringTextStackParameters(const GRFFile *grffile, StringID stringid, std::span<const int32_t> textstack)
{
if (stringid == INVALID_STRING_ID) return {};
@ -998,6 +998,6 @@ std::vector<StringParameter> GetGRFSringTextStackParameters(const GRFFile *grffi
std::string GetGRFStringWithTextStack(const struct GRFFile *grffile, GRFStringID grfstringid, std::span<const int32_t> textstack)
{
StringID stringid = GetGRFStringID(grffile->grfid, grfstringid);
auto params = GetGRFSringTextStackParameters(grffile, stringid, textstack);
auto params = GetGRFStringTextStackParameters(grffile, stringid, textstack);
return GetStringWithArgs(stringid, params);
}

View File

@ -28,7 +28,7 @@ void AddGRFTextToList(GRFTextWrapper &list, std::string_view text_to_add);
bool CheckGrfLangID(uint8_t lang_id, uint8_t grf_version);
std::vector<StringParameter> GetGRFSringTextStackParameters(const struct GRFFile *grffile, StringID stringid, std::span<const int32_t> textstack);
std::vector<StringParameter> GetGRFStringTextStackParameters(const struct GRFFile *grffile, StringID stringid, std::span<const int32_t> textstack);
std::string GetGRFStringWithTextStack(const struct GRFFile *grffile, GRFStringID grfstringid, std::span<const int32_t> textstack);
#endif /* NEWGRF_TEXT_H */