Min/max issue (#5574)

* Fixed min/max issue for zero variable value
* Added a CI test script

Co-authored-by: Lemongrass3110 <lemongrass@kstp.at>
This commit is contained in:
Atemo 2020-11-27 14:50:29 +01:00 committed by GitHub
parent 629c7b50f3
commit ae3c6ce38b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 31 additions and 1 deletions

View File

@ -7552,7 +7552,7 @@ Example:
*debugmes "<message>";
This command will send the message to the server console (map-server window). It
This command will send a debug message to the server console (map-server window). It
will not be displayed anywhere else.
// Displays "NAME has clicked me!" in the map-server window.
@ -7560,6 +7560,16 @@ will not be displayed anywhere else.
---------------------------------------
*errormes "<message>";
This command will send an error message to the server console (map-server window). It
will not be displayed anywhere else.
// Displays "NAME has clicked me!" in the map-server window.
errormes strcharinfo(0) + " has clicked me!";
---------------------------------------
*logmes "<message>";
This command will write the message given to the map server NPC log file, as

9
npc/test/ci/5573.txt Normal file
View File

@ -0,0 +1,9 @@
- script Issue5573 -1,{
OnInit:
.i = 0;
.@i = min( .i, 200 );
if( .@i == 200 ){
errormes "Issue 5573 is happening again.";
}
}

View File

@ -11901,6 +11901,13 @@ BUILDIN_FUNC(debugmes)
return SCRIPT_CMD_SUCCESS;
}
BUILDIN_FUNC( errormes ){
ShowError( "%s\n", script_getstr( st, 2 ) );
script_reportsrc( st );
return SCRIPT_CMD_SUCCESS;
}
/*==========================================
*------------------------------------------*/
BUILDIN_FUNC(catchpet)
@ -23184,6 +23191,9 @@ BUILDIN_FUNC(minmax){
value = func( value, get_val2_num( st, reference_uid( id, start ), reference_getref( data ) ) );
}
}
else {
value = func( value, 0 );
}
}else{
ShowError( "buildin_%s: not a supported data type!\n", functionname );
script_reportdata( data );
@ -25129,6 +25139,7 @@ struct script_function buildin_func[] = {
BUILDIN_DEF(getstatus, "i??"),
BUILDIN_DEF(getscrate,"ii?"),
BUILDIN_DEF(debugmes,"s"),
BUILDIN_DEF(errormes,"s"),
BUILDIN_DEF2(catchpet,"pet","i"),
BUILDIN_DEF2(birthpet,"bpet",""),
BUILDIN_DEF(catchpet,"i"),