diff options
| author | Spp <spp@jorge.gr> | 2011-10-18 14:59:23 +0200 |
|---|---|---|
| committer | Spp <spp@jorge.gr> | 2011-10-18 14:59:23 +0200 |
| commit | e3f8588a227cbf9108f396131a199d75868bf539 (patch) | |
| tree | 7af85d79ae50f08a965cd5f601542ea6959519ed /src/server/worldserver/CommandLine | |
| parent | b5e8a192b121b8ec297885e04566758c236d9191 (diff) | |
Minor changes here and there:
- Cosmetic changes
- 'Engrish fix'
- Initialization of some vars
- Remove some not needed includes
Diffstat (limited to 'src/server/worldserver/CommandLine')
| -rwxr-xr-x | src/server/worldserver/CommandLine/CliRunnable.cpp | 34 |
1 files changed, 18 insertions, 16 deletions
diff --git a/src/server/worldserver/CommandLine/CliRunnable.cpp b/src/server/worldserver/CommandLine/CliRunnable.cpp index cf5ad79f878..564f6028eca 100755 --- a/src/server/worldserver/CommandLine/CliRunnable.cpp +++ b/src/server/worldserver/CommandLine/CliRunnable.cpp @@ -115,6 +115,7 @@ void commandFinished(void*, bool /*success*/) printf("TC> "); fflush(stdout); } + /** * Collects all GUIDs (and related info) from deleted characters which are still in the database. * @@ -562,10 +563,11 @@ void CliRunnable::run() { ///- Display the list of available CLI functions then beep //sLog->outString(""); - #if PLATFORM != PLATFORM_WINDOWS +#if PLATFORM != PLATFORM_WINDOWS rl_attempted_completion_function = cli_completion; rl_event_hook = cli_hook_func; - #endif +#endif + if (ConfigMgr::GetBoolDefault("BeepAtStart", true)) printf("\a"); // \a = Alert @@ -580,49 +582,49 @@ void CliRunnable::run() char *command_str ; // = fgets(commandbuf, sizeof(commandbuf), stdin); - #if PLATFORM == PLATFORM_WINDOWS +#if PLATFORM == PLATFORM_WINDOWS char commandbuf[256]; command_str = fgets(commandbuf, sizeof(commandbuf), stdin); - #else +#else command_str = readline("TC>"); rl_bind_key('\t', rl_complete); - #endif +#endif + if (command_str != NULL) { - for (int x=0; command_str[x]; x++) - if (command_str[x]=='\r'||command_str[x]=='\n') + for (int x=0; command_str[x]; ++x) + if (command_str[x] == '\r' || command_str[x] == '\n') { - command_str[x]=0; + command_str[x] = 0; break; } if (!*command_str) { - #if PLATFORM == PLATFORM_WINDOWS +#if PLATFORM == PLATFORM_WINDOWS printf("TC>"); - #endif +#endif continue; } std::string command; if (!consoleToUtf8(command_str, command)) // convert from console encoding to utf8 { - #if PLATFORM == PLATFORM_WINDOWS +#if PLATFORM == PLATFORM_WINDOWS printf("TC>"); - #endif +#endif continue; } + fflush(stdout); sWorld->QueueCliCommand(new CliCommandHolder(NULL, command.c_str(), &utf8print, &commandFinished)); - #if PLATFORM != PLATFORM_WINDOWS +#if PLATFORM != PLATFORM_WINDOWS add_history(command.c_str()); - #endif - +#endif } else if (feof(stdin)) { World::StopNow(SHUTDOWN_EXIT_CODE); } - } } |
