summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/char/char.c3
-rw-r--r--src/map/atcommand.c1
-rw-r--r--src/map/clif.c4
-rw-r--r--src/map/instance.c3
-rw-r--r--src/map/mob.c4
-rw-r--r--src/map/party.c2
-rw-r--r--src/map/pc.c7
-rw-r--r--src/map/pet.c3
-rw-r--r--src/map/script.c8
-rw-r--r--src/map/skill.c15
-rw-r--r--src/map/status.c14
-rw-r--r--src/map/unit.c8
12 files changed, 37 insertions, 35 deletions
diff --git a/src/char/char.c b/src/char/char.c
index cb3007ff9..338744828 100644
--- a/src/char/char.c
+++ b/src/char/char.c
@@ -3992,9 +3992,8 @@ int mapif_sendallwos(int sfd, unsigned char *buf, unsigned int len)
int mapif_send(int fd, unsigned char *buf, unsigned int len)
{
- int i;
-
if (fd >= 0) {
+ int i;
ARR_FIND( 0, ARRAYLENGTH(server), i, fd == server[i].fd );
if( i < ARRAYLENGTH(server) )
{
diff --git a/src/map/atcommand.c b/src/map/atcommand.c
index de5d4549b..7c7aafbb7 100644
--- a/src/map/atcommand.c
+++ b/src/map/atcommand.c
@@ -183,7 +183,6 @@ ACMD_FUNC(send)
{
int len=0,off,end,type;
long num;
- (void)command; // not used
// read message type as hex number (without the 0x)
if(!message || !*message ||
diff --git a/src/map/clif.c b/src/map/clif.c
index e102fc169..fd14f4458 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -4423,7 +4423,7 @@ int clif_outsight(struct block_list *bl,va_list ap)
if (sd && sd->fd)
{ //sd is watching tbl go out of view.
if (((vd=status_get_viewdata(tbl)) && vd->class_ != INVISIBLE_CLASS) &&
- !(bl->type == BL_NPC && (((TBL_NPC*)bl)->sc.option&OPTION_INVISIBLE)))
+ !(tbl->type == BL_NPC && (((TBL_NPC*)tbl)->sc.option&OPTION_INVISIBLE)))
clif_clearunit_single(tbl->id,CLR_OUTSIGHT,sd->fd);
}
return 0;
@@ -10652,7 +10652,6 @@ void clif_parse_UseSkillToId(int fd, struct map_session_data *sd)
*------------------------------------------*/
static void clif_parse_UseSkillToPosSub(int fd, struct map_session_data *sd, short skilllv, short skillnum, short x, short y, int skillmoreinfo)
{
- int lv;
unsigned int tick = gettick();
if( !(skill_get_inf(skillnum)&INF_GROUND_SKILL) )
@@ -10716,6 +10715,7 @@ static void clif_parse_UseSkillToPosSub(int fd, struct map_session_data *sd, sho
}
else
{
+ int lv;
sd->skillitem = sd->skillitemlv = 0;
if( (lv = pc_checkskill(sd, skillnum)) > 0 )
{
diff --git a/src/map/instance.c b/src/map/instance.c
index d533a0188..d15b80a8a 100644
--- a/src/map/instance.c
+++ b/src/map/instance.c
@@ -260,14 +260,13 @@ int instance_del_load(struct map_session_data* sd, va_list args)
*--------------------------------------*/
void instance_del_map(int m)
{
- int sm, i;
+ int i;
if( m <= 0 || !map[m].instance_id )
{
ShowError("Tried to remove non-existing instance map (%d)\n", m);
return;
}
- sm = map[m].instance_src_map;
map_foreachpc(instance_del_load, m);
map_foreachinmap(cleanup_sub, m, BL_ALL);
diff --git a/src/map/mob.c b/src/map/mob.c
index acdfd5049..a079bbdf9 100644
--- a/src/map/mob.c
+++ b/src/map/mob.c
@@ -1113,7 +1113,6 @@ static int mob_warpchase_sub(struct block_list *bl,va_list ap)
static int mob_ai_sub_hard_slavemob(struct mob_data *md,unsigned int tick)
{
struct block_list *bl;
- int old_dist;
bl=map_id2bl(md->master_id);
@@ -1126,7 +1125,8 @@ static int mob_ai_sub_hard_slavemob(struct mob_data *md,unsigned int tick)
if(status_get_mode(&md->bl)&MD_CANMOVE)
{ //If the mob can move, follow around. [Check by Skotlex]
-
+ int old_dist;
+
// Distance with between slave and master is measured.
old_dist=md->master_dist;
md->master_dist=distance_bl(&md->bl, bl);
diff --git a/src/map/party.c b/src/map/party.c
index f850efb7c..15ada66fd 100644
--- a/src/map/party.c
+++ b/src/map/party.c
@@ -560,10 +560,10 @@ int party_member_withdraw(int party_id, int account_id, int char_id)
{
struct map_session_data* sd = map_id2sd(account_id);
struct party_data* p = party_search(party_id);
- int i;
if( p )
{
+ int i;
ARR_FIND( 0, MAX_PARTY, i, p->party.member[i].account_id == account_id && p->party.member[i].char_id == char_id );
if( i < MAX_PARTY )
{
diff --git a/src/map/pc.c b/src/map/pc.c
index 3155484dd..1b0d3f57a 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -8541,9 +8541,6 @@ int pc_readdb(void)
// Read MOTD on startup. [Valaris]
int pc_read_motd(void)
{
- char* buf, * ptr;
- unsigned int lines = 0, entries = 0;
- size_t len;
FILE* fp;
// clear old MOTD
@@ -8552,6 +8549,10 @@ int pc_read_motd(void)
// read current MOTD
if( ( fp = fopen(motd_txt, "r") ) != NULL )
{
+ char* buf, * ptr;
+ unsigned int lines = 0, entries = 0;
+ size_t len;
+
while( entries < MOTD_LINE_SIZE && fgets(motd_text[entries], sizeof(motd_text[entries]), fp) )
{
lines++;
diff --git a/src/map/pet.c b/src/map/pet.c
index 43c3bcb5c..09c924c3c 100644
--- a/src/map/pet.c
+++ b/src/map/pet.c
@@ -101,7 +101,6 @@ int pet_unlocktarget(struct pet_data *pd)
int pet_attackskill(struct pet_data *pd, int target_id)
{
struct block_list *bl;
- int inf;
if (!battle_config.pet_status_support || !pd->a_skill ||
(battle_config.pet_equip_required && !pd->pet.equip))
@@ -112,6 +111,8 @@ int pet_attackskill(struct pet_data *pd, int target_id)
if (rnd()%100 < (pd->a_skill->rate +pd->pet.intimate*pd->a_skill->bonusrate/1000))
{ //Skotlex: Use pet's skill
+ int inf;
+
bl=map_id2bl(target_id);
if(bl == NULL || pd->bl.m != bl->m || bl->prev == NULL || status_isdead(bl) ||
!check_distance_bl(&pd->bl, bl, pd->db->range3))
diff --git a/src/map/script.c b/src/map/script.c
index d9f2bc2e0..dbbabf74f 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -3878,7 +3878,6 @@ int script_reload()
/// mes "<message>";
BUILDIN_FUNC(mes)
{
- int i;
TBL_PC* sd = script_rid2sd(st);
if( sd == NULL )
return 0;
@@ -3889,6 +3888,8 @@ BUILDIN_FUNC(mes)
}
else
{// parse multiple lines as they exist
+ int i;
+
for( i = 2; script_hasdata(st, i); i++ )
{
// send the message to the client
@@ -11817,10 +11818,11 @@ BUILDIN_FUNC(getmercinfo)
BUILDIN_FUNC(checkequipedcard)
{
TBL_PC *sd=script_rid2sd(st);
- int n,i,c=0;
- c=script_getnum(st,2);
if(sd){
+ int n,i,c=0;
+ c=script_getnum(st,2);
+
for(i=0;i<MAX_INVENTORY;i++){
if(sd->status.inventory[i].nameid > 0 && sd->status.inventory[i].amount && sd->inventory_data[i]){
if (itemdb_isspecial(sd->status.inventory[i].card[0]))
diff --git a/src/map/skill.c b/src/map/skill.c
index 28160a5d5..ff9641451 100644
--- a/src/map/skill.c
+++ b/src/map/skill.c
@@ -8329,7 +8329,6 @@ int skill_castend_pos2(struct block_list* src, int x, int y, int skillid, int sk
// Plant Cultivation [Celest]
case CR_CULTIVATION:
if (sd) {
- int i;
if( map_count_oncell(src->m,x,y,BL_CHAR) > 0 )
{
clif_skill_fail(sd,skillid,USESKILL_FAIL_LEVEL,0);
@@ -8340,6 +8339,7 @@ int skill_castend_pos2(struct block_list* src, int x, int y, int skillid, int sk
clif_skill_fail(sd,skillid,USESKILL_FAIL_LEVEL,0);
} else {
TBL_MOB* md = mob_once_spawn_sub(src, src->m, x, y, "--ja--",(skilllv < 2 ? 1084+rnd()%2 : 1078+rnd()%6),"");
+ int i;
if (!md) break;
if ((i = skill_get_time(skillid, skilllv)) > 0)
{
@@ -11096,7 +11096,6 @@ int skill_check_condition_castend(struct map_session_data* sd, short skill, shor
// type&1: consume the others (before skill was used)
int skill_consume_requirement( struct map_session_data *sd, short skill, short lv, short type)
{
- int n,i;
struct skill_condition req;
nullpo_ret(sd);
@@ -11126,6 +11125,7 @@ int skill_consume_requirement( struct map_session_data *sd, short skill, short l
if( type&2 )
{
struct status_change *sc = &sd->sc;
+ int n,i;
if( !sc->count )
sc = NULL;
@@ -11752,14 +11752,13 @@ void skill_identify (struct map_session_data *sd, int idx)
*------------------------------------------*/
void skill_weaponrefine (struct map_session_data *sd, int idx)
{
- int i = 0, ep = 0, per;
- int material[5] = { 0, 1010, 1011, 984, 984 };
- struct item *item;
-
nullpo_retv(sd);
if (idx >= 0 && idx < MAX_INVENTORY)
{
+ int i = 0, ep = 0, per;
+ int material[5] = { 0, 1010, 1011, 984, 984 };
+ struct item *item;
struct item_data *ditem = sd->inventory_data[idx];
item = &sd->status.inventory[idx];
@@ -12384,11 +12383,11 @@ bool skill_check_cloaking(struct block_list *bl, struct status_change_entry *sce
static int dx[] = { 0, 1, 0, -1, -1, 1, 1, -1};
static int dy[] = {-1, 0, 1, 0, -1, -1, 1, 1};
bool wall = true;
- int i;
if( (bl->type == BL_PC && battle_config.pc_cloak_check_type&1)
|| (bl->type != BL_PC && battle_config.monster_cloak_check_type&1) )
{ //Check for walls.
+ int i;
ARR_FIND( 0, 8, i, map_getcell(bl->m, bl->x+dx[i], bl->y+dy[i], CELL_CHKNOPASS) != 0 );
if( i == 8 )
wall = false;
@@ -12424,10 +12423,10 @@ bool skill_check_camouflage(struct block_list *bl, struct status_change_entry *s
static int dx[] = { 0, 1, 0, -1, -1, 1, 1, -1};
static int dy[] = {-1, 0, 1, 0, -1, -1, 1, 1};
bool wall = true;
- int i;
if( bl->type == BL_PC )
{ //Check for walls.
+ int i;
ARR_FIND( 0, 8, i, map_getcell(bl->m, bl->x+dx[i], bl->y+dy[i], CELL_CHKNOPASS) != 0 );
if( i == 8 )
wall = false;
diff --git a/src/map/status.c b/src/map/status.c
index 807cab66d..b2088ebe0 100644
--- a/src/map/status.c
+++ b/src/map/status.c
@@ -6380,17 +6380,19 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val
case SC_DEFENDER:
if (!(flag&1))
{
- struct map_session_data *tsd;
- int i;
val2 = 5 + 15*val1; //Damage reduction
val3 = 0; // unused, previously speed adjustment
val4 = 250 - 50*val1; //Aspd adjustment
if (sd)
- for (i = 0; i < 5; i++)
- { //See if there are devoted characters, and pass the status to them. [Skotlex]
- if (sd->devotion[i] && (tsd = map_id2sd(sd->devotion[i])))
- status_change_start(&tsd->bl,type,10000,val1,5+val1*5,val3,val4,tick,1);
+ {
+ struct map_session_data *tsd;
+ int i;
+ for (i = 0; i < 5; i++)
+ { //See if there are devoted characters, and pass the status to them. [Skotlex]
+ if (sd->devotion[i] && (tsd = map_id2sd(sd->devotion[i])))
+ status_change_start(&tsd->bl,type,10000,val1,5+val1*5,val3,val4,tick,1);
+ }
}
}
break;
diff --git a/src/map/unit.c b/src/map/unit.c
index 631fc049a..950ffc983 100644
--- a/src/map/unit.c
+++ b/src/map/unit.c
@@ -665,12 +665,12 @@ uint8 unit_getdir(struct block_list *bl)
// &1 Do not send position update packets.
int unit_blown(struct block_list* bl, int dx, int dy, int count, int flag)
{
- int nx, ny, result;
- struct map_session_data* sd;
- struct skill_unit* su = NULL;
-
if(count)
{
+ struct map_session_data* sd;
+ struct skill_unit* su = NULL;
+ int nx, ny, result;
+
sd = BL_CAST(BL_PC, bl);
su = BL_CAST(BL_SKILL, bl);