From ef6249a84ac41ff029ee37dde1e8c9427515198f Mon Sep 17 00:00:00 2001 From: skotlex Date: Tue, 9 May 2006 21:09:53 +0000 Subject: - Updated setoption script command to receive a second (optional) argument flag. If the flag is 1, the option is added to what the player currently has; likewise using flag 2 removes only that option. No flag (or any other value) is the older behaviour of removing all other options and setting specificly what is passed. - Updated script_commands information for setoption due to this change. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@6538 54d463be-8e91-2dee-dedb-b68131a5f0ec --- src/map/script.c | 22 +++++++++++++++++++--- src/map/status.h | 1 - 2 files changed, 19 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/map/script.c b/src/map/script.c index 40b6f10a2..4cc2ab5b8 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -537,7 +537,7 @@ struct { {buildin_end,"end",""}, // {buildin_end,"break",""}, this might confuse advanced scripting support [Eoe] {buildin_checkoption,"checkoption","i"}, - {buildin_setoption,"setoption","i"}, + {buildin_setoption,"setoption","i*"}, {buildin_setcart,"setcart",""}, {buildin_checkcart,"checkcart","*"}, //fixed by Lupus (added '*') {buildin_setfalcon,"setfalcon",""}, @@ -5079,10 +5079,26 @@ int buildin_setoption(struct script_state *st) { int type; struct map_session_data *sd; - + int flag=0; + type=conv_num(st,& (st->stack->stack_data[st->start+2])); + if(st->end>st->start+3 ) + flag=conv_num(st,&(st->stack->stack_data[st->start+3]) ); + sd=script_rid2sd(st); - pc_setoption(sd,type); + if (!sd) return 0; + + switch (flag) { + case 1: //Add option + pc_setoption(sd,sd->sc.option|type); + break; + case 2: //Remove option + pc_setoption(sd,sd->sc.option&~type); + break; + default: //Set option + pc_setoption(sd,type); + break; + } return 0; } diff --git a/src/map/status.h b/src/map/status.h index 9d14cddf6..d4a7168ad 100644 --- a/src/map/status.h +++ b/src/map/status.h @@ -419,7 +419,6 @@ enum { #define OPT2_POISON 0x001 #define OPT2_CURSE 0x002 #define OPT2_SILENCE 0x004 -//0x008 Odd howl sound, Signum crucis? #define OPT2_SIGNUMCRUCIS 0x008 #define OPT2_BLIND 0x010 //0x020 - nothing -- cgit v1.2.3-70-g09d2