(svn r2631) Move screenshot related variables from variables.h to screenshot.[ch]

pull/155/head
tron 19 years ago
parent 3428e4e4b0
commit bce6f5c0a5

@ -9,6 +9,10 @@
#include "gui.h"
#include "screenshot.h"
char _screenshot_format_name[8];
uint _num_screenshot_formats;
uint _cur_screenshot_format;
// called by the ScreenShot proc to generate screenshot lines.
typedef void ScreenshotCallback(void *userdata, Pixel *buf, uint y, uint pitch, uint n);
typedef bool ScreenshotHandlerProc(const char *name, ScreenshotCallback *callb, void *userdata, uint w, uint h, int pixelformat, const Colour *palette);

@ -9,4 +9,8 @@ void SetScreenshotFormat(int i);
bool MakeScreenshot(void);
bool MakeWorldScreenshot(int left, int top, int width, int height, int zoom);
extern char _screenshot_format_name[8];
extern uint _num_screenshot_formats;
extern uint _cur_screenshot_format;
#endif

@ -1,5 +1,6 @@
#include "stdafx.h"
#include "openttd.h"
#include "screenshot.h"
#include "sound.h"
#include "string.h"
#include "table/currency.h"

@ -1078,13 +1078,32 @@ void InitializeLanguagePacks(void)
int n;
int m;
int def;
int fallback;
LanguagePack hdr;
FILE *in;
char *files[32];
uint j;
char lang[] = "en";
static const char* env[] = {
"LANGUAGE",
"LC_ALL",
"LC_MESSAGES",
"LANG"
};
for (j = 0; j < lengthof(env); j++) {
const char* envlang = getenv(env[j]);
if (envlang != NULL) {
snprintf(lang, lengthof(lang), "%.2s", envlang);
break;
}
}
n = GetLanguageList(files, lengthof(files));
def = 0; // default language file
def = -1;
fallback = 0;
// go through the language files and make sure that they are valid.
for (i = m = 0; i != n; i++) {
@ -1104,10 +1123,12 @@ void InitializeLanguagePacks(void)
dl->ent[m].file = files[i];
dl->ent[m].name = strdup(hdr.name);
if (strcmp(hdr.name, "English") == 0) def = m;
if (strcmp(hdr.name, "English") == 0) fallback = m;
if (strcmp(hdr.isocode, lang) == 0) def = m;
m++;
}
if (def == -1) def = fallback;
if (m == 0)
error(n == 0 ? "No available language packs" : "Invalid version of language packs");

@ -366,9 +366,6 @@ VARDEF int _num_resolutions;
VARDEF uint16 _resolutions[32][2];
VARDEF uint16 _cur_resolution[2];
VARDEF char _screenshot_format_name[8];
VARDEF int _num_screenshot_formats, _cur_screenshot_format;
VARDEF char _savegame_format[8];
VARDEF char *_config_file;

Loading…
Cancel
Save