Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.
Sign upbasecamp, faction camp: start merging faction camps into basecamps #26764
Conversation
mlangsdorf
added this to In progress
in Faction Camp Improvements
via automation
Nov 19, 2018
BevapDin
reviewed
Nov 19, 2018
src/basecamp.cpp Outdated
BevapDin
reviewed
Nov 19, 2018
src/basecamp.cpp Outdated
BevapDin
reviewed
Nov 19, 2018
src/basecamp.cpp Outdated
BevapDin
reviewed
Nov 19, 2018
src/basecamp.h Outdated
mlangsdorf
force-pushed the
mlangsdorf:fc_refactor_3
branch
from
c80f2c3
to
d8a9354
Nov 19, 2018
BevapDin
reviewed
Nov 19, 2018
src/basecamp.cpp Outdated
mlangsdorf
force-pushed the
mlangsdorf:fc_refactor_3
branch
5 times, most recently
from
8c65900
to
ed16f0b
Nov 19, 2018
mlangsdorf
changed the title
[WIP] basecamp, faction camp: start merging faction camps into basecamps
basecamp, faction camp: start merging faction camps into basecamps
Nov 21, 2018
BevapDin
reviewed
Nov 21, 2018
src/faction_camp.cpp Outdated
BevapDin
reviewed
Nov 21, 2018
src/savegame_json.cpp Outdated
BevapDin
reviewed
Nov 21, 2018
src/savegame_json.cpp Outdated
BevapDin
reviewed
Nov 21, 2018
src/faction_camp.cpp Outdated
BevapDin
reviewed
Nov 21, 2018
src/faction_camp.cpp Outdated
BevapDin
reviewed
Nov 21, 2018
src/faction_camp.cpp Outdated
mlangsdorf
force-pushed the
mlangsdorf:fc_refactor_3
branch
from
ed16f0b
to
26a8aaf
Nov 22, 2018
ZhilkinSerg
self-assigned this
Nov 24, 2018
mlangsdorf
force-pushed the
mlangsdorf:fc_refactor_3
branch
from
26a8aaf
to
fe7e5bf
Nov 24, 2018
ZhilkinSerg
reviewed
Nov 24, 2018
src/basecamp.cpp Outdated
mlangsdorf
force-pushed the
mlangsdorf:fc_refactor_3
branch
from
fe7e5bf
to
7be8430
Nov 24, 2018
This comment has been minimized.
This comment has been minimized.
|
Don't know if this is related yet, started a camp and upgraded it to the level that has crates, dispatched menial laborer, and encountered a segfault when I recovered them:
|
This comment has been minimized.
This comment has been minimized.
|
In basecamp_menial_return(), p.companion_mission_points is empty, but it gets dereferenced. |
mlangsdorf
force-pushed the
mlangsdorf:fc_refactor_3
branch
from
64a400c
to
43ee1ea
Nov 25, 2018
mlangsdorf
changed the title
[WIP] basecamp, faction camp: start merging faction camps into basecamps
basecamp, faction camp: start merging faction camps into basecamps
Nov 25, 2018
This comment has been minimized.
This comment has been minimized.
|
Okay, what was happening with expansions:
I still need to write test cases. That's going to be a few days but the rest can be reviewed. I'd be fine with submitting them as a separate PR, actually. |
mlangsdorf
force-pushed the
mlangsdorf:fc_refactor_3
branch
from
43ee1ea
to
ba63617
Nov 25, 2018
This comment has been minimized.
This comment has been minimized.
I'll accept this without unit tests, just pointing out that the cost/benefit ratio seems likely to be favorable since it's so hard to test manually. |
This comment has been minimized.
This comment has been minimized.
|
Started work on the unit tests, but the actual code flow depends on pop-ups and the test harness handles those poorly as far as I know. Refactoring everything to be easier to test would be a large task. It will probably happen as part of moving this stuff to JSON but I don't see an easy way to do it now. |
This comment has been minimized.
This comment has been minimized.
|
Not sure if this one is related, it might be pre-existing. I debugged in some NPCs and used mind control on them. I picked one and told them to be camp manager, then they were bugging me about not being able to breathe so I accepted their mission and gave them an inhaler. Now they're marked as a Camp Manager, but they don't have any dialog options for it. Teleported to an entirely different zone, made sure to satisfy the new NPCs mission needs, then started a camp. I can enter the manager dialog now, but if I select "What needs to be done?" I get "There are no missions at this colony.". Possibly pertinent minutiae, I'm mind controlling NPCs like crazy, teleporting all over the place, and I think I have 6 active camps scattered around at this point. |
This comment has been minimized.
This comment has been minimized.
|
No missions at this colony probably means that something went crazy with finding the basecamp. I'll see if I can reproduce it. |
mlangsdorf
force-pushed the
mlangsdorf:fc_refactor_3
branch
from
ba63617
to
e58a3b6
Nov 27, 2018
mlangsdorf
added some commits
Nov 16, 2018
mlangsdorf
force-pushed the
mlangsdorf:fc_refactor_3
branch
from
e58a3b6
to
e7f2d8c
Nov 27, 2018
This comment has been minimized.
This comment has been minimized.
|
The logic for finding a basecamp was indeed messed up. I have unmessed it up, I hope. |
This comment has been minimized.
This comment has been minimized.
|
Jenkins rebuild |
This comment has been minimized.
This comment has been minimized.
|
This pull request has been mentioned on Cataclysm: Dark Days Ahead. There might be relevant details there: https://discourse.cataclysmdda.org/t/aircraft-in-game/17669/6 |
I-am-Erk
reviewed
Nov 29, 2018
I-am-Erk
reviewed
Nov 29, 2018
This comment has been minimized.
This comment has been minimized.
|
After many many weeks of upgrades, I encountered this segfault when retrieving a blacksmith from a crafting job:
|
mlangsdorf
force-pushed the
mlangsdorf:fc_refactor_3
branch
from
e7f2d8c
to
e85de45
Dec 1, 2018
This comment has been minimized.
This comment has been minimized.
|
Dangling basecamp pointer resolved. |
This comment has been minimized.
This comment has been minimized.
|
I was testing with a basecamp, spent hours on it. |
mlangsdorf commentedNov 19, 2018
•
edited
Summary
SUMMARY: Infrastructure "basecamp, faction camp: start merging faction camps into basecamps"Purpose of change
Faction camps use the omt_terrain of the overmap tile containing the camp overseer to determine camp progress. This is bad and needs to be changed in order to do any serious improvement of faction camps, especially to make them more JSON friendly and to allow alternate upgrade paths.
Step 1 is to find some alternate persistent data structure that can hold faction camp data. The existing basecamp class is barely used. This PR moves some of the faction camp data into basecamp, with the short term goal of removing all uses of omt_terrain to determine faction camp upgrade process, aside from a single migration function for existing basecamps.
Describe the solution
the basecamp class gets heavily revised, picking up several members:
Various functions for manipulating these structures are introduced in this PR, and some existing talk_function:: code dealing with faction camps have been moved inside basecamp:: if those functions needed access to basecamp:: data internals.
Describe alternatives you've considered
Like everything else in faction camps, there's a bunch of different ways to start this process. I have to start somewhere.
Using the overmap terrain id as a data store is not great design for a bunch of reasons. It's just not compatible with a flexible faction camp design that includes the option to upgrade parts but not all of an overmap tile or take over existing buildings. So while it would be possible to continue with faction camps using the overmap terrain id to determine upgrade process, doing so is not my plan.
I could have moved more functions into basecamp::, but this PR is large enough as it is.
The map of string dir to expansion data isn't as useful as I hoped. A future commit will probably replace it with a fixed array indexed via an enum, but the current string indexing is built fairly heavily into the code and I don't want to do the necessary surgery at this time.
Additional context
This PR is going to be the first in an extended series that will eventually see the removal of the camp overseer role, the removal of the restriction on upgrading with vehicles on the map, and eventually JSON defined faction camps with multiple upgrade paths, including the ability to take over existing buildings. All of that is gated on NOT using the omt_terrain ID to measure faction camp upgrade progress.
The data structures introduced in this PR are not intended to be the final design of faction camps/base camps. They're being introduced to smooth the transition from the current state to the long term improved state.