From 9b4059fbdfc3ad77a1102dfdac0146797182d97a Mon Sep 17 00:00:00 2001 From: skotlex Date: Fri, 30 Jun 2006 16:53:56 +0000 Subject: - Added mapflag "nochat" to prevent chatting rooms from being created. - Corrected some of the sleep checks when the char id does not matches with the char-id expected by the script engine. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@7423 54d463be-8e91-2dee-dedb-b68131a5f0ec --- src/map/script.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'src/map/script.c') diff --git a/src/map/script.c b/src/map/script.c index c442f210f..c666a7728 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -6875,7 +6875,7 @@ enum { MF_NOMEMO,MF_NOTELEPORT,MF_NOSAVE,MF_NOBRANCH,MF_NOPENALTY,MF_NOZENYPENA MF_NOWARP,MF_FREE,MF_NOICEWALL,MF_SNOW,MF_FOG,MF_SAKURA,MF_LEAVES,MF_RAIN, MF_INDOORS,MF_NOGO,MF_CLOUDS,MF_CLOUDS2,MF_FIREWORKS,MF_GVG_CASTLE,MF_GVG_DUNGEON,MF_NIGHTENABLED, MF_NOBASEEXP, MF_NOJOBEXP, MF_NOMOBLOOT, MF_NOMVPLOOT, MF_NORETURN, MF_NOWARPTO, MF_NIGHTMAREDROP, - MF_RESTRICTED, MF_NOCOMMAND, MF_NODROP, MF_JEXP, MF_BEXP, MF_NOVENDING, MF_LOADEVENT }; + MF_RESTRICTED, MF_NOCOMMAND, MF_NODROP, MF_JEXP, MF_BEXP, MF_NOVENDING, MF_LOADEVENT, MF_NOCHAT }; int buildin_setmapflagnosave(struct script_state *st) { @@ -7037,6 +7037,8 @@ int buildin_setmapflag(struct script_state *st) case MF_LOADEVENT: map[m].flag.loadevent=1; break; + case MF_NOCHAT: + map[m].flag.nochat=1; } } @@ -7179,6 +7181,8 @@ int buildin_removemapflag(struct script_state *st) case MF_LOADEVENT: map[m].flag.loadevent=0; break; + case MF_NOCHAT: + map[m].flag.nochat=0; } } @@ -10962,8 +10966,11 @@ int buildin_awake(struct script_state *st) node = node->next; continue; } - if( sd && sd->char_id != tst->sleep.charid ) + if((sd && sd->char_id != tst->sleep.charid) || (tst->rid && !sd)) + { //Cancel Execution + tst->state=END; tst->rid = 0; + } delete_timer(tst->sleep.timer, run_script_timer); node = script_erase_sleepdb(node); @@ -11705,9 +11712,12 @@ int run_script_timer(int tid, unsigned int tick, int id, int data) struct linkdb_node *node = (struct linkdb_node *)sleep_db; struct map_session_data *sd = map_id2sd(st->rid); - if( sd && sd->char_id != id ) { + if((sd && sd->char_id != id) || (st->rid && !sd)) + { //Character mismatch. Cancel execution. st->rid = 0; + st->state = END; } + while( node && st->sleep.timer != -1 ) { if( (int)node->key == st->oid && ((struct script_state *)node->data)->sleep.timer == st->sleep.timer ) { script_erase_sleepdb(node); @@ -11716,8 +11726,6 @@ int run_script_timer(int tid, unsigned int tick, int id, int data) } node = node->next; } - if(st->rid && !sd) - st->state = END; run_script_main(st); return 0; -- cgit v1.2.3-70-g09d2