Merge branch 'master' into jgrpp
# Conflicts: # src/cheat_gui.cpp # src/genworld_gui.cpp # src/landscape.cpp # src/lang/english.txt # src/saveload/afterload.cpp # src/screenshot.cpp # src/settings_gui.cpp # src/settings_internal.h # src/settings_type.h # src/table/settings.ini # src/tile_type.h # src/widgets/genworld_widget.h
This commit is contained in:
@@ -42,6 +42,7 @@ uint _num_screenshot_formats; ///< Number of available screenshot format
|
||||
uint _cur_screenshot_format; ///< Index of the currently selected screenshot format in #_screenshot_formats.
|
||||
static char _screenshot_name[128]; ///< Filename of the screenshot file.
|
||||
char _full_screenshot_name[MAX_PATH]; ///< Pathname of the screenshot file.
|
||||
uint _heightmap_highest_peak; ///< When saving a heightmap, this contains the highest peak on the map.
|
||||
|
||||
static const char *_screenshot_aux_text_key = nullptr;
|
||||
static const char *_screenshot_aux_text_value = nullptr;
|
||||
@@ -848,7 +849,7 @@ static void HeightmapCallback(void *userdata, void *buffer, uint y, uint pitch,
|
||||
while (n > 0) {
|
||||
TileIndex ti = TileXY(MapMaxX(), y);
|
||||
for (uint x = MapMaxX(); true; x--) {
|
||||
*buf = 256 * TileHeight(ti) / (1 + _settings_game.construction.max_heightlevel);
|
||||
*buf = 256 * TileHeight(ti) / (1 + _heightmap_highest_peak);
|
||||
buf++;
|
||||
if (x == 0) break;
|
||||
ti = TILE_ADDXY(ti, -1, 0);
|
||||
@@ -871,6 +872,13 @@ bool MakeHeightmapScreenshot(const char *filename)
|
||||
palette[i].g = i;
|
||||
palette[i].b = i;
|
||||
}
|
||||
|
||||
_heightmap_highest_peak = 0;
|
||||
for (TileIndex tile = 0; tile < MapSize(); tile++) {
|
||||
uint h = TileHeight(tile);
|
||||
_heightmap_highest_peak = std::max(h, _heightmap_highest_peak);
|
||||
}
|
||||
|
||||
const ScreenshotFormat *sf = _screenshot_formats + _cur_screenshot_format;
|
||||
return sf->proc(filename, HeightmapCallback, nullptr, MapSizeX(), MapSizeY(), 8, palette);
|
||||
}
|
||||
@@ -918,11 +926,17 @@ void MakeScreenshotWithConfirm(ScreenshotType t)
|
||||
* Show a a success or failure message indicating the result of a screenshot action
|
||||
* @param ret whether the screenshot action was successful
|
||||
*/
|
||||
static void ShowScreenshotResultMessage(bool ret)
|
||||
static void ShowScreenshotResultMessage(ScreenshotType t, bool ret)
|
||||
{
|
||||
if (ret) {
|
||||
SetDParamStr(0, _screenshot_name);
|
||||
ShowErrorMessage(STR_MESSAGE_SCREENSHOT_SUCCESSFULLY, INVALID_STRING_ID, WL_WARNING);
|
||||
if (t == SC_HEIGHTMAP) {
|
||||
SetDParamStr(0, _screenshot_name);
|
||||
SetDParam(1, _heightmap_highest_peak);
|
||||
ShowErrorMessage(STR_MESSAGE_HEIGHTMAP_SUCCESSFULLY, INVALID_STRING_ID, WL_CRITICAL);
|
||||
} else {
|
||||
SetDParamStr(0, _screenshot_name);
|
||||
ShowErrorMessage(STR_MESSAGE_SCREENSHOT_SUCCESSFULLY, INVALID_STRING_ID, WL_WARNING);
|
||||
}
|
||||
} else {
|
||||
ShowErrorMessage(STR_ERROR_SCREENSHOT_FAILED, INVALID_STRING_ID, WL_ERROR);
|
||||
}
|
||||
@@ -990,7 +1004,7 @@ bool MakeScreenshot(ScreenshotType t, const char *name, uint32 width, uint32 hei
|
||||
NOT_REACHED();
|
||||
}
|
||||
|
||||
ShowScreenshotResultMessage(ret);
|
||||
ShowScreenshotResultMessage(t, ret);
|
||||
|
||||
return ret;
|
||||
}
|
||||
@@ -1021,7 +1035,7 @@ bool MakeSmallMapScreenshot(unsigned int width, unsigned int height, SmallMapWin
|
||||
_screenshot_name[0] = '\0';
|
||||
const ScreenshotFormat *sf = _screenshot_formats + _cur_screenshot_format;
|
||||
bool ret = sf->proc(MakeScreenshotName(SCREENSHOT_NAME, sf->extension), SmallMapCallback, window, width, height, BlitterFactory::GetCurrentBlitter()->GetScreenDepth(), _cur_palette.palette);
|
||||
ShowScreenshotResultMessage(ret);
|
||||
ShowScreenshotResultMessage(SC_SMALLMAP, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user