Fixed duplicate id issue(workaround) should fix some of the crashing, disabled vehicles for now(causing crashes), disabled some of the getObject spam

This commit is contained in:
Light2
2014-06-18 22:50:48 +02:00
parent e862a86345
commit 4f76d6593b
4 changed files with 15 additions and 8 deletions
+1 -3
View File
@@ -91,9 +91,7 @@ public class DevService implements INetworkDispatch {
if (creature.getClient().isGM()) {
suiOptions.put((long) 120, "House Deeds");
suiOptions.put((long) 125, "Crafting Tools");
}
suiOptions.put((long) 130, "Vehicle Deeds");
if (creature.getClient().isGM()) {
suiOptions.put((long) 130, "Vehicle Deeds");
suiOptions.put((long) 121, "Sandbox City");
if(creature.getPlayerObject().getProfession().equals("trader_0a") || creature.getPlayerObject().getProfession().equals("trader_0b") || creature.getPlayerObject().getProfession().equals("trader_0c") || creature.getPlayerObject().getProfession().equals("trader_0d"))
suiOptions.put((long) 177, "REing");
+2 -2
View File
@@ -200,8 +200,8 @@ public class PlayerService implements INetworkDispatch {
long[] ids = creature.getAwareObjects().stream().mapToLong(SWGObject::getObjectID).toArray();
for(int i = 0; i < ids.length; i++) {
for(int j = 0; j < ids.length; j++) {
if(ids[i] == ids[j] && i != j)
System.err.println("Detected duplicate ids");
if(ids[i] == ids[j] && i != j)
System.err.println("Detected duplicate ids, Template " + core.objectService.getObject(ids[i]).getTemplate());
}
}
}, 0, 5000, TimeUnit.MILLISECONDS));
+2 -2
View File
@@ -138,8 +138,8 @@ public class StaticService implements INetworkDispatch {
cellNumber = ((BuildingObject) cell.getContainer()).getCellNumberByObjectId(cellId);
}
long objectId = core.objectService.getDOId(planetName, template, 0, buildingId, cellNumber, x, y, z);
//long objectId = core.objectService.getDOId(planetName, template, 0, buildingId, cellNumber, x, y, z);
long objectId = 0;
SWGObject object = null;
MobileTemplate mobileTemplate = core.spawnService.getMobileTemplate(template);
+10 -1
View File
@@ -239,6 +239,15 @@ public class ObjectService implements INetworkDispatch {
boolean isSnapshot = false;
if(objectID != 0 && objectList.containsKey(objectID)) {
System.err.println("Trying to create object with duplicate Id");
try {
throw new Exception();
} catch(Exception e) {
e.printStackTrace();
}
}
if(objectID == 0)
objectID = generateObjectID();
else
@@ -472,7 +481,7 @@ public class ObjectService implements INetworkDispatch {
if (objectList.containsKey(objectID)) {
System.err.println("getObject(): object is null but objectList contains objectID key");
} else {
System.err.println("getObject(): object is null");
//System.err.println("getObject(): object is null");
}
}