Changeset - r17721:d580fdad4b98
[Not reviewed]
master
0 4 0
alberth - 13 years ago 2011-05-28 13:55:05
alberth@openttd.org
(svn r22511) -Add: Function to make heightmap file paths.
4 files changed with 24 insertions and 0 deletions:
0 comments (0 inline, 0 general)
src/fios.cpp
Show inline comments
 
@@ -13,12 +13,13 @@
 
 */
 

	
 
#include "stdafx.h"
 
#include "fios.h"
 
#include "fileio_func.h"
 
#include "tar_type.h"
 
#include "screenshot.h"
 
#include "string_func.h"
 
#include <sys/stat.h>
 

	
 
#ifndef WIN32
 
# include <unistd.h>
 
#endif /* WIN32 */
 
@@ -183,12 +184,27 @@ void FiosMakeSavegameName(char *buf, con
 
	const char *extension = (_game_mode == GM_EDITOR) ? ".scn" : ".sav";
 

	
 
	FiosMakeFilename(buf, _fios_path, name, extension, size);
 
}
 

	
 
/**
 
 * Construct a filename for a height map.
 
 * @param buf Destination buffer.
 
 * @param name Filename.
 
 * @param size Size of \a buf.
 
 */
 
void FiosMakeHeightmapName(char *buf, const char *name, size_t size)
 
{
 
	char ext[5];
 
	ext[0] = '.';
 
	strecpy(ext + 1, GetCurrentScreenshotExtension(), lastof(ext));
 

	
 
	FiosMakeFilename(buf, _fios_path, name, ext, size);
 
}
 

	
 
/**
 
 * Delete a file.
 
 * @param name Filename to delete.
 
 */
 
bool FiosDelete(const char *name)
 
{
 
	char filename[512];
src/fios.h
Show inline comments
 
@@ -161,12 +161,13 @@ void FiosGetHeightmapList(SaveLoadDialog
 

	
 
void FiosFreeSavegameList();
 
const char *FiosBrowseTo(const FiosItem *item);
 

	
 
StringID FiosGetDescText(const char **path, uint64 *total_free);
 
bool FiosDelete(const char *name);
 
void FiosMakeHeightmapName(char *buf,const char *name, size_t size);
 
void FiosMakeSavegameName(char *buf, const char *name, size_t size);
 

	
 
FiosType FiosGetSavegameListCallback(SaveLoadDialogMode mode, const char *file, const char *ext, char *title, const char *last);
 

	
 
int CDECL CompareFiosItems(const FiosItem *a, const FiosItem *b);
 

	
src/screenshot.cpp
Show inline comments
 
@@ -574,12 +574,18 @@ static const ScreenshotFormat _screensho
 
	{"PNG", "png", &MakePNGImage},
 
#endif
 
	{"BMP", "bmp", &MakeBMPImage},
 
	{"PCX", "pcx", &MakePCXImage},
 
};
 

	
 
/** Get filename extension of current screenshot file format. */
 
const char *GetCurrentScreenshotExtension()
 
{
 
	return _screenshot_formats[_cur_screenshot_format].extension;
 
}
 

	
 
/** Initialize screenshot format information on startup, with #_screenshot_format_name filled from the loadsave code. */
 
void InitializeScreenshotFormats()
 
{
 
	uint j = 0;
 
	for (uint i = 0; i < lengthof(_screenshot_formats); i++) {
 
		if (!strcmp(_screenshot_format_name, _screenshot_formats[i].extension)) {
src/screenshot.h
Show inline comments
 
@@ -13,12 +13,13 @@
 
#define SCREENSHOT_H
 

	
 
void InitializeScreenshotFormats();
 

	
 
const char *GetScreenshotFormatDesc(int i);
 
void SetScreenshotFormat(uint i);
 
const char *GetCurrentScreenshotExtension();
 

	
 
/** Type of requested screenshot */
 
enum ScreenshotType {
 
	SC_VIEWPORT,  ///< Screenshot of viewport.
 
	SC_RAW,       ///< Raw screenshot from blitter buffer.
 
	SC_ZOOMEDIN,  ///< Zoomed in screenshot of the visible area.
0 comments (0 inline, 0 general)