Coder Social home page Coder Social logo

Comments (4)

Bobtron avatar Bobtron commented on June 2, 2024 1

Thanks for the clarification/confirmation

The code snippet above is incorrect, I used a debugger to trace through where its getting the vehicle name added, and this is where its happening:

} else {
// This is a cable item with at least one connection already:
std::string state_desc_lhs;
std::string state_desc_rhs;
if( it.link_has_state( link_state::no_link ) ) {
state_desc_lhs = _( "\nAttached to " );
if( t_veh ) {
state_desc_rhs = it.link().t_veh->name;
} else if( it.link_has_state( link_state::bio_cable ) ) {
state_desc_rhs = _( "Cable Charger System" );
} else if( it.link_has_state( link_state::ups ) ) {
state_desc_rhs = _( "Unified Power Supply" );
} else if( it.link_has_state( link_state::solarpack ) ) {
state_desc_rhs = _( "solar backpack" );
}
} else {
if( it.link().source == link_state::bio_cable ) {
state_desc_lhs = _( "\nConnecting Cable Charger System to " );
} else if( it.link().source == link_state::ups ) {
state_desc_lhs = _( "\nConnecting UPS to " );
} else if( it.link().source == link_state::solarpack ) {
state_desc_lhs = _( "\nConnecting solar backpack to " );
}
if( it.link().t_veh ) {
state_desc_rhs = it.link().t_veh->name;
} else if( it.link().target == link_state::bio_cable ) {
state_desc_rhs = _( "Cable Charger System" );
}
}

The assumption of the else statement is false This is a cable item with at least one connection already:, where there should be no connection as the link over-extended and snapped off.

Also in the reset link, we don't remove the t_veh pointer, and we can't use link_.reset(); as we need to keep the state that the link needs to be respooled.

Cataclysm-DDA/src/item.cpp

Lines 13930 to 13940 in f7cce92

if( unspool_if_too_long && link().length > LINK_RESPOOL_THRESHOLD ) {
// Cables that are too long need to be manually rewound before reuse.
link().source = link_state::needs_reeling;
return false;
}
if( loose_message && p ) {
p->add_msg_if_player( m_info, _( "You reel in the %s and wind it up." ), link_name() );
}
link_.reset();

Thinking we can fix this by setting link().t_veh = nullptr after line 13932, but open to suggestions

from cataclysm-dda.

Bobtron avatar Bobtron commented on June 2, 2024

vehicle *t_veh = it.has_link_data() ? it.link().t_veh.get() : nullptr;
uilist link_menu;
if( !is_cable_item || it.has_no_links() ) {
// This is either a device or a cable item without any connections.
link_menu.text = string_format( _( "What to do with the %s?%s" ), it.link_name(), t_veh ?
string_format( _( "\nAttached to: %s" ), t_veh->name ) : "" );

t_veh should be a nullptr, but somehow its referencing a solar panel

Edit Ignore the above this is incorrect

from cataclysm-dda.

Brambor avatar Brambor commented on June 2, 2024

I did connect it to solar panel on the roof (z=1) and then walked away (in the z=0), until the cable snapped.

Those should be the reproduction steps.

from cataclysm-dda.

TealcOneill avatar TealcOneill commented on June 2, 2024

/Confirm
This happens with any appliance it's connected to. The z level doesn't affect this at all. Also, it uses the name of the appliance if applicable which I'm not sure matters but it's something.
I couldn't unzip the included save, 7zip says the archive is corrupted. I've included a new one

  • OS: Windows
    • OS Version: 10.0.19045.4412 (22H2)
  • Game Version: cdda-experimental-2024-05-25-0134 22d851b [64-bit]
  • Graphics Version: Tiles
  • Game Language: System language []
  • Mods loaded: [
    Dark Days Ahead [dda],
    Disable NPC Needs [no_npc_food],
    Portal Storms Ignore NPCs [personal_portal_storms],
    Slowdown Fungal Growth [no_fungal_growth]
    ]
    Tira-trimmed.tar.gz

from cataclysm-dda.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.