summaryrefslogtreecommitdiff
path: root/src/map/mob.c
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2013-09-26 02:34:45 +0200
committerHaru <haru@dotalux.com>2013-09-26 02:34:45 +0200
commit3e5bca5a3df07320ff5c41edbb282df041c36f66 (patch)
treec593fcf36c9113cd750013fff084052110cf56ce /src/map/mob.c
parentafcad494411995396b906f214d1c4ffcf485cc0a (diff)
downloadhercules-3e5bca5a3df07320ff5c41edbb282df041c36f66.tar.gz
hercules-3e5bca5a3df07320ff5c41edbb282df041c36f66.tar.bz2
hercules-3e5bca5a3df07320ff5c41edbb282df041c36f66.tar.xz
hercules-3e5bca5a3df07320ff5c41edbb282df041c36f66.zip
Renamed variables that would conflict with a rename of iMap to map
Note to plugin developers: if you were importing the "map", you'll need to change it to "maplist" Signed-off-by: Haru <haru@dotalux.com>
Diffstat (limited to 'src/map/mob.c')
-rw-r--r--src/map/mob.c92
1 files changed, 43 insertions, 49 deletions
diff --git a/src/map/mob.c b/src/map/mob.c
index 32bf3d72a..ceb00a6ce 100644
--- a/src/map/mob.c
+++ b/src/map/mob.c
@@ -173,11 +173,11 @@ void mvptomb_destroy(struct mob_data *md) {
iMap->delblock(&nd->bl);
- ARR_FIND( 0, map[m].npc_num, i, map[m].npc[i] == nd );
- if( !(i == map[m].npc_num) ) {
- map[m].npc_num--;
- map[m].npc[i] = map[m].npc[map[m].npc_num];
- map[m].npc[map[m].npc_num] = NULL;
+ ARR_FIND( 0, maplist[m].npc_num, i, maplist[m].npc[i] == nd );
+ if( !(i == maplist[m].npc_num) ) {
+ maplist[m].npc_num--;
+ maplist[m].npc[i] = maplist[m].npc[maplist[m].npc_num];
+ maplist[m].npc[maplist[m].npc_num] = NULL;
}
iMap->deliddb(&nd->bl);
@@ -363,7 +363,7 @@ bool mob_ksprotected (struct block_list *src, struct block_list *target)
t_sd = BL_CAST(BL_PC,s_bl);
do {
- if( map[md->bl.m].flag.allowks || map_flag_ks(md->bl.m) )
+ if( maplist[md->bl.m].flag.allowks || map_flag_ks(md->bl.m) )
return false; // Ignores GVG, PVP and AllowKS map flags
if( md->db->mexp || md->master_id )
@@ -635,19 +635,15 @@ int mob_spawn_guardian(const char* mapname, short x, short y, const char* mobnam
data.class_ = class_;
- if( !has_index )
- {
+ if( !has_index ) {
guardian = -1;
- }
- else if( guardian < 0 || guardian >= MAX_GUARDIANS )
- {
- ShowError("mob_spawn_guardian: Invalid guardian index %d for guardian %d (castle map %s)\n", guardian, class_, map[m].name);
+ } else if( guardian < 0 || guardian >= MAX_GUARDIANS ) {
+ ShowError("mob_spawn_guardian: Invalid guardian index %d for guardian %d (castle map %s)\n", guardian, class_, maplist[m].name);
return 0;
}
- if((x<=0 || y<=0) && !iMap->search_freecell(NULL, m, &x, &y, -1,-1, 1))
- {
- ShowWarning("mob_spawn_guardian: Couldn't locate a spawn cell for guardian class %d (index %d) at castle map %s\n",class_, guardian, map[m].name);
+ if((x<=0 || y<=0) && !iMap->search_freecell(NULL, m, &x, &y, -1,-1, 1)) {
+ ShowWarning("mob_spawn_guardian: Couldn't locate a spawn cell for guardian class %d (index %d) at castle map %s\n",class_, guardian, maplist[m].name);
return 0;
}
data.x = x;
@@ -657,24 +653,24 @@ int mob_spawn_guardian(const char* mapname, short x, short y, const char* mobnam
if (!mob->parse_dataset(&data))
return 0;
- gc=guild->mapname2gc(map[m].name);
- if (gc == NULL)
- {
- ShowError("mob_spawn_guardian: No castle set at map %s\n", map[m].name);
+ gc=guild->mapname2gc(maplist[m].name);
+ if (gc == NULL) {
+ ShowError("mob_spawn_guardian: No castle set at map %s\n", maplist[m].name);
return 0;
}
if (!gc->guild_id)
- ShowWarning("mob_spawn_guardian: Spawning guardian %d on a castle with no guild (castle map %s)\n", class_, map[m].name);
+ ShowWarning("mob_spawn_guardian: Spawning guardian %d on a castle with no guild (castle map %s)\n", class_, maplist[m].name);
else
g = guild->search(gc->guild_id);
if( has_index && gc->guardian[guardian].id )
{ //Check if guardian already exists, refuse to spawn if so.
struct mob_data *md2 = (TBL_MOB*)iMap->id2bl(gc->guardian[guardian].id);
- if (md2 && md2->bl.type == BL_MOB &&
- md2->guardian_data && md2->guardian_data->number == guardian)
- {
- ShowError("mob_spawn_guardian: Attempted to spawn guardian in position %d which already has a guardian (castle map %s)\n", guardian, map[m].name);
+ if (md2 && md2->bl.type == BL_MOB
+ && md2->guardian_data
+ && md2->guardian_data->number == guardian
+ ) {
+ ShowError("mob_spawn_guardian: Attempted to spawn guardian in position %d which already has a guardian (castle map %s)\n", guardian, maplist[m].name);
return 0;
}
}
@@ -736,9 +732,8 @@ int mob_spawn_bg(const char* mapname, short x, short y, const char* mobname, int
}
data.class_ = class_;
- if( (x <= 0 || y <= 0) && !iMap->search_freecell(NULL, m, &x, &y, -1,-1, 1) )
- {
- ShowWarning("mob_spawn_bg: Couldn't locate a spawn cell for guardian class %d (bg_id %d) at map %s\n",class_, bg_id, map[m].name);
+ if( (x <= 0 || y <= 0) && !iMap->search_freecell(NULL, m, &x, &y, -1,-1, 1) ) {
+ ShowWarning("mob_spawn_bg: Couldn't locate a spawn cell for guardian class %d (bg_id %d) at map %s\n",class_, bg_id, maplist[m].name);
return 0;
}
@@ -971,7 +966,7 @@ int mob_spawn (struct mob_data *md)
mob->mvptomb_destroy(md);
iMap->addblock(&md->bl);
- if( map[md->bl.m].users )
+ if( maplist[md->bl.m].users )
clif->spawn(&md->bl);
skill->unit_move(&md->bl,tick,1);
mob->skill_use(md, tick, MSC_SPAWN);
@@ -1076,7 +1071,7 @@ int mob_ai_sub_hard_activesearch(struct block_list *bl,va_list ap)
battle->check_range(&md->bl,bl,md->db->range2)
) { //Pick closest target?
- if( map[bl->m].icewall_num &&
+ if( maplist[bl->m].icewall_num &&
!path->search_long(NULL,bl->m,md->bl.x,md->bl.y,bl->x,bl->y,CELL_CHKICEWALL) ) {
if( !check_distance_bl(&md->bl, bl, status_get_range(&md->bl) ) )
@@ -1346,7 +1341,7 @@ int mob_randomwalk(struct mob_data *md,unsigned int tick)
if(i==retrycount){
md->move_fail_count++;
if(md->move_fail_count>1000){
- ShowWarning("MOB can't move. random spawn %d, class = %d, at %s (%d,%d)\n",md->bl.id,md->class_,map[md->bl.m].name, md->bl.x, md->bl.y);
+ ShowWarning("MOB can't move. random spawn %d, class = %d, at %s (%d,%d)\n",md->bl.id,md->class_,maplist[md->bl.m].name, md->bl.x, md->bl.y);
md->move_fail_count=0;
mob->spawn(md);
}
@@ -1696,7 +1691,7 @@ int mob_ai_sub_lazy(struct mob_data *md, va_list args)
tick = va_arg(args,unsigned int);
- if (battle_config.mob_ai&0x20 && map[md->bl.m].users>0)
+ if (battle_config.mob_ai&0x20 && maplist[md->bl.m].users>0)
return (int)mob->ai_sub_hard(md, tick);
if (md->bl.prev==NULL || md->status.hp == 0)
@@ -1732,9 +1727,8 @@ int mob_ai_sub_lazy(struct mob_data *md, va_list args)
return 0;
}
- if( DIFF_TICK(md->next_walktime,tick) < 0 && (status_get_mode(&md->bl)&MD_CANMOVE) && unit->can_move(&md->bl) )
- {
- if( map[md->bl.m].users > 0 )
+ if( DIFF_TICK(md->next_walktime,tick) < 0 && (status_get_mode(&md->bl)&MD_CANMOVE) && unit->can_move(&md->bl) ) {
+ if( maplist[md->bl.m].users > 0 )
{
if( rnd()%1000 < MOB_LAZYMOVEPERC(md) )
mob->randomwalk(md, tick);
@@ -2165,10 +2159,10 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type) {
}
}
- if(!(type&2) && //No exp
- (!map[m].flag.pvp || battle_config.pvp_exp) && //Pvp no exp rule [MouseJstr]
- (!md->master_id || !md->special_state.ai) && //Only player-summoned mobs do not give exp. [Skotlex]
- (!map[m].flag.nobaseexp || !map[m].flag.nojobexp) //Gives Exp
+ if( !(type&2) //No exp
+ && (!maplist[m].flag.pvp || battle_config.pvp_exp) //Pvp no exp rule [MouseJstr]
+ && (!md->master_id || !md->special_state.ai) //Only player-summoned mobs do not give exp. [Skotlex]
+ && (!maplist[m].flag.nobaseexp || !maplist[m].flag.nojobexp) //Gives Exp
) { //Experience calculation.
int bonus = 100; //Bonus on top of your share (common to all attackers).
if (md->sc.data[SC_RICHMANKIM])
@@ -2230,15 +2224,15 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type) {
zeny*=rnd()%250;
}
- if (map[m].flag.nobaseexp || !md->db->base_exp)
+ if (maplist[m].flag.nobaseexp || !md->db->base_exp)
base_exp = 0;
else
- base_exp = (unsigned int)cap_value(md->db->base_exp * per * bonus/100. * map[m].bexp/100., 1, UINT_MAX);
+ base_exp = (unsigned int)cap_value(md->db->base_exp * per * bonus/100. * maplist[m].bexp/100., 1, UINT_MAX);
- if (map[m].flag.nojobexp || !md->db->job_exp || md->dmglog[i].flag == MDLF_HOMUN) //Homun earned job-exp is always lost.
+ if (maplist[m].flag.nojobexp || !md->db->job_exp || md->dmglog[i].flag == MDLF_HOMUN) //Homun earned job-exp is always lost.
job_exp = 0;
else
- job_exp = (unsigned int)cap_value(md->db->job_exp * per * bonus/100. * map[m].jexp/100., 1, UINT_MAX);
+ job_exp = (unsigned int)cap_value(md->db->job_exp * per * bonus/100. * maplist[m].jexp/100., 1, UINT_MAX);
if ( (temp = tmpsd[i]->status.party_id) > 0 ) {
int j;
@@ -2292,7 +2286,7 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type) {
} //End EXP giving.
- if( !(type&1) && !map[m].flag.nomobloot && !md->state.rebirth && (
+ if( !(type&1) && !maplist[m].flag.nomobloot && !md->state.rebirth && (
!md->special_state.ai || //Non special mob
battle_config.alchemist_summon_reward == 2 || //All summoned give drops
(md->special_state.ai==2 && battle_config.alchemist_summon_reward == 1) //Marine Sphere Drops items.
@@ -2460,7 +2454,7 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type) {
double exp;
//mapflag: noexp check [Lorky]
- if (map[m].flag.nobaseexp || type&2)
+ if (maplist[m].flag.nobaseexp || type&2)
exp =1;
else {
exp = md->db->mexp;
@@ -2475,7 +2469,7 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type) {
pc->gainexp(mvp_sd, &md->bl, mexp,0, false);
log_mvp[1] = mexp;
- if( !(map[m].flag.nomvploot || type&1) ) {
+ if( !(maplist[m].flag.nomvploot || type&1) ) {
/* pose them randomly in the list -- so on 100% drop servers it wont always drop the same item */
int mdrop_id[MAX_MVP_DROP];
int mdrop_p[MAX_MVP_DROP];
@@ -2619,7 +2613,7 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type) {
return 5; // Note: Actually, it's 4. Oh well...
// MvP tomb [GreenBox]
- if (battle_config.mvp_tomb_enabled && md->spawn->state.boss && map[md->bl.m].flag.notomb != 1)
+ if (battle_config.mvp_tomb_enabled && md->spawn->state.boss && maplist[md->bl.m].flag.notomb != 1)
mob->mvptomb_create(md, mvp_sd ? mvp_sd->status.name : NULL, time(NULL));
if( !rebirth ) {
@@ -3382,12 +3376,12 @@ int mob_clone_spawn(struct map_session_data *sd, int16 m, int16 x, int16 y, cons
(skill_db[idx].inf2&(INF2_WEDDING_SKILL|INF2_GUILD_SKILL))
)
continue;
- for(h = 0; h < map[sd->bl.m].zone->disabled_skills_count; h++) {
- if( skill_id == map[sd->bl.m].zone->disabled_skills[h]->nameid && map[sd->bl.m].zone->disabled_skills[h]->subtype == MZS_CLONE ) {
+ for(h = 0; h < maplist[sd->bl.m].zone->disabled_skills_count; h++) {
+ if( skill_id == maplist[sd->bl.m].zone->disabled_skills[h]->nameid && maplist[sd->bl.m].zone->disabled_skills[h]->subtype == MZS_CLONE ) {
break;
}
}
- if( h < map[sd->bl.m].zone->disabled_skills_count )
+ if( h < maplist[sd->bl.m].zone->disabled_skills_count )
continue;
//Normal aggressive mob, disable skills that cannot help them fight
//against players (those with flags UF_NOMOB and UF_NOPC are specific