소스 검색

* Completed Reddozen's hanging mapwarp code to support party and old syntax.

modified   Changelog-Trunk.txt
modified   src/map/script.c


git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@9305 54d463be-8e91-2dee-dedb-b68131a5f0ec
Lance 18 년 전
부모
커밋
05b2d83b43
2개의 변경된 파일33개의 추가작업 그리고 17개의 파일을 삭제
  1. 1 0
      Changelog-Trunk.txt
  2. 32 17
      src/map/script.c

+ 1 - 0
Changelog-Trunk.txt

@@ -4,6 +4,7 @@ AS OF SVN REV. 5091, WE ARE NOW USING TRUNK.  ALL UNTESTED BUGFIXES/FEATURES GO
 IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
 
 2006/11/23
+	* Completed Reddozen's hanging mapwarp code to support party and old syntax. [Lance]
 	* Updated sql files [Playtester]
 	* Made WFIFOHEAD() check for available buffer size remaining on the
 	  connection, and when there's not enough space, it will increase it.

+ 32 - 17
src/map/script.c

@@ -3802,7 +3802,7 @@ struct script_function buildin_func[] = {
 	{buildin_specialeffect,"specialeffect","i*"}, // npc skill effect [Valaris]
 	{buildin_specialeffect2,"specialeffect2","i*"}, // skill effect on players[Valaris]
 	{buildin_nude,"nude",""}, // nude command [Valaris]
-	{buildin_mapwarp,"mapwarp","ssiiii"},		// Added by RoVeRT
+	{buildin_mapwarp,"mapwarp","ssii*"},		// Added by RoVeRT
 	{buildin_inittimer,"inittimer",""},
 	{buildin_stoptimer,"stoptimer",""},
 	{buildin_cmdothernpc,"cmdothernpc","ss"},
@@ -9114,12 +9114,15 @@ int buildin_failedremovecards(struct script_state *st)
 
 /* ================================================================
  * mapwarp "<from map>","<to map>",<x>,<y>,<type>,<ID for Type>;
- * type: 0=everyone, 1=guild, 2=party(uncoded);	[Reddozen]
+ * type: 0=everyone, 1=guild, 2=party;	[Reddozen]
+ * improved by [Lance]
  * ================================================================
  */
 int buildin_mapwarp(struct script_state *st)	// Added by RoVeRT
 {
 	int x,y,m,check_val=0,check_ID=0,i=0;
+	struct guild *g = NULL;
+	struct party_data *p = NULL;
 	char *str;
 	char *mapname;
 	unsigned int index;
@@ -9127,8 +9130,10 @@ int buildin_mapwarp(struct script_state *st)	// Added by RoVeRT
 	str=conv_str(st,& (st->stack->stack_data[st->start+3]));
 	x=conv_num(st,& (st->stack->stack_data[st->start+4]));
 	y=conv_num(st,& (st->stack->stack_data[st->start+5]));
-	check_val=conv_num(st,& (st->stack->stack_data[st->start+6]));
-	check_ID=conv_num(st,& (st->stack->stack_data[st->start+7]));
+	if(st->end > st->start+7){
+		check_val=conv_num(st,& (st->stack->stack_data[st->start+6]));
+		check_ID=conv_num(st,& (st->stack->stack_data[st->start+7]));
+	}
 
 	if( (m=map_mapname2mapid(mapname))< 0)
 		return 0;
@@ -9136,21 +9141,31 @@ int buildin_mapwarp(struct script_state *st)	// Added by RoVeRT
 	if(!(index=mapindex_name2id(str)))
 		return 0;
 
-	if(!(check_val))
-	map_foreachinmap(buildin_areawarp_sub,
-		m,BL_PC,index,x,y);
-
-	if(check_val==1){
-		struct guild *g = guild_search(check_ID);
-
-		if (g){
-			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);
+	switch(check_val){
+		case 1:
+			g = guild_search(check_ID);
+			if (g){
+				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);
+					}
 				}
 			}
-		}
+			break;
+		case 2:
+			p = party_search(check_ID);
+			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);
+					}
+				}
+			}
+			break;
+		default:
+			map_foreachinmap(buildin_areawarp_sub,m,BL_PC,index,x,y);
+			break;
 	}
 
 	return 0;