summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2010-06-30 22:17:53 +0000
committerrubidium <rubidium@openttd.org>2010-06-30 22:17:53 +0000
commit7062bb0bd7b1654567b54d55f401fa693d4ff018 (patch)
treebe4e4963a8252e0aa0cebe21c372687db8837583
parent939145c50b3ad9613342bc1132bae0d0cbf63439 (diff)
downloadopenttd-7062bb0bd7b1654567b54d55f401fa693d4ff018.tar.xz
(svn r20040) -Codechange: some coding style + using proper types
-rw-r--r--src/screenshot.cpp8
-rw-r--r--src/screenshot.h2
2 files changed, 6 insertions, 4 deletions
diff --git a/src/screenshot.cpp b/src/screenshot.cpp
index b5198e276..983c416cb 100644
--- a/src/screenshot.cpp
+++ b/src/screenshot.cpp
@@ -482,12 +482,13 @@ static const ScreenshotFormat _screenshot_formats[] = {
void InitializeScreenshotFormats()
{
- int i, j;
- for (i = 0, j = 0; i != lengthof(_screenshot_formats); i++)
+ uint j = 0;
+ for (uint i = 0; i < lengthof(_screenshot_formats); i++) {
if (!strcmp(_screenshot_format_name, _screenshot_formats[i].extension)) {
j = i;
break;
}
+ }
_cur_screenshot_format = j;
_num_screenshot_formats = lengthof(_screenshot_formats);
}
@@ -497,8 +498,9 @@ const char *GetScreenshotFormatDesc(int i)
return _screenshot_formats[i].name;
}
-void SetScreenshotFormat(int i)
+void SetScreenshotFormat(uint i)
{
+ assert(i < _num_screenshot_formats);
_cur_screenshot_format = i;
strecpy(_screenshot_format_name, _screenshot_formats[i].extension, lastof(_screenshot_format_name));
}
diff --git a/src/screenshot.h b/src/screenshot.h
index 163362f55..2361dc01f 100644
--- a/src/screenshot.h
+++ b/src/screenshot.h
@@ -15,7 +15,7 @@
void InitializeScreenshotFormats();
const char *GetScreenshotFormatDesc(int i);
-void SetScreenshotFormat(int i);
+void SetScreenshotFormat(uint i);
/** Type of requested screenshot */
enum ScreenshotType {