diff options
-rw-r--r-- | doc/script_commands.txt | 4 | ||||
-rw-r--r-- | npc/pre-re/guides/guides_lighthalzen.txt | 2 | ||||
-rw-r--r-- | npc/quests/quests_lighthalzen.txt | 8 | ||||
-rw-r--r-- | npc/quests/quests_moscovia.txt | 18 | ||||
-rw-r--r-- | src/map/script.c | 11 |
5 files changed, 26 insertions, 17 deletions
diff --git a/doc/script_commands.txt b/doc/script_commands.txt index 2e8afe5dd..b10c7aef0 100644 --- a/doc/script_commands.txt +++ b/doc/script_commands.txt @@ -404,7 +404,9 @@ are otherwise identical. Writing a number like '0x<hex digits>' will make it recognized as a hexadecimal value. Notice that 0x10 is equal to 16. Also notice that if you try to 'mes 0x10' it will print '16'. -This is not used much, but it pays to know about it. +Number values can't exceed the limits of an integer variable: Any number +greater than INT_MAX (2147483647) or smaller than INT_MIN (-2147483648) will +not be recognized. Variables --------- diff --git a/npc/pre-re/guides/guides_lighthalzen.txt b/npc/pre-re/guides/guides_lighthalzen.txt index c9fb40b5b..466182cd9 100644 --- a/npc/pre-re/guides/guides_lighthalzen.txt +++ b/npc/pre-re/guides/guides_lighthalzen.txt @@ -80,7 +80,7 @@ lighthalzen,207,310,5 script Guide#lhz::LhzGuide 852,{ mes "activity, or if you have any"; mes "problems whatsoever."; if (.@compass_check) - viewpoint 1,236,276,4,0x99FFFFF; + viewpoint 1,236,276,4,0x99FFFF; break; case 4: mes "[Lighthalzen Guide]"; diff --git a/npc/quests/quests_lighthalzen.txt b/npc/quests/quests_lighthalzen.txt index d67e79c78..1085774e0 100644 --- a/npc/quests/quests_lighthalzen.txt +++ b/npc/quests/quests_lighthalzen.txt @@ -4472,10 +4472,10 @@ lighthalzen,346,263,3 script Elder#lhz 846,{ mes "you must search should"; mes "be clear to you now! Don't"; mes "forget these placemarks!"; - viewpoint 1,104,282,1,0xFF99FF33; - viewpoint 1,105,282,2,0xFF99FF33; - viewpoint 1,104,281,3,0xFF99FF33; - viewpoint 1,105,281,4,0xFF99FF33; + viewpoint 1,104,282,1,0x99FF33; + viewpoint 1,105,282,2,0x99FF33; + viewpoint 1,104,281,3,0x99FF33; + viewpoint 1,105,281,4,0x99FF33; next; mes "[Elder]"; mes "Good luck, youngster."; diff --git a/npc/quests/quests_moscovia.txt b/npc/quests/quests_moscovia.txt index bf6177bed..9ef4e6481 100644 --- a/npc/quests/quests_moscovia.txt +++ b/npc/quests/quests_moscovia.txt @@ -10970,20 +10970,20 @@ treasure01,24,39,0 script Old Bed#rus38 111,{ mes "...?! What is this?"; next; mes "- There is a scar on the sheet that seems to have the location !! -"; - viewpoint 1,165,58,1,0xFFFF0000; - viewpoint 1,61,183,2,0xFFFF0000; - viewpoint 1,98,118,3,0xFFFF0000; - viewpoint 1,27,115,4,0xFFFF0000; + viewpoint 1,165,58,1,0xFF0000; + viewpoint 1,61,183,2,0xFF0000; + viewpoint 1,98,118,3,0xFF0000; + viewpoint 1,27,115,4,0xFF0000; next; mes "["+ strcharinfo(0) +"]"; mes "...This may be?!"; next; mes "[Voice unidentified]"; mes "Who is there!?"; - viewpoint 2,165,58,1,0xFF00FF00; - viewpoint 2,61,183,2,0xFF00FF00; - viewpoint 2,98,118,3,0xFF00FF00; - viewpoint 2,27,115,4,0xFF00FF00; + viewpoint 2,165,58,1,0x00FF00; + viewpoint 2,61,183,2,0x00FF00; + viewpoint 2,98,118,3,0x00FF00; + viewpoint 2,27,115,4,0x00FF00; emotion 23,1; next; mes "["+ strcharinfo(0) +"]"; @@ -11824,4 +11824,4 @@ pay_dun04,163,186,0 script Ghost Tree#rus45 111,{ close; } end; -}
\ No newline at end of file +} diff --git a/src/map/script.c b/src/map/script.c index bad40b948..754cf6dd5 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -1006,7 +1006,7 @@ const char* parse_variable(const char* p) { *------------------------------------------*/ const char* parse_simpleexpr(const char *p) { - int i; + long long i; p=script->skip_space(p); if(*p==';' || *p==',') @@ -1031,7 +1031,14 @@ const char* parse_simpleexpr(const char *p) } else if(ISDIGIT(*p) || ((*p=='-' || *p=='+') && ISDIGIT(p[1]))){ char *np; while(*p == '0' && ISDIGIT(p[1])) p++; - i=strtoul(p,&np,0); + i=strtoll(p,&np,0); + if( i < INT_MIN ) { + i = INT_MIN; + disp_error_message("parse_simpleexpr: underflow detected, capping value to INT_MIN",p); + } else if( i > INT_MAX ) { + i = INT_MAX; + disp_error_message("parse_simpleexpr: overflow detected, capping value to INT_MAX",p); + } add_scripti(i); p=np; } else if(*p=='"'){ |