summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2010-08-01 18:48:00 +0000
committerrubidium <rubidium@openttd.org>2010-08-01 18:48:00 +0000
commit605f6d0ed3c81a77d533f3db40ed50350d57536c (patch)
tree5896e6260f06c178ee38d2e7c3b7b6c09f411b1c /src
parentdc6ed2c2c02a651a50b2d2b232302d0c7eab48ec (diff)
downloadopenttd-605f6d0ed3c81a77d533f3db40ed50350d57536c.tar.xz
(svn r20280) -Fix: indentation of some switch cases
Diffstat (limited to 'src')
-rw-r--r--src/console.cpp89
1 files changed, 48 insertions, 41 deletions
diff --git a/src/console.cpp b/src/console.cpp
index b2882ac2f..59c6c1a48 100644
--- a/src/console.cpp
+++ b/src/console.cpp
@@ -327,52 +327,59 @@ static void IConsoleAliasExec(const IConsoleAlias *alias, byte tokencount, char
if (a_index >= lengthof(aliases) || astream_i >= lengthof(aliasstream)) break;
switch (*cmdptr) {
- case '\'': // ' will double for ""
- aliasstream[astream_i++] = '"';
- break;
- case ';': // Cmd seperator, start new command
- aliasstream[astream_i] = '\0';
- aliases[++a_index] = &aliasstream[++astream_i];
- cmdptr++;
- break;
- case '%': // Some or all parameters
- cmdptr++;
- switch (*cmdptr) {
- case '+': { // All parameters seperated: "[param 1]" "[param 2]"
- for (i = 0; i != tokencount; i++) {
- aliasstream[astream_i++] = '"';
- astream_i += IConsoleCopyInParams(&aliasstream[astream_i], tokens[i], astream_i);
- aliasstream[astream_i++] = '"';
- aliasstream[astream_i++] = ' ';
- }
- } break;
- case '!': { // Merge the parameters to one: "[param 1] [param 2] [param 3...]"
- aliasstream[astream_i++] = '"';
- for (i = 0; i != tokencount; i++) {
- astream_i += IConsoleCopyInParams(&aliasstream[astream_i], tokens[i], astream_i);
- aliasstream[astream_i++] = ' ';
- }
+ case '\'': // ' will double for ""
aliasstream[astream_i++] = '"';
+ break;
- } break;
- default: { // One specific parameter: %A = [param 1] %B = [param 2] ...
- int param = *cmdptr - 'A';
+ case ';': // Cmd seperator, start new command
+ aliasstream[astream_i] = '\0';
+ aliases[++a_index] = &aliasstream[++astream_i];
+ cmdptr++;
+ break;
- if (param < 0 || param >= tokencount) {
- IConsoleError("too many or wrong amount of parameters passed to alias, aborting");
- IConsolePrintF(CC_WARNING, "Usage of alias '%s': %s", alias->name, alias->cmdline);
- return;
+ case '%': // Some or all parameters
+ cmdptr++;
+ switch (*cmdptr) {
+ case '+': { // All parameters seperated: "[param 1]" "[param 2]"
+ for (i = 0; i != tokencount; i++) {
+ aliasstream[astream_i++] = '"';
+ astream_i += IConsoleCopyInParams(&aliasstream[astream_i], tokens[i], astream_i);
+ aliasstream[astream_i++] = '"';
+ aliasstream[astream_i++] = ' ';
+ }
+ break;
+ }
+
+ case '!': { // Merge the parameters to one: "[param 1] [param 2] [param 3...]"
+ aliasstream[astream_i++] = '"';
+ for (i = 0; i != tokencount; i++) {
+ astream_i += IConsoleCopyInParams(&aliasstream[astream_i], tokens[i], astream_i);
+ aliasstream[astream_i++] = ' ';
+ }
+ aliasstream[astream_i++] = '"';
+ break;
+ }
+
+ default: { // One specific parameter: %A = [param 1] %B = [param 2] ...
+ int param = *cmdptr - 'A';
+
+ if (param < 0 || param >= tokencount) {
+ IConsoleError("too many or wrong amount of parameters passed to alias, aborting");
+ IConsolePrintF(CC_WARNING, "Usage of alias '%s': %s", alias->name, alias->cmdline);
+ return;
+ }
+
+ aliasstream[astream_i++] = '"';
+ astream_i += IConsoleCopyInParams(&aliasstream[astream_i], tokens[param], astream_i);
+ aliasstream[astream_i++] = '"';
+ break;
+ }
}
+ break;
- aliasstream[astream_i++] = '"';
- astream_i += IConsoleCopyInParams(&aliasstream[astream_i], tokens[param], astream_i);
- aliasstream[astream_i++] = '"';
- } break;
- } break;
-
- default:
- aliasstream[astream_i++] = *cmdptr;
- break;
+ default:
+ aliasstream[astream_i++] = *cmdptr;
+ break;
}
}