Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: LCS: Loot combining  (Read 2808 times)

Wisq

  • Bay Watcher
    • View Profile
LCS: Loot combining
« on: February 14, 2008, 12:53:00 pm »

Is there a reason loot isn't combined into a single item with a count, like weapons, ammo, and armour?  I edited it to do so, and there don't seem to be any adverse effects, except of course that it's less immediately obvious when you have massive amounts of it.  :)

Also, I found that after moving items between location and squad, they'd all be at the end of the inventory, but many actions (equipping, leaving inventory and coming back) would re-consolidate and sort them.  I can see the benefit of having recently moved items at the end of the listing, but it never lasts long anyway:  As soon as I do anything, it's re-sorted, so the net effect is that stuff just jumps around.  Calling consolidateloot at the end of moveloot seems to work fine.

Patch format

Logged

Jonathan S. Fox

  • Bay Watcher
    • View Profile
    • http://www.jonathansfox.com/
Re: LCS: Loot combining
« Reply #1 on: February 14, 2008, 01:47:00 pm »

Nope, no reason not to, and the changes are appreciated.  :D Applied your patch and it looks good. Committed to SVN too. If you make any other cool changes, you're welcome to make commits if you'd like to.
Logged

Wisq

  • Bay Watcher
    • View Profile
Re: LCS: Loot combining
« Reply #2 on: February 14, 2008, 02:26:00 pm »

Well, here's another one, then:

I found I would often get more than one warehouse with the same name, and it was difficult to tell them apart -- or impossible on screens that only show the short name.

The quick fix was to hex-edit my savegame, but here's a more permanent fix.  It enforces uniqueness across safehouses, and could be used to do the same for any building.

Patch

I've only applied it to safehouses so far (warehouses and apartments).  The apartments are fairly unlikely to collide due to the number of names, but it's still just as annoying when they do.  It can be applied to other locales if desired -- industrial plants, laboratories, crack houses, etc. -- but I left it out for simplicity's sake.

I could have theoretically wrapped all of initlocation in a do-while, but I limit it to random buildings to avoid potential infinite loops for statically-named buildings.  You'll still get an infinite loop if the number of buildings of one type exceeds the number of random possible names.

Logged

Jonathan S. Fox

  • Bay Watcher
    • View Profile
    • http://www.jonathansfox.com/
Re: LCS: Loot combining
« Reply #3 on: February 14, 2008, 04:51:00 pm »

Okay, applied it. There was a bug that caused repeated concatenation of new strings onto the end of the longname if the short name was identical to a previous one (Abandoned Meat PlantToy FactoryBuilding Site), but it's fixed and committed.   :D

This has been an irritation for awhile... I implemented a cheesy hack of just adding more options so it was less likely to occur early in development, so it's nice that you've helped out by actually doing it right.

[ February 14, 2008: Message edited by: Jonathan S. Fox ]

Logged

Wisq

  • Bay Watcher
    • View Profile
Re: LCS: Loot combining
« Reply #4 on: February 14, 2008, 05:08:00 pm »

Ahhh, oops.  :D  Glad you caught it.
Logged

Mercutio Valentine

  • Bay Watcher
    • View Profile
Re: LCS: Loot combining
« Reply #5 on: February 14, 2008, 07:04:00 pm »

Props for *kicking serious ass*, man.
Logged

Wisq

  • Bay Watcher
    • View Profile
Re: LCS: Loot combining
« Reply #6 on: February 14, 2008, 11:14:00 pm »

More updates, this time to equipment handling.  I thought it'd be neat to prompt for how many clips to supply a squaddie, rather than having to do it over and over.

In the process, I extracted the amount-prompting to a shared helper function, and cleaned up the code a little with a few quick variables.

I think there's some funny newline business going on in the SVN archive (Windows CRLF versus Unix LF), so you may not be able to apply the patch.  Hence, I've posted both the diff and the whole equipment.cpp file.  Grab the MIN and MAX #defines from the last hunk in the patch, replace equipment.cpp, and that's it.

Patch format
Whole file (equipment.cpp)

Logged

Wisq

  • Bay Watcher
    • View Profile
Re: LCS: Loot combining
« Reply #7 on: February 15, 2008, 01:16:00 am »

More updates to equipment.  Added error messages for various impossible actions -- equipping loot, ammo for the wrong gun (or no gun), and trying to load too much ammo.  The messages don't require a keypress to go away.

