コード例 #1
0
 public static void merge(
     final LayerVisibility v1,
     final LayerVisibility v2,
     final TShortObjectHashMap<short[]> layerByGroups) {
   for (int i = 0; i < v1.size(); ++i) {
     final short[] layers = v1.getQuickValue(i);
     if (Arrays.binarySearch(layers, (short) 0) >= 0) {
       final short layer = v1.getQuickKey(i);
       final TShortHashSet set = new TShortHashSet(layerByGroups.get(layer));
       set.addAll(v2.getVisibleFromOutdoor());
       final short[] added = set.toArray();
       Arrays.sort(added);
       layerByGroups.put(layer, added);
     }
   }
 }
コード例 #2
0
 private void mergeVisibility(
     final THashMap<AbstractBuildingStruct, LayerVisibility> transformed,
     final TShortObjectHashMap<short[]> layerByGroups) {
   final ArrayList<AbstractBuildingStruct> buildings = new ArrayList<AbstractBuildingStruct>();
   this.m_havenWorld.foreachBuildings(
       new TObjectProcedure<AbstractBuildingStruct>() {
         @Override
         public boolean execute(final AbstractBuildingStruct building) {
           buildings.add(building);
           return true;
         }
       });
   for (final AbstractBuildingStruct b1 : buildings) {
     for (final AbstractBuildingStruct b2 : buildings) {
       if (b1 == b2) {
         continue;
       }
       final LayerVisibility visibility1 = transformed.get(b1);
       final LayerVisibility visibility2 = transformed.get(b2);
       LayerVisibility.merge(visibility1, visibility2, layerByGroups);
     }
   }
 }