summaryrefslogtreecommitdiff
path: root/src/map/script.c
diff options
context:
space:
mode:
authorshennetsind <ind@henn.et>2013-02-18 00:30:28 -0300
committershennetsind <ind@henn.et>2013-02-18 00:30:28 -0300
commit7e72f0cee8867837be53cb2119b610b00e9bd587 (patch)
tree22ab404109fb2def22cf0085fcec2bf174210970 /src/map/script.c
parent237d76e7c409251b5fdb9f3eee40ef3fe5dc2b25 (diff)
downloadhercules-7e72f0cee8867837be53cb2119b610b00e9bd587.tar.gz
hercules-7e72f0cee8867837be53cb2119b610b00e9bd587.tar.bz2
hercules-7e72f0cee8867837be53cb2119b610b00e9bd587.tar.xz
hercules-7e72f0cee8867837be53cb2119b610b00e9bd587.zip
Improvements all over the place
Committing on the behalf of mkbu95 who is unable to do it himself, he coded it all and sent me the diff. Thanks mkbu95! Signed-off-by: shennetsind <ind@henn.et>
Diffstat (limited to 'src/map/script.c')
-rw-r--r--src/map/script.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/map/script.c b/src/map/script.c
index dd137d575..8827509ba 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -10577,9 +10577,8 @@ static void script_detach_rid(struct script_state* st)
BUILDIN_FUNC(attachrid)
{
int rid = script_getnum(st,2);
- struct map_session_data* sd;
- if ((sd = map_id2sd(rid))!=NULL) {
+ if (map_id2sd(rid) != NULL) {
script_detach_rid(st);
st->rid = rid;
@@ -16339,12 +16338,13 @@ BUILDIN_FUNC(instance_attach)
BUILDIN_FUNC(instance_id)
{
- int type, instance_id;
- struct map_session_data *sd;
- struct party_data *p;
+ int instance_id;
if( script_hasdata(st, 2) )
{
+ struct party_data *p;
+ struct map_session_data *sd;
+ int type;
type = script_getnum(st, 2);
if( type == 0 )
instance_id = st->instance_id;
@@ -16852,7 +16852,7 @@ BUILDIN_FUNC(checkdragon) {
BUILDIN_FUNC(setdragon) {
TBL_PC* sd;
int color = script_hasdata(st,2) ? script_getnum(st,2) : 0;
- unsigned int option = OPTION_DRAGON1;
+
if( (sd = script_rid2sd(st)) == NULL )
return 0;
if( !pc_checkskill(sd,RK_DRAGONTRAINING) || (sd->class_&MAPID_THIRDMASK) != MAPID_RUNE_KNIGHT )
@@ -16861,6 +16861,7 @@ BUILDIN_FUNC(setdragon) {
pc_setoption(sd, sd->sc.option&~OPTION_DRAGON);
script_pushint(st,1);
} else {//Not mounted; Mount now.
+ unsigned int option = OPTION_DRAGON1;
if( color ) {
option = ( color == 1 ? OPTION_DRAGON1 :
color == 2 ? OPTION_DRAGON2 :
@@ -16937,7 +16938,6 @@ BUILDIN_FUNC(getargcount) {
BUILDIN_FUNC(getcharip)
{
struct map_session_data* sd = NULL;
- int id = 0;
/* check if a character name is specified */
if( script_hasdata(st, 2) )
@@ -16946,6 +16946,7 @@ BUILDIN_FUNC(getcharip)
sd = map_nick2sd(script_getstr(st, 2));
else if (script_isint(st, 2) || script_getnum(st, 2))
{
+ int id;
id = script_getnum(st, 2);
sd = (map_id2sd(id) ? map_id2sd(id) : map_charid2sd(id));
}