summaryrefslogtreecommitdiff
path: root/src/map/pc.c
diff options
context:
space:
mode:
authorzephyrus <zephyrus@54d463be-8e91-2dee-dedb-b68131a5f0ec>2009-08-12 21:44:02 +0000
committerzephyrus <zephyrus@54d463be-8e91-2dee-dedb-b68131a5f0ec>2009-08-12 21:44:02 +0000
commit09e154b0687a2ba69d5ce6f2456c61db86bc4dec (patch)
tree6be18bd056964352e036afef8c36c860c0ff52af /src/map/pc.c
parent653c88c4f1bf019f61132324fd7146ae2f858cec (diff)
downloadhercules-09e154b0687a2ba69d5ce6f2456c61db86bc4dec.tar.gz
hercules-09e154b0687a2ba69d5ce6f2456c61db86bc4dec.tar.bz2
hercules-09e154b0687a2ba69d5ce6f2456c61db86bc4dec.tar.xz
hercules-09e154b0687a2ba69d5ce6f2456c61db86bc4dec.zip
- Optimization to instance system.
* Removed the crc feature to generate instance npc names. The instance npc name will be "dup_" + instanceid + "_" + srcnpcid. * Removed the big array under map structure and coded in a different way. It was only used to generate map names, but i just used the instance_id + "origin map name". * Moved all instance features to separated files. * Moved the npc duplication for instances into npc.c as Ultramage says (removed npcname_db from npc.h). * Added recomendations for scripts commands by Saithis. - Testing required, i will prepare Endless Tower script soon. I hope this do almost anything in bugreport 3276. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14003 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/pc.c')
-rw-r--r--src/map/pc.c25
1 files changed, 14 insertions, 11 deletions
diff --git a/src/map/pc.c b/src/map/pc.c
index 25bfaa9e9..2ded5e38b 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -25,6 +25,7 @@
#include "map.h"
#include "path.h"
#include "homunculus.h"
+#include "instance.h"
#include "mercenary.h"
#include "mob.h" // MAX_MOB_RACE_DB
#include "npc.h" // fake_nd
@@ -3868,11 +3869,13 @@ int pc_steal_coin(struct map_session_data *sd,struct block_list *target)
*------------------------------------------*/
int pc_setpos(struct map_session_data* sd, unsigned short mapindex, int x, int y, uint8 clrtype)
{
+ struct party_data *p;
int m;
nullpo_retr(0, sd);
- if (!mapindex || !mapindex_id2name(mapindex)) {
+ if( !mapindex || !mapindex_id2name(mapindex) )
+ {
ShowDebug("pc_setpos: Passed mapindex(%d) is invalid!\n", mapindex);
return 1;
}
@@ -3884,17 +3887,17 @@ int pc_setpos(struct map_session_data* sd, unsigned short mapindex, int x, int y
}
m = map_mapindex2mapid(mapindex);
- if( map[m].instance_map[0] && map[m].instance_id == 0 )
- { // Source Instance Map
- int im = map_instance_map2imap(m, sd, 0);
- if( im <= 0 )
- {
- ShowError("pc_setpos: player %s trying to enter instance map '%s' without instanced copy.\n", sd->status.name, map[m].name);
- return 2; // map not found
+ if( map[m].flag.src4instance && sd->status.party_id && (p = party_search(sd->status.party_id)) != NULL && p->instance_id )
+ {
+ // Request the mapid of this src map into the instance of the party
+ int im = instance_map2imap(m, sd->status.party_id, 0);
+ if( im < 0 )
+ ; // Player will enter the src map for instances
+ else
+ { // Changes destiny to the instance map, not the source map
+ m = im;
+ mapindex = map_id2index(m);
}
-
- m = im;
- mapindex = map_id2index(m);
}
sd->state.changemap = (sd->mapindex != mapindex);