xray-16 icon indicating copy to clipboard operation
xray-16 copied to clipboard

Condition factor added with use_condition param in LTX doesn't save properly

Open yohjimane opened this issue 1 year ago • 0 comments

Describe the bug There is some code in engine which does work initially, but doesn't save properly to packets:

    // Added by Axel, to enable optional condition use on any item
    m_flags.set(FUsingCondition, READ_IF_EXISTS(pSettings, r_bool, section, "use_condition", false));

To Reproduce Steps to reproduce the behavior:

  1. Add some log like so in CInventoryItem::Load/Save funcs: Msg("debug - save item %s with condition %f", m_object->cNameSect().c_str(), m_fCondition)
  2. load into game
  3. drop a weapon/item, shoot it
  4. pick it up, save game
  5. check logs from step 1 - correct values saved
  6. load game
  7. check logs from step 1 - correct values saved
  8. save game
  9. check logs from step 1 - observe bug, loaded values are reset to 1.f (unless the item condition has changed between steps 5 and 7; then it will be equal to 1 - conditionDecremented)

Expected behavior use_condition param should save to packets

Desktop (please complete the following information):

  • OS: Windows 10
  • OpenXRay build version: 98f80503e11d30861d9fe1079138544ac7866680

yohjimane avatar Nov 14 '23 13:11 yohjimane