CleverRaven / Cataclysm-DDA

Cataclysm - Dark Days Ahead. A turn-based survival game set in a post-apocalyptic world.
http://cataclysmdda.org
Other
10.73k stars 4.21k forks source link

Trail guides and maps change their name if you travel to a different city #61214

Closed sethsimon closed 2 weeks ago

sethsimon commented 2 years ago

Describe the bug

The name (ie what you see in your inventory) of trail guides and other maps is dynamically generated based on your position and the nearest city. Thus, if you drive (or long-range teleport) to another city, your Corinna trail guide would now be called a Lemington trail guide.

Steps to reproduce

  1. Go to the middle of some city (say, Corinna).
  2. Find/debug yourself a trail guide.
  3. Enter your inventory with i to see that you have a Corinna trail guide.
  4. Travel to the middle of another city (say, Lemington).
  5. Enter your inventory with i to see that you have a Lemington trail guide.

Expected behavior

Dynamically generating the map name is fine, but the city/area that's revealed should be stored in the item instead of being based on the player's position. This would also allow behavior such as spawning maps of various nearby cities at bus stations and airports.

Screenshots

No response

Versions and configuration

Linux, last commit is 25fd53ce63259b4c232782b1bcd15e86e7d7585c

Additional context

No response

PatrikLundell commented 2 years ago

I haven't seen this exact issue personally, as I always look at them immediately. However, I've seen what is most likely the same thing with notes hidden away in wallets, where the note claims to show info about secret facilities, and that gets somewhat silly when I finally get to examine the wallet contents and find notes about facilities under cities that don't have anything underground.

Terrorforge commented 2 years ago

They also reveal the map around wherever you happen to be, rather than where you initially picked them up.

This gets particularly silly with the Visitor's Pass for the TCL. I have them on autopickup so I don't have to manually dig through wallets, and this results in me always having a big stack of maps I can use to reveal all the nearby roads and TCLs whenever I want.

ZhilkinSerg commented 2 years ago

They also reveal the map around wherever you happen to be, rather than where you initially picked them up.

This gets particularly silly with the Visitor's Pass for the TCL. I have them on autopickup so I don't have to manually dig through wallets, and this results in me always having a big stack of maps I can use to reveal all the nearby roads and TCLs whenever I want.

No, it does not work that way. Maps store center of reveal location when generated and map details are revealed in a radius from that center point - https://github.com/CleverRaven/Cataclysm-DDA/pull/27012

ZhilkinSerg commented 2 years ago

debug yourself a trail guide.

Do not do that - debug-spawned items are not originating from a specific city, so they do not have center point added to them.

ZhilkinSerg commented 2 years ago

Here is the save with road map that was spawned in the city (it would behave properly) and debug spawned tourist guide (that would reveal map around your current location and change its name to reflect current nearest city).

Pine Crest.zip

Terrorforge commented 2 years ago

No, it does not work that way. Maps store center of reveal location when generated and map details are revealed in a radius from that center point - #27012

I can tell you with certainty that's how visitor's passes work: image After teleporting off into the fog on a pre-existing character and using one of my 14 visitor's passes.

It also seems to also be the case for the handwritten note: image image image Although I did spawn the map extra via debug to find this one, so I'm not sure this behavior is 100% organic.

I'm guessing this has something to do with these maps being generated as part of a map extra rather than standard mapgen.

ZhilkinSerg commented 2 years ago

If these handwritten notes and visitor passes are not inherited from abstractmap, they won't have valid category maps and might work improperly, unless maps category is added for them.

Terrorforge commented 2 years ago

The handwritten note does, and is "maps" category. But the visitor's pass doesn't. It's a "keys" category item, since it also acts as a key for the TCL.

ZhilkinSerg commented 2 years ago

Then it should be an easy fix - e.g item::is_map() should be updated to include all items with reveal_map iuse action in addition to maps category.

Harrison-Salzverg commented 2 years ago

Then it should be an easy fix - e.g item::is_map() should be updated to include all items with reveal_map iuse action in addition to maps category.

If this issue is still open, I can go ahead and try this.

Night-Pryanik commented 2 years ago

@Harrison-Salzverg you are welcome to try.

Inglonias commented 1 year ago

Notes for my own reference - Put a breakpoint in overmapbuffer::closest_city as I know that's being called when it shouldn't be.