소스 검색

viewpoint command update (#4143)

* Added the optional parameter 'char ID' to the command
Sader Fawall 6 년 전
부모
커밋
a3fc44ef8a
2개의 변경된 파일7개의 추가작업 그리고 5개의 파일을 삭제
  1. 1 1
      doc/script_commands.txt
  2. 6 4
      src/map/script.cpp

+ 1 - 1
doc/script_commands.txt

@@ -7489,7 +7489,7 @@ rand(2,5) would result in 2,3,4 or 5
 
 ---------------------------------------
 
-*viewpoint <action>,<x>,<y>,<point number>,<color>;
+*viewpoint <action>,<x>,<y>,<point number>,<color>{,<Char ID>};
 
 This command will mark places on the mini map in the client connected to the
 invoking character. It uses the normal X and Y coordinates from the main map.

+ 6 - 4
src/map/script.cpp

@@ -6687,15 +6687,17 @@ BUILDIN_FUNC(viewpoint)
 	int type,x,y,id,color;
 	TBL_PC* sd;
 
+	if (!script_charid2sd(7, sd)) {
+		st->state = END;
+		return SCRIPT_CMD_FAILURE;
+	}
+
 	type=script_getnum(st,2);
 	x=script_getnum(st,3);
 	y=script_getnum(st,4);
 	id=script_getnum(st,5);
 	color=script_getnum(st,6);
 
-	if( !script_rid2sd(sd) )
-		return SCRIPT_CMD_SUCCESS;
-
 	clif_viewpoint(sd,st->oid,type,x,y,id,color);
 
 	return SCRIPT_CMD_SUCCESS;
@@ -24496,7 +24498,7 @@ struct script_function buildin_func[] = {
 	BUILDIN_DEF2(enableitemuse,"enable_items",""),
 	BUILDIN_DEF2(disableitemuse,"disable_items",""),
 	BUILDIN_DEF(cutin,"si"),
-	BUILDIN_DEF(viewpoint,"iiiii"),
+	BUILDIN_DEF(viewpoint,"iiiii?"),
 	BUILDIN_DEF(heal,"ii?"),
 	BUILDIN_DEF(itemheal,"ii?"),
 	BUILDIN_DEF(percentheal,"ii?"),