Update house counts from rent lines

When 'with N houses, rent is X' or 'with a hotel, rent is X' is seen,
update property_houses for the current player's location. This partially
fixes stale house data in the UI — houses are synced when rent is charged,
though not at the moment of purchase.
This commit is contained in:
Jarvis 2026-02-21 19:01:08 +00:00
parent 1cb6da257f
commit a08fd86bf2
2 changed files with 14 additions and 0 deletions

View file

@ -679,13 +679,20 @@ class MonopParser:
m = self.RENT_HOUSES_RE.match(msg) m = self.RENT_HOUSES_RE.match(msg)
if m: if m:
houses = int(m.group(1))
rent = int(m.group(2)) rent = int(m.group(2))
# Update house count for this property (player just landed here)
if cp and 0 <= cp.location < 40:
g.property_houses[cp.location] = houses
self._pay_rent(rent) self._pay_rent(rent)
return return
m = self.RENT_HOTEL_RE.match(msg) m = self.RENT_HOTEL_RE.match(msg)
if m: if m:
rent = int(m.group(1)) rent = int(m.group(1))
# Hotel = 5 houses
if cp and 0 <= cp.location < 40:
g.property_houses[cp.location] = 5
self._pay_rent(rent) self._pay_rent(rent)
return return

View file

@ -679,13 +679,20 @@ class MonopParser:
m = self.RENT_HOUSES_RE.match(msg) m = self.RENT_HOUSES_RE.match(msg)
if m: if m:
houses = int(m.group(1))
rent = int(m.group(2)) rent = int(m.group(2))
# Update house count for this property (player just landed here)
if cp and 0 <= cp.location < 40:
g.property_houses[cp.location] = houses
self._pay_rent(rent) self._pay_rent(rent)
return return
m = self.RENT_HOTEL_RE.match(msg) m = self.RENT_HOTEL_RE.match(msg)
if m: if m:
rent = int(m.group(1)) rent = int(m.group(1))
# Hotel = 5 houses
if cp and 0 <= cp.location < 40:
g.property_houses[cp.location] = 5
self._pay_rent(rent) self._pay_rent(rent)
return return