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

Wierd suffix in message: What to do with the extension cord?solar panel #73859

Closed
Brambor opened this issue May 16, 2024 · 4 comments · Fixed by #74280
Closed

Wierd suffix in message: What to do with the extension cord?solar panel #73859

Brambor opened this issue May 16, 2024 · 4 comments · Fixed by #74280
Labels
(S2 - Confirmed) Bug that's been confirmed to exist

Comments

@Brambor
Copy link
Contributor

Brambor commented May 16, 2024

Describe the bug

image

Attach save file

がめ-trimmed.tar.gz - said to be corrupted, use this one #73859 (comment)

Steps to reproduce

  1. Load save.
  2. Open AIM /.
  3. Activate extension cord (x/10 cable).
  4. Observe weird message.

Expected behavior

Drop the solar panel in the suffix, probably.

Screenshots

No response

Versions and configuration

  • OS: Windows
    • OS Version: 10.0.19045.4291 (22H2)
  • Game Version: 0.G-9614-gf522d7df2d-dirty [64-bit] master was 39e2afa
  • Graphics Version: Tiles
  • Game Language: English [en]
  • 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]
    ]

Additional context

No response

@Brambor Brambor added the (S1 - Need confirmation) Report waiting on confirmation of reproducibility label May 16, 2024
@Bobtron
Copy link
Contributor

Bobtron commented May 18, 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

@Brambor
Copy link
Contributor Author

Brambor commented May 18, 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.

@TealcOneill
Copy link
Contributor

/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

@github-actions github-actions bot added (S2 - Confirmed) Bug that's been confirmed to exist and removed (S1 - Need confirmation) Report waiting on confirmation of reproducibility labels May 25, 2024
@Bobtron
Copy link
Contributor

Bobtron commented May 29, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
(S2 - Confirmed) Bug that's been confirmed to exist
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants