Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: Looking into implementing canceling the renting of an apartment  (Read 936 times)

InfernoZeus

  • Bay Watcher
    • View Profile
Looking into implementing canceling the renting of an apartment
« on: February 11, 2011, 12:26:28 am »

Something that I've noticed myself, and seems to be asked a lot, is if its possible to stop renting an apartment. I thought I'd take a look at the code and see how difficult it would be to add in. (If anyone has already done anything towards this, just gimme a heads up and I'll leave it alone)

As far as I can tell it seems like it should be pretty simple, but I wasn't sure how to go about charging for the number of days that the apartment had already been in use that month. It wouldn't make sense not to charge anything as people could just cancel right before payment was due, and then take it out again the next month. Does the code currently track when someone started renting the apartment?

Also, is the right place to ask questions about the code itself? The sourceforge page doesn't seem to have an issue list like Google Code does.
Logged

Jonathan S. Fox

  • Bay Watcher
    • View Profile
    • http://www.jonathansfox.com/
Re: Looking into implementing canceling the renting of an apartment
« Reply #1 on: February 11, 2011, 02:38:42 am »

Sourceforge CAN have such pages, but most of the community features on the LCS sourceforge page are disabled specifically because that would be the wrong place to discuss the game. Anyone who posts there would be posting into a black void of nothingness.

You don't have to add a charge on moving out; the apartments charge you the first month's rent up front (they call it a security deposit, but that's not really true), and then again at the start of each month. That means if the player stays there 2.5 months then moves out, they'll have paid for 3 months already. At any given time, the apartment is already paid for through the end of the month.
Logged

InfernoZeus

  • Bay Watcher
    • View Profile
Re: Looking into implementing canceling the renting of an apartment
« Reply #2 on: February 11, 2011, 12:25:40 pm »

Thanks for the feedback Jonathan, I've added some code to src/sitemode/talk.cpp which checks if a room is being rented, and then gives an option to stop renting. I had a look at the code for when the player is evicted in order to work out how to move all of the possessions and people that have the room set as their base.

Is it possible to attach a patch or something - would you mind taking a look at it?

Edit: Also, what is RENTING_PERMANENT used for? Is that for the free rental places that you never get kicked out of?

locationst->newrental seems to be set when you rent a room and its reset at the start of the month. Is that so if you started renting since the start of the month, you don't pay any additional rent on the third?
« Last Edit: February 11, 2011, 01:57:59 pm by InfernoZeus »
Logged

Jonathan S. Fox

  • Bay Watcher
    • View Profile
    • http://www.jonathansfox.com/
Re: Looking into implementing canceling the renting of an apartment
« Reply #3 on: February 11, 2011, 04:49:36 pm »

You can send me an email at jonathansfox@gmail.com and attach the patch file, and I'll apply, test, and commit it. Could you provide a sourceforge username in the email as well? If it works, I'll add you to the project as a developer, so you can use SVN commit to save any future changes you make directly to the main codebase. There aren't any responsibilities to being on the project, just the ability to commit changes.

RENTING_PERMANENT is indeed used for the free rental places you never get kicked out of, and you are also correct on the locationst->newrental variable; its purpose is to prevent you from having to pay rent twice on a month where you start renting on day one or two.

EDIT: Update for anyone following the thread -- looks good, leaving your apartment without trouble will be possible in the next release. Thank you!
« Last Edit: February 12, 2011, 01:41:06 am by Jonathan S. Fox »
Logged

Gentle Manne

  • Bay Watcher
    • View Profile
Re: Looking into implementing canceling the renting of an apartment
« Reply #4 on: February 12, 2011, 01:47:04 am »

Ah, open source software.
Logged

InfernoZeus

  • Bay Watcher
    • View Profile
Re: Looking into implementing canceling the renting of an apartment
« Reply #5 on: February 12, 2011, 07:39:49 am »

Ah, open source software.

It is nice when it works so smoothly! :)
Logged