Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NPC Camp: Forest trails invalid for logging/cutting/fortifying #30408

Closed
Grayven opened this issue May 11, 2019 · 5 comments · Fixed by #42972
Closed

NPC Camp: Forest trails invalid for logging/cutting/fortifying #30408

Grayven opened this issue May 11, 2019 · 5 comments · Fixed by #42972
Labels
<Bug> This needs to be fixed Fields / Furniture / Terrain / Traps Objects that are part of the map or its features. Good First Issue This is a good first issue for a new contributor Player Faction Base / Camp All about the player faction base/camp/site

Comments

@Grayven
Copy link

Grayven commented May 11, 2019

Describe the bug
On attempting to "Cut Logs" or "Clear a forest" and selecting an overmap "Forest Trail" tile, it reverts to initial prompt asking to select a tile to log. Admittedly the prompt does specify 'forest' and 'swamp' as being allowed selection for loggings and 'forest' as the only acceptable option for clearing, but it is rather perplexing that the presence of a minor dirt path prevents cutting trees there.

Similarly for the "Construct Map Fortifications" task, it specifies that forest, swamps and fields are valid options only, and having a forest trail included between the two designated points to dig a trench gives a "invalid terrain in construction path"

To Reproduce
Steps to reproduce the behavior:

  1. Make an NPC camp, reach level for cut logs, clear forest, make map fortifications.
  2. Attempt to include a forest trail in the selection of either of the listed tasks

Expected behavior
A forest trail is just a rough dirt path through the forest, it should not prevent the cutting of trees to convert it to a field-type over time, or of having a companion dig a trench through it to make a fortification. Adding the forest trail map type to acceptable tiles is (probably) all it needs to work.

Versions and configuration(please complete the following information):

  • OS: Windows 10
  • Game Version: 0.D-2786-gb574176
  • Graphics version: Tiles
@ifreund ifreund added <Bug> This needs to be fixed Fields / Furniture / Terrain / Traps Objects that are part of the map or its features. Player Faction Base / Camp All about the player faction base/camp/site labels May 11, 2019
@mlangsdorf
Copy link
Contributor

There's a better solution for this, but fixing it would involve rewriting another piece of confused faction_camp legacy code and I'm already rewriting a different piece of confused faction_camp legacy code.

diff --git a/src/faction_camp.cpp b/src/faction_camp.cpp
index c1383cd3cc..538a13397b 100644
--- a/src/faction_camp.cpp
+++ b/src/faction_camp.cpp
@@ -450,6 +450,7 @@ void talk_function::start_camp( npc &p )
     for( const auto &om_near : om_region ) {
         if( om_near.first != "field" && om_near.first != "forest" &&
             om_near.first != "forest_thick" && om_near.first != "forest_water" &&
+            om_near.first != "forest_trail" &&
             om_near.first.find( "river_" ) == std::string::npos ) {
             popup( _( "You need more room for camp expansions!" ) );
             return;
@@ -465,7 +466,8 @@ void talk_function::start_camp( npc &p )
             popup( _( "You are too close to another camp!" ) );
             return;
         }
-        if( om_near.first == "forest" || om_near.first == "forest_thick" ) {
+        if( om_near.first == "forest" || om_near.first == "forest_thick" ||
+            om_near.first == "forest_trail" ) {
             forests++;
         } else if( om_near.first.find( "river_" ) != std::string::npos ) {
             waters++;
@@ -1435,7 +1437,7 @@ void basecamp::start_menial_labor()
 
 void basecamp::start_cut_logs()
 {
-    std::vector<std::string> log_sources = { "forest", "forest_thick", "forest_water" };
+    std::vector<std::string> log_sources = { "forest", "forest_thick", "forest_trail", "forest_water" };
     popup( _( "Forests and swamps are the only valid cutting locations." ) );
     tripoint forest = om_target_tile( omt_pos, 1, 50, log_sources );
     if( forest != tripoint( -999, -999, -999 ) ) {
@@ -1492,7 +1494,7 @@ void basecamp::start_cut_logs()
 
 void basecamp::start_clearcut()
 {
-    std::vector<std::string> log_sources = { "forest", "forest_thick" };
+    std::vector<std::string> log_sources = { "forest", "forest_thick", "forest_trail" };
     popup( _( "Forests are the only valid cutting locations." ) );
     tripoint forest = om_target_tile( omt_pos, 1, 50, log_sources );
     if( forest != tripoint( -999, -999, -999 ) ) {
@@ -1529,7 +1531,7 @@ void basecamp::start_clearcut()
 void basecamp::start_setup_hide_site()
 {
     std::vector<std::string> hide_locations = { "forest", "forest_thick", "forest_water",
-                                                "field"
+                                                "field", "forest_trail"
                                               };
     popup( _( "Forests, swamps, and fields are valid hide site locations." ) );
     tripoint forest = om_target_tile( omt_pos, 10, 90, hide_locations, true, true, omt_pos, true );
@@ -1628,7 +1630,7 @@ void basecamp::start_relay_hide_site()
 void basecamp::start_fortifications( std::string &bldg_exp, bool by_radio )
 {
     std::vector<std::string> allowed_locations = {
-        "forest", "forest_thick", "forest_water", "field"
+        "forest", "forest_thick", "forest_trail", "forest_water", "field"
     };
     popup( _( "Select a start and end point.  Line must be straight.  Fields, forests, and "
               "swamps are valid fortification locations.  In addition to existing fortification "

Anyway, that's the necessary minimal code changes if someone wants to apply them and test them. If not, I'll do it sometime Real Soon Now.

@mlangsdorf mlangsdorf added the Good First Issue This is a good first issue for a new contributor label May 12, 2019
@PixelBrewer
Copy link
Contributor

@mlangsdorf Hi I would love to apply these changes and test them. I'm new to contributing to open source so if it is alright I may tag you in this conversation again if I have any questions.

@mlangsdorf
Copy link
Contributor

Please do.

@korvyr
Copy link
Contributor

korvyr commented Oct 28, 2019

I'll tackle this one this weekend along with the starving faction members on missions issue.

@AlexJBlair Let me know if you still want this one and I'll move on. :D I'm just trying to grab 2 per weekend.

Edit: Shame I can't assign these to myself. Ah well.

@korvyr
Copy link
Contributor

korvyr commented Nov 3, 2019

If anyone wants to tackle this in the future, here's the solution I came up with that should do the trick:
979d8bb

I probably won't get around it it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
<Bug> This needs to be fixed Fields / Furniture / Terrain / Traps Objects that are part of the map or its features. Good First Issue This is a good first issue for a new contributor Player Faction Base / Camp All about the player faction base/camp/site
Projects
None yet
5 participants