summaryrefslogtreecommitdiff
path: root/src/console_cmds.cpp
diff options
context:
space:
mode:
authorsmatz <smatz@openttd.org>2009-11-01 18:15:35 +0000
committersmatz <smatz@openttd.org>2009-11-01 18:15:35 +0000
commit090c762921d7452b7f7730016d6a1d385fcfc953 (patch)
tree2c52bd64ede330c0b5b308dfd79d7b0f9606e5a5 /src/console_cmds.cpp
parentbe446d6f542fccf1e5cc2ed50225c4a8289aa7dc (diff)
downloadopenttd-090c762921d7452b7f7730016d6a1d385fcfc953.tar.xz
(svn r17938) -Feature: non-automatic screenshot name can be entered in console
Diffstat (limited to 'src/console_cmds.cpp')
-rw-r--r--src/console_cmds.cpp29
1 files changed, 22 insertions, 7 deletions
diff --git a/src/console_cmds.cpp b/src/console_cmds.cpp
index 83ec9a3ef..1f0d3f42e 100644
--- a/src/console_cmds.cpp
+++ b/src/console_cmds.cpp
@@ -1218,22 +1218,37 @@ DEF_CONSOLE_CMD(ConAlias)
DEF_CONSOLE_CMD(ConScreenShot)
{
if (argc == 0) {
- IConsoleHelp("Create a screenshot of the game. Usage: 'screenshot [big | no_con]'");
- IConsoleHelp("'big' makes a screenshot of the whole map, 'no_con' hides the console to create the screenshot");
+ IConsoleHelp("Create a screenshot of the game. Usage: 'screenshot [big | no_con] [file name]'");
+ IConsoleHelp("'big' makes a screenshot of the whole map, 'no_con' hides the console to create"
+ "the screenshot. Screenshots of whole map are always drawn without console");
return true;
}
if (argc > 3) return false;
- SetScreenshotType(SC_VIEWPORT);
- if (argc > 1) {
- if (strcmp(argv[1], "big") == 0 || (argc == 3 && strcmp(argv[2], "big") == 0))
- SetScreenshotType(SC_WORLD);
+ ScreenshotType type = SC_VIEWPORT;
+ const char *name = NULL;
- if (strcmp(argv[1], "no_con") == 0 || (argc == 3 && strcmp(argv[2], "no_con") == 0))
+ if (argc > 1) {
+ if (strcmp(argv[1], "big") == 0) {
+ /* screenshot big [filename] */
+ type = SC_WORLD;
+ if (argc > 2) name = argv[2];
+ } else if (strcmp(argv[1], "no_con") == 0) {
+ /* screenshot no_con [filename] */
IConsoleClose();
+ if (argc > 2) name = argv[2];
+ } else if (argc == 2) {
+ /* screenshot filename */
+ name = argv[1];
+ } else {
+ /* screenshot argv[1] argv[2] - invalid*/
+ return false;
+ }
}
+ RequestScreenshot(type, name);
+
return true;
}