Cataclysm-DDA icon indicating copy to clipboard operation
Cataclysm-DDA copied to clipboard

Move ACT_VEHICLE handler to vehicle_activity_actor

Open ShnitzelX2 opened this issue 3 weeks ago • 0 comments

Summary

Infrastructure "move ACT_VEHICLE handler to vehicle_activity_actor"

Purpose of change

Update legacy activities.

Describe the solution

By commit:

  1. Refactor veh_interact::dd to veh_interact::cursor_vp_mount. Note to contributors: avoid using two-letter variables for very vital data, it took me hours to figure out what this actually did.
  2. Convert char arguments for ACT_VEHICLE sub-activity to enum. Note to contributors: don't use char when you could use an enum.
  3. See title, all the work that involves the actual migration of the handler to the actor. This was a lot; vehicle_activity_actor is called with a ton of parameters from four different locations.

Describe alternatives you've considered

I added a TODO to split up vehicle_activity_actor because it's bloated, probably into something like this:

  • VEHICLE_INSTALL
  • VEHICLE_REMOVE
  • VEHICLE_REFILL_SIPHON
  • VEHICLE_REPAIR
  • VEHICLE_DECONSTRUCTION
  • VEHICLE_UNLOAD_SOLID_FUEL (?)

Also, actions in the vehicle examine menu like label and shape shouldn't be activities at all.

Testing

Tested and confirmed the following vehicle actions work (from the examine vehicle menu):

  • install, repair, mend, refill, remove, siphon, unload, crew, shape, rename, label

Also did the usual:

  • Ordered an NPC to complete Vehicle Deconstruction and Repair multi-activity successfully.
  • Ordered an NPC to do Vehicle Deconstruction in a 0.H save, confirmed activity was canceled when loaded with these changes.
  • Confirmed vehicle activity (de)serialized correctly with NPC still deconstructing for correct duration after a save/load

Additional context

Hopefully I haven't missed anything, the scope of what the vehicle handler touches is large

ShnitzelX2 avatar Dec 10 '25 04:12 ShnitzelX2