Skip to content

Commit 4901561

Browse files
authored
Merge pull request tonihele#488 from tonihele/bugfix/room_owner_fix
Take room owner from the room itself, not from the obsoletish roomins…
2 parents cf66038 + ed32a0f commit 4901561

File tree

5 files changed

+8
-8
lines changed

5 files changed

+8
-8
lines changed

src/toniarts/openkeeper/game/controller/room/storage/RoomGoldControl.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ private int putGold(int sum, Point p) {
8686

8787
// Add the visuals
8888
if (goldPile == null) {
89-
EntityId entityId = objectsController.addRoomGold(parent.getRoomInstance().getOwnerId(), p.x, p.y, pointStoredGold, getGoldPerObject());
89+
EntityId entityId = objectsController.addRoomGold(parent.getOwnerId(), p.x, p.y, pointStoredGold, getGoldPerObject());
9090
if (goldPiles == null) {
9191
goldPiles = new ArrayList<>(1);
9292
}
@@ -127,7 +127,7 @@ public void destroy() {
127127
// Create the loose gold
128128
if (!storedGoldList.isEmpty()) {
129129
for (Entry<Point, Integer> entry : storedGoldList.entrySet()) {
130-
objectsController.addLooseGold(parent.getRoomInstance().getOwnerId(), entry.getKey().x, entry.getKey().y, entry.getValue(), getGoldPerObject());
130+
objectsController.addLooseGold(parent.getOwnerId(), entry.getKey().x, entry.getKey().y, entry.getValue(), getGoldPerObject());
131131
}
132132
}
133133
}

src/toniarts/openkeeper/game/logic/ChickenSpawnSystem.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -151,9 +151,9 @@ private void evaluateAndSpawnCreature(IChickenGenerator entrance, double gameTim
151151

152152
// Spawn chicken
153153
Point entranceCoordinate = entrance.getEntranceCoordinate();
154-
entityId = objectsController.spawnChicken(entrance.getRoomInstance().getOwnerId(), WorldUtils.pointToVector3f(entranceCoordinate));
154+
entityId = objectsController.spawnChicken(entrance.getOwnerId(), WorldUtils.pointToVector3f(entranceCoordinate));
155155
spawned = true;
156-
} else if (freeRangeChickensByPlayer.get(entrance.getRoomInstance().getOwnerId()).size() < maximumFreerangeChickenCount && freerangeChickenGeneratorsByRoom.get(entrance) != null) {
156+
} else if (freeRangeChickensByPlayer.get(entrance.getOwnerId()).size() < maximumFreerangeChickenCount && freerangeChickenGeneratorsByRoom.get(entrance) != null) {
157157
Set<EntityId> generators = freerangeChickenGeneratorsByRoom.get(entrance);
158158
Optional<EntityId> generator = Utils.getRandomItem(generators);
159159
if (generator.isPresent()) {
@@ -162,7 +162,7 @@ private void evaluateAndSpawnCreature(IChickenGenerator entrance, double gameTim
162162
// Don't give the entity ID, it is not added to room inventory
163163
// TODO: Need to have the generator IN USE component etc. This goes for all the objects, how we use them
164164
Position position = entityData.getComponent(generator.get(), Position.class);
165-
objectsController.spawnFreerangeChicken(entrance.getRoomInstance().getOwnerId(), position.position.clone(), gameTime);
165+
objectsController.spawnFreerangeChicken(entrance.getOwnerId(), position.position.clone(), gameTime);
166166
spawned = true;
167167
}
168168
}

src/toniarts/openkeeper/game/logic/CreatureSpawnSystem.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ private void evaluateAndSpawnCreature(ICreatureEntrance entrance, double gameTim
119119
}
120120

121121
double timeSinceLastSpawn = gameTime - entrance.getLastSpawnTime();
122-
IPlayerController player = playerControllersById.get(entrance.getRoomInstance().getOwnerId());
122+
IPlayerController player = playerControllersById.get(entrance.getOwnerId());
123123
boolean spawned = false;
124124
EntityId entityId = null;
125125
if (timeSinceLastSpawn >= freeImpCoolDownTime && entrance.isDungeonHeart()) {

src/toniarts/openkeeper/game/logic/LooseObjectSystem.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ public void processTick(float tpf, double gameTime) {
103103
IRoomController roomController = mapController.getRoomControllerByCoordinates(point);
104104
ObjectComponent objectComponent = entity.get(ObjectComponent.class);
105105
if (roomController != null && objectComponent.objectType != null && roomController.hasObjectControl(objectComponent.objectType) && !roomController.getObjectControl(objectComponent.objectType).isFullCapacity()) {
106-
short ownerId = roomController.getRoomInstance().getOwnerId();
106+
short ownerId = roomController.getOwnerId();
107107
if (objectComponent.objectType == AbstractRoomController.ObjectType.GOLD) {
108108
synchronized (GameWorldController.GOLD_LOCK) {
109109
Gold gold = entityData.getComponent(entityId, Gold.class);

src/toniarts/openkeeper/game/task/AbstractRoomTask.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ protected IRoomController getRoom() {
4747
public boolean isValid(ICreatureController creature) {
4848

4949
// See that the room exists and has capacity etc.
50-
return room.getRoomInstance().getOwnerId() == playerId && !room.isDestroyed() && !getRoomObjectControl().isFullCapacity();
50+
return room.getOwnerId() == playerId && !room.isDestroyed() && !getRoomObjectControl().isFullCapacity();
5151
}
5252

5353
protected abstract ObjectType getRoomObjectType();

0 commit comments

Comments
 (0)