DEADSOFTWARE

Fix ArrayIndexOutOfBoundsException
[cavecraft.git] / src / CAVE.mpsrc
index ccdef84c131cb89a5c76f85934566c3e4ab5663e..623e6a4d509ddfd1ff5a337cce55a91ca9ee68de 100644 (file)
@@ -513,9 +513,8 @@ procedure saveworld(path:string);
    if file_exists(path+world_name)<>1 then file_create(path+world_name);\r
    if open_file(path+world_name)=1 then\r
     begin\r
-      writeint(player.getX);\r
-      writeint(player.getX);\r
-     //Matrix\r
+     writeint(player.getX);\r
+     writeint(player.getY);\r
      //Matrix\r
      SaveMapRLE;\r
      SaveMapInfoRLE;\r
@@ -1272,7 +1271,7 @@ function menu_game:boolean;
      if m_cur>3 then m_cur:=0;\r
     end;\r
 \r
-   if clickedKey(KEY_MENU_LEFT) then\r
+   if (max_r >= 0) and clickedKey(KEY_MENU_LEFT) then\r
     begin\r
      cur_name:=cur_name-1;\r
      if cur_name<0 then cur_name:=0;\r
@@ -1282,7 +1281,7 @@ function menu_game:boolean;
 \r
      if file_exists('/'+sd+'/cavecraft/saves/'+names[cur_name]+'/player.dat')=1 then\r
     end;\r
-   if clickedKey(KEY_MENU_RIGHT) then\r
+   if (max_r >= 0) and clickedKey(KEY_MENU_RIGHT) then\r
     begin\r
      cur_name:=cur_name+1;\r
      if cur_name>max_r then cur_name:=max_r;\r