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

Instead of a count, it returns the list of owned properties

Netuttki 1 год назад
Родитель
Сommit
5684471a18
1 измененных файлов с 8 добавлено и 5 удалено
  1. 8 5
      locations/homes_properties.qsrc

+ 8 - 5
locations/homes_properties.qsrc

@@ -276,26 +276,29 @@ if $ARGS[0] = 'set_ownership':
 	killvar 'property'
 end
 
-!! Use it as a func() returns the total count of properties that are homes and are owned (including wiht tenants)
+!! Use it as a func() returns the list of property codes for the properties are homes and are owned (including wiht tenants)
 if $ARGS[0] = 'get_owned_homes':
 	i = 0
+	j = 0
 	count = ARRSIZE('owned_property')
 	if count > 0: 
 		:countloop
 			gs 'homes_properties', 'get_property_attr', $owned_property[i]
-			if $property['type'] = 'permanent_residence' and (owned_property[i] = 2 or owned_property[i] = 3): counter += 1
+			if $property['type'] = 'permanent_residence' and (owned_property[i] = 2 or owned_property[i] = 3): 
+				$result[j] = $property['code']
+				j += 1
+			end
 			i += 1
 			killvar 'property'
 		if i < count: jump 'countloop'
 	end
-	result = counter
-	killvar 'counter'
 	killvar 'count'
 	killvar 'i'
+	killvar 'j'
 end
 
 !! Use it as a func() returns the total count of rented properties that are homes
-if $ARGS[0] = 'get_rented_count':
+if $ARGS[0] = 'get_rented':
 	i = 0
 	count = ARRSIZE('owned_property')
 	if count > 0: