summaryrefslogtreecommitdiff
path: root/src/map/mercenary.c
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2016-02-27 05:24:02 +0100
committerHaru <haru@dotalux.com>2016-02-27 14:30:02 +0100
commit654975dab8c0e47f3523745bfee4abecf8ab0b30 (patch)
tree0460bd654e9e90823c957667bdd83e9ceea5389b /src/map/mercenary.c
parent33d37ff161f724b0bbcde4eedf32c528d3576c90 (diff)
downloadhercules-654975dab8c0e47f3523745bfee4abecf8ab0b30.tar.gz
hercules-654975dab8c0e47f3523745bfee4abecf8ab0b30.tar.bz2
hercules-654975dab8c0e47f3523745bfee4abecf8ab0b30.tar.xz
hercules-654975dab8c0e47f3523745bfee4abecf8ab0b30.zip
Replaced various '-1' with the correct constant
INFINITE_DURATION, INVALID_TIMER, SC_NONE, INDEX_NOT_FOUND, depending on context. Signed-off-by: Haru <haru@dotalux.com>
Diffstat (limited to 'src/map/mercenary.c')
-rw-r--r--src/map/mercenary.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/map/mercenary.c b/src/map/mercenary.c
index ec0b2291f..fa337e13b 100644
--- a/src/map/mercenary.c
+++ b/src/map/mercenary.c
@@ -66,19 +66,23 @@ int merc_search_index(int class_)
{
int i;
ARR_FIND(0, MAX_MERCENARY_CLASS, i, mercenary->db[i].class_ == class_);
- return (i == MAX_MERCENARY_CLASS)?-1:i;
+ if (i == MAX_MERCENARY_CLASS)
+ return INDEX_NOT_FOUND;
+ return i;
}
bool merc_class(int class_)
{
- return (bool)(mercenary->search_index(class_) > -1);
+ if (mercenary->search_index(class_) != INDEX_NOT_FOUND)
+ return true;
+ return false;
}
struct view_data * merc_get_viewdata(int class_)
{
int i = mercenary->search_index(class_);
- if( i < 0 )
- return 0;
+ if (i == INDEX_NOT_FOUND)
+ return NULL;
return &mercenary->db[i].vd;
}
@@ -90,7 +94,7 @@ int merc_create(struct map_session_data *sd, int class_, unsigned int lifetime)
int i;
nullpo_retr(0,sd);
- if( (i = mercenary->search_index(class_)) < 0 )
+ if ((i = mercenary->search_index(class_)) == INDEX_NOT_FOUND)
return 0;
db = &mercenary->db[i];
@@ -310,8 +314,8 @@ int merc_data_received(const struct s_mercenary *merc, bool flag)
if( (sd = map->charid2sd(merc->char_id)) == NULL )
return 0;
- if( !flag || i < 0 )
- { // Not created - loaded - DB info
+ if (!flag || i == INDEX_NOT_FOUND) {
+ // Not created - loaded - DB info
sd->status.mer_id = 0;
return 0;
}