summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-08-16 18:52:59 +0000
committerultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-08-16 18:52:59 +0000
commit6efed405193d1dd7dc1f517ff4e3366eeef477e3 (patch)
treef1838bc9d0175eff2fe44690d7f93ffaef06600e
parent8459713dcadc8ec7e2a1f68f6f6ca24cf5f0d3f3 (diff)
downloadhercules-6efed405193d1dd7dc1f517ff4e3366eeef477e3.tar.gz
hercules-6efed405193d1dd7dc1f517ff4e3366eeef477e3.tar.bz2
hercules-6efed405193d1dd7dc1f517ff4e3366eeef477e3.tar.xz
hercules-6efed405193d1dd7dc1f517ff4e3366eeef477e3.zip
Added pc_isidle() to simplify a few idle-no-share checks.
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@11026 54d463be-8e91-2dee-dedb-b68131a5f0ec
-rw-r--r--src/map/party.c11
-rw-r--r--src/map/pc.h1
2 files changed, 5 insertions, 7 deletions
diff --git a/src/map/party.c b/src/map/party.c
index 195e844cb..43835f94f 100644
--- a/src/map/party.c
+++ b/src/map/party.c
@@ -711,8 +711,7 @@ int party_exp_share(struct party_data* p, struct block_list* src, unsigned int b
// count the number of players eligible for exp sharing
for (i = c = 0; i < MAX_PARTY; i++) {
- if( (sd[c] = p->data[i].sd) == NULL || sd[c]->bl.m != src->m || pc_isdead(sd[c]) ||
- (battle_config.idle_no_share && (sd[c]->chatID || sd[c]->vender_id || sd[c]->idletime < last_tick - battle_config.idle_no_share)) )
+ if( (sd[c] = p->data[i].sd) == NULL || sd[c]->bl.m != src->m || pc_isdead(sd[c]) || (battle_config.idle_no_share && pc_isidle(sd[c])) )
continue;
c++;
}
@@ -760,8 +759,7 @@ int party_share_loot(struct party_data* p, TBL_PC* sd, struct item* item_data, i
if (i >= MAX_PARTY)
i = 0; // reset counter to 1st person in party so it'll stop when it reaches "itemc"
- if( (psd = p->data[i].sd) == NULL || sd->bl.m != psd->bl.m || pc_isdead(psd) ||
- (battle_config.idle_no_share && (psd->chatID || psd->vender_id || last_tick - battle_config.idle_no_share > psd->idletime)) )
+ if( (psd = p->data[i].sd) == NULL || sd->bl.m != psd->bl.m || pc_isdead(psd) || (battle_config.idle_no_share && pc_isidle(psd)) )
continue;
if (pc_additem(psd,item_data,item_data->amount))
@@ -779,8 +777,7 @@ int party_share_loot(struct party_data* p, TBL_PC* sd, struct item* item_data, i
int count = 0;
//Collect pick candidates
for (i = 0; i < MAX_PARTY; i++) {
- if( (psd[count] = p->data[i].sd) == NULL || psd[count]->bl.m != sd->bl.m || pc_isdead(psd[count]) ||
- (battle_config.idle_no_share && (psd[count]->chatID || psd[count]->vender_id || last_tick - battle_config.idle_no_share > psd[count]->idletime)) )
+ if( (psd[count] = p->data[i].sd) == NULL || psd[count]->bl.m != sd->bl.m || pc_isdead(psd[count]) || (battle_config.idle_no_share && pc_isidle(psd[count])) )
continue;
count++;
@@ -833,7 +830,7 @@ int party_sub_count(struct block_list *bl, va_list ap)
if (sd->state.autotrade)
return 0;
- if (battle_config.idle_no_share && (sd->chatID || sd->vender_id || (sd->idletime < (last_tick - battle_config.idle_no_share))))
+ if (battle_config.idle_no_share && pc_isidle(sd))
return 0;
return 1;
diff --git a/src/map/pc.h b/src/map/pc.h
index a0302cad0..7e0a8f7bb 100644
--- a/src/map/pc.h
+++ b/src/map/pc.h
@@ -89,6 +89,7 @@ enum {
#define pc_setsit(sd) ((sd)->state.dead_sit = (sd)->vd.dead_sit = 2)
#define pc_isdead(sd) ((sd)->state.dead_sit == 1)
#define pc_issit(sd) ((sd)->vd.dead_sit == 2)
+#define pc_isidle(sd) ((sd)->chatID || (sd)->vender_id || DIFF_TICK(last_tick, sd->idletime) >= battle_config.idle_no_share)
#define pc_setdir(sd,b,h) ((sd)->ud.dir = (b) ,(sd)->head_dir = (h) )
#define pc_setchatid(sd,n) ((sd)->chatID = n)
#define pc_ishiding(sd) ((sd)->sc.option&(OPTION_HIDE|OPTION_CLOAK|OPTION_CHASEWALK))