summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorai4rei <ai4rei@54d463be-8e91-2dee-dedb-b68131a5f0ec>2010-11-28 21:41:38 +0000
committerai4rei <ai4rei@54d463be-8e91-2dee-dedb-b68131a5f0ec>2010-11-28 21:41:38 +0000
commitdc1175bda087b4b4ce657a114225b5daefbcf5c4 (patch)
tree906c022c31ea0966b12519d8d105627da335789f
parentfcf5b330c38bc7a48e774163c5624428f25aead6 (diff)
downloadhercules-dc1175bda087b4b4ce657a114225b5daefbcf5c4.tar.gz
hercules-dc1175bda087b4b4ce657a114225b5daefbcf5c4.tar.bz2
hercules-dc1175bda087b4b4ce657a114225b5daefbcf5c4.tar.xz
hercules-dc1175bda087b4b4ce657a114225b5daefbcf5c4.zip
* Added clr_type enumeration for vanish effect constants.
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14517 54d463be-8e91-2dee-dedb-b68131a5f0ec
-rw-r--r--Changelog-Trunk.txt1
-rw-r--r--src/map/atcommand.c22
-rw-r--r--src/map/battleground.c4
-rw-r--r--src/map/clif.c34
-rw-r--r--src/map/clif.h12
-rw-r--r--src/map/homunculus.c10
-rw-r--r--src/map/instance.c6
-rw-r--r--src/map/map.c6
-rw-r--r--src/map/mercenary.c4
-rw-r--r--src/map/mob.c16
-rw-r--r--src/map/npc.c16
-rw-r--r--src/map/pc.c16
-rw-r--r--src/map/pc.h8
-rw-r--r--src/map/pet.c4
-rw-r--r--src/map/script.c58
-rw-r--r--src/map/skill.c28
-rw-r--r--src/map/status.c10
-rw-r--r--src/map/unit.c26
-rw-r--r--src/map/unit.h9
19 files changed, 150 insertions, 140 deletions
diff --git a/Changelog-Trunk.txt b/Changelog-Trunk.txt
index 2ad71fe15..9277b6267 100644
--- a/Changelog-Trunk.txt
+++ b/Changelog-Trunk.txt
@@ -1,6 +1,7 @@
Date Added
2010/11/28
+ * Added clr_type enumeration for vanish effect constants. [Ai4rei]
* Resolved multiple issues with the party booking system (bugreport:4573, since r14412). [Ai4rei]
- Fixed recruitments were limited to party leaders.
- Fixed recruitment index was party id instead of an auto-increment value, causing sorting by age not working.
diff --git a/src/map/atcommand.c b/src/map/atcommand.c
index 41a27bc8a..7f73a536a 100644
--- a/src/map/atcommand.c
+++ b/src/map/atcommand.c
@@ -452,7 +452,7 @@ ACMD_FUNC(mapmove)
clif_displaymessage(fd, msg_txt(248));
return -1;
}
- if (pc_setpos(sd, mapindex, x, y, 3) != 0) {
+ if (pc_setpos(sd, mapindex, x, y, CLR_TELEPORT) != 0) {
clif_displaymessage(fd, msg_txt(1)); // Map not found.
return -1;
}
@@ -535,7 +535,7 @@ ACMD_FUNC(jumpto)
return -1;
}
- pc_setpos(sd, pl_sd->mapindex, pl_sd->bl.x, pl_sd->bl.y, 3);
+ pc_setpos(sd, pl_sd->mapindex, pl_sd->bl.x, pl_sd->bl.y, CLR_TELEPORT);
sprintf(atcmd_output, msg_txt(4), pl_sd->status.name); // Jumped to %s
clif_displaymessage(fd, atcmd_output);
@@ -572,7 +572,7 @@ ACMD_FUNC(jump)
x = y = 0; //Invalid cell, use random spot.
}
- pc_setpos(sd, sd->mapindex, x, y, 3);
+ pc_setpos(sd, sd->mapindex, x, y, CLR_TELEPORT);
sprintf(atcmd_output, msg_txt(5), sd->bl.x, sd->bl.y); // Jumped to %d %d
clif_displaymessage(fd, atcmd_output);
return 0;
@@ -1114,7 +1114,7 @@ ACMD_FUNC(load)
return -1;
}
- pc_setpos(sd, sd->status.save_point.map, sd->status.save_point.x, sd->status.save_point.y, 0);
+ pc_setpos(sd, sd->status.save_point.map, sd->status.save_point.x, sd->status.save_point.y, CLR_OUTSIGHT);
clif_displaymessage(fd, msg_txt(7)); // Warping to save point..
return 0;
@@ -2308,7 +2308,7 @@ ACMD_FUNC(go)
clif_displaymessage(fd, msg_txt(248));
return -1;
}
- if (pc_setpos(sd, mapindex_name2id(data[town].map), data[town].x, data[town].y, 3) == 0) {
+ if (pc_setpos(sd, mapindex_name2id(data[town].map), data[town].x, data[town].y, CLR_TELEPORT) == 0) {
clif_displaymessage(fd, msg_txt(0)); // Warped.
} else {
clif_displaymessage(fd, msg_txt(1)); // Map not found.
@@ -3329,7 +3329,7 @@ ACMD_FUNC(recall)
clif_displaymessage(fd, "You are not authorized to warp this player from its actual map.");
return -1;
}
- pc_setpos(pl_sd, sd->mapindex, sd->bl.x, sd->bl.y, 2);
+ pc_setpos(pl_sd, sd->mapindex, sd->bl.x, sd->bl.y, CLR_RESPAWN);
sprintf(atcmd_output, msg_txt(46), pl_sd->status.name); // %s recalled!
clif_displaymessage(fd, atcmd_output);
@@ -3988,7 +3988,7 @@ ACMD_FUNC(recallall)
pc_setstand(pl_sd);
pc_setrestartvalue(pl_sd,1);
}
- pc_setpos(pl_sd, sd->mapindex, sd->bl.x, sd->bl.y, 2);
+ pc_setpos(pl_sd, sd->mapindex, sd->bl.x, sd->bl.y, CLR_RESPAWN);
}
}
}
@@ -4047,7 +4047,7 @@ ACMD_FUNC(guildrecall)
if (pl_sd->bl.m >= 0 && map[pl_sd->bl.m].flag.nowarp && battle_config.any_warp_GM_min_level > pc_isGM(sd))
count++;
else
- pc_setpos(pl_sd, sd->mapindex, sd->bl.x, sd->bl.y, 2);
+ pc_setpos(pl_sd, sd->mapindex, sd->bl.x, sd->bl.y, CLR_RESPAWN);
}
}
mapit_free(iter);
@@ -4106,7 +4106,7 @@ ACMD_FUNC(partyrecall)
if (pl_sd->bl.m >= 0 && map[pl_sd->bl.m].flag.nowarp && battle_config.any_warp_GM_min_level > pc_isGM(sd))
count++;
else
- pc_setpos(pl_sd, sd->mapindex, sd->bl.x, sd->bl.y, 2);
+ pc_setpos(pl_sd, sd->mapindex, sd->bl.x, sd->bl.y, CLR_RESPAWN);
}
}
mapit_free(iter);
@@ -4704,7 +4704,7 @@ ACMD_FUNC(tonpc)
}
if ((nd = npc_name2id(npcname)) != NULL) {
- if (pc_setpos(sd, map_id2index(nd->bl.m), nd->bl.x, nd->bl.y, 3) == 0)
+ if (pc_setpos(sd, map_id2index(nd->bl.m), nd->bl.x, nd->bl.y, CLR_TELEPORT) == 0)
clif_displaymessage(fd, msg_txt(0)); // Warped.
else
return -1;
@@ -7700,7 +7700,7 @@ ACMD_FUNC(size)
size = atoi(message);
if(sd->state.size) {
sd->state.size=0;
- pc_setpos(sd, sd->mapindex, sd->bl.x, sd->bl.y, 3);
+ pc_setpos(sd, sd->mapindex, sd->bl.x, sd->bl.y, CLR_TELEPORT);
}
if(size==1) {
diff --git a/src/map/battleground.c b/src/map/battleground.c
index fad22c38f..1c2a90d90 100644
--- a/src/map/battleground.c
+++ b/src/map/battleground.c
@@ -64,7 +64,7 @@ int bg_team_warp(int bg_id, unsigned short mapindex, short x, short y)
struct battleground_data *bg = bg_team_search(bg_id);
if( bg == NULL ) return 0;
for( i = 0; i < MAX_BG_MEMBERS; i++ )
- if( bg->members[i].sd != NULL ) pc_setpos(bg->members[i].sd, mapindex, x, y, 3);
+ if( bg->members[i].sd != NULL ) pc_setpos(bg->members[i].sd, mapindex, x, y, CLR_TELEPORT);
return 1;
}
@@ -145,7 +145,7 @@ int bg_member_respawn(struct map_session_data *sd)
return 0;
if( bg->mapindex == 0 )
return 0; // Respawn not handled by Core
- pc_setpos(sd, bg->mapindex, bg->x, bg->y, 0);
+ pc_setpos(sd, bg->mapindex, bg->x, bg->y, CLR_OUTSIGHT);
status_revive(&sd->bl, 1, 100);
return 1; // Warped
diff --git a/src/map/clif.c b/src/map/clif.c
index 151c63e65..c99dab0b2 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -658,7 +658,7 @@ int clif_clearflooritem(struct flooritem_data *fitem, int fd)
* 3 - teleported / logged out
* fd : the target client
*------------------------------------------*/
-int clif_clearunit_single(int id, uint8 type, int fd)
+int clif_clearunit_single(int id, clr_type type, int fd)
{
WFIFOHEAD(fd, packet_len(0x80));
WFIFOW(fd,0) = 0x80;
@@ -676,7 +676,7 @@ int clif_clearunit_single(int id, uint8 type, int fd)
* 2 - respawned
* 3 - teleported / logged out
*------------------------------------------*/
-int clif_clearunit_area(struct block_list* bl, uint8 type)
+int clif_clearunit_area(struct block_list* bl, clr_type type)
{
unsigned char buf[16];
@@ -686,7 +686,7 @@ int clif_clearunit_area(struct block_list* bl, uint8 type)
WBUFL(buf,2) = bl->id;
WBUFB(buf,6) = type;
- clif_send(buf, packet_len(0x80), bl, type == 1 ? AREA : AREA_WOS);
+ clif_send(buf, packet_len(0x80), bl, type == CLR_DEAD ? AREA : AREA_WOS);
if(disguised(bl)) {
WBUFL(buf,2) = -bl->id;
@@ -699,7 +699,7 @@ int clif_clearunit_area(struct block_list* bl, uint8 type)
static int clif_clearunit_delayed_sub(int tid, unsigned int tick, int id, intptr data)
{
struct block_list *bl = (struct block_list *)data;
- clif_clearunit_area(bl, 0);
+ clif_clearunit_area(bl, CLR_OUTSIGHT);
aFree(bl);
return 0;
}
@@ -4195,7 +4195,7 @@ int clif_outsight(struct block_list *bl,va_list ap)
switch(bl->type){
case BL_PC:
if (sd->vd.class_ != INVISIBLE_CLASS)
- clif_clearunit_single(bl->id,0,tsd->fd);
+ clif_clearunit_single(bl->id,CLR_OUTSIGHT,tsd->fd);
if(sd->chatID){
struct chat_data *cd;
cd=(struct chat_data*)map_id2bl(sd->chatID);
@@ -4213,14 +4213,14 @@ int clif_outsight(struct block_list *bl,va_list ap)
break;
default:
if ((vd=status_get_viewdata(bl)) && vd->class_ != INVISIBLE_CLASS)
- clif_clearunit_single(bl->id,0,tsd->fd);
+ clif_clearunit_single(bl->id,CLR_OUTSIGHT,tsd->fd);
break;
}
}
if (sd && sd->fd)
{ //sd is watching tbl go out of view.
if ((vd=status_get_viewdata(tbl)) && vd->class_ != INVISIBLE_CLASS)
- clif_clearunit_single(tbl->id,0,sd->fd);
+ clif_clearunit_single(tbl->id,CLR_OUTSIGHT,sd->fd);
}
return 0;
}
@@ -7742,7 +7742,7 @@ int clif_refresh(struct map_session_data *sd)
if( pc_issit(sd) )
clif_sitting(&sd->bl); // FIXME: just send to self, not area
if( pc_isdead(sd) ) //When you refresh, resend the death packet.
- clif_clearunit_single(sd->bl.id,1,sd->fd);
+ clif_clearunit_single(sd->bl.id,CLR_DEAD,sd->fd);
else
clif_changed_dir(&sd->bl, SELF);
@@ -8720,7 +8720,7 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd)
// If player is dead, and is spawned (such as @refresh) send death packet. [Valaris]
if(pc_isdead(sd))
- clif_clearunit_area(&sd->bl, 1);
+ clif_clearunit_area(&sd->bl, CLR_DEAD);
// Uncomment if you want to make player face in the same direction he was facing right before warping. [Skotlex]
// else
// clif_changed_dir(&sd->bl, SELF);
@@ -8821,7 +8821,7 @@ void clif_parse_WalkToXY(int fd, struct map_session_data *sd)
int cmd;
if (pc_isdead(sd)) {
- clif_clearunit_area(&sd->bl, 1);
+ clif_clearunit_area(&sd->bl, CLR_DEAD);
return;
}
@@ -9100,7 +9100,7 @@ void clif_parse_HowManyConnections(int fd, struct map_session_data *sd)
void clif_parse_ActionRequest_sub(struct map_session_data *sd, int action_type, int target_id, unsigned int tick)
{
if (pc_isdead(sd)) {
- clif_clearunit_area(&sd->bl, 1);
+ clif_clearunit_area(&sd->bl, CLR_DEAD);
return;
}
@@ -9198,7 +9198,7 @@ void clif_parse_Restart(int fd, struct map_session_data *sd)
{
switch(RFIFOB(fd,2)) {
case 0x00:
- pc_respawn(sd,2);
+ pc_respawn(sd,CLR_RESPAWN);
break;
case 0x01:
/* Rovert's Prevent logout option - Fixed [Valaris] */
@@ -9416,7 +9416,7 @@ void clif_parse_TakeItem(int fd, struct map_session_data *sd)
do {
if (pc_isdead(sd)) {
- clif_clearunit_area(&sd->bl, 1);
+ clif_clearunit_area(&sd->bl, CLR_DEAD);
break;
}
@@ -9483,7 +9483,7 @@ void clif_parse_UseItem(int fd, struct map_session_data *sd)
int n;
if (pc_isdead(sd)) {
- clif_clearunit_area(&sd->bl, 1);
+ clif_clearunit_area(&sd->bl, CLR_DEAD);
return;
}
@@ -9516,7 +9516,7 @@ void clif_parse_EquipItem(int fd,struct map_session_data *sd)
int index;
if(pc_isdead(sd)) {
- clif_clearunit_area(&sd->bl,1);
+ clif_clearunit_area(&sd->bl,CLR_DEAD);
return;
}
index = RFIFOW(fd,2)-2;
@@ -9559,7 +9559,7 @@ void clif_parse_UnequipItem(int fd,struct map_session_data *sd)
int index;
if(pc_isdead(sd)) {
- clif_clearunit_area(&sd->bl,1);
+ clif_clearunit_area(&sd->bl,CLR_DEAD);
return;
}
@@ -9581,7 +9581,7 @@ void clif_parse_NpcClicked(int fd,struct map_session_data *sd)
struct block_list *bl;
if(pc_isdead(sd)) {
- clif_clearunit_area(&sd->bl,1);
+ clif_clearunit_area(&sd->bl,CLR_DEAD);
return;
}
diff --git a/src/map/clif.h b/src/map/clif.h
index 5989fa5c8..e93291c9a 100644
--- a/src/map/clif.h
+++ b/src/map/clif.h
@@ -78,6 +78,14 @@ typedef enum send_target {
BG_AREA_WOS,
} send_target;
+typedef enum clr_type
+{
+ CLR_OUTSIGHT = 0,
+ CLR_DEAD,
+ CLR_RESPAWN,
+ CLR_TELEPORT,
+} clr_type;
+
int clif_setip(const char* ip);
void clif_setbindip(const char* ip);
void clif_setport(uint16 port);
@@ -92,8 +100,8 @@ int clif_charselectok(int);
int clif_dropflooritem(struct flooritem_data *);
int clif_clearflooritem(struct flooritem_data *,int);
-int clif_clearunit_single(int id, uint8 type, int fd);
-int clif_clearunit_area(struct block_list* bl, uint8 type);
+int clif_clearunit_single(int id, clr_type type, int fd);
+int clif_clearunit_area(struct block_list* bl, clr_type type);
int clif_clearunit_delayed(struct block_list* bl, unsigned int tick);
int clif_spawn(struct block_list*); //area
int clif_walkok(struct map_session_data*); // self
diff --git a/src/map/homunculus.c b/src/map/homunculus.c
index 97a3274fb..6b31e2b6b 100644
--- a/src/map/homunculus.c
+++ b/src/map/homunculus.c
@@ -107,7 +107,7 @@ int merc_hom_vaporize(struct map_session_data *sd, int flag)
memset(hd->blockskill, 0, sizeof(hd->blockskill));
clif_hominfo(sd, sd->hd, 0);
merc_save(hd);
- return unit_remove_map(&hd->bl, 0);
+ return unit_remove_map(&hd->bl, CLR_OUTSIGHT);
}
//delete a homunculus, completely "killing it".
@@ -119,7 +119,7 @@ int merc_hom_delete(struct homun_data *hd, int emote)
sd = hd->master;
if (!sd)
- return unit_free(&hd->bl,1);
+ return unit_free(&hd->bl,CLR_DEAD);
if (emote >= 0)
clif_emotion(&sd->bl, emote);
@@ -129,7 +129,7 @@ int merc_hom_delete(struct homun_data *hd, int emote)
// Send homunculus_dead to client
hd->homunculus.hp = 0;
clif_hominfo(sd, hd, 0);
- return unit_remove_map(&hd->bl,0);
+ return unit_remove_map(&hd->bl,CLR_OUTSIGHT);
}
int merc_hom_calc_skilltree(struct homun_data *hd)
@@ -317,7 +317,7 @@ int merc_hom_evolution(struct homun_data *hd)
hom->luk += 10*rand(min->luk, max->luk);
hom->intimacy = 500;
- unit_remove_map(&hd->bl, 0);
+ unit_remove_map(&hd->bl, CLR_OUTSIGHT);
map_addblock(&hd->bl);
clif_spawn(&hd->bl);
@@ -676,7 +676,7 @@ int merc_call_homunculus(struct map_session_data *sd)
merc_save(hd);
} else
//Warp him to master.
- unit_warp(&hd->bl,sd->bl.m, sd->bl.x, sd->bl.y,0);
+ unit_warp(&hd->bl,sd->bl.m, sd->bl.x, sd->bl.y,CLR_OUTSIGHT);
return 1;
}
diff --git a/src/map/instance.c b/src/map/instance.c
index c1d43c27b..6fa3a2c0a 100644
--- a/src/map/instance.c
+++ b/src/map/instance.c
@@ -235,7 +235,7 @@ int instance_del_load(struct map_session_data* sd, va_list args)
if( !sd || sd->bl.m != m )
return 0;
- pc_setpos(sd, sd->status.save_point.map, sd->status.save_point.x, sd->status.save_point.y, 0);
+ pc_setpos(sd, sd->status.save_point.map, sd->status.save_point.x, sd->status.save_point.y, CLR_OUTSIGHT);
return 1;
}
@@ -439,9 +439,9 @@ void instance_check_kick(struct map_session_data *sd)
if( map[m].instance_id )
{ // User was on the instance map
if( map[m].save.map )
- pc_setpos(sd, map[m].save.map, map[m].save.x, map[m].save.y, 3);
+ pc_setpos(sd, map[m].save.map, map[m].save.x, map[m].save.y, CLR_TELEPORT);
else
- pc_setpos(sd, sd->status.save_point.map, sd->status.save_point.x, sd->status.save_point.y, 3);
+ pc_setpos(sd, sd->status.save_point.map, sd->status.save_point.x, sd->status.save_point.y, CLR_TELEPORT);
}
}
diff --git a/src/map/map.c b/src/map/map.c
index b7b1c09b8..5f4a1cf16 100644
--- a/src/map/map.c
+++ b/src/map/map.c
@@ -1645,7 +1645,7 @@ int map_quit(struct map_session_data *sd)
if( sd->pd ) pet_lootitem_drop(sd->pd, sd);
if( sd->state.storage_flag == 1 ) sd->state.storage_flag = 0; // No need to Double Save Storage on Quit.
- unit_remove_map_pc(sd,3);
+ unit_remove_map_pc(sd,CLR_TELEPORT);
if( map[sd->bl.m].instance_id )
{ // Avoid map conflicts and warnings on next login
@@ -2150,7 +2150,7 @@ int map_removemobs_sub(struct block_list *bl, va_list ap)
if( md->db->mexp > 0 )
return 0;
- unit_free(&md->bl,0);
+ unit_free(&md->bl,CLR_OUTSIGHT);
return 1;
}
@@ -3365,7 +3365,7 @@ int cleanup_sub(struct block_list *bl, va_list ap)
npc_unload((struct npc_data *)bl);
break;
case BL_MOB:
- unit_free(bl,0);
+ unit_free(bl,CLR_OUTSIGHT);
break;
case BL_PET:
//There is no need for this, the pet is removed together with the player. [Skotlex]
diff --git a/src/map/mercenary.c b/src/map/mercenary.c
index 84974e906..53f70a462 100644
--- a/src/map/mercenary.c
+++ b/src/map/mercenary.c
@@ -244,7 +244,7 @@ int merc_delete(struct mercenary_data *md, int reply)
merc_contract_stop(md);
if( !sd )
- return unit_free(&md->bl, 0);
+ return unit_free(&md->bl, CLR_OUTSIGHT);
if( md->devotion_flag )
{
@@ -259,7 +259,7 @@ int merc_delete(struct mercenary_data *md, int reply)
}
clif_mercenary_message(sd->fd, reply);
- return unit_remove_map(&md->bl, 0);
+ return unit_remove_map(&md->bl, CLR_OUTSIGHT);
}
void merc_contract_stop(struct mercenary_data *md)
diff --git a/src/map/mob.c b/src/map/mob.c
index 15e27b686..a52c6f087 100644
--- a/src/map/mob.c
+++ b/src/map/mob.c
@@ -547,7 +547,7 @@ static int mob_spawn_guardian_sub(int tid, unsigned int tick, int id, intptr dat
md->guardian_data->castle->guardian[md->guardian_data->number].visible = 0;
guild_castledatasave(md->guardian_data->castle->castle_id, 10+md->guardian_data->number,0);
}
- unit_free(&md->bl,0); //Remove guardian.
+ unit_free(&md->bl,CLR_OUTSIGHT); //Remove guardian.
}
return 0;
}
@@ -795,7 +795,7 @@ int mob_setdelayspawn(struct mob_data *md)
unsigned int spawntime;
if (!md->spawn) //Doesn't has respawn data!
- return unit_free(&md->bl,1);
+ return unit_free(&md->bl,CLR_DEAD);
spawntime = md->spawn->delay1; //Base respawn time
if (md->spawn->delay2) //random variance
@@ -826,7 +826,7 @@ int mob_spawn (struct mob_data *md)
md->last_thinktime = tick;
if (md->bl.prev != NULL)
- unit_remove_map(&md->bl,2);
+ unit_remove_map(&md->bl,CLR_RESPAWN);
else
if (md->spawn && md->class_ != md->spawn->class_)
{
@@ -1121,7 +1121,7 @@ static int mob_ai_sub_hard_slavemob(struct mob_data *md,unsigned int tick)
md->master_dist > MAX_MINCHASE
){
md->master_dist = 0;
- unit_warp(&md->bl,bl->m,bl->x,bl->y,3);
+ unit_warp(&md->bl,bl->m,bl->x,bl->y,CLR_TELEPORT);
return 1;
}
@@ -1761,7 +1761,7 @@ int mob_timer_delete(int tid, unsigned int tick, int id, intptr data)
}
//for Alchemist CANNIBALIZE [Lupus]
md->deletetimer = INVALID_TIMER;
- unit_free(bl, 3);
+ unit_free(bl, CLR_TELEPORT);
}
return 0;
}
@@ -2491,7 +2491,7 @@ int mob_guardian_guildchange(struct block_list *bl,va_list ap)
md->guardian_data->castle->guardian[md->guardian_data->number].visible = 0;
guild_castledatasave(md->guardian_data->castle->castle_id, 10+md->guardian_data->number,0);
}
- unit_free(&md->bl,0); //Remove guardian.
+ unit_free(&md->bl,CLR_OUTSIGHT); //Remove guardian.
}
return 0;
}
@@ -2505,7 +2505,7 @@ int mob_guardian_guildchange(struct block_list *bl,va_list ap)
md->guardian_data->castle->guardian[md->guardian_data->number].visible = 0;
guild_castledatasave(md->guardian_data->castle->castle_id, 10+md->guardian_data->number,0);
}
- unit_free(&md->bl,0);
+ unit_free(&md->bl,CLR_OUTSIGHT);
return 0;
}
@@ -2631,7 +2631,7 @@ int mob_warpslave_sub(struct block_list *bl,va_list ap)
return 0;
map_search_freecell(master, 0, &x, &y, range, range, 0);
- unit_warp(&md->bl, master->m, x, y,2);
+ unit_warp(&md->bl, master->m, x, y,CLR_RESPAWN);
return 1;
}
diff --git a/src/map/npc.c b/src/map/npc.c
index 9f988df6f..893b3c871 100644
--- a/src/map/npc.c
+++ b/src/map/npc.c
@@ -176,7 +176,7 @@ int npc_enable(const char* name, int flag)
if (nd->class_ == WARP_CLASS || nd->class_ == FLAG_CLASS)
{ //Client won't display option changes for these classes [Toms]
if (nd->sc.option&(OPTION_HIDE|OPTION_INVISIBLE))
- clif_clearunit_area(&nd->bl, 0);
+ clif_clearunit_area(&nd->bl, CLR_OUTSIGHT);
else
clif_spawn(&nd->bl);
} else
@@ -206,7 +206,7 @@ int npc_event_dequeue(struct map_session_data* sd)
if(sd->npc_id)
{ //Current script is aborted.
if(sd->state.using_fake_npc){
- clif_clearunit_single(sd->npc_id, 0, sd->fd);
+ clif_clearunit_single(sd->npc_id, CLR_OUTSIGHT, sd->fd);
sd->state.using_fake_npc = 0;
}
if (sd->st) {
@@ -866,7 +866,7 @@ int npc_touch_areanpc(struct map_session_data* sd, int m, int x, int y)
case WARP:
if( pc_ishiding(sd) )
break; // hidden chars cannot use warps
- pc_setpos(sd,map[m].npc[i]->u.warp.mapindex,map[m].npc[i]->u.warp.x,map[m].npc[i]->u.warp.y,0);
+ pc_setpos(sd,map[m].npc[i]->u.warp.mapindex,map[m].npc[i]->u.warp.x,map[m].npc[i]->u.warp.y,CLR_OUTSIGHT);
break;
case SCRIPT:
if( npc_ontouch_event(sd,map[m].npc[i]) > 0 && npc_ontouch2_event(sd,map[m].npc[i]) > 0 )
@@ -923,7 +923,7 @@ int npc_touch_areanpc2(struct mob_data *md)
xs = map_mapindex2mapid(map[m].npc[i]->u.warp.mapindex);
if( m < 0 )
break; // Cannot Warp between map servers
- if( unit_warp(&md->bl, xs, map[m].npc[i]->u.warp.x, map[m].npc[i]->u.warp.y, 0) == 0 )
+ if( unit_warp(&md->bl, xs, map[m].npc[i]->u.warp.x, map[m].npc[i]->u.warp.y, CLR_OUTSIGHT) == 0 )
return 1; // Warped
break;
case SCRIPT:
@@ -1451,7 +1451,7 @@ int npc_remove_map(struct npc_data* nd)
if(nd->bl.prev == NULL || nd->bl.m < 0)
return 1; //Not assigned to a map.
m = nd->bl.m;
- clif_clearunit_area(&nd->bl,2);
+ clif_clearunit_area(&nd->bl,CLR_RESPAWN);
npc_unsetcells(nd);
map_delblock(&nd->bl);
//Remove npc from map[].npc list. [Skotlex]
@@ -2550,7 +2550,7 @@ void npc_setclass(struct npc_data* nd, short class_)
if( nd->class_ == class_ )
return;
- clif_clearunit_area(&nd->bl, 0);// fade out
+ clif_clearunit_area(&nd->bl, CLR_OUTSIGHT);// fade out
nd->class_ = class_;
status_set_viewdata(&nd->bl, class_);
clif_spawn(&nd->bl);// fade in
@@ -3280,7 +3280,7 @@ int npc_reload(void)
npc_unload((struct npc_data *)bl);
break;
case BL_MOB:
- unit_free(bl,0);
+ unit_free(bl,CLR_OUTSIGHT);
break;
}
}
@@ -3360,7 +3360,7 @@ int do_final_npc(void)
if (bl->type == BL_NPC)
npc_unload((struct npc_data *)bl);
else if (bl->type&(BL_MOB|BL_PET|BL_HOM|BL_MER))
- unit_free(bl, 0);
+ unit_free(bl, CLR_OUTSIGHT);
}
}
diff --git a/src/map/pc.c b/src/map/pc.c
index 6c8b94485..902463cb0 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -910,11 +910,11 @@ bool pc_authok(struct map_session_data *sd, int login_id2, time_t expiration_tim
sd->hate_mob[i] = -1;
// 位置の設定
- if ((i=pc_setpos(sd,sd->status.last_point.map, sd->status.last_point.x, sd->status.last_point.y, 0)) != 0) {
+ if ((i=pc_setpos(sd,sd->status.last_point.map, sd->status.last_point.x, sd->status.last_point.y, CLR_OUTSIGHT)) != 0) {
ShowError ("Last_point_map %s - id %d not found (error code %d)\n", mapindex_id2name(sd->status.last_point.map), sd->status.last_point.map, i);
// try warping to a default map instead (church graveyard)
- if (pc_setpos(sd, mapindex_name2id(MAP_PRONTERA), 273, 354, 0) != 0) {
+ if (pc_setpos(sd, mapindex_name2id(MAP_PRONTERA), 273, 354, CLR_OUTSIGHT) != 0) {
// if we fail again
clif_authfail_fd(sd->fd, 0);
return false;
@@ -1439,7 +1439,7 @@ int pc_disguise(struct map_session_data *sd, int class_)
if (sd->bl.prev != NULL) {
pc_stop_walking(sd, 0);
- clif_clearunit_area(&sd->bl, 0);
+ clif_clearunit_area(&sd->bl, CLR_OUTSIGHT);
}
if (!class_) {
@@ -4038,7 +4038,7 @@ int pc_steal_coin(struct map_session_data *sd,struct block_list *target)
* 1 - Invalid map index.
* 2 - Map not in this map-server, and failed to locate alternate map-server.
*------------------------------------------*/
-int pc_setpos(struct map_session_data* sd, unsigned short mapindex, int x, int y, uint8 clrtype)
+int pc_setpos(struct map_session_data* sd, unsigned short mapindex, int x, int y, clr_type clrtype)
{
struct party_data *p;
int m;
@@ -4196,7 +4196,7 @@ int pc_setpos(struct map_session_data* sd, unsigned short mapindex, int x, int y
/*==========================================
* PCのランダムワ?プ
*------------------------------------------*/
-int pc_randomwarp(struct map_session_data *sd, int type)
+int pc_randomwarp(struct map_session_data *sd, clr_type type)
{
int x,y,i=0;
int m;
@@ -4704,7 +4704,7 @@ int pc_follow_timer(int tid, unsigned int tick, int id, intptr data)
if (!check_distance_bl(&sd->bl, tbl, 5))
unit_walktobl(&sd->bl, tbl, 5, 0);
} else
- pc_setpos(sd, map_id2index(tbl->m), tbl->x, tbl->y, 3);
+ pc_setpos(sd, map_id2index(tbl->m), tbl->x, tbl->y, CLR_TELEPORT);
}
sd->followtimer = add_timer(
tick + 1000, // increase time a bit to loosen up map's load
@@ -5520,7 +5520,7 @@ int pc_skillheal2_bonus(struct map_session_data *sd, int skill_num)
return bonus;
}
-void pc_respawn(struct map_session_data* sd, uint8 clrtype)
+void pc_respawn(struct map_session_data* sd, clr_type clrtype)
{
if( !pc_isdead(sd) )
return; // not applicable
@@ -5539,7 +5539,7 @@ static int pc_respawn_timer(int tid, unsigned int tick, int id, intptr data)
if( sd != NULL )
{
sd->pvp_point=0;
- pc_respawn(sd,0);
+ pc_respawn(sd,CLR_OUTSIGHT);
}
return 0;
diff --git a/src/map/pc.h b/src/map/pc.h
index 9c9408da6..16c8ec3fc 100644
--- a/src/map/pc.h
+++ b/src/map/pc.h
@@ -545,7 +545,7 @@ bool pc_can_give_items(int level);
int pc_setrestartvalue(struct map_session_data *sd,int type);
int pc_makesavestatus(struct map_session_data *);
-void pc_respawn(struct map_session_data* sd, uint8 clrtype);
+void pc_respawn(struct map_session_data* sd, clr_type clrtype);
int pc_setnewpc(struct map_session_data*,int,int,int,unsigned int,int,int);
bool pc_authok(struct map_session_data* sd, int, time_t, int gmlevel, struct mmo_charstatus* status);
void pc_authfail(struct map_session_data *);
@@ -566,11 +566,11 @@ int pc_clean_skilltree(struct map_session_data *sd);
#define pc_checkoverhp(sd) (sd->battle_status.hp == sd->battle_status.max_hp)
#define pc_checkoversp(sd) (sd->battle_status.sp == sd->battle_status.max_sp)
-int pc_setpos(struct map_session_data* sd, unsigned short mapindex, int x, int y, uint8 clrtype);
+int pc_setpos(struct map_session_data* sd, unsigned short mapindex, int x, int y, clr_type clrtype);
int pc_setsavepoint(struct map_session_data*,short,int,int);
-int pc_randomwarp(struct map_session_data *sd,int type);
+int pc_randomwarp(struct map_session_data *sd,clr_type type);
int pc_memo(struct map_session_data* sd, int pos);
-int pc_remove_map(struct map_session_data *sd,int clrtype);
+int pc_remove_map(struct map_session_data *sd,clr_type clrtype);
int pc_checkadditem(struct map_session_data*,int,int);
int pc_inventoryblank(struct map_session_data*);
diff --git a/src/map/pet.c b/src/map/pet.c
index d02f93446..d3758b9e5 100644
--- a/src/map/pet.c
+++ b/src/map/pet.c
@@ -306,7 +306,7 @@ static int pet_return_egg(struct map_session_data *sd, struct pet_data *pd)
map_addflooritem(&tmp_item,1,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0);
}
pd->pet.incuvate = 1;
- unit_free(&pd->bl,0);
+ unit_free(&pd->bl,CLR_OUTSIGHT);
status_calc_pc(sd,0);
sd->status.pet_id = 0;
@@ -523,7 +523,7 @@ int pet_catch_process2(struct map_session_data* sd, int target_id)
if(rand()%10000 < pet_catch_rate)
{
- unit_remove_map(&md->bl,0);
+ unit_remove_map(&md->bl,CLR_OUTSIGHT);
status_kill(&md->bl);
clif_pet_roulette(sd,1);
intif_create_pet(sd->status.account_id,sd->status.char_id,pet_db[i].class_,mob_db(pet_db[i].class_)->lv,
diff --git a/src/map/script.c b/src/map/script.c
index 589129b2e..c6c9c3591 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -3335,7 +3335,7 @@ void run_script_main(struct script_state *st)
if ((sd = map_id2sd(st->rid))!=NULL)
{ //Restore previous stack and save char.
if(sd->state.using_fake_npc){
- clif_clearunit_single(sd->npc_id, 0, sd->fd);
+ clif_clearunit_single(sd->npc_id, CLR_OUTSIGHT, sd->fd);
sd->state.using_fake_npc = 0;
}
//Restore previous script if any.
@@ -4136,11 +4136,11 @@ BUILDIN_FUNC(warp)
y = script_getnum(st,4);
if(strcmp(str,"Random")==0)
- ret = pc_randomwarp(sd,3);
+ ret = pc_randomwarp(sd,CLR_TELEPORT);
else if(strcmp(str,"SavePoint")==0 || strcmp(str,"Save")==0)
- ret = pc_setpos(sd,sd->status.save_point.map,sd->status.save_point.x,sd->status.save_point.y,3);
+ ret = pc_setpos(sd,sd->status.save_point.map,sd->status.save_point.x,sd->status.save_point.y,CLR_TELEPORT);
else
- ret = pc_setpos(sd,mapindex_name2id(str),x,y,0);
+ ret = pc_setpos(sd,mapindex_name2id(str),x,y,CLR_OUTSIGHT);
if( ret ) {
ShowError("buildin_warp: moving player '%s' to \"%s\",%d,%d failed.\n", sd->status.name, str, x, y);
@@ -4160,9 +4160,9 @@ static int buildin_areawarp_sub(struct block_list *bl,va_list ap)
x=va_arg(ap,int);
y=va_arg(ap,int);
if(map == 0)
- pc_randomwarp((TBL_PC *)bl,3);
+ pc_randomwarp((TBL_PC *)bl,CLR_TELEPORT);
else
- pc_setpos((TBL_PC *)bl,map,x,y,0);
+ pc_setpos((TBL_PC *)bl,map,x,y,CLR_OUTSIGHT);
return 0;
}
BUILDIN_FUNC(areawarp)
@@ -4248,12 +4248,12 @@ BUILDIN_FUNC(warpchar)
return 0;
if(strcmp(str, "Random") == 0)
- pc_randomwarp(sd, 3);
+ pc_randomwarp(sd, CLR_TELEPORT);
else
if(strcmp(str, "SavePoint") == 0)
- pc_setpos(sd, sd->status.save_point.map,sd->status.save_point.x, sd->status.save_point.y, 3);
+ pc_setpos(sd, sd->status.save_point.map,sd->status.save_point.x, sd->status.save_point.y, CLR_TELEPORT);
else
- pc_setpos(sd, mapindex_name2id(str), x, y, 3);
+ pc_setpos(sd, mapindex_name2id(str), x, y, CLR_TELEPORT);
return 0;
}
@@ -4310,15 +4310,15 @@ BUILDIN_FUNC(warpparty)
{
case 0: // Random
if(!map[pl_sd->bl.m].flag.nowarp)
- pc_randomwarp(pl_sd,3);
+ pc_randomwarp(pl_sd,CLR_TELEPORT);
break;
case 1: // SavePointAll
if(!map[pl_sd->bl.m].flag.noreturn)
- pc_setpos(pl_sd,pl_sd->status.save_point.map,pl_sd->status.save_point.x,pl_sd->status.save_point.y,3);
+ pc_setpos(pl_sd,pl_sd->status.save_point.map,pl_sd->status.save_point.x,pl_sd->status.save_point.y,CLR_TELEPORT);
break;
case 2: // SavePoint
if(!map[pl_sd->bl.m].flag.noreturn)
- pc_setpos(pl_sd,sd->status.save_point.map,sd->status.save_point.x,sd->status.save_point.y,3);
+ pc_setpos(pl_sd,sd->status.save_point.map,sd->status.save_point.x,sd->status.save_point.y,CLR_TELEPORT);
break;
case 3: // Leader
for(j = 0; j < MAX_PARTY && !p->party.member[j].leader; j++);
@@ -4334,12 +4334,12 @@ BUILDIN_FUNC(warpparty)
continue;
if(map[pl_sd->bl.m].flag.noreturn || map[pl_sd->bl.m].flag.nowarp)
continue;
- pc_setpos(pl_sd,mapindex,x,y,3);
+ pc_setpos(pl_sd,mapindex,x,y,CLR_TELEPORT);
}
break;
case 4: // m,x,y
if(!map[pl_sd->bl.m].flag.noreturn && !map[pl_sd->bl.m].flag.nowarp)
- pc_setpos(pl_sd,mapindex_name2id(str),x,y,3);
+ pc_setpos(pl_sd,mapindex_name2id(str),x,y,CLR_TELEPORT);
break;
}
}
@@ -4388,19 +4388,19 @@ BUILDIN_FUNC(warpguild)
{
case 0: // Random
if(!map[pl_sd->bl.m].flag.nowarp)
- pc_randomwarp(pl_sd,3);
+ pc_randomwarp(pl_sd,CLR_TELEPORT);
break;
case 1: // SavePointAll
if(!map[pl_sd->bl.m].flag.noreturn)
- pc_setpos(pl_sd,pl_sd->status.save_point.map,pl_sd->status.save_point.x,pl_sd->status.save_point.y,3);
+ pc_setpos(pl_sd,pl_sd->status.save_point.map,pl_sd->status.save_point.x,pl_sd->status.save_point.y,CLR_TELEPORT);
break;
case 2: // SavePoint
if(!map[pl_sd->bl.m].flag.noreturn)
- pc_setpos(pl_sd,sd->status.save_point.map,sd->status.save_point.x,sd->status.save_point.y,3);
+ pc_setpos(pl_sd,sd->status.save_point.map,sd->status.save_point.x,sd->status.save_point.y,CLR_TELEPORT);
break;
case 3: // m,x,y
if(!map[pl_sd->bl.m].flag.noreturn && !map[pl_sd->bl.m].flag.nowarp)
- pc_setpos(pl_sd,mapindex_name2id(str),x,y,3);
+ pc_setpos(pl_sd,mapindex_name2id(str),x,y,CLR_TELEPORT);
break;
}
}
@@ -9104,16 +9104,16 @@ BUILDIN_FUNC(warpwaitingpc)
mapreg_setreg(add_str("$@warpwaitingpc")+(i<<24), sd->bl.id);
if( strcmp(map_name,"Random") == 0 )
- pc_randomwarp(sd,3);
+ pc_randomwarp(sd,CLR_TELEPORT);
else if( strcmp(map_name,"SavePoint") == 0 )
{
if( map[sd->bl.m].flag.noteleport )
return 0;// can't teleport on this map
- pc_setpos(sd, sd->status.save_point.map, sd->status.save_point.x, sd->status.save_point.y, 3);
+ pc_setpos(sd, sd->status.save_point.map, sd->status.save_point.x, sd->status.save_point.y, CLR_TELEPORT);
}
else
- pc_setpos(sd, mapindex_name2id(map_name), x, y, 0);
+ pc_setpos(sd, mapindex_name2id(map_name), x, y, CLR_OUTSIGHT);
}
mapreg_setreg(add_str("$@warpwaitingpcnum"), i);
return 0;
@@ -9547,7 +9547,7 @@ static int buildin_maprespawnguildid_sub_pc(struct map_session_data* sd, va_list
(sd->status.guild_id != g_id && flag&2) || //Warp out outsiders
(sd->status.guild_id == 0) // Warp out players not in guild [Valaris]
)
- pc_setpos(sd,sd->status.save_point.map,sd->status.save_point.x,sd->status.save_point.y,3);
+ pc_setpos(sd,sd->status.save_point.map,sd->status.save_point.x,sd->status.save_point.y,CLR_TELEPORT);
return 1;
}
@@ -10021,7 +10021,7 @@ BUILDIN_FUNC(mapwarp) // Added by RoVeRT
for( i=0; i < g->max_member; i++)
{
if(g->member[i].sd && g->member[i].sd->bl.m==m){
- pc_setpos(g->member[i].sd,index,x,y,3);
+ pc_setpos(g->member[i].sd,index,x,y,CLR_TELEPORT);
}
}
}
@@ -10031,7 +10031,7 @@ BUILDIN_FUNC(mapwarp) // Added by RoVeRT
if(p){
for(i=0;i<MAX_PARTY; i++){
if(p->data[i].sd && p->data[i].sd->bl.m == m){
- pc_setpos(p->data[i].sd,index,x,y,3);
+ pc_setpos(p->data[i].sd,index,x,y,CLR_TELEPORT);
}
}
}
@@ -10194,7 +10194,7 @@ BUILDIN_FUNC(warppartner)
mapindex = mapindex_name2id(str);
if (mapindex) {
- pc_setpos(p_sd,mapindex,x,y,0);
+ pc_setpos(p_sd,mapindex,x,y,CLR_OUTSIGHT);
script_pushint(st,1);
} else
script_pushint(st,0);
@@ -12203,7 +12203,7 @@ BUILDIN_FUNC(setnpcdisplay)
npc_setclass(nd, class_);
else if( size != -1 )
{ // Required to update the visual size
- clif_clearunit_area(&nd->bl, 0);
+ clif_clearunit_area(&nd->bl, CLR_OUTSIGHT);
clif_spawn(&nd->bl);
}
@@ -13068,7 +13068,7 @@ BUILDIN_FUNC(unitwarp)
bl = map_id2bl(unit_id);
if( map >= 0 && bl != NULL )
- script_pushint(st, unit_warp(bl,map,x,y,0));
+ script_pushint(st, unit_warp(bl,map,x,y,CLR_OUTSIGHT));
else
script_pushint(st, 0);
@@ -13860,7 +13860,7 @@ BUILDIN_FUNC(waitingroom2bg_single)
if( bg_team_join(bg_id, sd) )
{
- pc_setpos(sd, mapindex, x, y, 3);
+ pc_setpos(sd, mapindex, x, y, CLR_TELEPORT);
script_pushint(st,1);
}
else
@@ -14329,7 +14329,7 @@ BUILDIN_FUNC(instance_warpall)
mapindex = map_id2index(m);
for( i = 0; i < MAX_PARTY; i++ )
- if( (pl_sd = p->data[i].sd) && map[pl_sd->bl.m].instance_id == st->instance_id ) pc_setpos(pl_sd,mapindex,x,y,3);
+ if( (pl_sd = p->data[i].sd) && map[pl_sd->bl.m].instance_id == st->instance_id ) pc_setpos(pl_sd,mapindex,x,y,CLR_TELEPORT);
return 0;
}
diff --git a/src/map/skill.c b/src/map/skill.c
index ccc3d96f9..4db0b1e2b 100644
--- a/src/map/skill.c
+++ b/src/map/skill.c
@@ -2307,11 +2307,11 @@ static int skill_timerskill(int tid, unsigned int tick, int id, intptr data)
switch(skl->skill_id) {
case RG_INTIMIDATE:
- if (unit_warp(src,-1,-1,-1,3) == 0) {
+ if (unit_warp(src,-1,-1,-1,CLR_TELEPORT) == 0) {
short x,y;
map_search_freecell(src, 0, &x, &y, 1, 1, 0);
if (target != src && !status_isdead(target))
- unit_warp(target, -1, x, y, 3);
+ unit_warp(target, -1, x, y, CLR_TELEPORT);
}
break;
case BA_FROSTJOKER:
@@ -4418,9 +4418,9 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in
if( sd->state.autocast || ( (sd->skillitem == AL_TELEPORT || battle_config.skip_teleport_lv1_menu) && skilllv == 1 ) || skilllv == 3 )
{
if( skilllv == 1 )
- pc_randomwarp(sd,3);
+ pc_randomwarp(sd,CLR_TELEPORT);
else
- pc_setpos(sd,sd->status.save_point.map,sd->status.save_point.x,sd->status.save_point.y,3);
+ pc_setpos(sd,sd->status.save_point.map,sd->status.save_point.x,sd->status.save_point.y,CLR_TELEPORT);
break;
}
@@ -4430,12 +4430,12 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in
else
clif_skill_warppoint(sd,skillid,skilllv, (unsigned short)-1,sd->status.save_point.map,0,0);
} else
- unit_warp(bl,-1,-1,-1,3);
+ unit_warp(bl,-1,-1,-1,CLR_TELEPORT);
break;
case NPC_EXPULSION:
clif_skill_nodamage(src,bl,skillid,skilllv,1);
- unit_warp(bl,-1,-1,-1,3);
+ unit_warp(bl,-1,-1,-1,CLR_TELEPORT);
break;
case AL_HOLYWATER:
@@ -5360,7 +5360,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in
case 5: // 2000HP heal, random teleported
status_heal(src, 2000, 0, 0);
if( !map_flag_vs(bl->m) )
- unit_warp(bl, -1,-1,-1, 3);
+ unit_warp(bl, -1,-1,-1, CLR_TELEPORT);
break;
case 6: // random 2 other effects
if (count == -1)
@@ -5530,7 +5530,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in
continue;
if(map_getcell(src->m,src->x+dx[j],src->y+dy[j],CELL_CHKNOREACH))
dx[j] = dy[j] = 0;
- pc_setpos(dstsd, map_id2index(src->m), src->x+dx[j], src->y+dy[j], 2);
+ pc_setpos(dstsd, map_id2index(src->m), src->x+dx[j], src->y+dy[j], CLR_RESPAWN);
}
}
if (sd)
@@ -6643,9 +6643,9 @@ int skill_castend_map (struct map_session_data *sd, short skill_num, const char
{
case AL_TELEPORT:
if(strcmp(map,"Random")==0)
- pc_randomwarp(sd,3);
+ pc_randomwarp(sd,CLR_TELEPORT);
else if (sd->menuskill_val > 1) //Need lv2 to be able to warp here.
- pc_setpos(sd,sd->status.save_point.map,sd->status.save_point.x,sd->status.save_point.y,3);
+ pc_setpos(sd,sd->status.save_point.map,sd->status.save_point.x,sd->status.save_point.y,CLR_TELEPORT);
break;
case AL_WARP:
@@ -7259,7 +7259,7 @@ static int skill_unit_onplace (struct skill_unit *src, struct block_list *bl, un
if( --sg->val1 <= 0 )
skill_delunitgroup(sg);
- pc_setpos(sd,m,x,y,3);
+ pc_setpos(sd,m,x,y,CLR_TELEPORT);
sg = src->group; // avoid dangling pointer (pc_setpos can cause deletion of 'sg')
}
} else
@@ -7267,7 +7267,7 @@ static int skill_unit_onplace (struct skill_unit *src, struct block_list *bl, un
{
int m = map_mapindex2mapid(sg->val3);
if (m < 0) break; //Map not available on this map-server.
- unit_warp(bl,m,sg->val2>>16,sg->val2&0xffff,3);
+ unit_warp(bl,m,sg->val2>>16,sg->val2&0xffff,CLR_TELEPORT);
}
break;
@@ -10404,13 +10404,13 @@ static int skill_unit_timer_sub (DBKey key, void* data, va_list ap)
sd = map_charid2sd(group->val1);
group->val1 = 0;
if (sd && !map[sd->bl.m].flag.nowarp)
- pc_setpos(sd,map_id2index(unit->bl.m),unit->bl.x,unit->bl.y,3);
+ pc_setpos(sd,map_id2index(unit->bl.m),unit->bl.x,unit->bl.y,CLR_TELEPORT);
}
if(group->val2) {
sd = map_charid2sd(group->val2);
group->val2 = 0;
if (sd && !map[sd->bl.m].flag.nowarp)
- pc_setpos(sd,map_id2index(unit->bl.m),unit->bl.x,unit->bl.y,3);
+ pc_setpos(sd,map_id2index(unit->bl.m),unit->bl.x,unit->bl.y,CLR_TELEPORT);
}
skill_delunit(unit);
}
diff --git a/src/map/status.c b/src/map/status.c
index a9bf031e1..3b9213ca5 100644
--- a/src/map/status.c
+++ b/src/map/status.c
@@ -831,16 +831,16 @@ int status_damage(struct block_list *src,struct block_list *target,int hp, int s
status_change_clear(target,0);
if(flag&4) //Delete from memory. (also invokes map removal code)
- unit_free(target,1);
+ unit_free(target,CLR_DEAD);
else
if(flag&2) //remove from map
- unit_remove_map(target,1);
+ unit_remove_map(target,CLR_DEAD);
else
{ //Some death states that would normally be handled by unit_remove_map
unit_stop_attack(target);
unit_stop_walking(target,1);
unit_skillcastcancel(target,0);
- clif_clearunit_area(target,1);
+ clif_clearunit_area(target,CLR_DEAD);
skill_unit_move(target,gettick(),4);
skill_cleartimerskill(target);
}
@@ -5953,7 +5953,7 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val
int pos = (bl->x&0xFFFF)|(bl->y<<16), //Current Coordinates
map = sd->mapindex; //Current Map
//1. Place in Jail (val2 -> Jail Map, val3 -> x, val4 -> y
- pc_setpos(sd,(unsigned short)val2,val3,val4, 3);
+ pc_setpos(sd,(unsigned short)val2,val3,val4, CLR_TELEPORT);
//2. Set restore point (val3 -> return map, val4 return coords
val3 = map;
val4 = pos;
@@ -6736,7 +6736,7 @@ int status_change_end(struct block_list* bl, enum sc_type type, int tid)
break;
//natural expiration.
if(sd && sd->mapindex == sce->val2)
- pc_setpos(sd,(unsigned short)sce->val3,sce->val4&0xFFFF, sce->val4>>16, 3);
+ pc_setpos(sd,(unsigned short)sce->val3,sce->val4&0xFFFF, sce->val4>>16, CLR_TELEPORT);
break; //guess hes not in jail :P
case SC_CHANGE:
if (tid == -1)
diff --git a/src/map/unit.c b/src/map/unit.c
index c6f50f819..a1e523fa1 100644
--- a/src/map/unit.c
+++ b/src/map/unit.c
@@ -641,7 +641,7 @@ int unit_blown(struct block_list* bl, int dx, int dy, int count, int flag)
//Warps a unit/ud to a given map/position.
//In the case of players, pc_setpos is used.
//it respects the no warp flags, so it is safe to call this without doing nowarpto/nowarp checks.
-int unit_warp(struct block_list *bl,short m,short x,short y,int type)
+int unit_warp(struct block_list *bl,short m,short x,short y,clr_type type)
{
struct unit_data *ud;
nullpo_ret(bl);
@@ -650,7 +650,7 @@ int unit_warp(struct block_list *bl,short m,short x,short y,int type)
if(bl->prev==NULL || !ud)
return 1;
- if (type == 1)
+ if (type == CLR_DEAD)
//Type 1 is invalid, since you shouldn't warp a bl with the "death"
//animation, it messes up with unit_remove_map! [Skotlex]
return 1;
@@ -1811,7 +1811,7 @@ int unit_changeviewsize(struct block_list *bl,short size)
* Otherwise it is assumed bl is being warped.
* On-Kill specific stuff is not performed here, look at status_damage for that.
*------------------------------------------*/
-int unit_remove_map_(struct block_list *bl, int clrtype, const char* file, int line, const char* func)
+int unit_remove_map_(struct block_list *bl, clr_type clrtype, const char* file, int line, const char* func)
{
struct unit_data *ud = unit_bl2ud(bl);
struct status_change *sc = status_get_sc(bl);
@@ -1960,7 +1960,7 @@ int unit_remove_map_(struct block_list *bl, int clrtype, const char* file, int l
{ //If logging out, this is deleted on unit_free
clif_clearunit_area(bl,clrtype);
map_delblock(bl);
- unit_free(bl,0);
+ unit_free(bl,CLR_OUTSIGHT);
map_freeblock_unlock();
return 0;
}
@@ -1976,7 +1976,7 @@ int unit_remove_map_(struct block_list *bl, int clrtype, const char* file, int l
clif_emotion(bl, 28) ; //sob
clif_clearunit_area(bl,clrtype);
map_delblock(bl);
- unit_free(bl,0);
+ unit_free(bl,CLR_OUTSIGHT);
map_freeblock_unlock();
return 0;
}
@@ -1990,7 +1990,7 @@ int unit_remove_map_(struct block_list *bl, int clrtype, const char* file, int l
{
clif_clearunit_area(bl,clrtype);
map_delblock(bl);
- unit_free(bl,0);
+ unit_free(bl,CLR_OUTSIGHT);
map_freeblock_unlock();
return 0;
}
@@ -2005,11 +2005,11 @@ int unit_remove_map_(struct block_list *bl, int clrtype, const char* file, int l
return 1;
}
-void unit_remove_map_pc(struct map_session_data *sd, int clrtype)
+void unit_remove_map_pc(struct map_session_data *sd, clr_type clrtype)
{
unit_remove_map(&sd->bl,clrtype);
- if (clrtype == 3) clrtype = 0; //3 is the warp from logging out, but pets/homunc need to just 'vanish' instead of showing the warping out animation.
+ if (clrtype == CLR_TELEPORT) clrtype = CLR_OUTSIGHT; //CLR_TELEPORT is the warp from logging out, but pets/homunc need to just 'vanish' instead of showing the warping out animation.
if(sd->pd)
unit_remove_map(&sd->pd->bl, clrtype);
@@ -2021,17 +2021,17 @@ void unit_remove_map_pc(struct map_session_data *sd, int clrtype)
void unit_free_pc(struct map_session_data *sd)
{
- if (sd->pd) unit_free(&sd->pd->bl,0);
- if (sd->hd) unit_free(&sd->hd->bl,0);
- if (sd->md) unit_free(&sd->md->bl,0);
- unit_free(&sd->bl,3);
+ if (sd->pd) unit_free(&sd->pd->bl,CLR_OUTSIGHT);
+ if (sd->hd) unit_free(&sd->hd->bl,CLR_OUTSIGHT);
+ if (sd->md) unit_free(&sd->md->bl,CLR_OUTSIGHT);
+ unit_free(&sd->bl,CLR_TELEPORT);
}
/*==========================================
* Function to free all related resources to the bl
* if unit is on map, it is removed using the clrtype specified
*------------------------------------------*/
-int unit_free(struct block_list *bl, int clrtype)
+int unit_free(struct block_list *bl, clr_type clrtype)
{
struct unit_data *ud = unit_bl2ud( bl );
nullpo_ret(ud);
diff --git a/src/map/unit.h b/src/map/unit.h
index 3b82dce56..fd5a83208 100644
--- a/src/map/unit.h
+++ b/src/map/unit.h
@@ -9,6 +9,7 @@ struct block_list;
struct unit_data;
struct map_session_data;
+#include "clif.h" // clr_type
#include "map.h" // struct block_list
#include "path.h" // struct walkpath_data
#include "skill.h" // struct skill_timerskill, struct skill_unit_group, struct skill_unit_group_tickset
@@ -81,7 +82,7 @@ int unit_set_walkdelay(struct block_list *bl, unsigned int tick, int delay, int
int unit_escape(struct block_list *bl, struct block_list *target, short dist);
// 位置の強制移動(吹き飛ばしなど)
int unit_movepos(struct block_list *bl, short dst_x, short dst_y, int easy, bool checkpath);
-int unit_warp(struct block_list *bl, short map, short x, short y, int type);
+int unit_warp(struct block_list *bl, short map, short x, short y, clr_type type);
int unit_setdir(struct block_list *bl,unsigned char dir);
uint8 unit_getdir(struct block_list *bl);
int unit_blown(struct block_list* bl, int dx, int dy, int count, int flag);
@@ -114,11 +115,11 @@ void unit_dataset(struct block_list *bl);
int unit_fixdamage(struct block_list *src,struct block_list *target,unsigned int tick,int sdelay,int ddelay,int damage,int div,int type,int damage2);
// その他
struct unit_data* unit_bl2ud(struct block_list *bl);
-void unit_remove_map_pc(struct map_session_data *sd, int clrtype);
+void unit_remove_map_pc(struct map_session_data *sd, clr_type clrtype);
void unit_free_pc(struct map_session_data *sd);
#define unit_remove_map(bl,clrtype) unit_remove_map_(bl,clrtype,__FILE__,__LINE__,__func__)
-int unit_remove_map_(struct block_list *bl, int clrtype, const char* file, int line, const char* func);
-int unit_free(struct block_list *bl, int clrtype);
+int unit_remove_map_(struct block_list *bl, clr_type clrtype, const char* file, int line, const char* func);
+int unit_free(struct block_list *bl, clr_type clrtype);
int unit_changeviewsize(struct block_list *bl,short size);
// 初期化ルーチン