Jelajahi Sumber

Follow up to 60d59124a357510a15d0039f42fce187a3104caa

* Fixes some compile warnings
* "Forcing value to bool"
* Thanks @M4karov
Jey 7 tahun lalu
induk
melakukan
528539f621
1 mengubah file dengan 4 tambahan dan 4 penghapusan
  1. 4 4
      src/map/script.cpp

+ 4 - 4
src/map/script.cpp

@@ -2388,7 +2388,7 @@ static void read_constdb(void)
 		if(sscanf(line,"%1023[A-Za-z0-9/_],%1023[A-Za-z0-9/_-],%11d",name,val,&type)>=2 ||
 		   sscanf(line,"%1023[A-Za-z0-9/_] %1023[A-Za-z0-9/_-] %11d",name,val,&type)>=2){
 			entries++;
-			script_set_constant(name, (int)strtol(val, NULL, 0), (bool)type, false);
+			script_set_constant(name, (int)strtol(val, NULL, 0), (type != 0), false);
 		}
 		else {
 			skipped++;
@@ -13529,7 +13529,7 @@ BUILDIN_FUNC(setwall)
 	y = script_getnum(st,4);
 	size = script_getnum(st,5);
 	dir = script_getnum(st,6);
-	shootable = script_getnum(st,7);
+	shootable = script_getnum(st,7) != 0;
 	name = script_getstr(st,8);
 
 	if( (m = map_mapname2mapid(mapname)) < 0 )
@@ -18807,7 +18807,7 @@ BUILDIN_FUNC(setcell)
 	int16 x2 = script_getnum(st,5);
 	int16 y2 = script_getnum(st,6);
 	cell_t type = (cell_t)script_getnum(st,7);
-	bool flag = (bool)script_getnum(st,8);
+	bool flag = script_getnum(st,8) != 0;
 
 	int x,y;
 
@@ -21652,7 +21652,7 @@ BUILDIN_FUNC(bonus_script_clear) {
 		return SCRIPT_CMD_FAILURE;
 
 	if (script_hasdata(st,2))
-		flag = script_getnum(st,2);
+		flag = script_getnum(st,2) != 0;
 
 	pc_bonus_script_clear(sd,(flag ? BSF_PERMANENT : BSF_REM_ALL));
 	return SCRIPT_CMD_SUCCESS;