From ae8af396f45fbabebd37d532adea499585a8055d Mon Sep 17 00:00:00 2001
From: slawkens <slawkens@gmail.com>
Date: Thu, 16 Feb 2023 08:56:08 +0100
Subject: [PATCH] fix #136

---
 system/pages/houses.php | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/system/pages/houses.php b/system/pages/houses.php
index db1a6992..535f3719 100644
--- a/system/pages/houses.php
+++ b/system/pages/houses.php
@@ -165,6 +165,7 @@ if(isset($_POST['town']) && isset($_POST['state']) && isset($_POST['order']) &&
     foreach($players_info->fetchAll() as $player)
         $players[$player['houseid']] = array('name' => $player['ownername']);
 
+    $hasTilesColumn = $db->hasColumn('houses', 'tiles');
     $houses = array();
     foreach($houses_info->fetchAll() as $house)
     {
@@ -185,7 +186,7 @@ if(isset($_POST['town']) && isset($_POST['state']) && isset($_POST['order']) &&
                 $houseRent = 'Free';
         }
 
-        $houses[] = array('owner' => $owner, 'name' => $house['name'], 'size' => $house['size'], 'rent' => $house['rent'], 'rentedBy' => $houseRent);
+        $houses[] = array('owner' => $owner, 'name' => $house['name'], 'size' => ($hasTilesColumn ? $house['tiles'] : $house['size']), 'rent' => $house['rent'], 'rentedBy' => $houseRent);
     }
 
     $housesSearch = true;
@@ -203,4 +204,4 @@ $twig->display('houses.html.twig', array(
     'cleanOldHouse' => isset($cleanOld) ? $cleanOld : null,
     'housesSearch' => $housesSearch,
     'houses' => isset($houses) ? $houses : null
-));
\ No newline at end of file
+));