summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2015-06-18 02:29:43 +0200
committerHaru <haru@dotalux.com>2015-08-15 00:51:39 +0200
commit1f4d2c86b3d9ef894d77f7f47e0c2337fb17738b (patch)
tree08a9e7b2b4fee9b86cdf2f5ea19ead5e842ed79a /src
parent2ce7edfe772c319756a9e4feb46f33b201ccfae5 (diff)
downloadhercules-1f4d2c86b3d9ef894d77f7f47e0c2337fb17738b.tar.gz
hercules-1f4d2c86b3d9ef894d77f7f47e0c2337fb17738b.tar.bz2
hercules-1f4d2c86b3d9ef894d77f7f47e0c2337fb17738b.tar.xz
hercules-1f4d2c86b3d9ef894d77f7f47e0c2337fb17738b.zip
Added showmsg HPM interface
- The showmsg interface is automatically imported into plugins by the HPM (just like previously, the various Show* functions were). This change requires no actions from plugin developers. - stdout_with_ansisequence is now available through showmsg->stdout_with_ansisequence - msg_silent is now available through showmsg->silent - console_msg_log is now available through showmsg->console_log - timestamp_format is now available through showmsg->timestamp_format - Plugin-safe macros are provided, so that all Show* and Clear* calls will require no changes. - vShowMessage is provided through the public API, as va_list variant of ShowMessage. - vShowMessage_ is no longer part of the public API. If necessary, va_list variants of the other Show* functions will be added at a later time as follow-ups. Signed-off-by: Haru <haru@dotalux.com>
Diffstat (limited to 'src')
-rw-r--r--src/char/char.c8
-rw-r--r--src/common/HPM.c12
-rw-r--r--src/common/HPMDataCheck.h5
-rw-r--r--src/common/HPMi.h4
-rw-r--r--src/common/core.c7
-rw-r--r--src/common/showmsg.c149
-rw-r--r--src/common/showmsg.h75
-rw-r--r--src/login/login.c8
-rw-r--r--src/map/clif.c2
-rw-r--r--src/map/map.c10
-rw-r--r--src/map/pc.c14
11 files changed, 173 insertions, 121 deletions
diff --git a/src/char/char.c b/src/char/char.c
index 52c560373..6cfcdb331 100644
--- a/src/char/char.c
+++ b/src/char/char.c
@@ -5575,13 +5575,13 @@ int char_config_read(const char* cfgName)
remove_control_chars(w1);
remove_control_chars(w2);
if(strcmpi(w1,"timestamp_format") == 0) {
- safestrncpy(timestamp_format, w2, sizeof(timestamp_format));
+ safestrncpy(showmsg->timestamp_format, w2, sizeof(showmsg->timestamp_format));
} else if(strcmpi(w1,"console_silent")==0){
- msg_silent = atoi(w2);
- if( msg_silent ) /* only bother if its actually enabled */
+ showmsg->silent = atoi(w2);
+ if (showmsg->silent) /* only bother if its actually enabled */
ShowInfo("Console Silent Setting: %d\n", atoi(w2));
} else if(strcmpi(w1,"stdout_with_ansisequence")==0){
- stdout_with_ansisequence = config_switch(w2);
+ showmsg->stdout_with_ansisequence = config_switch(w2) ? true : false;
} else if (strcmpi(w1, "userid") == 0) {
safestrncpy(chr->userid, w2, sizeof(chr->userid));
} else if (strcmpi(w1, "passwd") == 0) {
diff --git a/src/common/HPM.c b/src/common/HPM.c
index cdd9bb769..caf0f9471 100644
--- a/src/common/HPM.c
+++ b/src/common/HPM.c
@@ -100,15 +100,7 @@ bool hplugin_populate(struct hplugin *plugin, const char *filename) {
const char* name;
void *Ref;
} ToLink[] = {
- HPM_POP(ShowMessage),
- HPM_POP(ShowStatus),
- HPM_POP(ShowSQL),
- HPM_POP(ShowInfo),
- HPM_POP(ShowNotice),
- HPM_POP(ShowWarning),
- HPM_POP(ShowDebug),
- HPM_POP(ShowError),
- HPM_POP(ShowFatalError),
+ HPM_POP(showmsg),
};
int i, length = ARRAYLENGTH(ToLink);
@@ -778,6 +770,8 @@ void hplugins_share_defaults(void) {
HPM->share(DB, "DB");
HPM->share(HPMiMalloc, "iMalloc");
HPM->share(nullpo,"nullpo");
+ /* showmsg */
+ HPM->share(showmsg,"showmsg");
/* socket */
HPM->share(sockt,"sockt");
/* strlib */
diff --git a/src/common/HPMDataCheck.h b/src/common/HPMDataCheck.h
index 584cab5c9..f7b1fcb98 100644
--- a/src/common/HPMDataCheck.h
+++ b/src/common/HPMDataCheck.h
@@ -185,6 +185,11 @@ HPExport const struct s_HPMDataCheck HPMDataCheck[] = {
#else
#define COMMON_NULLPO_H
#endif // COMMON_NULLPO_H
+ #ifdef COMMON_SHOWMSG_H
+ { "showmsg_interface", sizeof(struct showmsg_interface), SERVER_TYPE_ALL },
+ #else
+ #define COMMON_SHOWMSG_H
+ #endif // COMMON_SHOWMSG_H
#ifdef COMMON_SOCKET_H
{ "hSockOpt", sizeof(struct hSockOpt), SERVER_TYPE_ALL },
{ "s_subnet", sizeof(struct s_subnet), SERVER_TYPE_ALL },
diff --git a/src/common/HPMi.h b/src/common/HPMi.h
index bf4eb83c8..2054657be 100644
--- a/src/common/HPMi.h
+++ b/src/common/HPMi.h
@@ -7,6 +7,7 @@
#include "common/cbasetypes.h"
#include "common/console.h"
#include "common/core.h"
+#include "common/showmsg.h"
#include "common/sql.h"
struct script_state;
@@ -20,9 +21,6 @@ struct map_session_data;
#define HPExport
#endif
-/* after */
-#include "common/showmsg.h"
-
#define HPM_VERSION "1.0"
#define HPM_ADDCONF_LENGTH 40
diff --git a/src/common/core.c b/src/common/core.c
index e663c4e4c..e46c9589b 100644
--- a/src/common/core.c
+++ b/src/common/core.c
@@ -176,6 +176,7 @@ void core_defaults(void) {
console_defaults();
strlib_defaults();
malloc_defaults();
+ showmsg_defaults();
cmdline_defaults();
#ifndef MINICORE
libconfig_defaults();
@@ -317,7 +318,7 @@ int cmdline_exec(int argc, char **argv, unsigned int options)
}
if (options&CMDLINE_OPT_SILENT) {
if (data->options&CMDLINE_OPT_SILENT) {
- msg_silent = 0x7; // silence information and status messages
+ showmsg->silent = 0x7; // silence information and status messages
break;
}
} else if ((data->options&CMDLINE_OPT_PREINIT) == (options&CMDLINE_OPT_PREINIT)) {
@@ -393,6 +394,7 @@ int main (int argc, char **argv) {
core_defaults();
iMalloc->init();// needed for Show* in display_title() [FlavioJS]
+ showmsg->init();
cmdline->init();
@@ -402,7 +404,7 @@ int main (int argc, char **argv) {
sysinfo->init();
- if (!(msg_silent&0x1))
+ if (!(showmsg->silent&0x1))
console->display_title();
usercheck();
@@ -458,6 +460,7 @@ int main (int argc, char **argv) {
//sysinfo->final(); Called by iMalloc->final()
iMalloc->final();
+ showmsg->final(); // Should be after iMalloc->final()
return retval;
}
diff --git a/src/common/showmsg.c b/src/common/showmsg.c
index 01dc0b01a..68af31917 100644
--- a/src/common/showmsg.c
+++ b/src/common/showmsg.c
@@ -30,16 +30,7 @@
#define DEBUGLOGPATH "log"PATHSEP_STR"login-server.log"
#endif
-///////////////////////////////////////////////////////////////////////////////
-/// behavioral parameter.
-/// when redirecting output:
-/// if true prints escape sequences
-/// if false removes the escape sequences
-int stdout_with_ansisequence = 0;
-
-int msg_silent = 0; //Specifies how silent the console is.
-
-int console_msg_log = 0;//[Ind] msg error logging
+struct showmsg_interface showmsg_s;
///////////////////////////////////////////////////////////////////////////////
/// static/dynamic buffer for the messages
@@ -197,8 +188,7 @@ int VFPRINTF(HANDLE handle, const char *fmt, va_list argptr)
// Print everything to the buffer
BUFVPRINTF(tempbuf,fmt,argptr);
- if( !is_console(handle) && stdout_with_ansisequence )
- {
+ if (!is_console(handle) && showmsg->stdout_with_ansisequence) {
WriteFile(handle, BUFVAL(tempbuf), BUFLEN(tempbuf), &written, 0);
return 0;
}
@@ -490,8 +480,7 @@ int VFPRINTF(FILE *file, const char *fmt, va_list argptr)
if(!fmt || !*fmt)
return 0;
- if( is_console(file) || stdout_with_ansisequence )
- {
+ if (is_console(file) || showmsg->stdout_with_ansisequence) {
vfprintf(file, fmt, argptr);
return 0;
}
@@ -596,9 +585,6 @@ int FPRINTF(FILE *file, const char *fmt, ...) {
#endif// not _WIN32
-
-char timestamp_format[20] = ""; //For displaying Timestamps
-
int vShowMessage_(enum msg_type flag, const char *string, va_list ap)
{
va_list apcopy;
@@ -612,9 +598,9 @@ int vShowMessage_(enum msg_type flag, const char *string, va_list ap)
return 1;
}
if(
- ( flag == MSG_WARNING && console_msg_log&1 ) ||
- ( ( flag == MSG_ERROR || flag == MSG_SQL ) && console_msg_log&2 ) ||
- ( flag == MSG_DEBUG && console_msg_log&4 ) ) {//[Ind]
+ ( flag == MSG_WARNING && showmsg->console_log&1 ) ||
+ ( ( flag == MSG_ERROR || flag == MSG_SQL ) && showmsg->console_log&2 ) ||
+ ( flag == MSG_DEBUG && showmsg->console_log&4 ) ) {//[Ind]
FILE *log = NULL;
if( (log = fopen(SERVER_TYPE == SERVER_TYPE_MAP ? "./log/map-msg_log.log" : "./log/unknown.log","a+")) ) {
char timestring[255];
@@ -635,20 +621,20 @@ int vShowMessage_(enum msg_type flag, const char *string, va_list ap)
}
}
if(
- (flag == MSG_INFORMATION && msg_silent&1) ||
- (flag == MSG_STATUS && msg_silent&2) ||
- (flag == MSG_NOTICE && msg_silent&4) ||
- (flag == MSG_WARNING && msg_silent&8) ||
- (flag == MSG_ERROR && msg_silent&16) ||
- (flag == MSG_SQL && msg_silent&16) ||
- (flag == MSG_DEBUG && msg_silent&32)
+ (flag == MSG_INFORMATION && showmsg->silent&1) ||
+ (flag == MSG_STATUS && showmsg->silent&2) ||
+ (flag == MSG_NOTICE && showmsg->silent&4) ||
+ (flag == MSG_WARNING && showmsg->silent&8) ||
+ (flag == MSG_ERROR && showmsg->silent&16) ||
+ (flag == MSG_SQL && showmsg->silent&16) ||
+ (flag == MSG_DEBUG && showmsg->silent&32)
)
return 0; //Do not print it.
- if (timestamp_format[0] && flag != MSG_NONE) {
+ if (showmsg->timestamp_format[0] && flag != MSG_NONE) {
//Display time format. [Skotlex]
time_t t = time(NULL);
- strftime(prefix, 80, timestamp_format, localtime(&t));
+ strftime(prefix, 80, showmsg->timestamp_format, localtime(&t));
} else prefix[0]='\0';
switch (flag) {
@@ -721,7 +707,17 @@ int vShowMessage_(enum msg_type flag, const char *string, va_list ap)
return 0;
}
-void ClearScreen(void)
+int showmsg_vShowMessage(const char *string, va_list ap)
+{
+ int ret;
+ va_list apcopy;
+ va_copy(apcopy, ap);
+ ret = vShowMessage_(MSG_NONE, string, apcopy);
+ va_end(apcopy);
+ return ret;
+}
+
+void showmsg_clearScreen(void)
{
#ifndef _WIN32
ShowMessage(CL_CLS); // to prevent empty string passed messages
@@ -738,50 +734,57 @@ int ShowMessage_(enum msg_type flag, const char *string, ...) {
}
// direct printf replacement
-void ShowMessage(const char *string, ...) __attribute__((format(printf, 1, 2)));
-void ShowMessage(const char *string, ...) {
+void showmsg_showMessage(const char *string, ...) __attribute__((format(printf, 1, 2)));
+void showmsg_showMessage(const char *string, ...)
+{
va_list ap;
va_start(ap, string);
vShowMessage_(MSG_NONE, string, ap);
va_end(ap);
}
-void ShowStatus(const char *string, ...) __attribute__((format(printf, 1, 2)));
-void ShowStatus(const char *string, ...) {
+void showmsg_showStatus(const char *string, ...) __attribute__((format(printf, 1, 2)));
+void showmsg_showStatus(const char *string, ...)
+{
va_list ap;
va_start(ap, string);
vShowMessage_(MSG_STATUS, string, ap);
va_end(ap);
}
-void ShowSQL(const char *string, ...) __attribute__((format(printf, 1, 2)));
-void ShowSQL(const char *string, ...) {
+void showmsg_showSQL(const char *string, ...) __attribute__((format(printf, 1, 2)));
+void showmsg_showSQL(const char *string, ...)
+{
va_list ap;
va_start(ap, string);
vShowMessage_(MSG_SQL, string, ap);
va_end(ap);
}
-void ShowInfo(const char *string, ...) __attribute__((format(printf, 1, 2)));
-void ShowInfo(const char *string, ...) {
+void showmsg_showInfo(const char *string, ...) __attribute__((format(printf, 1, 2)));
+void showmsg_showInfo(const char *string, ...)
+{
va_list ap;
va_start(ap, string);
vShowMessage_(MSG_INFORMATION, string, ap);
va_end(ap);
}
-void ShowNotice(const char *string, ...) __attribute__((format(printf, 1, 2)));
-void ShowNotice(const char *string, ...) {
+void showmsg_showNotice(const char *string, ...) __attribute__((format(printf, 1, 2)));
+void showmsg_showNotice(const char *string, ...)
+{
va_list ap;
va_start(ap, string);
vShowMessage_(MSG_NOTICE, string, ap);
va_end(ap);
}
-void ShowWarning(const char *string, ...) __attribute__((format(printf, 1, 2)));
-void ShowWarning(const char *string, ...) {
+void showmsg_showWarning(const char *string, ...) __attribute__((format(printf, 1, 2)));
+void showmsg_showWarning(const char *string, ...)
+{
va_list ap;
va_start(ap, string);
vShowMessage_(MSG_WARNING, string, ap);
va_end(ap);
}
-void ShowConfigWarning(config_setting_t *config, const char *string, ...) __attribute__((format(printf, 2, 3)));
-void ShowConfigWarning(config_setting_t *config, const char *string, ...) {
+void showmsg_showConfigWarning(config_setting_t *config, const char *string, ...) __attribute__((format(printf, 2, 3)));
+void showmsg_showConfigWarning(config_setting_t *config, const char *string, ...)
+{
StringBuf buf;
va_list ap;
StrBuf->Init(&buf);
@@ -792,24 +795,70 @@ void ShowConfigWarning(config_setting_t *config, const char *string, ...) {
va_end(ap);
StrBuf->Destroy(&buf);
}
-void ShowDebug(const char *string, ...) __attribute__((format(printf, 1, 2)));
-void ShowDebug(const char *string, ...) {
+void showmsg_showDebug(const char *string, ...) __attribute__((format(printf, 1, 2)));
+void showmsg_showDebug(const char *string, ...)
+{
va_list ap;
va_start(ap, string);
vShowMessage_(MSG_DEBUG, string, ap);
va_end(ap);
}
-void ShowError(const char *string, ...) __attribute__((format(printf, 1, 2)));
-void ShowError(const char *string, ...) {
+void showmsg_showError(const char *string, ...) __attribute__((format(printf, 1, 2)));
+void showmsg_showError(const char *string, ...)
+{
va_list ap;
va_start(ap, string);
vShowMessage_(MSG_ERROR, string, ap);
va_end(ap);
}
-void ShowFatalError(const char *string, ...) __attribute__((format(printf, 1, 2)));
-void ShowFatalError(const char *string, ...) {
+void showmsg_showFatalError(const char *string, ...) __attribute__((format(printf, 1, 2)));
+void showmsg_showFatalError(const char *string, ...)
+{
va_list ap;
va_start(ap, string);
vShowMessage_(MSG_FATALERROR, string, ap);
va_end(ap);
}
+
+void showmsg_init(void)
+{
+}
+
+void showmsg_final(void)
+{
+}
+
+void showmsg_defaults(void)
+{
+ showmsg = &showmsg_s;
+
+ ///////////////////////////////////////////////////////////////////////////////
+ /// behavioral parameter.
+ /// when redirecting output:
+ /// if true prints escape sequences
+ /// if false removes the escape sequences
+ showmsg->stdout_with_ansisequence = false;
+
+ showmsg->silent = 0; //Specifies how silent the console is.
+
+ showmsg->console_log = 0;//[Ind] msg error logging
+
+ memset(showmsg->timestamp_format, '\0', sizeof(showmsg->timestamp_format));
+
+ showmsg->init = showmsg_init;
+ showmsg->final = showmsg_final;
+
+ showmsg->clearScreen = showmsg_clearScreen;
+ showmsg->showMessageV = showmsg_vShowMessage;
+
+ showmsg->showMessage = showmsg_showMessage;
+ showmsg->showStatus = showmsg_showStatus;
+ showmsg->showSQL = showmsg_showSQL;
+ showmsg->showInfo = showmsg_showInfo;
+ showmsg->showNotice = showmsg_showNotice;
+ showmsg->showWarning = showmsg_showWarning;
+ showmsg->showDebug = showmsg_showDebug;
+ showmsg->showError = showmsg_showError;
+ showmsg->showFatalError = showmsg_showFatalError;
+ showmsg->showConfigWarning = showmsg_showConfigWarning;
+}
diff --git a/src/common/showmsg.h b/src/common/showmsg.h
index 63e42ab57..6b119a1ce 100644
--- a/src/common/showmsg.h
+++ b/src/common/showmsg.h
@@ -7,11 +7,7 @@
#include "common/cbasetypes.h"
-#ifdef HERCULES_CORE
-# include <libconfig/libconfig.h>
-#else
-# include "common/HPMi.h"
-#endif
+#include <libconfig/libconfig.h>
#include <stdarg.h>
@@ -85,35 +81,48 @@ enum msg_type {
MSG_FATALERROR
};
+struct showmsg_interface {
+ bool stdout_with_ansisequence; //If the color ANSI sequences are to be used. [flaviojs]
+ int silent; //Specifies how silent the console is. [Skotlex]
+ int console_log; //Specifies what error messages to log. [Ind]
+ char timestamp_format[20]; //For displaying Timestamps [Skotlex]
+
+ void (*init) (void);
+ void (*final) (void);
+
+ void (*clearScreen) (void);
+ int (*showMessageV) (const char *string, va_list ap);
+
+ void (*showMessage) (const char *, ...) __attribute__((format(printf, 1, 2)));
+ void (*showStatus) (const char *, ...) __attribute__((format(printf, 1, 2)));
+ void (*showSQL) (const char *, ...) __attribute__((format(printf, 1, 2)));
+ void (*showInfo) (const char *, ...) __attribute__((format(printf, 1, 2)));
+ void (*showNotice) (const char *, ...) __attribute__((format(printf, 1, 2)));
+ void (*showWarning) (const char *, ...) __attribute__((format(printf, 1, 2)));
+ void (*showDebug) (const char *, ...) __attribute__((format(printf, 1, 2)));
+ void (*showError) (const char *, ...) __attribute__((format(printf, 1, 2)));
+ void (*showFatalError) (const char *, ...) __attribute__((format(printf, 1, 2)));
+ void (*showConfigWarning) (config_setting_t *config, const char *string, ...) __attribute__((format(printf, 2, 3)));
+};
+
+struct showmsg_interface *showmsg;
+
+/* the purpose of these macros is simply to not make calling them be an annoyance */
+#define ClearScreen() (showMsg->clearScreen())
+#define vShowMessage(fmt, list) (showmsg->showMessageV((fmt), (list)))
+#define ShowMessage(fmt, ...) (showmsg->showMessage((fmt), ##__VA_ARGS__))
+#define ShowStatus(fmt, ...) (showmsg->showStatus((fmt), ##__VA_ARGS__))
+#define ShowSQL(fmt, ...) (showmsg->showSQL((fmt), ##__VA_ARGS__))
+#define ShowInfo(fmt, ...) (showmsg->showInfo((fmt), ##__VA_ARGS__))
+#define ShowNotice(fmt, ...) (showmsg->showNotice((fmt), ##__VA_ARGS__))
+#define ShowWarning(fmt, ...) (showmsg->showWarning((fmt), ##__VA_ARGS__))
+#define ShowDebug(fmt, ...) (showmsg->showDebug((fmt), ##__VA_ARGS__))
+#define ShowError(fmt, ...) (showmsg->showError((fmt), ##__VA_ARGS__))
+#define ShowFatalError(fmt, ...) (showmsg->showFatalError((fmt), ##__VA_ARGS__))
+#define ShowConfigWarning(config, fmt, ...) (showmsg->showConfigWarning((config), (fmt), ##__VA_ARGS__))
+
#ifdef HERCULES_CORE
-extern int stdout_with_ansisequence; //If the color ANSI sequences are to be used. [flaviojs]
-extern int msg_silent; //Specifies how silent the console is. [Skotlex]
-extern int console_msg_log; //Specifies what error messages to log. [Ind]
-extern char timestamp_format[20]; //For displaying Timestamps [Skotlex]
-
-extern void ClearScreen(void);
-extern int vShowMessage_(enum msg_type flag, const char *string, va_list ap);
-
- extern void ShowMessage(const char *, ...) __attribute__((format(printf, 1, 2)));
- extern void ShowStatus(const char *, ...) __attribute__((format(printf, 1, 2)));
- extern void ShowSQL(const char *, ...) __attribute__((format(printf, 1, 2)));
- extern void ShowInfo(const char *, ...) __attribute__((format(printf, 1, 2)));
- extern void ShowNotice(const char *, ...) __attribute__((format(printf, 1, 2)));
- extern void ShowWarning(const char *, ...) __attribute__((format(printf, 1, 2)));
- extern void ShowDebug(const char *, ...) __attribute__((format(printf, 1, 2)));
- extern void ShowError(const char *, ...) __attribute__((format(printf, 1, 2)));
- extern void ShowFatalError(const char *, ...) __attribute__((format(printf, 1, 2)));
- extern void ShowConfigWarning(config_setting_t *config, const char *string, ...) __attribute__((format(printf, 2, 3)));
-#else
- HPExport void (*ShowMessage) (const char *, ...) __attribute__((format(printf, 1, 2)));
- HPExport void (*ShowStatus) (const char *, ...) __attribute__((format(printf, 1, 2)));
- HPExport void (*ShowSQL) (const char *, ...) __attribute__((format(printf, 1, 2)));
- HPExport void (*ShowInfo) (const char *, ...) __attribute__((format(printf, 1, 2)));
- HPExport void (*ShowNotice) (const char *, ...) __attribute__((format(printf, 1, 2)));
- HPExport void (*ShowWarning) (const char *, ...) __attribute__((format(printf, 1, 2)));
- HPExport void (*ShowDebug) (const char *, ...) __attribute__((format(printf, 1, 2)));
- HPExport void (*ShowError) (const char *, ...) __attribute__((format(printf, 1, 2)));
- HPExport void (*ShowFatalError) (const char *, ...) __attribute__((format(printf, 1, 2)));
+void showmsg_defaults(void);
#endif
#endif /* COMMON_SHOWMSG_H */
diff --git a/src/login/login.c b/src/login/login.c
index 3109e80fd..d17e5d2df 100644
--- a/src/login/login.c
+++ b/src/login/login.c
@@ -1734,12 +1734,12 @@ int login_config_read(const char* cfgName)
continue;
if(!strcmpi(w1,"timestamp_format"))
- safestrncpy(timestamp_format, w2, 20);
+ safestrncpy(showmsg->timestamp_format, w2, 20);
else if(!strcmpi(w1,"stdout_with_ansisequence"))
- stdout_with_ansisequence = config_switch(w2);
+ showmsg->stdout_with_ansisequence = config_switch(w2) ? true : false;
else if(!strcmpi(w1,"console_silent")) {
- msg_silent = atoi(w2);
- if( msg_silent ) /* only bother if we actually have this enabled */
+ showmsg->silent = atoi(w2);
+ if (showmsg->silent) /* only bother if we actually have this enabled */
ShowInfo("Console Silent Setting: %d\n", atoi(w2));
}
else if( !strcmpi(w1, "bind_ip") ) {
diff --git a/src/map/clif.c b/src/map/clif.c
index 66f245980..db5259d81 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -5403,7 +5403,7 @@ void clif_displaymessage_sprintf(const int fd, const char *mes, ...) {
if (map->cpsd_active && fd == 0) {
ShowInfo("HCP: ");
va_start(ap,mes);
- vShowMessage_(MSG_NONE,mes,ap);
+ vShowMessage(mes,ap);
va_end(ap);
ShowMessage("\n");
} else if (fd > 0) {
diff --git a/src/map/map.c b/src/map/map.c
index d8ea311f9..a39c6a03a 100644
--- a/src/map/map.c
+++ b/src/map/map.c
@@ -3538,12 +3538,12 @@ int map_config_read(char *cfgName) {
*ptr = '\0';
if(strcmpi(w1,"timestamp_format")==0)
- safestrncpy(timestamp_format, w2, 20);
+ safestrncpy(showmsg->timestamp_format, w2, 20);
else if(strcmpi(w1,"stdout_with_ansisequence")==0)
- stdout_with_ansisequence = config_switch(w2);
+ showmsg->stdout_with_ansisequence = config_switch(w2) ? true : false;
else if(strcmpi(w1,"console_silent")==0) {
- msg_silent = atoi(w2);
- if( msg_silent ) // only bother if its actually enabled
+ showmsg->silent = atoi(w2);
+ if (showmsg->silent) // only bother if its actually enabled
ShowInfo("Console Silent Setting: %d\n", atoi(w2));
} else if (strcmpi(w1, "userid")==0)
chrif->setuserid(w2);
@@ -3593,7 +3593,7 @@ int map_config_read(char *cfgName) {
else if (strcmpi(w1, "use_grf") == 0)
map->enable_grf = config_switch(w2);
else if (strcmpi(w1, "console_msg_log") == 0)
- console_msg_log = atoi(w2);//[Ind]
+ showmsg->console_log = atoi(w2);//[Ind]
else if (strcmpi(w1, "default_language") == 0)
safestrncpy(map->default_lang_str, w2, sizeof(map->default_lang_str));
else if (strcmpi(w1, "import") == 0)
diff --git a/src/map/pc.c b/src/map/pc.c
index 04d597d81..327b7428f 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -3268,23 +3268,17 @@ int pc_bonus2(struct map_session_data *sd,int type,int type2,int val)
sd->skillblown[i].val = val;
}
break;
- #ifndef RENEWAL_CAST
+#ifndef RENEWAL_CAST
case SP_VARCASTRATE:
- #endif
+#endif
case SP_CASTRATE:
if(sd->state.lr_flag == 2)
break;
ARR_FIND(0, ARRAYLENGTH(sd->skillcast), i, sd->skillcast[i].id == 0 || sd->skillcast[i].id == type2);
if (i == ARRAYLENGTH(sd->skillcast)) {
//Better mention this so the array length can be updated. [Skotlex]
- ShowDebug("script->run: bonus2 %s reached it's limit (%"PRIuS" skills per character), bonus skill %d (+%d%%) lost.\n",
-
- #ifndef RENEWAL_CAST
- "bCastRate",
- #else
- "bVariableCastrate",
- #endif
-
+ ShowDebug("script->run: bonus2 %s reached its limit (%"PRIuS" skills per character), bonus skill %d (+%d%%) lost.\n",
+ type == SP_CASTRATE ? "bCastRate" : "bVariableCastrate",
ARRAYLENGTH(sd->skillcast), type2, val);
break;
}