mirror of
https://github.com/ondra-novak/gates_of_skeldal.git
synced 2025-07-20 05:04:53 -04:00
sse client to listen commands (from mapedit)
This commit is contained in:
parent
13f6c05c60
commit
bb5be10adc
10 changed files with 336 additions and 29 deletions
|
@ -10,7 +10,7 @@
|
|||
#include <shellapi.h>
|
||||
|
||||
void show_help(std::ostream &out, const char *arg0) {
|
||||
out <<
|
||||
out <<
|
||||
"Brany Skeldalu (Gates of Skeldal) portable game player\n"
|
||||
"Copyright (c) 2025 Ondrej Novak. All rights reserved.\n\n"
|
||||
"This work is licensed under the terms of the MIT license.\n"
|
||||
|
@ -22,7 +22,8 @@ void show_help(std::ostream &out, const char *arg0) {
|
|||
"-a <adv> path for adventure file (.adv)\n"
|
||||
"-l <lang> set language (cz|en)\n"
|
||||
"-s <directory> generate string-tables (for localization) and exit\n"
|
||||
"-h this help\n";
|
||||
"-L <host:port> connect to host:port to listen commands (mapedit)\n"
|
||||
"-h this help\n";
|
||||
}
|
||||
|
||||
void show_help_short(std::ostream &out) {
|
||||
|
@ -30,20 +31,22 @@ void show_help_short(std::ostream &out) {
|
|||
}
|
||||
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
int main(int argc, char **argv) {
|
||||
std::string config_name = SKELDALINI;
|
||||
std::string adv_config_file;
|
||||
std::string gen_stringtable_path;
|
||||
std::string lang;
|
||||
std::string sse_hostport;
|
||||
std::ostringstream console;
|
||||
for (int optchr = -1; (optchr = getopt(argc, argv, "hf:a:s:l:")) != -1; ) {
|
||||
for (int optchr = -1; (optchr = getopt(argc, argv, "hf:a:s:l:L:")) != -1; ) {
|
||||
switch (optchr) {
|
||||
case 'f': config_name = optarg;break;
|
||||
case 'a': adv_config_file = optarg;break;
|
||||
case 'h': show_help(console, argv[0]);break;
|
||||
case 'l': lang = optarg;break;
|
||||
case 's': gen_stringtable_path = optarg;break;
|
||||
default: show_help_short(console);break;
|
||||
case 'L': sse_hostport = optarg;break;
|
||||
default: show_help_short(console);break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -52,7 +55,7 @@ int main(int argc, char **argv) {
|
|||
show_help(console, argv[0]);
|
||||
}
|
||||
|
||||
SKELDAL_CONFIG cfg;
|
||||
SKELDAL_CONFIG cfg = {};
|
||||
cfg.short_help = []{};
|
||||
cfg.show_error = [](const char *txt) {
|
||||
char buff[MAX_PATH];
|
||||
|
@ -63,6 +66,7 @@ int main(int argc, char **argv) {
|
|||
cfg.adventure_path = adv_config_file.empty()?NULL:adv_config_file.c_str();
|
||||
cfg.config_path = config_name.c_str();
|
||||
cfg.lang_path = lang.empty()?NULL:lang.c_str();
|
||||
cfg.sse_hostport = sse_hostport.c_str();
|
||||
|
||||
{
|
||||
std::string msg = console.str();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue