Commit ab892f2f by 李进峰

所在地点 null repair

parent 572086f9
......@@ -61,12 +61,17 @@ public class GameEnv implements Serializable{
Place place = new Place();
place.setIntro((String)one.get("intro"));
place.setName((String)one.get("name"));
place.setGoFlag((Integer)one.get("goFlag"));
if(((Integer)one.get("goFlag")).equals(new Integer(2))) {
this.placeLinkDirectGo.put(place.getName(), place);
}else if(((Integer)one.get("goFlag")).equals(new Integer(3))) {
this.placeNoLinkDirectGo.put(place.getName(), place);
if(one.get("goFlag")!=null) {
place.setGoFlag((Integer)one.get("goFlag"));
if(((Integer)one.get("goFlag")).equals(new Integer(2))) {
this.placeLinkDirectGo.put(place.getName(), place);
}else if(((Integer)one.get("goFlag")).equals(new Integer(3))) {
this.placeNoLinkDirectGo.put(place.getName(), place);
}
}else {
place.setGoFlag(new Integer(1));
}
List<String> nickname = (List<String>)one.get("nickname");
place.setGoodsInstances(new ArrayList<GoodsInstance>());
place.setNpcInstances(new ArrayList<NpcInstance>());
......@@ -180,15 +185,17 @@ public class GameEnv implements Serializable{
npcInstance.setAttrs(npcInstanceAttrs);
Place place = null;
if(instanceAttrMap.get("所在地点")!=null) {
Map<String, Object> placeMap = (Map<String, Object>)map.get((String)instanceAttrMap.get("所在地点"));
if(placeMap!=null) {
place = placeIndex.get(placeMap.get("name"));
List<NpcInstance> npcInstances = place.getNpcInstances();
if(npcInstances == null) {
npcInstances = new ArrayList<NpcInstance>();
if(!instanceAttrMap.get("所在地点").equals("")) {
Map<String, Object> placeMap = (Map<String, Object>)map.get((String)instanceAttrMap.get("所在地点"));
if(placeMap!=null) {
place = placeIndex.get(placeMap.get("name"));
List<NpcInstance> npcInstances = place.getNpcInstances();
if(npcInstances == null) {
npcInstances = new ArrayList<NpcInstance>();
}
npcInstances.add(npcInstance);
place.setNpcInstances(npcInstances);
}
npcInstances.add(npcInstance);
place.setNpcInstances(npcInstances);
}
}
......@@ -265,26 +272,29 @@ public class GameEnv implements Serializable{
}
goodsInstance.setAttrs(goodsInstanceAttrs);
if(instanceAttrMap.get("所在地点")!=null) {
Map<String, Object> placeMap = (Map<String, Object>)map.get((String)instanceAttrMap.get("所在地点"));
Place place = placeIndex.get(placeMap.get("name"));
goodsInstance.setPlace(place);
List<GoodsInstance> placeGoodsInstances= place.getGoodsInstances();
if(placeGoodsInstances == null) {
placeGoodsInstances = new ArrayList<GoodsInstance>();
if(!instanceAttrMap.get("所在地点").equals("")) {
Map<String, Object> placeMap = (Map<String, Object>)map.get((String)instanceAttrMap.get("所在地点"));
Place place = placeIndex.get(placeMap.get("name"));
goodsInstance.setPlace(place);
List<GoodsInstance> placeGoodsInstances= place.getGoodsInstances();
if(placeGoodsInstances == null) {
placeGoodsInstances = new ArrayList<GoodsInstance>();
}
placeGoodsInstances.add(goodsInstance);
place.setGoodsInstances(placeGoodsInstances);
}
placeGoodsInstances.add(goodsInstance);
place.setGoodsInstances(placeGoodsInstances);
}
if(instanceAttrMap.get("所属角色")!=null){
System.out.println(npcNames.get((String)instanceAttrMap.get("所属角色")));
NpcInstance npc = this.npcInstanceIndex.get(npcNames.get((String)instanceAttrMap.get("所属角色")));
goodsInstance.setNpc(npc);
List<GoodsInstance> npcGoodsInstances = npc.getGoodsInstances();
if(npcGoodsInstances == null) {
npcGoodsInstances = new ArrayList<GoodsInstance>();
if(!instanceAttrMap.get("所属角色").equals("")) {
NpcInstance npc = this.npcInstanceIndex.get(npcNames.get((String)instanceAttrMap.get("所属角色")));
goodsInstance.setNpc(npc);
List<GoodsInstance> npcGoodsInstances = npc.getGoodsInstances();
if(npcGoodsInstances == null) {
npcGoodsInstances = new ArrayList<GoodsInstance>();
}
npcGoodsInstances.add(goodsInstance);
npc.setGoodsInstances(npcGoodsInstances);
}
npcGoodsInstances.add(goodsInstance);
npc.setGoodsInstances(npcGoodsInstances);
}
// if(instanceAttrMap.get("placeId")!=null) {
// Map<String, Object> placeMap = (Map<String, Object>)map.get(String.valueOf(instanceAttrMap.get("placeId")));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment