Create player buildings in memory with a single DB write
Building gets a no-arg constructor, a createBuilding factory (in the style of Mob.createMob) and persistBuilding, which inserts the row through building_CREATE, sets the returned UID, caches the object and runs runAfterLoad. The GET_BUILDINGBYUUID re-select after the insert is gone. PlaceAssetMsgHandler (createStructure, createBarracks, createWarehouse), Bane and AddBuildingCmd move onto it. Value changes: - floor/level start at -1 and the other unset fields at the obj_building column defaults, same as the reloaded row. - upgradeDateTime keeps milliseconds instead of the DATETIME-rounded value (sub-second difference in the upgrade job time). - Warehouse placement no longer runs runAfterLoad twice, which submitted the warehouse upgrade job twice. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
15437246ce
commit
d586536c74
5 files changed
+120
-18
No files matched your search
@@ -90,11 +90,10 @@ public class AddBuildingCmd extends AbstractDevCmd {
|
||||
blueprintUUID = blueprint.getBlueprintUUID();
|
||||
}
|
||||
|
||||
Building building = DbManager.BuildingQueries.
|
||||
CREATE_BUILDING(
|
||||
zone.getObjectUUID(), 0, buildingName, ID,
|
||||
localLoc, 1.0f, 0, ProtectionState.PROTECTED, 0, rank,
|
||||
null, blueprintUUID, w, rot.y);
|
||||
Building building = Building.persistBuilding(Building.createBuilding(
|
||||
zone, 0, buildingName, ID,
|
||||
localLoc, 1.0f, 0, ProtectionState.PROTECTED, 0, rank,
|
||||
null, blueprintUUID, w, rot.y));
|
||||
|
||||
|
||||
if (building == null) {
|
||||
|
||||
Reference in new issue
Block a user