summaryrefslogtreecommitdiff
path: root/src/map/chat.c
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2013-09-27 05:30:37 +0200
committerHaru <haru@dotalux.com>2013-09-27 05:30:37 +0200
commitb89f58edd8b368e2548ace86f06354bd6ea1c8d2 (patch)
tree2f30953a986a2690c333370d99232a43853a1781 /src/map/chat.c
parent17bc1fab375f8ecc951fbba058a346b1460bf783 (diff)
downloadhercules-b89f58edd8b368e2548ace86f06354bd6ea1c8d2.tar.gz
hercules-b89f58edd8b368e2548ace86f06354bd6ea1c8d2.tar.bz2
hercules-b89f58edd8b368e2548ace86f06354bd6ea1c8d2.tar.xz
hercules-b89f58edd8b368e2548ace86f06354bd6ea1c8d2.zip
Renamed iMap interface to map
Signed-off-by: Haru <haru@dotalux.com>
Diffstat (limited to 'src/map/chat.c')
-rw-r--r--src/map/chat.c74
1 files changed, 32 insertions, 42 deletions
diff --git a/src/map/chat.c b/src/map/chat.c
index 21d49cfc8..3886b69da 100644
--- a/src/map/chat.c
+++ b/src/map/chat.c
@@ -44,20 +44,19 @@ static struct chat_data* chat_createchat(struct block_list* bl, const char* titl
cd->owner = bl;
safestrncpy(cd->npc_event, ev, sizeof(cd->npc_event));
- cd->bl.id = iMap->get_new_object_id();
+ cd->bl.id = map->get_new_object_id();
cd->bl.m = bl->m;
cd->bl.x = bl->x;
cd->bl.y = bl->y;
cd->bl.type = BL_CHAT;
cd->bl.next = cd->bl.prev = NULL;
- if( cd->bl.id == 0 )
- {
+ if( cd->bl.id == 0 ) {
aFree(cd);
cd = NULL;
}
- iMap->addiddb(&cd->bl);
+ map->addiddb(&cd->bl);
if( bl->type != BL_NPC )
cd->kick_list = idb_alloc(DB_OPT_BASE);
@@ -85,8 +84,7 @@ int chat_createpcchat(struct map_session_data* sd, const char* title, const char
return 0; //Can't create chatrooms on this map.
}
- if( iMap->getcell(sd->bl.m,sd->bl.x,sd->bl.y,CELL_CHKNOCHAT) )
- {
+ if( map->getcell(sd->bl.m,sd->bl.x,sd->bl.y,CELL_CHKNOCHAT) ) {
clif->message (sd->fd, msg_txt(665));
return 0;
}
@@ -110,12 +108,11 @@ int chat_createpcchat(struct map_session_data* sd, const char* title, const char
/*==========================================
* join an existing chatroom
*------------------------------------------*/
-int chat_joinchat(struct map_session_data* sd, int chatid, const char* pass)
-{
+int chat_joinchat(struct map_session_data* sd, int chatid, const char* pass) {
struct chat_data* cd;
nullpo_ret(sd);
- cd = (struct chat_data*)iMap->id2bl(chatid);
+ cd = (struct chat_data*)map->id2bl(chatid);
if( cd == NULL || cd->bl.type != BL_CHAT || cd->bl.m != sd->bl.m || sd->state.vending || sd->state.buyingstore || sd->chatID || ((cd->owner->type == BL_NPC) ? cd->users+1 : cd->users) >= cd->limit )
{
@@ -167,17 +164,15 @@ int chat_joinchat(struct map_session_data* sd, int chatid, const char* pass)
/*==========================================
* leave a chatroom
*------------------------------------------*/
-int chat_leavechat(struct map_session_data* sd, bool kicked)
-{
+int chat_leavechat(struct map_session_data* sd, bool kicked) {
struct chat_data* cd;
int i;
int leavechar;
nullpo_retr(1, sd);
- cd = (struct chat_data*)iMap->id2bl(sd->chatID);
- if( cd == NULL )
- {
+ cd = (struct chat_data*)map->id2bl(sd->chatID);
+ if( cd == NULL ) {
pc_setchatid(sd, 0);
return 1;
}
@@ -201,15 +196,15 @@ int chat_leavechat(struct map_session_data* sd, bool kicked)
if( cd->users == 0 && cd->owner->type == BL_PC ) { // Delete empty chatroom
struct skill_unit* su;
- struct skill_unit_group* group;
+ struct skill_unit_group* group;
clif->clearchat(cd, 0);
db_destroy(cd->kick_list);
- iMap->deliddb(&cd->bl);
- iMap->delblock(&cd->bl);
- iMap->freeblock(&cd->bl);
+ map->deliddb(&cd->bl);
+ map->delblock(&cd->bl);
+ map->freeblock(&cd->bl);
- su = iMap->find_skill_unit_oncell(&sd->bl, sd->bl.x, sd->bl.y, AL_WARP, NULL, 0);
+ su = map->find_skill_unit_oncell(&sd->bl, sd->bl.x, sd->bl.y, AL_WARP, NULL, 0);
group = (su != NULL) ? su->group : NULL;
if (group != NULL)
skill->unit_onplace(su, &sd->bl, group->tick);
@@ -217,21 +212,20 @@ int chat_leavechat(struct map_session_data* sd, bool kicked)
return 1;
}
- if( leavechar == 0 && cd->owner->type == BL_PC )
- { // Set and announce new owner
+ if( leavechar == 0 && cd->owner->type == BL_PC ) {
+ // Set and announce new owner
cd->owner = (struct block_list*) cd->usersd[0];
clif->changechatowner(cd, cd->usersd[0]);
clif->clearchat(cd, 0);
//Adjust Chat location after owner has been changed.
- iMap->delblock( &cd->bl );
+ map->delblock( &cd->bl );
cd->bl.x=cd->usersd[0]->bl.x;
cd->bl.y=cd->usersd[0]->bl.y;
- iMap->addblock( &cd->bl );
+ map->addblock( &cd->bl );
clif->dispchat(cd,0);
- }
- else
+ } else
clif->dispchat(cd,0); // refresh chatroom
return 0;
@@ -240,15 +234,14 @@ int chat_leavechat(struct map_session_data* sd, bool kicked)
/*==========================================
* change a chatroom's owner
*------------------------------------------*/
-int chat_changechatowner(struct map_session_data* sd, const char* nextownername)
-{
+int chat_changechatowner(struct map_session_data* sd, const char* nextownername) {
struct chat_data* cd;
struct map_session_data* tmpsd;
int i;
nullpo_retr(1, sd);
- cd = (struct chat_data*)iMap->id2bl(sd->chatID);
+ cd = (struct chat_data*)map->id2bl(sd->chatID);
if( cd == NULL || (struct block_list*) sd != cd->owner )
return 1;
@@ -269,10 +262,10 @@ int chat_changechatowner(struct map_session_data* sd, const char* nextownername)
cd->usersd[0] = tmpsd;
// set the new chatroom position
- iMap->delblock( &cd->bl );
+ map->delblock( &cd->bl );
cd->bl.x = cd->owner->x;
cd->bl.y = cd->owner->y;
- iMap->addblock( &cd->bl );
+ map->addblock( &cd->bl );
// and display again
clif->dispchat(cd,0);
@@ -283,13 +276,12 @@ int chat_changechatowner(struct map_session_data* sd, const char* nextownername)
/*==========================================
* change a chatroom's status (title, etc)
*------------------------------------------*/
-int chat_changechatstatus(struct map_session_data* sd, const char* title, const char* pass, int limit, bool pub)
-{
+int chat_changechatstatus(struct map_session_data* sd, const char* title, const char* pass, int limit, bool pub) {
struct chat_data* cd;
nullpo_retr(1, sd);
- cd = (struct chat_data*)iMap->id2bl(sd->chatID);
+ cd = (struct chat_data*)map->id2bl(sd->chatID);
if( cd==NULL || (struct block_list *)sd != cd->owner )
return 1;
@@ -307,14 +299,13 @@ int chat_changechatstatus(struct map_session_data* sd, const char* title, const
/*==========================================
* kick an user from a chatroom
*------------------------------------------*/
-int chat_kickchat(struct map_session_data* sd, const char* kickusername)
-{
+int chat_kickchat(struct map_session_data* sd, const char* kickusername) {
struct chat_data* cd;
int i;
nullpo_retr(1, sd);
- cd = (struct chat_data *)iMap->id2bl(sd->chatID);
+ cd = (struct chat_data *)map->id2bl(sd->chatID);
if( cd==NULL || (struct block_list *)sd != cd->owner )
return -1;
@@ -359,20 +350,19 @@ int chat_createnpcchat(struct npc_data* nd, const char* title, int limit, bool p
}
/// Removes the chatroom from the npc.
-int chat_deletenpcchat(struct npc_data* nd)
-{
+int chat_deletenpcchat(struct npc_data* nd) {
struct chat_data *cd;
nullpo_ret(nd);
- cd = (struct chat_data*)iMap->id2bl(nd->chat_id);
+ cd = (struct chat_data*)map->id2bl(nd->chat_id);
if( cd == NULL )
return 0;
chat->npckickall(cd);
clif->clearchat(cd, 0);
- iMap->deliddb(&cd->bl);
- iMap->delblock(&cd->bl);
- iMap->freeblock(&cd->bl);
+ map->deliddb(&cd->bl);
+ map->delblock(&cd->bl);
+ map->freeblock(&cd->bl);
nd->chat_id = 0;
return 0;