summaryrefslogtreecommitdiff
path: root/src/map/script.c
diff options
context:
space:
mode:
authorskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-05-09 21:09:53 +0000
committerskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-05-09 21:09:53 +0000
commitef6249a84ac41ff029ee37dde1e8c9427515198f (patch)
tree2953e78f0340be0f592eab832290972ee2463a0f /src/map/script.c
parentf405f3e4f972e26cf09f25363d6499b2f265ef8c (diff)
downloadhercules-ef6249a84ac41ff029ee37dde1e8c9427515198f.tar.gz
hercules-ef6249a84ac41ff029ee37dde1e8c9427515198f.tar.bz2
hercules-ef6249a84ac41ff029ee37dde1e8c9427515198f.tar.xz
hercules-ef6249a84ac41ff029ee37dde1e8c9427515198f.zip
- 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
Diffstat (limited to 'src/map/script.c')
-rw-r--r--src/map/script.c22
1 files changed, 19 insertions, 3 deletions
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;
}