summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2016-07-14 03:45:31 +0200
committerHaru <haru@dotalux.com>2016-07-14 03:45:31 +0200
commitd85daf0f76485c8a3f065d79fb23dc3566aa81cd (patch)
treebfd6ebfd9d3a668e368266e1f94d0b4d619ea407
parentf4aee10c1ae44e220e9e84ae47180758a4a77f4d (diff)
downloadhercules-d85daf0f76485c8a3f065d79fb23dc3566aa81cd.tar.gz
hercules-d85daf0f76485c8a3f065d79fb23dc3566aa81cd.tar.bz2
hercules-d85daf0f76485c8a3f065d79fb23dc3566aa81cd.tar.xz
hercules-d85daf0f76485c8a3f065d79fb23dc3566aa81cd.zip
Changed chat_data::minLvl and chat_data::maxLvl to int and renamed to min_level and max_level
Fixes several -Wsign-compare issues Signed-off-by: Haru <haru@dotalux.com>
-rw-r--r--src/map/chat.c16
-rw-r--r--src/map/chat.h8
-rw-r--r--src/map/script.c4
3 files changed, 14 insertions, 14 deletions
diff --git a/src/map/chat.c b/src/map/chat.c
index 4429d125c..2fe1aacd4 100644
--- a/src/map/chat.c
+++ b/src/map/chat.c
@@ -44,7 +44,7 @@ struct chat_interface *chat;
/// Initializes a chatroom object (common functionality for both pc and npc chatrooms).
/// Returns a chatroom object on success, or NULL on failure.
-struct chat_data* chat_createchat(struct block_list* bl, const char* title, const char* pass, int limit, bool pub, int trigger, const char* ev, int zeny, int minLvl, int maxLvl)
+struct chat_data* chat_createchat(struct block_list* bl, const char* title, const char* pass, int limit, bool pub, int trigger, const char* ev, int zeny, int min_level, int max_level)
{
struct chat_data* cd;
nullpo_retr(NULL, bl);
@@ -62,8 +62,8 @@ struct chat_data* chat_createchat(struct block_list* bl, const char* title, cons
cd->limit = min(limit, ARRAYLENGTH(cd->usersd));
cd->trigger = trigger;
cd->zeny = zeny;
- cd->minLvl = minLvl;
- cd->maxLvl = maxLvl;
+ cd->min_level = min_level;
+ cd->max_level = max_level;
memset(cd->usersd, 0, sizeof(cd->usersd));
cd->owner = bl;
safestrncpy(cd->npc_event, ev, sizeof(cd->npc_event));
@@ -156,8 +156,8 @@ bool chat_joinchat(struct map_session_data* sd, int chatid, const char* pass) {
return false;
}
- if (sd->status.base_level < (int)cd->minLvl || sd->status.base_level > (int)cd->maxLvl) { // FIXME
- if(sd->status.base_level < (int)cd->minLvl) // FIXME
+ if (sd->status.base_level < cd->min_level || sd->status.base_level > cd->max_level) {
+ if(sd->status.base_level < cd->min_level)
clif->joinchatfail(sd,5); // too low level
else
clif->joinchatfail(sd,6); // too high level
@@ -375,7 +375,7 @@ bool chat_kickchat(struct map_session_data* sd, const char* kickusername) {
/*==========================================
* Creates a chat room for the npc
*------------------------------------------*/
-bool chat_createnpcchat(struct npc_data* nd, const char* title, int limit, bool pub, int trigger, const char* ev, int zeny, int minLvl, int maxLvl)
+bool chat_createnpcchat(struct npc_data* nd, const char* title, int limit, bool pub, int trigger, const char* ev, int zeny, int min_level, int max_level)
{
struct chat_data* cd;
nullpo_ret(nd);
@@ -385,12 +385,12 @@ bool chat_createnpcchat(struct npc_data* nd, const char* title, int limit, bool
return false;
}
- if( zeny > MAX_ZENY || maxLvl > MAX_LEVEL ) {
+ if (zeny > MAX_ZENY || max_level > MAX_LEVEL) {
ShowError("chat_createnpcchat: npc '%s' has a required lvl or amount of zeny over the max limit!\n", nd->exname);
return false;
}
- cd = chat->create(&nd->bl, title, "", limit, pub, trigger, ev, zeny, minLvl, maxLvl);
+ cd = chat->create(&nd->bl, title, "", limit, pub, trigger, ev, zeny, min_level, max_level);
if( cd ) {
nd->chat_id = cd->bl.id;
diff --git a/src/map/chat.h b/src/map/chat.h
index 59d61a46e..af43d9703 100644
--- a/src/map/chat.h
+++ b/src/map/chat.h
@@ -41,8 +41,8 @@ struct chat_data {
uint8 limit; ///< join limit
uint8 trigger; ///< number of users needed to trigger event
uint32 zeny; ///< required zeny to join
- uint32 minLvl; ///< minimum base level to join
- uint32 maxLvl; ///< maximum base level allowed to join
+ int min_level; ///< minimum base level to join
+ int max_level; ///< maximum base level allowed to join
struct map_session_data* usersd[MAX_CHAT_USERS];
struct block_list* owner;
char npc_event[EVENT_NAME_LENGTH];
@@ -63,13 +63,13 @@ struct chat_interface {
bool (*change_owner) (struct map_session_data* sd, const char* nextownername);
bool (*change_status) (struct map_session_data* sd, const char* title, const char* pass, int limit, bool pub);
bool (*kick) (struct map_session_data* sd, const char* kickusername);
- bool (*create_npc_chat) (struct npc_data* nd, const char* title, int limit, bool pub, int trigger, const char* ev, int zeny, int minLvl, int maxLvl);
+ bool (*create_npc_chat) (struct npc_data* nd, const char* title, int limit, bool pub, int trigger, const char* ev, int zeny, int min_level, int max_level);
bool (*delete_npc_chat) (struct npc_data* nd);
bool (*enable_event) (struct chat_data* cd);
bool (*disable_event) (struct chat_data* cd);
bool (*npc_kick_all) (struct chat_data* cd);
bool (*trigger_event) (struct chat_data *cd);
- struct chat_data* (*create) (struct block_list* bl, const char* title, const char* pass, int limit, bool pub, int trigger, const char* ev, int zeny, int minLvl, int maxLvl);
+ struct chat_data* (*create) (struct block_list* bl, const char* title, const char* pass, int limit, bool pub, int trigger, const char* ev, int zeny, int min_level, int max_level);
};
#ifdef HERCULES_CORE
diff --git a/src/map/script.c b/src/map/script.c
index effe40ea5..353d57a67 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -11928,8 +11928,8 @@ BUILDIN(getwaitingroomstate)
case 32: script_pushint(st, (cd->users >= cd->limit)); break;
case 33: script_pushint(st, (cd->users >= cd->trigger)); break;
- case 34: script_pushint(st, cd->minLvl); break;
- case 35: script_pushint(st, cd->maxLvl); break;
+ case 34: script_pushint(st, cd->min_level); break;
+ case 35: script_pushint(st, cd->max_level); break;
case 36: script_pushint(st, cd->zeny); break;
default: script_pushint(st, -1); break;
}