summaryrefslogtreecommitdiff
path: root/src/map/party.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/party.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/party.c')
-rw-r--r--src/map/party.c27
1 files changed, 18 insertions, 9 deletions
diff --git a/src/map/party.c b/src/map/party.c
index 39c6e25fb..77f3c2b0b 100644
--- a/src/map/party.c
+++ b/src/map/party.c
@@ -67,18 +67,27 @@ void party_fill_member(struct party_member* member, struct map_session_data* sd,
member->online = 1;
member->leader = leader;
}
-/// Get the member_id of a party member.
-/// Return -1 if not in party.
-int party_getmemberid(struct party_data* p, struct map_session_data* sd) {
+
+/**
+ * Gets the member_id of a party member.
+ *
+ * @param p Party data.
+ * @param sd Member data.
+ * @return the member_id.
+ * @retval INDEX_NOT_FOUND if not in party.
+ */
+int party_getmemberid(struct party_data *p, struct map_session_data *sd)
+{
int member_id;
- nullpo_retr(-1, p);
- if( sd == NULL )
- return -1;// no player
+ nullpo_retr(INDEX_NOT_FOUND, p);
+
+ if (sd == NULL)
+ return INDEX_NOT_FOUND; // no player
ARR_FIND(0, MAX_PARTY, member_id,
p->party.member[member_id].account_id == sd->status.account_id &&
p->party.member[member_id].char_id == sd->status.char_id);
- if( member_id == MAX_PARTY )
- return -1;// not found
+ if (member_id == MAX_PARTY)
+ return INDEX_NOT_FOUND; // not found
return member_id;
}
@@ -326,7 +335,7 @@ int party_recv_info(const struct party *sp, int char_id)
if( char_id != 0 ) {
// requester
sd = map->charid2sd(char_id);
- if( sd && sd->status.party_id == sp->party_id && party->getmemberid(p,sd) == -1 )
+ if (sd != NULL && sd->status.party_id == sp->party_id && party->getmemberid(p,sd) == INDEX_NOT_FOUND)
sd->status.party_id = 0;// was not in the party
}
return 0;