summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorParadox924X <Paradox924X@54d463be-8e91-2dee-dedb-b68131a5f0ec>2010-11-02 04:24:46 +0000
committerParadox924X <Paradox924X@54d463be-8e91-2dee-dedb-b68131a5f0ec>2010-11-02 04:24:46 +0000
commit5ffec3d741ee12ffdf55467dee5245cd50b9f702 (patch)
treecd04f375116d2f97dc8a93e66b3d71ee6b4d5159
parent771ec0d02a5660a10f27d8545917104f40e802fa (diff)
downloadhercules-5ffec3d741ee12ffdf55467dee5245cd50b9f702.tar.gz
hercules-5ffec3d741ee12ffdf55467dee5245cd50b9f702.tar.bz2
hercules-5ffec3d741ee12ffdf55467dee5245cd50b9f702.tar.xz
hercules-5ffec3d741ee12ffdf55467dee5245cd50b9f702.zip
Applied patch by xazax to clean up various bits of code across mapserver code. (bugreport:4512)
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14438 54d463be-8e91-2dee-dedb-b68131a5f0ec
-rw-r--r--Changelog-Trunk.txt2
-rw-r--r--src/map/clif.c4
-rw-r--r--src/map/guild.c3
-rw-r--r--src/map/map.c4
-rw-r--r--src/map/npc.c3
-rw-r--r--src/map/script.c9
-rw-r--r--src/map/skill.c10
-rw-r--r--src/map/status.c4
8 files changed, 10 insertions, 29 deletions
diff --git a/Changelog-Trunk.txt b/Changelog-Trunk.txt
index e937f0ffb..7539962be 100644
--- a/Changelog-Trunk.txt
+++ b/Changelog-Trunk.txt
@@ -1,5 +1,7 @@
Date Added
+2010/11/02
+ * Applied patch by xazax to clean up various bits of code across mapserver code. (bugreport:4512) [Paradox924X]
2010/11/01
* Changed Normal and Cash Food statuses so they do not stack and overwrite the other if the level (val1) is the same or higher. (bugreport:4519) [Paradox924X]
* Modified certain atcommands to use 64 bit arithmetic before capping a value to correct boundary logic for overflowing values. [Paradox924X]
diff --git a/src/map/clif.c b/src/map/clif.c
index dfc464fb9..a13811913 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -4191,7 +4191,7 @@ int clif_outsight(struct block_list *bl,va_list ap)
{ //tsd has lost sight of the bl object.
switch(bl->type){
case BL_PC:
- if (((TBL_PC*)bl)->vd.class_ != INVISIBLE_CLASS)
+ if (sd->vd.class_ != INVISIBLE_CLASS)
clif_clearunit_single(bl->id,0,tsd->fd);
if(sd->chatID){
struct chat_data *cd;
@@ -13128,10 +13128,8 @@ void clif_parse_cashshop_buy(int fd, struct map_session_data *sd)
{
int fail = 0, amount, points;
short nameid;
- struct npc_data *nd;
nullpo_retv(sd);
- nd = (struct npc_data *)map_id2bl(sd->npc_shopid);
nameid = RFIFOW(fd,2);
amount = RFIFOW(fd,4);
points = RFIFOL(fd,6); // Not Implemented. Should be 0
diff --git a/src/map/guild.c b/src/map/guild.c
index b89e1a368..1b91dfc93 100644
--- a/src/map/guild.c
+++ b/src/map/guild.c
@@ -1203,11 +1203,10 @@ unsigned int guild_payexp(struct map_session_data *sd,unsigned int exp)
// Celest
int guild_getexp(struct map_session_data *sd,int exp)
{
- struct guild *g;
struct guild_expcache *c;
nullpo_ret(sd);
- if (sd->status.guild_id == 0 || (g = guild_search(sd->status.guild_id)) == NULL)
+ if (sd->status.guild_id == 0 || guild_search(sd->status.guild_id) == NULL)
return 0;
c = (struct guild_expcache*)guild_expcache_db->ensure(guild_expcache_db, i2key(sd->status.char_id), create_expcache, sd);
diff --git a/src/map/map.c b/src/map/map.c
index be50cf887..e696b874d 100644
--- a/src/map/map.c
+++ b/src/map/map.c
@@ -2673,7 +2673,7 @@ int map_eraseipport(unsigned short mapindex, uint32 ip, uint16 port)
*------------------------------------------*/
static char *map_init_mapcache(FILE *fp)
{
- size_t size = 0, read_size;
+ size_t size = 0;
char *buffer;
// No file open? Return..
@@ -2691,7 +2691,7 @@ static char *map_init_mapcache(FILE *fp)
nullpo_ret(buffer);
// Read file into buffer..
- if((read_size = fread(buffer, sizeof(char), size, fp)) != size) {
+ if(fread(buffer, sizeof(char), size, fp) != size) {
ShowError("map_init_mapcache: Could not read entire mapcache file\n");
return NULL;
}
diff --git a/src/map/npc.c b/src/map/npc.c
index 8eb1c1ba7..95981ad55 100644
--- a/src/map/npc.c
+++ b/src/map/npc.c
@@ -135,12 +135,11 @@ int npc_ontouch2_event(struct map_session_data *sd, struct npc_data *nd)
*------------------------------------------*/
int npc_enable_sub(struct block_list *bl, va_list ap)
{
- struct map_session_data *sd;
struct npc_data *nd;
nullpo_ret(bl);
nullpo_ret(nd=va_arg(ap,struct npc_data *));
- if(bl->type == BL_PC && (sd=(struct map_session_data *)bl))
+ if(bl->type == BL_PC)
{
TBL_PC *sd = (TBL_PC*)bl;
diff --git a/src/map/script.c b/src/map/script.c
index ac7ac9163..68f291f2c 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -7517,7 +7517,6 @@ BUILDIN_FUNC(getmobdrops)
{
int class_ = script_getnum(st,2);
int i, j = 0;
- struct item_data *i_data;
struct mob_db *mob;
if( !mobdb_checkid(class_) )
@@ -7532,7 +7531,7 @@ BUILDIN_FUNC(getmobdrops)
{
if( mob->dropitem[i].nameid < 1 )
continue;
- if( (i_data = itemdb_exists(mob->dropitem[i].nameid)) == NULL )
+ if( itemdb_exists(mob->dropitem[i].nameid) == NULL )
continue;
mapreg_setreg(add_str("$@MobDrop_item") + (j<<24), mob->dropitem[i].nameid);
@@ -10039,10 +10038,9 @@ BUILDIN_FUNC(divorce)
BUILDIN_FUNC(ispartneron)
{
TBL_PC *sd=script_rid2sd(st);
- TBL_PC *p_sd=NULL;
if(sd==NULL || !pc_ismarried(sd) ||
- (p_sd=map_charid2sd(sd->status.partner_id)) == NULL) {
+ map_charid2sd(sd->status.partner_id) == NULL) {
script_pushint(st,0);
return 0;
}
@@ -11352,12 +11350,9 @@ BUILDIN_FUNC(movenpc)
*------------------------------------------*/
BUILDIN_FUNC(message)
{
- TBL_PC *sd;
const char *msg,*player;
TBL_PC *pl_sd = NULL;
- sd = script_rid2sd(st);
-
player = script_getstr(st,2);
msg = script_getstr(st,3);
diff --git a/src/map/skill.c b/src/map/skill.c
index c7b60661e..a54bedc20 100644
--- a/src/map/skill.c
+++ b/src/map/skill.c
@@ -323,9 +323,6 @@ int skill_calc_heal(struct block_list *src, struct block_list *target, int skill
// Making plagiarize check its own function [Aru]
int can_copy (struct map_session_data *sd, int skillid, struct block_list* bl)
{
- struct status_change* sc;
- sc = status_get_sc(bl);
-
// Never copy NPC/Wedding Skills
if (skill_get_inf2(skillid)&(INF2_NPC_SKILL|INF2_WEDDING_SKILL))
return 0;
@@ -2483,7 +2480,7 @@ static int skill_reveal_trap (struct block_list *bl, va_list ap)
*------------------------------------------*/
int skill_castend_damage_id (struct block_list* src, struct block_list *bl, int skillid, int skilllv, unsigned int tick, int flag)
{
- struct map_session_data *sd = NULL, *tsd = NULL;
+ struct map_session_data *sd = NULL;
struct status_data *tstatus;
struct status_change *sc;
@@ -2499,7 +2496,6 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, int
return 1;
sd = BL_CAST(BL_PC, src);
- tsd = BL_CAST(BL_PC, bl);
if (status_isdead(bl))
return 1;
@@ -7408,7 +7404,6 @@ int skill_unit_onplace_timer (struct skill_unit *src, struct block_list *bl, uns
{
struct skill_unit_group *sg;
struct block_list *ss;
- TBL_PC* sd;
TBL_PC* tsd;
struct status_data *tstatus, *sstatus;
struct status_change *tsc, *sc;
@@ -7425,7 +7420,6 @@ int skill_unit_onplace_timer (struct skill_unit *src, struct block_list *bl, uns
nullpo_ret(sg=src->group);
nullpo_ret(ss=map_id2bl(sg->src_id));
- sd = BL_CAST(BL_PC, ss);
tsd = BL_CAST(BL_PC, bl);
tsc = status_get_sc(bl);
tstatus = status_get_status_data(bl);
@@ -9041,11 +9035,9 @@ int skill_castfix (struct block_list *bl, int skill_id, int skill_lv)
{
int time = skill_get_cast(skill_id, skill_lv);
struct map_session_data *sd;
- struct status_change *sc;
nullpo_ret(bl);
sd = BL_CAST(BL_PC, bl);
- sc = status_get_sc(bl);
// calculate base cast time (reduced by dex)
if( !(skill_get_castnodex(skill_id, skill_lv)&1) )
diff --git a/src/map/status.c b/src/map/status.c
index b8767fde0..3b34d0e53 100644
--- a/src/map/status.c
+++ b/src/map/status.c
@@ -7326,7 +7326,6 @@ int status_change_timer(int tid, unsigned int tick, int id, intptr data)
*------------------------------------------*/
int status_change_timer_sub(struct block_list* bl, va_list ap)
{
- struct map_session_data *sd, *tsd;
struct status_change* tsc;
struct block_list* src = va_arg(ap,struct block_list*);
@@ -7339,9 +7338,6 @@ int status_change_timer_sub(struct block_list* bl, va_list ap)
tsc = status_get_sc(bl);
- sd = BL_CAST(BL_PC, src);
- tsd = BL_CAST(BL_PC, bl);
-
switch( type )
{
case SC_SIGHT: /* ƒTƒCƒg */