Browse Source

rewrite the cleaning of the npc arrays

rachels 2 years ago
parent
commit
cf24cf9e2a
4 changed files with 53 additions and 135 deletions
  1. 22 130
      locations/cikl.qsrc
  2. 1 1
      locations/saveg.qsrc
  3. 25 0
      locations/saveupdater.qsrc
  4. 5 4
      locations/shortgs.qsrc

+ 22 - 130
locations/cikl.qsrc

@@ -1872,139 +1872,31 @@ if blizoruk < 0: blizoruk = 0
 
 
 !!------------------------------------------------------------------------------------------------------------------------
-!!array cleaning moving potential fathers from C to B array and cleaning C array
-
-!First look is there any cum in the womb,when womb is empty random genereted npc record are cleaningare deleted
-
-! mid($npclastgenerated[0],2,9)	 number of the last random created npcs
-norandomdads = 1
-!checking if Sveta have children or babies
-if arrsize('$ChildFath') > 0:
-		!Yes she have... cheking if random NPC is the dady
-		!'Sveta have <<$ChildFath>> children'
-
-		childtmp = 0
-		:childloop
-		if mid($ChildFath[childtmp],1,1) = 'C':
-			!yes child is from random genereted npc
-			norandomdads = 0
-		else
-			!child is not from random genereted npc
-
-			childtmp += 1
-			if childtmp < arrsize('$ChildFath'): jump 'childloop'
-		end
-end
-
-
-number = 0
-
-
-
-!checking if there is some cum in womb.
-if arrsize('$cumarrnam') > 0:
-	!there is cum in womb
-
-	:cleaning_records_cum
-	$tmp = 'C' + '<<number>>'
-
-	cum_number = 0
-	:cumloop
-	!look if cum in womb is from random created npc
-	if($tmp = $cumarrnam[cum_number]):
-		!'cum from <<$tmp>> is in the womb'
-		number +=1
-		if number < mid($npclastgenerated[0],2,9): jump 'cleaning_records_cum'
-	else
-		cum_number += 1
-		if cum_number < arrsize('$cumarrnam'):
-			jump 'cumloop'
-		else
-			!'no cum in woomb from <<$tmp>>'
-			if norandomdads = 1:
-				!no random dads
-				If npc_pers[$tmp] ! '': gs 'npccleanc',$tmp 
-			else
-				!some children are from random genereted npc
-				!checking if selected npc is a dady
-				childtmp = 0
-				:childloop3
-
-				if $ChildFath[childtmp] = $tmp:
-					!selected npc is father of the child, he will stay in record or now
-					!moving npc from C array to B array,
-					gs 'npcpreservec',$tmp
-					number += 1
-					if number < mid($npclastgenerated[0],2,9): jump 'cleaning_records_cum'
-				else
-					!child is not from random genereted npc
-					childtmp += 1
-					if childtmp < arrsize('$ChildFath'):
-						jump 'childloop3'
-					else
-						!children are not from seleted random npc, we are cleaning his redords
-						gs 'npccleanc',$tmp
-						number += 1
-						if number < mid($npclastgenerated[0],2,9): jump 'cleaning_records_cum'
-
-					end
-				end
-
-
-			end
-
+!!C and b array cleaning 
+
+if InSleep = 1:
+	i_gs_cl = 0
+	:CiklNpcCleanLoop
+	if i_gs_cl < arrsize('$npc_index'):
+		if $npc_index[i_gs_cl] = $npclastgenerated : 			i_gs_cl += 1 & jump 'CiklNpcCleanLoop'
+		if arrpos('$cumarrnam', $npc_index[i_gs_cl]) >= 0 : 	i_gs_cl += 1 & jump 'CiklNpcCleanLoop'
+		if arrpos('$sparrnam', $npc_index[i_gs_cl]) >= 0 : 		i_gs_cl += 1 & jump 'CiklNpcCleanLoop'
+		if arrpos('$cumfthname', $npc_index[i_gs_cl]) >= 0 : 	i_gs_cl += 1 & jump 'CiklNpcCleanLoop'
+		if arrpos('$wombpotfath', $npc_index[i_gs_cl]) >= 0 : 	i_gs_cl += 1 & jump 'CiklNpcCleanLoop'
+		if arrpos('$wombName', $npc_index[i_gs_cl]) >= 0 : 		i_gs_cl += 1 & jump 'CiklNpcCleanLoop'
+		if arrpos('$cumfathlotto', $npc_index[i_gs_cl]) >= 0 : 	i_gs_cl += 1 & jump 'CiklNpcCleanLoop'
+		if arrpos('$ChildFath', $npc_index[i_gs_cl]) >= 0 : 	i_gs_cl += 1 & jump 'CiklNpcCleanLoop'
+		if arrpos('$ChildThFath', $npc_index[i_gs_cl]) >= 0 : 	i_gs_cl += 1 & jump 'CiklNpcCleanLoop'
+
+		if mid($npc_index[i_gs_cl],1,1) = 'C' or mid($npc_index[i_gs_cl],1,1) = 'b' :
+			gs 'npccleanc',ucase($npc_index[i_gs_cl])
+			jump 'CiklNpcCleanLoop'
 		end