Patch format
Whole equipment.cpp

A minor note:

It bears noting that my changes so far have had one negative effect.  It used to be that the inventory interface was very predictable in terms of keystrokes -- things might or might not work, but either way, you still pressed the same keys to try to make it happen.  So a touch-typist like myself could bash away at inventory keys and generally stay "in sync" with the interface, even if some of my actions had no effect.

With these changes, equipping loot is one fewer prompt ("what party member?") than equipping a weapon or armour, which is in turn one fewer prompt ("how many?") than equipping clips.  That means that if you type fast, you can find yourself typing numbers when it expects letters or vice versa.

However, with (most) loot combined into a single item, and with ammo assigned all at once, the need to pound away at the keyboard has mostly gone away as well -- you can get much more done with fewer keystrokes.  So I think this'll make things better overall, rather than pissing off the old-timers.  :D

Logged

Jonathan S. Fox

  • Bay Watcher
    • View Profile
    • http://www.jonathansfox.com/
Re: LCS: Loot combining
« Reply #8 on: February 15, 2008, 03:22:00 am »

Cool, applied. I have a request though: could you use spaces instead of tabs? The LCS source uses unusual three space indent, and spaces instead of tabs. When you indent with tabs of size 8 spaces, then use spaces to fill in any remaining spaces, it comes through on my end completely butchered on my end, as my tab breaks for LCS are every 3 characters instead of 8, in line with the indent scheme it uses. So I have to repair it by replacing the tabs with spaces manually. You should be able to flip a setting in your IDE or editing program (if the editor's designed for source editing) that will enable you to convert tabs into spaces, and fit your tab size to the three space indent LCS uses -- then you can hit tab, and it'll just fill in spaces until the next tab stop, almost completely transparent. It'll save you the trouble of having to manually accommodate the funky indent size LCS uses too.
Logged

a1s

  • Bay Watcher
  • Russian civil war "expert"
    • View Profile
Re: LCS: Loot combining
« Reply #9 on: February 15, 2008, 03:32:00 am »

since you are doing minor useful stuff: can the talk dialog be changed when you are confronted by alarmed conservatives, so that you could only chose conservatives? (as opposed to being able to chose anyone, but only talk to conservatives)
Logged
Wanted to host a great feast.
Accidentally commited suicide.
Posses help delinquent players!

Wisq

  • Bay Watcher
    • View Profile
Re: LCS: Loot combining
« Reply #10 on: February 15, 2008, 03:50:00 am »

Sure -- I was wondering if/when the various style issues would come up.  :)
Logged

Jonathan S. Fox

  • Bay Watcher
    • View Profile
    • http://www.jonathansfox.com/
Re: LCS: Loot combining
« Reply #11 on: February 15, 2008, 02:54:00 pm »

Ouch, autoconvert spaces to tabs... that is the exact opposite of what I set my programs to do.  :D
Logged

Wisq

  • Bay Watcher
    • View Profile
Re: LCS: Loot combining
« Reply #12 on: February 15, 2008, 03:23:00 pm »

Here's another bug I found a long time ago, but it didn't seem reproducible at the time.  I finally figured it out -- the equipment screen knows how to display money, but moveloot() doesn't, and actually reuses the previous item's description.

For example, in my current save, if I try to get objects from the base, I see I have two damaged lab coats.  If I grab the second one (money), I end up with money in my inventory, alongside my 17 trenchcoats.  If I try to put it back, I "discover" I have two stacks of 17 trenchcoats.  Oops.  :)

Logged

Jonathan S. Fox

  • Bay Watcher
    • View Profile
    • http://www.jonathansfox.com/
Re: LCS: Loot combining
« Reply #13 on: February 15, 2008, 03:46:00 pm »

I'm pretty sure that you shouldn't, theoretically, have money in your inventory at your base. It should be converted into funds for your account the moment you walk off-site. Any idea how you got that money?

Not that it shouldn't be able to support displaying money, if there is money to display. That would help to catch the bug of having money in your inventory more readily anyway.

Logged

Wisq

  • Bay Watcher
    • View Profile
Re: LCS: Loot combining
« Reply #14 on: February 15, 2008, 04:02:00 pm »

I believe I brought the money back to base as loot from a murderous expedition.  I'll keep an eye on my inventory and see if it happens again.
Logged