Ver Fonte

[Fixed] Infinite loop causing crash in therapist event

Awesome há 1 mês atrás
pai
commit
08d2318b2f
1 ficheiros alterados com 14 adições e 12 exclusões
  1. 14 12
      locations/lover.qsrc

+ 14 - 12
locations/lover.qsrc

@@ -111,24 +111,26 @@ end
 if $ARGS[0] = 'clear_all':
 	! CLEAR LOVERS
 	! THIS IS A NUCLEAR OPTION!
-
+	temp_lover_index = 0
 	:clear_lovers_loop
-	if arrsize('$lover') > 0:
-		if $npc_rel_type[$lover[0]] = 'boyfriend':
-			gs 'lover', 'remove_boyfriend', $lover[0]
-		elseif $npc_rel_type[$lover[0]] = 'girlfriend':
-			gs 'lover', 'remove_girlfriend', $lover[0]
-		elseif $npc_rel_type[$lover[0]] = 'fuckbuddy':
-			gs 'lover', 'remove_fuckbuddy', $lover[0]
-		elseif $npc_rel_type[$lover[0]] = 'sugar_daddy':
-			gs 'lover', 'remove_sugar_daddy', $lover[0]
-		elseif $npc_rel_type[$lover[0]] = 'husband':
-			gs 'lover', 'remove_husband', $lover[0]
+	if arrsize('$lover') > temp_lover_index:
+		if $npc_rel_type[$lover[temp_lover_index]] = 'boyfriend':
+			gs 'lover', 'remove_boyfriend', $lover[temp_lover_index]
+		elseif $npc_rel_type[$lover[temp_lover_index]] = 'girlfriend':
+			gs 'lover', 'remove_girlfriend', $lover[temp_lover_index]
+		elseif $npc_rel_type[$lover[temp_lover_index]] = 'fuckbuddy':
+			gs 'lover', 'remove_fuckbuddy', $lover[temp_lover_index]
+		elseif $npc_rel_type[$lover[temp_lover_index]] = 'sugar_daddy':
+			gs 'lover', 'remove_sugar_daddy', $lover[temp_lover_index]
+		elseif $npc_rel_type[$lover[temp_lover_index]] = 'husband':
+			gs 'lover', 'remove_husband', $lover[temp_lover_index]
 			gs 'lover_love', 'divorce'
 
 		end
+		temp_lover_index += 1
 		jump 'clear_lovers_loop'
 	end
+	killvar'temp_lover_index'
 end