Skip to content

Commit 5941d5e

Browse files
authored
Merge pull request #7123 from Goober5000/ship_cleanup_tweak
tweak ship_cleanup
2 parents 879b1f4 + fff480e commit 5941d5e

File tree

4 files changed

+8
-6
lines changed

4 files changed

+8
-6
lines changed

code/mission/missionparse.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -663,7 +663,7 @@ MONITOR(NumShipArrivals)
663663
MONITOR(NumShipDepartures)
664664

665665
const std::shared_ptr<scripting::Hook<scripting::hooks::ShipDepartConditions>> OnDepartureStartedHook = scripting::Hook<scripting::hooks::ShipDepartConditions>::Factory(
666-
"On Departure Started", "Called when a ship starts the departure process.",
666+
"On Departure Started", "Called when a ship initiates a departure (acquires a hangar bay path or begins to warp) but is not actually exiting the mission yet.",
667667
{
668668
{"Self", "ship", "An alias for Ship."},
669669
{"Ship", "ship", "The ship that has begun the departure process."},

code/scripting/api/libs/mission.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -486,7 +486,7 @@ ADE_INDEXER(l_Mission_Ships, "number/string IndexOrName", "Gets ship", "ship", "
486486
auto entry = ship_registry_get(name);
487487
if (entry)
488488
{
489-
if (entry->has_shipp())
489+
if (entry->has_objp())
490490
objnum = entry->objnum;
491491
}
492492
else

code/scripting/global_hooks.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ const std::shared_ptr<Hook<ShipDepartConditions>> OnShipDepart = Hook<ShipDepart
304304
"Invoked when a ship departs the mission without being destroyed.",
305305
{
306306
{"Ship", "ship", "The ship departing the mission"},
307-
{"JumpNode", "string", "The name of the jump node the ship jumped out of. Can be nil."},
307+
{"JumpNode", "string", "The name of the jump node the ship was in when it departed. Can be nil."},
308308
{"Method", "ship", "The name of the method the ship used to depart. One of: 'SHIP_DEPARTED', 'SHIP_DEPARTED_WARP', 'SHIP_DEPARTED_BAY', 'SHIP_VANISHED', 'SHIP_DEPARTED_REDALERT'."},
309309
});
310310

code/ship/ship.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9134,11 +9134,9 @@ void ship_cleanup(int shipnum, int cleanup_mode)
91349134
// this should never happen
91359135
Assertion(Ship_registry_map.find(shipp->ship_name) != Ship_registry_map.end(), "Ship %s was destroyed, but was never stored in the ship registry!", shipp->ship_name);
91369136

9137-
// Goober5000 - handle ship registry
9137+
// Goober5000 - handle ship registry, part 1
91389138
auto entry = &Ship_registry[Ship_registry_map[shipp->ship_name]];
91399139
entry->status = ShipStatus::EXITED;
9140-
entry->objnum = -1;
9141-
entry->shipnum = -1;
91429140
entry->cleanup_mode = cleanup_mode;
91439141

91449142
// add the information to the exited ship list
@@ -9289,6 +9287,10 @@ void ship_cleanup(int shipnum, int cleanup_mode)
92899287
// (for exploding ships, this list should have already been cleared by now, via
92909288
// do_dying_undock_physics, except in the case of the destroy-instantly sexp)
92919289
dock_dead_undock_all(objp);
9290+
9291+
// Goober5000 - handle ship registry, part 2
9292+
entry->objnum = -1;
9293+
entry->shipnum = -1;
92929294
}
92939295

92949296
/**

0 commit comments

Comments
 (0)