+		i_gs_cl += 1
+		jump 'CiklNpcCleanLoop'
 	end
-
-else
-	!there is no cum in womb, cleaning random created npc redords
-
-	if norandomdads = 0:
-
-		:cleaning_with_babies
-		$tmp = 'C' + '<<number>>'
-		!cheking if random NPC is the dady
-		childtmp2 = 0
-
-		:childloop2
-
-		if $ChildFath[childtmp2] = $tmp:
-			!selected random NPC is dady selected child
-			gs 'npcpreservec', $tmp
-			number +=1
-			if number < mid($npclastgenerated[0],2,9): jump 'cleaning_with_babies'
-
-		else
-			!selected random NPC is not dady selected child
-			childtmp2 += 1
-			if childtmp2 < arrsize('$ChildFath'):
-				jump 'childloop2'
-			else
-				!selected random npc is not any child dady
-				gs 'npccleanc',$tmp
-				number += 1
-				if number < mid($npclastgenerated[0],2,9): jump 'cleaning_with_babies'
-			end
-		end
-	else
-		!she have no children or babies, and no cum freom random npc
-		!'cleaning random NPC records'
-		:cleaning_no_babies
-		$tmp = 'C' + '<<number>>'
-		!'clining <<$tmp>>'
-		gs 'npccleanc',$tmp
-		number += 1
-		if number < mid($npclastgenerated[0],2,9): jump 'cleaning_no_babies'
-	end
+	killvar 'i_gs_cl'
 end
-
-
-killvar '$tmp'
-killvar 'number'
-killvar 'childtmp2'
-killvar 'childtmp'
-killvar 'norandomdads'
-
 !!------------------------------------------------------------------------------------------------------------
 
 !!-------------Family schedule variables----------------------------------------------------------------------

+ 1 - 1
locations/saveg.qsrc

@@ -16,6 +16,6 @@
 version_major = 0
 version_minor = 8
 version_revision = 5
-version_patch = 1
+version_patch = 2
 --- saveg ---------------------------------
 

+ 25 - 0
locations/saveupdater.qsrc

@@ -1368,6 +1368,31 @@ if ((100*version_major +version_minor)*100+version_revision)*100+version_patch
 	if $loc='ykabinet': $loc ='city_mansion_residence_2' & $loc_arg='yoffice'   & $menu_loc ='city_mansion_residence_2' & $menu_arg='yoffice'
 end
 
+if ((100*version_major +version_minor)*100+version_revision)*100+version_patch  < 00080502:
+	i = 0
+	:saveupdaterloop852_1
+	$text = 'C'+str(i)
+	temp1 = func('shortgs', 'get_me_index', '$npc_firstname',$text)
+	if temp1 >= 0:
+		$npc_index[$text] = $text
+	end
+	i += 1
+	if i < carraynumber: jump 'saveupdaterloop852_1'
+
+	i = 0
+	:saveupdaterloop852_2
+	$text = 'B'+str(i)
+	temp1 = func('shortgs', 'get_me_index', '$npc_firstname',$text)
+	if temp1 >= 0:
+		$npc_index[$text] = $text
+	end
+	i += 1
+	if i < barraynumber: jump 'saveupdaterloop852_2'
+end
+
+
+
+
 
 if mod_list > 0:
 	mod_i=1

+ 5 - 4
locations/shortgs.qsrc

@@ -499,16 +499,15 @@ end
 
 !! call gs 'shortgs', 'remove_array_element', 'name of array','string index'
 if $ARGS[0] = 'remove_array_element':
-	i = func('shortgs', 'get_me_index', $ARGS[1],$ARGS[2])
-	killvar '<<$ARGS[1]>>',i
+	killvar '<<$ARGS[1]>>',func('shortgs', 'get_me_index', $ARGS[1],$ARGS[2])
 end
 
 if $ARGS[0] = 'testsize':
 
 	'$npc_dna = ' + arrsize('$npc_dna')
-	'npc_firstname = ' + arrsize('$npc_firstname')
+	'$npc_firstname = ' + arrsize('$npc_firstname')
 	'$npc_lastname = ' + arrsize('$npc_lastname')
-	'npc_nickname = ' + arrsize('$npc_nickname')
+	'$npc_nickname = ' + arrsize('$npc_nickname')
 	'$npc_notes = ' + arrsize('$npc_notes')
 	'$npc_occupation = ' + arrsize('$npc_occupation')
 	'$npc_perstype = ' + arrsize('$npc_perstype')
@@ -563,6 +562,8 @@ if $ARGS[0] = 'testsize':
 	'npc_lover_days = ' + arrsize('npc_lover_days')
 	'npc_lover_keys = ' + arrsize('npc_lover_keys')
 
+	'$npc_index = ' + arrsize('$npc_index')
+
 end
 
 if $ARGS[0] = 'npctest':