(svn r2631) Move screenshot related variables from variables.h to screenshot.[ch]
This commit is contained in:
		@@ -9,6 +9,10 @@
 | 
				
			|||||||
#include "gui.h"
 | 
					#include "gui.h"
 | 
				
			||||||
#include "screenshot.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.
 | 
					// called by the ScreenShot proc to generate screenshot lines.
 | 
				
			||||||
typedef void ScreenshotCallback(void *userdata, Pixel *buf, uint y, uint pitch, uint n);
 | 
					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);
 | 
					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 MakeScreenshot(void);
 | 
				
			||||||
bool MakeWorldScreenshot(int left, int top, int width, int height, int zoom);
 | 
					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
 | 
					#endif
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,5 +1,6 @@
 | 
				
			|||||||
#include "stdafx.h"
 | 
					#include "stdafx.h"
 | 
				
			||||||
#include "openttd.h"
 | 
					#include "openttd.h"
 | 
				
			||||||
 | 
					#include "screenshot.h"
 | 
				
			||||||
#include "sound.h"
 | 
					#include "sound.h"
 | 
				
			||||||
#include "string.h"
 | 
					#include "string.h"
 | 
				
			||||||
#include "table/currency.h"
 | 
					#include "table/currency.h"
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										25
									
								
								strings.c
									
									
									
									
									
								
							
							
						
						
									
										25
									
								
								strings.c
									
									
									
									
									
								
							@@ -1078,13 +1078,32 @@ void InitializeLanguagePacks(void)
 | 
				
			|||||||
	int n;
 | 
						int n;
 | 
				
			||||||
	int m;
 | 
						int m;
 | 
				
			||||||
	int def;
 | 
						int def;
 | 
				
			||||||
 | 
						int fallback;
 | 
				
			||||||
	LanguagePack hdr;
 | 
						LanguagePack hdr;
 | 
				
			||||||
	FILE *in;
 | 
						FILE *in;
 | 
				
			||||||
	char *files[32];
 | 
						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));
 | 
						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.
 | 
						// go through the language files and make sure that they are valid.
 | 
				
			||||||
	for (i = m = 0; i != n; i++) {
 | 
						for (i = m = 0; i != n; i++) {
 | 
				
			||||||
@@ -1104,10 +1123,12 @@ void InitializeLanguagePacks(void)
 | 
				
			|||||||
		dl->ent[m].file = files[i];
 | 
							dl->ent[m].file = files[i];
 | 
				
			||||||
		dl->ent[m].name = strdup(hdr.name);
 | 
							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++;
 | 
							m++;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
						if (def == -1) def = fallback;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (m == 0)
 | 
						if (m == 0)
 | 
				
			||||||
		error(n == 0 ? "No available language packs" : "Invalid version of language packs");
 | 
							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 _resolutions[32][2];
 | 
				
			||||||
VARDEF uint16 _cur_resolution[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 _savegame_format[8];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
VARDEF char *_config_file;
 | 
					VARDEF char *_config_file;
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user