Browse Source

Add upgrade path for fuckbuddy: remove duplicates from array

HotMike 1 year ago
parent
commit
9dd99f1b47
2 changed files with 15 additions and 3 deletions
  1. 1 3
      locations/booty_call.qsrc
  2. 14 0
      locations/saveupdater.qsrc

+ 1 - 3
locations/booty_call.qsrc

@@ -94,12 +94,10 @@ if $ARGS[0] = 'home_links':
 	*nl
 	:loopBC_homes
 	if (npc_residence[$Fuckbuddy[i]] = 1 and $loc = 'pav_residential') or (npc_residence[$Fuckbuddy[i]] = 3 and $loc = 'city_residential')or (npc_residence[$Fuckbuddy[i]] = 4 and $loc = 'city_center'):
-	
-!!		dynamic(' ''<a href="exec: minut += 2 & gt ''''sex_ev_start'''',''''fb_npc_home_start'''',''''<<$Fuckbuddy[i]>>'''' "><<$npc_firstname[$Fuckbuddy[i]]>>''''s</a> apartment is nearby.'' ')
 		dynamic(' ''<a href="exec: minut += 2 & gt ''''sex_ev_start'''',''''initiate_pre'''',''''<<$Fuckbuddy[i]>>'''' "><<$npc_firstname[$Fuckbuddy[i]]>>''''s</a> apartment is nearby.'' ')
 		!! ''''
 	end
-	
+	!!		dynamic(' ''<a href="exec: minut += 2 & gt ''''sex_ev_start'''',''''fb_npc_home_start'''',''''<<$Fuckbuddy[i]>>'''' "><<$npc_firstname[$Fuckbuddy[i]]>>''''s</a> apartment is nearby.'' ')
 
 	i +=1
 	if i < arrsize('$Fuckbuddy') : jump 'loopBC_homes'

+ 14 - 0
locations/saveupdater.qsrc

@@ -1689,6 +1689,20 @@ if ((100*version_major +version_minor)*100+version_revision)*100+version_patch <
 	if photography_job >0:
 		photography['experience'] = photography_job & killvar 'photography_job'
 	end
+	! Deduplication in $fuckbuddy
+	if arrsize('$fuckbuddy') > 0:
+		! Loop over the array, check if the value already exists in the temp array. If not copy.
+		i_fb = 0
+		:loopFuckbuddies
+		if arrpos('$_fuckbuddies', '$fuckbuddy[i_fb]') = -1:
+			copyarr('$_fuckbuddies', '$fuckbuddy', i_fb, 1)
+			i_fb +=1
+		end
+		if i_fb < arrsize('$fuckbuddy') : jump 'loopFuckbuddies'
+		killvar '$fuckbuddy'
+		$fuckbuddy = $_fuckbuddies
+		killvar '$_fuckbuddies' & killvar 'i_fb'
+	end
 end