Core/Housing: stage 25 professionalize room removal persistence comments
This commit is contained in:
@@ -181,9 +181,9 @@ namespace Housing
|
||||
if (loadResult != Result::Success)
|
||||
return loadResult;
|
||||
|
||||
// Stage 14 resolves every surviving side before opening the delete
|
||||
// transaction. If a bidirectional edge or its verified visual pair is
|
||||
// malformed, fail closed and leave the complete persisted graph untouched.
|
||||
// Resolve every surviving side before opening the delete transaction. If a
|
||||
// bidirectional edge or its verified visual pair is malformed, fail closed and
|
||||
// leave the complete persisted graph untouched.
|
||||
RoomRemovalConnectionPlan connectionPlan;
|
||||
if (!sHousingRoomRemovalService.Prepare(player, state, connectionPlan))
|
||||
{
|
||||
@@ -212,12 +212,12 @@ namespace Housing
|
||||
houseGuid, persistedRoomGuid, SafetyMaxPlacedDecorPerHouse + 1),
|
||||
SafetyMaxPlacedDecorPerHouse, childEntityGuids);
|
||||
|
||||
CharacterDatabaseTransaction trans = CharacterDatabase.BeginTransaction();
|
||||
CharacterDatabaseTransaction transaction = CharacterDatabase.BeginTransaction();
|
||||
|
||||
// Restore every surviving doorway wall and delete both directions of each
|
||||
// Room connection in this same transaction. No intermediate database state
|
||||
// can commit with a deleted Room and a neighbor still pointing at its GUID.
|
||||
if (!sHousingRoomRemovalService.AppendPersistence(trans, connectionPlan))
|
||||
if (!sHousingRoomRemovalService.AppendPersistence(transaction, connectionPlan))
|
||||
{
|
||||
TC_LOG_ERROR("housing", "Room REMOVE failed to append safe connection cleanup for room {}",
|
||||
state.RoomGuid.ToString());
|
||||
@@ -226,21 +226,21 @@ namespace Housing
|
||||
|
||||
// Room removal must never destroy owned decor. Return every decor instance
|
||||
// placed in this room to storage before removing the placement rows.
|
||||
trans->PAppend(
|
||||
transaction->PAppend(
|
||||
"UPDATE housing_decor_instance i INNER JOIN housing_placed_decor p ON p.DecorGuid = i.DecorGuid "
|
||||
"SET i.HouseGuid = '', i.PlacementStatus = 0 "
|
||||
"WHERE p.HouseGuid = '{}' AND p.RoomGuid = '{}'",
|
||||
houseGuid, persistedRoomGuid);
|
||||
trans->PAppend(
|
||||
transaction->PAppend(
|
||||
"DELETE FROM housing_placed_decor WHERE HouseGuid = '{}' AND RoomGuid = '{}'",
|
||||
houseGuid, persistedRoomGuid);
|
||||
trans->PAppend(
|
||||
transaction->PAppend(
|
||||
"DELETE FROM housing_room_component_entity WHERE HouseGuid = '{}' AND RoomGuid = '{}'",
|
||||
houseGuid, persistedRoomGuid);
|
||||
trans->PAppend(
|
||||
transaction->PAppend(
|
||||
"DELETE FROM housing_room_entity WHERE HouseGuid = '{}' AND RoomGuid = '{}'",
|
||||
houseGuid, persistedRoomGuid);
|
||||
CharacterDatabase.DirectCommitTransaction(trans);
|
||||
CharacterDatabase.DirectCommitTransaction(transaction);
|
||||
|
||||
// Persistence is now authoritative. Synchronize surviving live Rooms before
|
||||
// the packet handler despawns children/parent of the removed Room. This sends
|
||||
|
||||
Reference in New Issue
Block a user