diff --git a/source/house.cpp b/source/house.cpp index 5b7da805..5d430a32 100644 --- a/source/house.cpp +++ b/source/house.cpp @@ -182,7 +182,7 @@ std::string House::getDescription() { std::ostringstream os; os << name; - os << " (ID:" << id << "; Rent: " << rent << ")"; + os << " (ID:" << id << "; Rent: " << rent << "; Max Beds: " << beds << ")"; return os.str(); } diff --git a/source/iomap_otmm.cpp b/source/iomap_otmm.cpp index 08e4aa46..ff465caa 100644 --- a/source/iomap_otmm.cpp +++ b/source/iomap_otmm.cpp @@ -852,9 +852,16 @@ bool IOMapOTMM::loadMap(Map& map, NodeFileReadHandle& f, const FileName& identif continue; } + uint32_t beds; + if(!houseNode->getU32(beds)) { + warning("Could not read house max beds."); + continue; + } + house->name = house_name; house->townid = town_id; house->rent = rent; + house->beds = beds; uint16_t x; uint16_t y; @@ -1097,6 +1104,7 @@ bool IOMapOTMM::saveMap(Map& map, NodeFileWriteHandle& f, const FileName& identi f.addString(house->name); f.addU16(house->townid); f.addU16(house->rent); + f.addU16(house->beds); f.addU16(house->getExit().x); f.addU16(house->getExit().y); f.addU8(house->getExit().z & 0xf); diff --git a/source/palette_house.cpp b/source/palette_house.cpp index 212a390f..d3c6f20e 100644 --- a/source/palette_house.cpp +++ b/source/palette_house.cpp @@ -521,17 +521,22 @@ void EditHouseDialog::OnClickOK(wxCommandEvent& WXUNUSED(event)) long new_house_rent; house_rent.ToLong(&new_house_rent); - long new_house_clientid; - house_clientid.ToLong(&new_house_clientid); - long new_house_beds; house_beds.ToLong(&new_house_beds); + long new_house_clientid; + house_clientid.ToLong(&new_house_clientid); + if(new_house_rent < 0) { g_gui.PopupDialog(this, "Error", "House rent cannot be less than 0.", wxOK); return; } + if(new_house_beds < 0) { + g_gui.PopupDialog(this, "Error", "House beds cannot be less than 0.", wxOK); + return; + } + if(house_name.length() == 0) { g_gui.PopupDialog(this, "Error", "House name cannot be nil.", wxOK); return;