summaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
Diffstat (limited to 'src/common')
-rw-r--r--src/common/grfio.c8
-rw-r--r--src/common/showmsg.c16
-rw-r--r--src/common/showmsg.h12
3 files changed, 25 insertions, 11 deletions
diff --git a/src/common/grfio.c b/src/common/grfio.c
index 2ba701632..d3d39c106 100644
--- a/src/common/grfio.c
+++ b/src/common/grfio.c
@@ -614,7 +614,8 @@ static int grfio_entryread(char *gfname,int gentry)
fp = fopen(gfname,"rb");
if(fp==NULL) {
- printf("%s not found (grfio_entryread)\n",gfname);
+ sprintf(tmp_output,"GRF Data File not found: '\033[1;29m%s\033[0;0m'.\n",gfname);
+ ShowWarning(tmp_output);
return 1; // 1:not found error
}
@@ -837,7 +838,8 @@ int grfio_add(char *fname)
exit(1);
}
- printf("%s file reading...\n",fname);
+// sprintf(tmp_output,"Reading GRF File: '%s'.\n",fname);
+// ShowStatus(tmp_output);
if (gentry_entrys>=gentry_maxentry) {
char **new_gentry = (char**)realloc(
@@ -924,7 +926,7 @@ void grfio_init(char *fname)
}
fclose(data_conf);
- sprintf(tmp_output,"Done reading GRF File: '\033[1;29m%s\033[0;0m'.\n",fname);
+ sprintf(tmp_output,"Done reading '\033[1;29m%s\033[0;0m'.\n",fname);
ShowStatus(tmp_output);
} // end of reading grf-files.txt
diff --git a/src/common/showmsg.c b/src/common/showmsg.c
index e96f97e22..32b9dd22c 100644
--- a/src/common/showmsg.c
+++ b/src/common/showmsg.c
@@ -14,12 +14,12 @@ int _ShowMessage(const char *string, enum msg_type flag){ // by MC Cameri
char prefix[40];
char *output;
if (strlen(string) <= 0) {
- ShowError("Empty string passed to ShowMessage().\n");
+ ShowError("Empty string passed to _ShowMessage().\n");
return 1;
}
switch (flag) {
case MSG_STATUS: //Bright Green (To inform about good things)
- strcpy(prefix,"\033[1;32m[Status]\033[0;0m:");
+ 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)
@@ -27,19 +27,19 @@ int _ShowMessage(const char *string, enum msg_type flag){ // by MC Cameri
break;
*/
case MSG_INFORMATION: //Bright White (Variable information)
- strcpy(prefix,"\033[1;29m[Info]\033[0;0m:");
+ strcpy(prefix,CL_WHITE"[Info]"CL_RESET":");
break;
case MSG_NOTICE: //Bright White (Less than a warning)
- strcpy(prefix,"\033[1;29m[Notice]\033[0;0m:");
+ strcpy(prefix,CL_WHITE"[Notice]"CL_RESET":");
break;
case MSG_WARNING: //Bright Yellow
- strcpy(prefix,"\033[1;33m[Warning]\033[0;0m:");
+ strcpy(prefix,CL_YELLOW"[Warning]"CL_RESET":");
break;
case MSG_ERROR: //Bright Red (Regular errors)
- strcpy(prefix,"\033[1;31m[Error]\033[0;0m:");
+ strcpy(prefix,CL_RED"[Error]"CL_RESET":");
break;
case MSG_FATALERROR: //Bright Red (Fatal errors, abort(); if possible)
- strcpy(prefix,"\033[1;31m[Fatal Error]\033[0;0m:");
+ strcpy(prefix,CL_RED"[Fatal Error]"CL_RESET":");
break;
default:
ShowError("In function _ShowMessage() -> Invalid flag passed.\n");
@@ -48,7 +48,7 @@ int _ShowMessage(const char *string, enum msg_type flag){ // by MC Cameri
output = (char*)malloc(sizeof(char)*(strlen(prefix)+strlen(string)+2)); // +2: space and a \0
if (output == NULL) {
return 1;
-// abort(); // Kill server? Deadly
+// exit(1); // Kill server? Deadly
}
strcpy(output,prefix);
strcat(output," ");
diff --git a/src/common/showmsg.h b/src/common/showmsg.h
index 03ffe310b..59bd6a090 100644
--- a/src/common/showmsg.h
+++ b/src/common/showmsg.h
@@ -1,6 +1,18 @@
#ifndef _SHOWMSG_H_
#define _SHOWMSG_H_
+#define CL_RESET "\033[0;0m"
+#define CL_NORMAL CL_RESET
+#define CL_NONE CL_RESET
+#define CL_WHITE "\033[1;29m"
+#define CL_GRAY "\033[1;30m"
+#define CL_RED "\033[1;31m"
+#define CL_GREEN "\033[1;32m"
+#define CL_YELLOW "\033[1;33m"
+#define CL_BLUE "\033[1;34m"
+#define CL_MAGENTA "\033[1;35m"
+#define CL_CYAN "\033[1;36m"
+
extern char tmp_output[1024];
enum msg_type {MSG_STATUS,/* MSG_SQL, */MSG_INFORMATION,MSG_NOTICE,MSG_WARNING,MSG_ERROR,MSG_FATALERROR};