Просмотр исходного кода

Corrected script command getmapxy (#3922)

* Fixed an issue with floating NPC being on an 'invalid' map and attempting to store the map name.
Thanks to @Atemo!
Aleos 6 лет назад
Родитель
Сommit
5908c0484f
1 измененных файлов с 4 добавлено и 1 удалено
  1. 4 1
      src/map/script.cpp

+ 4 - 1
src/map/script.cpp

@@ -15033,7 +15033,10 @@ BUILDIN_FUNC(getmapxy)
 
 	x= bl->x;
 	y= bl->y;
-	safestrncpy(mapname, map_getmapdata(bl->m)->name, MAP_NAME_LENGTH);
+	if (bl->m >= 0)
+		safestrncpy(mapname, map_getmapdata(bl->m)->name, MAP_NAME_LENGTH);
+	else
+		memset(mapname, '\0', sizeof(mapname));
 
 	//Set MapName$
 	num=st->stack->stack_data[st->start+2].u.num;