summaryrefslogtreecommitdiff
path: root/src/map
diff options
context:
space:
mode:
authorshennetsind <ind@henn.et>2013-10-07 13:40:34 -0300
committershennetsind <ind@henn.et>2013-10-07 13:40:34 -0300
commitc56e3eb701658079f1de09db759f3b09327ec046 (patch)
treea37f7ff23a9adc9d7c725b85f94cf25685e30aba /src/map
parentbaa5c1fc386a706ba4bf4aa48409b8947274c928 (diff)
downloadhercules-c56e3eb701658079f1de09db759f3b09327ec046.tar.gz
hercules-c56e3eb701658079f1de09db759f3b09327ec046.tar.bz2
hercules-c56e3eb701658079f1de09db759f3b09327ec046.tar.xz
hercules-c56e3eb701658079f1de09db759f3b09327ec046.zip
Fixed Bug #7744
Adjusted missing #ifdef behavior to be friendly to the hooking. http://hercules.ws/board/tracker/issue-7744-compiler-error-on-hpm-hooking-after-undefined-packetver-re/ Signed-off-by: shennetsind <ind@henn.et>
Diffstat (limited to 'src/map')
-rw-r--r--src/map/clif.c24
-rw-r--r--src/map/clif.h6
-rw-r--r--src/map/map.c12
-rw-r--r--src/map/map.h2
-rw-r--r--src/map/npc.c6
-rw-r--r--src/map/npc.h2
-rw-r--r--src/map/party.c145
-rw-r--r--src/map/party.h13
-rw-r--r--src/map/status.c35
-rw-r--r--src/map/status.h6
10 files changed, 146 insertions, 105 deletions
diff --git a/src/map/clif.c b/src/map/clif.c
index f6c2ef4d0..e730823be 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -860,9 +860,9 @@ static int clif_setlevel(struct block_list* bl) {
}
return lv;
}
-#if PACKETVER < 20091103
/* for 'packetver < 20091103' 0x78 non-pc-looking unit handling */
void clif_set_unit_idle2(struct block_list* bl, struct map_session_data *tsd, enum send_target target) {
+#if PACKETVER < 20091103
struct map_session_data* sd;
struct status_change* sc = status->get_sc(bl);
struct view_data* vd = status->get_viewdata(bl);
@@ -907,8 +907,10 @@ void clif_set_unit_idle2(struct block_list* bl, struct map_session_data *tsd, en
p.clevel = clif_setlevel(bl);
clif->send(&p,sizeof(p),tsd?&tsd->bl:bl,target);
-}
+#else
+ return;
#endif
+}
/*==========================================
* Prepares 'unit standing' packet
*------------------------------------------*/
@@ -996,9 +998,9 @@ void clif_set_unit_idle(struct block_list* bl, struct map_session_data *tsd, enu
}
}
-#if PACKETVER < 20091103
/* for 'packetver < 20091103' 0x7c non-pc-looking unit handling */
void clif_spawn_unit2(struct block_list* bl, enum send_target target) {
+#if PACKETVER < 20091103
struct map_session_data* sd;
struct status_change* sc = status->get_sc(bl);
struct view_data* vd = status->get_viewdata(bl);
@@ -1037,8 +1039,10 @@ void clif_spawn_unit2(struct block_list* bl, enum send_target target) {
p.xSize = p.ySize = (sd) ? 5 : 0;
clif->send(&p,sizeof(p),bl,target);
-}
+#else
+ return;
#endif
+}
void clif_spawn_unit(struct block_list* bl, enum send_target target) {
struct map_session_data* sd;
struct status_change* sc = status->get_sc(bl);
@@ -12369,7 +12373,7 @@ void clif_parse_PartyBookingRegisterReq(int fd, struct map_session_data* sd)
short level = RFIFOW(fd,2);
const char *notice = (const char*)RFIFOP(fd, 4);
- party->booking_register(sd, level, notice);
+ party->recruit_register(sd, level, notice);
}
/// Party booking search results (ZC_PARTY_RECRUIT_ACK_SEARCH).
@@ -12426,7 +12430,7 @@ void clif_parse_PartyBookingSearchReq(int fd, struct map_session_data* sd)
unsigned long lastindex = RFIFOL(fd, 6);
short resultcount = RFIFOW(fd, 10);
- party->booking_search(sd, level, mapid, lastindex, resultcount);
+ party->recruit_search(sd, level, mapid, lastindex, resultcount);
}
/// Request to delete own party booking advertisment (CZ_PARTY_RECRUIT_REQ_DELETE).
@@ -12462,7 +12466,7 @@ void clif_parse_PartyBookingUpdateReq(int fd, struct map_session_data *sd)
notice = (const char*)RFIFOP(fd, 2);
- party->booking_update(sd, notice);
+ party->recruit_update(sd, notice);
}
/// Notification about new party booking advertisment (ZC_PARTY_RECRUIT_NOTIFY_INSERT).
@@ -17984,10 +17988,8 @@ void clif_defaults(void) {
clif->clearunit_delayed_sub = clif_clearunit_delayed_sub;
clif->set_unit_idle = clif_set_unit_idle;
clif->spawn_unit = clif_spawn_unit;
-#if PACKETVER < 20091103
clif->spawn_unit2 = clif_spawn_unit2;
clif->set_unit_idle2 = clif_set_unit_idle2;
-#endif
clif->set_unit_walking = clif_set_unit_walking;
clif->calc_walkdelay = clif_calc_walkdelay;
clif->getareachar_skillunit = clif_getareachar_skillunit;
@@ -18343,13 +18345,11 @@ void clif_defaults(void) {
clif->PartyBookingDeleteNotify = clif_PartyBookingDeleteNotify;
clif->PartyBookingInsertNotify = clif_PartyBookingInsertNotify;
/* Group Search System Update */
-#ifdef PARTY_RECRUIT
clif->PartyBookingVolunteerInfo = clif_PartyBookingVolunteerInfo;
clif->PartyBookingRefuseVolunteer = clif_PartyBookingRefuseVolunteer;
clif->PartyBookingCancelVolunteer = clif_PartyBookingCancelVolunteer;
clif->PartyBookingAddFilteringList = clif_PartyBookingAddFilteringList;
clif->PartyBookingSubFilteringList = clif_PartyBookingSubFilteringList;
-#endif
/* buying store-related */
clif->buyingstore_open = clif_buyingstore_open;
clif->buyingstore_open_failed = clif_buyingstore_open_failed;
@@ -18613,11 +18613,9 @@ void clif_defaults(void) {
clif->pPartyTick = clif_parse_PartyTick;
clif->pGuildInvite2 = clif_parse_GuildInvite2;
/* Group Search System Update */
-#ifdef PARTY_RECRUIT
clif->pPartyBookingAddFilter = clif_parse_PartyBookingAddFilteringList;
clif->pPartyBookingSubFilter = clif_parse_PartyBookingSubFilteringList;
clif->pPartyBookingReqVolunteer = clif_parse_PartyBookingReqVolunteer;
clif->pPartyBookingRefuseVolunteer = clif_parse_PartyBookingRefuseVolunteer;
clif->pPartyBookingCancelVolunteer = clif_parse_PartyBookingCancelVolunteer;
-#endif
}
diff --git a/src/map/clif.h b/src/map/clif.h
index 1e054db1d..31808ddcc 100644
--- a/src/map/clif.h
+++ b/src/map/clif.h
@@ -546,10 +546,8 @@ struct clif_interface {
int (*clearunit_delayed_sub) (int tid, unsigned int tick, int id, intptr_t data);
void (*set_unit_idle) (struct block_list* bl, struct map_session_data *tsd,enum send_target target);
void (*spawn_unit) (struct block_list* bl, enum send_target target);
-#if PACKETVER < 20091103
void (*spawn_unit2) (struct block_list* bl, enum send_target target);
void (*set_unit_idle2) (struct block_list* bl, struct map_session_data *tsd, enum send_target target);
-#endif
void (*set_unit_walking) (struct block_list* bl, struct map_session_data *tsd,struct unit_data* ud, enum send_target target);
int (*calc_walkdelay) (struct block_list *bl,int delay, int type, int damage, int div_);
void (*getareachar_skillunit) (struct map_session_data *sd, struct skill_unit *su);
@@ -905,13 +903,11 @@ struct clif_interface {
void (*PartyBookingDeleteNotify) (struct map_session_data* sd, int index);
void (*PartyBookingInsertNotify) (struct map_session_data* sd, struct party_booking_ad_info* pb_ad);
/* Group Search System Update */
-#ifdef PARTY_RECRUIT
void (*PartyBookingVolunteerInfo) (int index, struct map_session_data *sd);
void (*PartyBookingRefuseVolunteer) (unsigned long aid, struct map_session_data *sd);
void (*PartyBookingCancelVolunteer) (int index, struct map_session_data *sd);
void (*PartyBookingAddFilteringList) (int index, struct map_session_data *sd);
void (*PartyBookingSubFilteringList) (int gid, struct map_session_data *sd);
-#endif
/* buying store-related */
void (*buyingstore_open) (struct map_session_data* sd);
void (*buyingstore_open_failed) (struct map_session_data* sd, unsigned short result, unsigned int weight);
@@ -1173,13 +1169,11 @@ struct clif_interface {
void (*pPartyTick) (int fd, struct map_session_data *sd);
void (*pGuildInvite2) (int fd, struct map_session_data *sd);
/* Group Search System Update */
-#ifdef PARTY_RECRUIT
void (*pPartyBookingAddFilter) (int fd, struct map_session_data *sd);
void (*pPartyBookingSubFilter) (int fd, struct map_session_data *sd);
void (*pPartyBookingReqVolunteer) (int fd, struct map_session_data *sd);
void (*pPartyBookingRefuseVolunteer) (int fd, struct map_session_data *sd);
void (*pPartyBookingCancelVolunteer) (int fd, struct map_session_data *sd);
-#endif
};
struct clif_interface *clif;
diff --git a/src/map/map.c b/src/map/map.c
index 0c684542d..d920875ee 100644
--- a/src/map/map.c
+++ b/src/map/map.c
@@ -137,26 +137,32 @@ int map_freeblock_timer(int tid, unsigned int tick, int id, intptr_t data) {
return 0;
}
-#ifdef CELL_NOSTACK
/*==========================================
* These pair of functions update the counter of how many objects
* lie on a tile.
*------------------------------------------*/
void map_addblcell(struct block_list *bl) {
+#ifdef CELL_NOSTACK
if( bl->m < 0 || bl->x < 0 || bl->x >= map->list[bl->m].xs
|| bl->y < 0 || bl->y >= map->list[bl->m].ys
|| !(bl->type&BL_CHAR) )
return;
map->list[bl->m].cell[bl->x+bl->y*map->list[bl->m].xs].cell_bl++;
+#else
+ return;
+#endif
}
void map_delblcell(struct block_list *bl) {
+#ifdef CELL_NOSTACK
if( bl->m < 0 || bl->x < 0 || bl->x >= map->list[bl->m].xs
|| bl->y < 0 || bl->y >= map->list[bl->m].ys
|| !(bl->type&BL_CHAR) )
map->list[bl->m].cell[bl->x+bl->y*map->list[bl->m].xs].cell_bl--;
-}
+#else
+ return;
#endif
+}
/*==========================================
* Adds a block to the map.
@@ -5792,10 +5798,8 @@ void map_defaults(void) {
map->versionscreen = map_versionscreen;
map->arg_next_value = map_arg_next_value;
-#ifdef CELL_NOSTACK
map->addblcell = map_addblcell;
map->delblcell = map_delblcell;
-#endif
/**
* mapit interface
diff --git a/src/map/map.h b/src/map/map.h
index 67fdfcf96..29c1dfecc 100644
--- a/src/map/map.h
+++ b/src/map/map.h
@@ -1018,10 +1018,8 @@ struct map_interface {
void (*helpscreen) (bool do_exit);
void (*versionscreen) (bool do_exit);
bool (*arg_next_value) (const char *option, int i, int argc);
-#ifdef CELL_NOSTACK
void (*addblcell) (struct block_list *bl);
void (*delblcell) (struct block_list *bl);
-#endif
};
struct map_interface *map;
diff --git a/src/map/npc.c b/src/map/npc.c
index a28724238..c52dce325 100644
--- a/src/map/npc.c
+++ b/src/map/npc.c
@@ -212,11 +212,11 @@ struct npc_data* npc_name2id(const char* name)
/**
* For the Secure NPC Timeout option (check config/Secure.h) [RR]
**/
-#ifdef SECURE_NPCTIMEOUT
/**
* Timer to check for idle time and timeout the dialog if necessary
**/
int npc_rr_secure_timeout_timer(int tid, unsigned int tick, int id, intptr_t data) {
+#ifdef SECURE_NPCTIMEOUT
struct map_session_data* sd = NULL;
unsigned int timeout = NPC_SECURE_TIMEOUT_NEXT;
if( (sd = map->id2sd(id)) == NULL || !sd->npc_id ) {
@@ -251,9 +251,9 @@ int npc_rr_secure_timeout_timer(int tid, unsigned int tick, int id, intptr_t dat
sd->npc_idle_timer = INVALID_TIMER;
} else //Create a new instance of ourselves to continue
sd->npc_idle_timer = timer->add(timer->gettick() + (SECURE_NPCTIMEOUT_INTERVAL*1000),npc->secure_timeout_timer,sd->bl.id,0);
+#endif
return 0;
}
-#endif
/*==========================================
* Dequeue event and add timer for execution (100ms)
@@ -4072,7 +4072,5 @@ void npc_defaults(void) {
npc->do_clear_npc = do_clear_npc;
npc->debug_warps_sub = npc_debug_warps_sub;
npc->debug_warps = npc_debug_warps;
-#ifdef SECURE_NPCTIMEOUT
npc->secure_timeout_timer = npc_rr_secure_timeout_timer;
-#endif
}
diff --git a/src/map/npc.h b/src/map/npc.h
index 3c273fffb..f809cb19c 100644
--- a/src/map/npc.h
+++ b/src/map/npc.h
@@ -229,9 +229,7 @@ struct npc_interface {
/**
* For the Secure NPC Timeout option (check config/Secure.h) [RR]
**/
-#ifdef SECURE_NPCTIMEOUT
int (*secure_timeout_timer) (int tid, unsigned int tick, int id, intptr_t data);
-#endif
};
struct npc_interface *npc;
diff --git a/src/map/party.c b/src/map/party.c
index 1694adf2c..7db6b8e10 100644
--- a/src/map/party.c
+++ b/src/map/party.c
@@ -1108,16 +1108,9 @@ struct party_booking_ad_info* create_party_booking_data(void) {
return pb_ad;
}
-#ifndef PARTY_RECRUIT
-void party_booking_register(struct map_session_data *sd, short level, short mapid, short* job)
-#else
-void party_booking_register(struct map_session_data *sd, short level, const char *notice)
-#endif
-{
+void party_recruit_register(struct map_session_data *sd, short level, const char *notice) {
+#ifdef PARTY_RECRUIT
struct party_booking_ad_info *pb_ad;
-#ifndef PARTY_RECRUIT
- int i;
-#endif
pb_ad = (struct party_booking_ad_info*)idb_get(party->booking_db, sd->status.char_id);
@@ -1135,30 +1128,52 @@ void party_booking_register(struct map_session_data *sd, short level, const char
memcpy(pb_ad->charname,sd->status.name,NAME_LENGTH);
pb_ad->expiretime = (int)time(NULL);
pb_ad->p_detail.level = level;
+ safestrncpy(pb_ad->p_detail.notice, notice, PB_NOTICE_LENGTH);
+
+ clif->PartyBookingRegisterAck(sd, 0);
+ clif->PartyBookingInsertNotify(sd, pb_ad); // Notice
+#else
+ return;
+#endif
+}
+
+void party_booking_register(struct map_session_data *sd, short level, short mapid, short* job) {
#ifndef PARTY_RECRUIT
+ struct party_booking_ad_info *pb_ad;
+ int i;
+
+ pb_ad = (struct party_booking_ad_info*)idb_get(party->booking_db, sd->status.char_id);
+
+ if( pb_ad == NULL )
+ {
+ pb_ad = party->create_booking_data();
+ idb_put(party->booking_db, sd->status.char_id, pb_ad);
+ }
+ else
+ {// already registered
+ clif->PartyBookingRegisterAck(sd, 2);
+ return;
+ }
+
+ memcpy(pb_ad->charname,sd->status.name,NAME_LENGTH);
+ pb_ad->expiretime = (int)time(NULL);
+ pb_ad->p_detail.level = level;
pb_ad->p_detail.mapid = mapid;
-
+
for(i=0;i<PARTY_BOOKING_JOBS;i++)
if(job[i] != 0xFF)
pb_ad->p_detail.job[i] = job[i];
else pb_ad->p_detail.job[i] = -1;
-#else
- safestrncpy(pb_ad->p_detail.notice, notice, PB_NOTICE_LENGTH);
-#endif
-
+
clif->PartyBookingRegisterAck(sd, 0);
clif->PartyBookingInsertNotify(sd, pb_ad); // Notice
-}
-
-#ifndef PARTY_RECRUIT
-void party_booking_update(struct map_session_data *sd, short* job)
#else
-void party_booking_update(struct map_session_data *sd, const char *notice)
-#endif
-{
-#ifndef PARTY_RECRUIT
- int i;
+ return;
#endif
+}
+
+void party_recruit_update(struct map_session_data *sd, const char *notice) {
+#ifdef PARTY_RECRUIT
struct party_booking_ad_info *pb_ad;
pb_ad = (struct party_booking_ad_info*)idb_get(party->booking_db, sd->status.char_id);
@@ -1168,30 +1183,42 @@ void party_booking_update(struct map_session_data *sd, const char *notice)
pb_ad->expiretime = (int)time(NULL);// Update time.
-#ifndef PARTY_RECRUIT
- for(i=0;i<PARTY_BOOKING_JOBS;i++)
- if(job[i] != 0xFF)
- pb_ad->p_detail.job[i] = job[i];
- else pb_ad->p_detail.job[i] = -1;
-#else
if (notice != NULL) {
safestrncpy(pb_ad->p_detail.notice, notice, PB_NOTICE_LENGTH);
}
-#endif
clif->PartyBookingUpdateNotify(sd, pb_ad);
-}
-
-#ifndef PARTY_RECRUIT
-void party_booking_search(struct map_session_data *sd, short level, short mapid, short job, unsigned long lastindex, short resultcount)
#else
-void party_booking_search(struct map_session_data *sd, short level, short mapid, unsigned long lastindex, short resultcount)
+ return;
#endif
-{
- struct party_booking_ad_info *pb_ad;
+}
+void party_booking_update(struct map_session_data *sd, short* job) {
#ifndef PARTY_RECRUIT
int i;
+ struct party_booking_ad_info *pb_ad;
+
+ pb_ad = (struct party_booking_ad_info*)idb_get(party->booking_db, sd->status.char_id);
+
+ if( pb_ad == NULL )
+ return;
+
+ pb_ad->expiretime = (int)time(NULL);// Update time.
+
+ for(i=0;i<PARTY_BOOKING_JOBS;i++)
+ if(job[i] != 0xFF)
+ pb_ad->p_detail.job[i] = job[i];
+ else pb_ad->p_detail.job[i] = -1;
+
+ clif->PartyBookingUpdateNotify(sd, pb_ad);
+#else
+ return;
#endif
+}
+
+
+void party_recruit_search(struct map_session_data *sd, short level, short mapid, unsigned long lastindex, short resultcount) {
+#ifdef PARTY_RECRUIT
+ struct party_booking_ad_info *pb_ad;
int count = 0;
struct party_booking_ad_info* result_list[PARTY_BOOKING_RESULTS];
bool more_result = false;
@@ -1201,18 +1228,42 @@ void party_booking_search(struct map_session_data *sd, short level, short mapid,
for( pb_ad = dbi_first(iter); dbi_exists(iter); pb_ad = dbi_next(iter) )
{
-#ifndef PARTY_RECRUIT
- if (pb_ad->index < lastindex || (level && (pb_ad->p_detail.level < level-15 || pb_ad->p_detail.level > level)))
- continue;
-#else
if ((level && (pb_ad->p_detail.level < level-15 || pb_ad->p_detail.level > level)))
continue;
-#endif
if (count >= PARTY_BOOKING_RESULTS){
more_result = true;
break;
}
+ result_list[count] = pb_ad;
+ if( result_list[count] )
+ {
+ count++;
+ }
+ }
+ dbi_destroy(iter);
+ clif->PartyBookingSearchAck(sd->fd, result_list, count, more_result);
+#else
+ return;
+#endif
+}
+void party_booking_search(struct map_session_data *sd, short level, short mapid, short job, unsigned long lastindex, short resultcount) {
#ifndef PARTY_RECRUIT
+ struct party_booking_ad_info *pb_ad;
+ int i;
+ int count = 0;
+ struct party_booking_ad_info* result_list[PARTY_BOOKING_RESULTS];
+ bool more_result = false;
+ DBIterator* iter = db_iterator(party->booking_db);
+
+ memset(result_list, 0, sizeof(result_list));
+
+ for( pb_ad = dbi_first(iter); dbi_exists(iter); pb_ad = dbi_next(iter) ) {
+ if (pb_ad->index < lastindex || (level && (pb_ad->p_detail.level < level-15 || pb_ad->p_detail.level > level)))
+ continue;
+ if (count >= PARTY_BOOKING_RESULTS){
+ more_result = true;
+ break;
+ }
if (mapid == 0 && job == -1)
result_list[count] = pb_ad;
else if (mapid == 0) {
@@ -1223,9 +1274,6 @@ void party_booking_search(struct map_session_data *sd, short level, short mapid,
if (pb_ad->p_detail.mapid == mapid)
result_list[count] = pb_ad;
}
-#else
- result_list[count] = pb_ad;
-#endif
if( result_list[count] )
{
count++;
@@ -1233,8 +1281,12 @@ void party_booking_search(struct map_session_data *sd, short level, short mapid,
}
dbi_destroy(iter);
clif->PartyBookingSearchAck(sd->fd, result_list, count, more_result);
+#else
+ return;
+#endif
}
+
bool party_booking_delete(struct map_session_data *sd)
{
struct party_booking_ad_info* pb_ad;
@@ -1309,6 +1361,9 @@ void party_defaults(void) {
party->booking_register = party_booking_register;
party->booking_update = party_booking_update;
party->booking_search = party_booking_search;
+ party->recruit_register = party_recruit_register;
+ party->recruit_update = party_recruit_update;
+ party->recruit_search = party_recruit_search;
party->booking_delete = party_booking_delete;
party->vforeachsamemap = party_vforeachsamemap;
party->foreachsamemap = party_foreachsamemap;
diff --git a/src/map/party.h b/src/map/party.h
index 570c7bd11..208edb846 100644
--- a/src/map/party.h
+++ b/src/map/party.h
@@ -34,6 +34,8 @@ struct party_data {
} state;
};
+#define PB_NOTICE_LENGTH (36 + 1)
+
#ifndef PARTY_RECRUIT
struct party_booking_detail {
short level;
@@ -48,7 +50,6 @@ struct party_booking_ad_info {
struct party_booking_detail p_detail;
};
#else /* PARTY_RECRUIT */
-#define PB_NOTICE_LENGTH (36 + 1)
struct party_booking_detail {
short level;
char notice[PB_NOTICE_LENGTH];
@@ -111,15 +112,13 @@ struct party_interface {
/*==========================================
* Party Booking in KRO [Spiria]
*------------------------------------------*/
-#ifndef PARTY_RECRUIT
void (*booking_register) (struct map_session_data *sd, short level, short mapid, short* job);
void (*booking_update) (struct map_session_data *sd, short* job);
void (*booking_search) (struct map_session_data *sd, short level, short mapid, short job, unsigned long lastindex, short resultcount);
-#else /* PARTY_RECRUIT */
- void (*booking_register) (struct map_session_data *sd, short level, const char *notice);
- void (*booking_update) (struct map_session_data *sd, const char *notice);
- void (*booking_search) (struct map_session_data *sd, short level, short mapid, unsigned long lastindex, short resultcount);
-#endif
+ /* PARTY_RECRUIT */
+ void (*recruit_register) (struct map_session_data *sd, short level, const char *notice);
+ void (*recruit_update) (struct map_session_data *sd, const char *notice);
+ void (*recruit_search) (struct map_session_data *sd, short level, short mapid, unsigned long lastindex, short resultcount);
bool (*booking_delete) (struct map_session_data *sd);
/* */
int (*vforeachsamemap) (int (*func)(struct block_list *,va_list),struct map_session_data *sd,int range, va_list ap);
diff --git a/src/map/status.c b/src/map/status.c
index 6953312f8..6b2edc9ac 100644
--- a/src/map/status.c
+++ b/src/map/status.c
@@ -1911,9 +1911,14 @@ unsigned short status_base_atk(const struct block_list *bl, const struct status_
static inline unsigned short status_base_matk_min(const struct status_data *st){ return st->int_+(st->int_/7)*(st->int_/7); }
static inline unsigned short status_base_matk_max(const struct status_data *st){ return st->int_+(st->int_/5)*(st->int_/5); }
+
+unsigned short status_base_matk(const struct status_data *st, int level) {
#ifdef RENEWAL
-unsigned short status_base_matk(const struct status_data *st, int level){ return st->int_+(st->int_/2)+(st->dex/5)+(st->luk/3)+(level/4); }
+ return st->int_+(st->int_/2)+(st->dex/5)+(st->luk/3)+(level/4);
+#else
+ return 0;
#endif
+}
//Fills in the misc data that can be calculated from the other status info (except for level)
void status_calc_misc(struct block_list *bl, struct status_data *st, int level) {
@@ -4514,9 +4519,8 @@ unsigned short status_calc_watk(struct block_list *bl, struct status_change *sc,
return (unsigned short)cap_value(watk,0,USHRT_MAX);
}
+unsigned short status_calc_ematk(struct block_list *bl, struct status_change *sc, int matk) {
#ifdef RENEWAL
-unsigned short status_calc_ematk(struct block_list *bl, struct status_change *sc, int matk)
-{
if (!sc || !sc->count)
return cap_value(matk,0,USHRT_MAX);
@@ -4539,8 +4543,10 @@ unsigned short status_calc_ematk(struct block_list *bl, struct status_change *sc
if(sc->data[SC_IZAYOI])
matk += 25 * sc->data[SC_IZAYOI]->val1;
return (unsigned short)cap_value(matk,0,USHRT_MAX);
-}
+#else
+ return 0;
#endif
+}
unsigned short status_calc_matk(struct block_list *bl, struct status_change *sc, int matk, bool viewable)
{
if(!sc || !sc->count)
@@ -5202,11 +5208,10 @@ unsigned short status_calc_speed(struct block_list *bl, struct status_change *sc
return (short)cap_value(speed,10,USHRT_MAX);
}
-#ifdef RENEWAL_ASPD
// flag&1 - fixed value [malufett]
// flag&2 - percentage value
-short status_calc_aspd(struct block_list *bl, struct status_change *sc, short flag)
-{
+short status_calc_aspd(struct block_list *bl, struct status_change *sc, short flag) {
+#ifdef RENEWAL_ASPD
int i, pots = 0, skills1 = 0, skills2 = 0;
if(!sc || !sc->count)
@@ -5318,8 +5323,10 @@ short status_calc_aspd(struct block_list *bl, struct status_change *sc, short fl
}
}
return ( flag&1? (skills1 + pots) : skills2 );
-}
+#else
+ return 0;
#endif
+}
short status_calc_fix_aspd(struct block_list *bl, struct status_change *sc, int aspd) {
if (!sc || !sc->count)
@@ -10768,8 +10775,8 @@ int status_change_timer_sub(struct block_list* bl, va_list ap) {
int status_get_total_def(struct block_list *src) { return status->get_status_data(src)->def2 + (short)status->get_def(src); }
int status_get_total_mdef(struct block_list *src) { return status->get_status_data(src)->mdef2 + (short)status_get_mdef(src); }
-#ifdef RENEWAL
int status_get_weapon_atk(struct block_list *bl, struct weapon_atk *watk, int flag) {
+#ifdef RENEWAL
int min = 0, max = 0, dstr;
float strdex_bonus, variance;
struct status_change *sc = status->get_sc(bl);
@@ -10803,8 +10810,10 @@ int status_get_weapon_atk(struct block_list *bl, struct weapon_atk *watk, int fl
max = status->calc_watk(bl, sc, max, false);
return max;
-}
+#else
+ return 0;
#endif
+}
#define GETRANDMATK(st) do {\
if( (st)->matk_max > (st)->matk_min ) \
@@ -11552,10 +11561,8 @@ void status_defaults(void) {
status->calc_mdef = status_calc_mdef;
status->calc_mdef2 = status_calc_mdef2;
status->calc_batk = status_calc_batk;
-#ifdef RENEWAL
status->base_matk = status_base_matk;
status->get_weapon_atk = status_get_weapon_atk;
-#endif
status->get_total_mdef = status_get_total_mdef;
status->get_total_def = status_get_total_def;
@@ -11588,18 +11595,14 @@ void status_defaults(void) {
status->calc_speed = status_calc_speed;
status->calc_aspd_rate = status_calc_aspd_rate;
status->calc_dmotion = status_calc_dmotion;
-#ifdef RENEWAL_ASPD
status->calc_aspd = status_calc_aspd;
-#endif
status->calc_fix_aspd = status_calc_fix_aspd;
status->calc_maxhp = status_calc_maxhp;
status->calc_maxsp = status_calc_maxsp;
status->calc_element = status_calc_element;
status->calc_element_lv = status_calc_element_lv;
status->calc_mode = status_calc_mode;
-#ifdef RENEWAL
status->calc_ematk = status_calc_ematk;
-#endif
status->calc_bl_main = status_calc_bl_main;
status->display_add = status_display_add;
status->display_remove = status_display_remove;
diff --git a/src/map/status.h b/src/map/status.h
index d1e78b0b7..c7518a213 100644
--- a/src/map/status.h
+++ b/src/map/status.h
@@ -1893,10 +1893,8 @@ struct status_interface {
defType (*calc_mdef) (struct block_list *bl, struct status_change *sc, int mdef, bool viewable);
short (*calc_mdef2) (struct block_list *bl, struct status_change *sc, int mdef2, bool viewable);
unsigned short (*calc_batk)(struct block_list *bl, struct status_change *sc, int batk, bool viewable);
-#ifdef RENEWAL
unsigned short (*base_matk) (const struct status_data *st, int level);
int (*get_weapon_atk) (struct block_list *src, struct weapon_atk *watk, int flag);
-#endif
int (*get_total_mdef) (struct block_list *src);
int (*get_total_def) (struct block_list *src);
int (*get_matk) (struct block_list *src, int flag);
@@ -1925,18 +1923,14 @@ struct status_interface {
unsigned short (*calc_speed) (struct block_list *bl, struct status_change *sc, int speed);
short (*calc_aspd_rate) (struct block_list *bl, struct status_change *sc, int aspd_rate);
unsigned short (*calc_dmotion) (struct block_list *bl, struct status_change *sc, int dmotion);
-#ifdef RENEWAL_ASPD
short (*calc_aspd) (struct block_list *bl, struct status_change *sc, short flag);
-#endif
short (*calc_fix_aspd) (struct block_list *bl, struct status_change *sc, int aspd);
unsigned int (*calc_maxhp) (struct block_list *bl, struct status_change *sc, uint64 maxhp);
unsigned int (*calc_maxsp) (struct block_list *bl, struct status_change *sc, unsigned int maxsp);
unsigned char (*calc_element) (struct block_list *bl, struct status_change *sc, int element);
unsigned char (*calc_element_lv) (struct block_list *bl, struct status_change *sc, int lv);
unsigned short (*calc_mode) (struct block_list *bl, struct status_change *sc, int mode);
-#ifdef RENEWAL
unsigned short (*calc_ematk) (struct block_list *bl, struct status_change *sc, int matk);
-#endif
void (*calc_bl_main) (struct block_list *bl, int flag);
void (*display_add) (struct map_session_data *sd, enum sc_type type, int dval1, int dval2, int dval3);
void (*display_remove) (struct map_session_data *sd, enum sc_type type);