summaryrefslogtreecommitdiff
path: root/src/map
diff options
context:
space:
mode:
authorshennetsind <ind@henn.et>2013-11-30 14:44:44 -0200
committershennetsind <ind@henn.et>2013-11-30 14:44:44 -0200
commit6fc1cae2088dd9f450e15728ca4bf4a82fcb8070 (patch)
tree1b43199b27c13d9db23d14a012c41a5b68bda577 /src/map
parent098dbcf672e04657553b9f1629550e6bc8771af3 (diff)
downloadhercules-6fc1cae2088dd9f450e15728ca4bf4a82fcb8070.tar.gz
hercules-6fc1cae2088dd9f450e15728ca4bf4a82fcb8070.tar.bz2
hercules-6fc1cae2088dd9f450e15728ca4bf4a82fcb8070.tar.xz
hercules-6fc1cae2088dd9f450e15728ca4bf4a82fcb8070.zip
Minor adjustments
- improved @makehomun -1 so that if the homun data hasnt been loaded it is requested. - instances of private types (party/guild/char) no longer create channels, however global types still does (IOT_NONE). - Fixed an issue with party/guild instance data not being freed when either is destroyed (Special Thanks to Yommy). Signed-off-by: shennetsind <ind@henn.et>
Diffstat (limited to 'src/map')
-rw-r--r--src/map/atcommand.c18
-rw-r--r--src/map/clif.c6
-rw-r--r--src/map/guild.c2
-rw-r--r--src/map/party.c3
4 files changed, 24 insertions, 5 deletions
diff --git a/src/map/atcommand.c b/src/map/atcommand.c
index c355f6bbd..3976c8427 100644
--- a/src/map/atcommand.c
+++ b/src/map/atcommand.c
@@ -6812,8 +6812,10 @@ ACMD(makehomun) {
homunid = atoi(message);
- if( homunid == -1 && sd->status.hom_id && !homun_alive(sd->hd) ) {
- if( sd->hd->homunculus.vaporize )
+ if( homunid == -1 && sd->status.hom_id && !(sd->hd && homun_alive(sd->hd)) ) {
+ if( !sd->hd )
+ homun->call(sd);
+ else if( sd->hd->homunculus.vaporize )
homun->ressurect(sd, 100, sd->bl.x, sd->bl.y);
else
homun->call(sd);
@@ -8615,7 +8617,7 @@ ACMD(cart) {
}
/* [Ind/Hercules] */
ACMD(join) {
- struct hChSysCh *channel;
+ struct hChSysCh *channel = NULL;
char name[HCHSYS_NAME_LENGTH], pass[HCHSYS_NAME_LENGTH];
if( !message || !*message || sscanf(message, "%s %s", name, pass) < 1 ) {
@@ -8626,7 +8628,8 @@ ACMD(join) {
if( hChSys.local && strcmpi(name + 1, hChSys.local_name) == 0 ) {
if( !map->list[sd->bl.m].channel ) {
clif->chsys_mjoin(sd);
- return true;
+ if( map->list[sd->bl.m].channel ) /* mjoin might have refused, map has chatting capabilities disabled */
+ return true;
} else
channel = map->list[sd->bl.m].channel;
} else if( hChSys.ally && sd->status.guild_id && strcmpi(name + 1, hChSys.ally_name) == 0 ) {
@@ -8639,6 +8642,13 @@ ACMD(join) {
return false;
}
+ if( !channel ) {
+ sprintf(atcmd_output, msg_txt(1400),name,command); // Unknown Channel '%s' (usage: %s <#channel_name>)
+ clif->message(fd, atcmd_output);
+ return false;
+ }
+
+
if( idb_exists(channel->users, sd->status.char_id) ) {
sprintf(atcmd_output, msg_txt(1475),name); // You're already in the '%s' channel
clif->message(fd, atcmd_output);
diff --git a/src/map/clif.c b/src/map/clif.c
index a383617b5..2257df0aa 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -9164,6 +9164,10 @@ void clif_parse_WantToConnection(int fd, struct map_session_data* sd) {
}
void clif_hercules_chsys_mjoin(struct map_session_data *sd) {
if( !map->list[sd->bl.m].channel ) {
+
+ if (map->list[sd->bl.m].flag.chsysnolocalaj || (map->list[sd->bl.m].instance_id >= 0 && instance->list[map->list[sd->bl.m].instance_id].owner_type != IOT_NONE) )
+ return;
+
CREATE(map->list[sd->bl.m].channel, struct hChSysCh , 1);
safestrncpy(map->list[sd->bl.m].channel->name, hChSys.local_name, HCHSYS_NAME_LENGTH);
map->list[sd->bl.m].channel->type = hChSys_MAP;
@@ -9453,7 +9457,7 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd) {
status_calc_pc(sd, SCO_NONE);/* some conditions are map-dependent so we must recalculate */
sd->state.changemap = false;
- if( hChSys.local && hChSys.local_autojoin && !map->list[sd->bl.m].flag.chsysnolocalaj ) {
+ if( hChSys.local && hChSys.local_autojoin ) {
clif->chsys_mjoin(sd);
}
}
diff --git a/src/map/guild.c b/src/map/guild.c
index cba568bd8..cca4da6cf 100644
--- a/src/map/guild.c
+++ b/src/map/guild.c
@@ -1756,6 +1756,8 @@ int guild_broken(int guild_id,int flag)
clif->chsys_delete(( struct hChSysCh * )g->channel);
}
}
+ if( g->instance )
+ aFree(g->instance);
idb_remove(guild->db,guild_id);
return 0;
}
diff --git a/src/map/party.c b/src/map/party.c
index 0a7467162..8e3ac3dcf 100644
--- a/src/map/party.c
+++ b/src/map/party.c
@@ -589,6 +589,9 @@ int party_broken(int party_id)
}
}
+ if( p->instance )
+ aFree(p->instance);
+
idb_remove(party->db,party_id);
return 0;
}