OpenTTD
|
Implementation of textfile window. More...
#include "stdafx.h"
#include "fileio_func.h"
#include "fontcache.h"
#include "gfx_type.h"
#include "gfx_func.h"
#include "string_func.h"
#include "textfile_gui.h"
#include "widgets/misc_widget.h"
#include "table/strings.h"
#include <zlib.h>
#include <lzma.h>
#include "safeguards.h"
Go to the source code of this file.
Functions | |
static void | Gunzip (byte **bufp, size_t *sizep) |
Do an in-memory gunzip operation. | |
static void | Xunzip (byte **bufp, size_t *sizep) |
Do an in-memory xunzip operation. | |
const char * | GetTextfile (TextfileType type, Subdirectory dir, const char *filename) |
Search a textfile file next to the given content. |
Variables | |
static const NWidgetPart | _nested_textfile_widgets [] |
Widgets for the textfile window. | |
static WindowDesc | _textfile_desc (WDP_CENTER,"textfile", 630, 460, WC_TEXTFILE, WC_NONE, 0, _nested_textfile_widgets, lengthof(_nested_textfile_widgets)) |
Window definition for the textfile window. |
Implementation of textfile window.
Definition in file textfile_gui.cpp.
const char* GetTextfile | ( | TextfileType | type, |
Subdirectory | dir, | ||
const char * | filename | ||
) |
Search a textfile file next to the given content.
type | The type of the textfile to search for. |
dir | The subdirectory to search in. |
filename | The filename of the content to look for. |
NULL
otherwise. Definition at line 386 of file textfile_gui.cpp.
References FioCheckFileExists(), GetCurrentLanguageIsoCode(), lastof, lengthof, seprintf(), and strecpy().
Referenced by GameOptionsWindow::OnInvalidateData(), and AIConfigWindow::OnInvalidateData().
|
static |
Do an in-memory gunzip operation.
This works on a raw deflate stream, or a file with gzip or zlib header.
bufp | A pointer to a buffer containing the input data. This buffer will be freed and replaced by a buffer containing the uncompressed data. |
sizep | A pointer to the buffer size. Before the call, the value pointed to should contain the size of the input buffer. After the call, it contains the size of the uncompressed data. |
When decompressing fails, *bufp is set to NULL and *sizep to 0. The compressed buffer passed in is still freed in this case.
Definition at line 220 of file textfile_gui.cpp.
References free(), and ReallocT().
Referenced by TextfileWindow::LoadTextfile().
|
static |
Do an in-memory xunzip operation.
This works on a .xz or (legacy) .lzma file.
bufp | A pointer to a buffer containing the input data. This buffer will be freed and replaced by a buffer containing the uncompressed data. |
sizep | A pointer to the buffer size. Before the call, the value pointed to should contain the size of the input buffer. After the call, it contains the size of the uncompressed data. |
When decompressing fails, *bufp is set to NULL and *sizep to 0. The compressed buffer passed in is still freed in this case.
Definition at line 276 of file textfile_gui.cpp.
References free(), and ReallocT().
Referenced by TextfileWindow::LoadTextfile().
|
static |
Widgets for the textfile window.
Definition at line 35 of file textfile_gui.cpp.