diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/common/showmsg.c | 26 | ||||
-rw-r--r-- | src/common/showmsg.h | 4 | ||||
-rw-r--r-- | src/map/map.c | 29 |
3 files changed, 29 insertions, 30 deletions
diff --git a/src/common/showmsg.c b/src/common/showmsg.c index 3488926bf..857a819bb 100644 --- a/src/common/showmsg.c +++ b/src/common/showmsg.c @@ -21,11 +21,9 @@ int _ShowMessage(const char *string, enum msg_type flag){ // by MC Cameri case MSG_STATUS: //Bright Green (To inform about good things) strcpy(prefix,CL_GREEN"[Status]"CL_RESET":"); break; -/* //Do we really need this now? [MC Cameri] case MSG_SQL: //Bright Violet (For dumping out anything related with SQL) strcpy(prefix,CL_MAGENTA"[SQL]"CL_RESET":"); break; -*/ case MSG_INFORMATION: //Bright White (Variable information) strcpy(prefix,CL_WHITE"[Info]"CL_RESET":"); break; @@ -49,18 +47,18 @@ int _ShowMessage(const char *string, enum msg_type flag){ // by MC Cameri return 1; } if (!(flag == MSG_DEBUG && !SHOW_DEBUG_MSG)) { - output = (char*)malloc(sizeof(char)*(strlen(prefix)+strlen(string)+2)); // +2: space and a \0 - if (output == NULL) { - return 1; -// exit(1); // Kill server? Deadly - } - - strcpy(output,prefix); - strcat(output," "); - strcat(output,string); - printf(output); - fflush(stdout); - free(output); + output = (char*)malloc(sizeof(char)*(strlen(prefix)+strlen(string)+2)); // prefix+string+two chars(space and \0) + if (output == NULL) { + return 1; +// exit(1); // Kill server? Deadly + } + + strcpy(output,prefix); + strcat(output," "); + strcat(output,string); + printf(output); + fflush(stdout); + free(output); } /* if ((core_config.debug_output_level > -1) && (flag >= core_config.debug_output_level)) { diff --git a/src/common/showmsg.h b/src/common/showmsg.h index 2d40255fb..0949d08e4 100644 --- a/src/common/showmsg.h +++ b/src/common/showmsg.h @@ -18,7 +18,7 @@ extern char tmp_output[1024]; -enum msg_type {MSG_STATUS,/* MSG_SQL, */MSG_INFORMATION,MSG_NOTICE,MSG_WARNING,MSG_DEBUG,MSG_ERROR,MSG_FATALERROR}; +enum msg_type {MSG_STATUS, MSG_SQL, MSG_INFORMATION,MSG_NOTICE,MSG_WARNING,MSG_DEBUG,MSG_ERROR,MSG_FATALERROR}; extern int _ShowMessage(const char *string, enum msg_type flag); @@ -32,7 +32,7 @@ extern int _ShowMessage(const char *string, enum msg_type flag); // #define DisplayStatus(string) _ShowMessage(string,MSG_STATUS) /* MSG_SQL*/ -// #define ShowSQL(string) _ShowMessage(string,MSG_SQL) + #define ShowSQL(string) _ShowMessage(string,MSG_SQL) // #define DisplaySQL(string) _ShowMessage(string,MSG_SQL) /* MSG_INFORMATION */ diff --git a/src/map/map.c b/src/map/map.c index cb3a3a0a9..d89bf424d 100644 --- a/src/map/map.c +++ b/src/map/map.c @@ -2325,7 +2325,8 @@ int sql_config_read(char *cfgName) fp=fopen(cfgName,"r"); if(fp==NULL){ - printf("file not found: %s\n",cfgName); + snprintf(tmp_output,sizeof(tmp_output),"File not found: '%s'.\n",cfgName); + ShowError(tmp_output); return 1; } while(fgets(line,1020,fp)){ @@ -2355,19 +2356,19 @@ int sql_config_read(char *cfgName) //Map Server SQL DB } else if(strcmpi(w1,"map_server_ip")==0){ strcpy(map_server_ip, w2); - printf ("set map_server_ip : %s\n",w2); +// printf ("set map_server_ip : %s\n",w2); } else if(strcmpi(w1,"map_server_port")==0){ map_server_port=atoi(w2); - printf ("set map_server_port : %s\n",w2); +// printf ("set map_server_port : %s\n",w2); } else if(strcmpi(w1,"map_server_id")==0){ strcpy(map_server_id, w2); - printf ("set map_server_id : %s\n",w2); +// printf ("set map_server_id : %s\n",w2); } else if(strcmpi(w1,"map_server_pw")==0){ strcpy(map_server_pw, w2); - printf ("set map_server_pw : %s\n",w2); +// printf ("set map_server_pw : %s\n",w2); } else if(strcmpi(w1,"map_server_db")==0){ strcpy(map_server_db, w2); - printf ("set map_server_db : %s\n",w2); +// printf ("set map_server_db : %s\n",w2); //Map server option to use SQL db or not } else if(strcmpi(w1,"use_sql_db")==0){ if (strcmpi(w2,"yes")){db_use_sqldbs=0;} else if (strcmpi(w2,"no")){db_use_sqldbs=1;} @@ -2375,25 +2376,25 @@ int sql_config_read(char *cfgName) //Login Server SQL DB } else if(strcmpi(w1,"login_server_ip")==0){ strcpy(login_server_ip, w2); - printf ("set login_server_ip : %s\n",w2); +// printf ("set login_server_ip : %s\n",w2); } else if(strcmpi(w1,"login_server_port")==0){ login_server_port = atoi(w2); - printf ("set login_server_port : %s\n",w2); +// printf ("set login_server_port : %s\n",w2); } else if(strcmpi(w1,"login_server_id")==0){ strcpy(login_server_id, w2); - printf ("set login_server_id : %s\n",w2); +// printf ("set login_server_id : %s\n",w2); } else if(strcmpi(w1,"login_server_pw")==0){ strcpy(login_server_pw, w2); - printf ("set login_server_pw : %s\n",w2); +// printf ("set login_server_pw : %s\n",w2); } else if(strcmpi(w1,"login_server_db")==0){ strcpy(login_server_db, w2); - printf ("set login_server_db : %s\n",w2); +// printf ("set login_server_db : %s\n",w2); } else if(strcmpi(w1,"lowest_gm_level")==0){ lowest_gm_level = atoi(w2); - printf ("set lowest_gm_level : %s\n",w2); +// printf ("set lowest_gm_level : %s\n",w2); } else if(strcmpi(w1,"read_gm_interval")==0){ read_gm_interval = ( atoi(w2) * 60 * 1000 ); // Minutes multiplied by 60 secs per min by 1000 milliseconds per second - printf ("set read_gm_interval : %s\n",w2); +// printf ("set read_gm_interval : %s\n",w2); } else if(strcmpi(w1,"log_db")==0) { strcpy(log_db, w2); } else if(strcmpi(w1,"log_db_ip")==0) { @@ -2567,7 +2568,7 @@ void map_helpscreen(int flag) { puts("Usage: map-server [options]"); puts("Options:"); puts(CL_WHITE" Commands\t\t\tDescription"CL_RESET); - puts("---------------------------------------------"); + puts("-----------------------------------------------------------------------------"); puts(" --help, --h, --?, /? Displays this help screen"); puts(" --map-config <file> Load map-server configuration from <file>"); puts(" --battle-config <file> Load battle configuration from <file>"); |