Changeset 741742de22a86c1b2732bd7d4c3e76ec274c34a6

Show
Ignore:
Timestamp:
01/01/08 11:52:07 (11 months ago)
Author:
Christopher Jung <bktheg@web.de>
git-committer:
Christopher Jung <bktheg@web.de> 1199184727 +0100
git-parent:

[678b16a15b56fc4c1b3237d8eceb3250b0e873a9]

git-author:
Christopher Jung <bktheg@web.de> 1199184727 +0100
Message:

ModuleSlots? wirft nun eine NoSuchSlotException? falls ein ungueltiger Slottyp abgerufen wird

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • src/net/driftingsouls/ds2/server/config/IEModule.java

    r087498f r741742d  
    7777                for( int i=0, length=nodes.getLength(); i < length; i++ ) { 
    7878                        final String slot = XMLUtils.getStringAttribute(nodes.item(i), "id"); 
    79                         if( ModuleSlots.get().slot(slot) == null ) { 
    80                                 throw new Exception("Item-Effekt Modul: Ungueltige Slot-ID '"+slot+"'"); 
    81                         } 
     79                         
     80                        // Sicherstellen, dass der Slot existiert 
     81                        // sonst -> NoSuchSlotException 
     82                        ModuleSlots.get().slot(slot); 
     83                         
    8284                        slots.add(slot); 
    8385                } 
  • src/net/driftingsouls/ds2/server/config/ModuleSlots.java

    r283e6c7 r741742d  
    7070         * @param id Die ID des gewuenschten Modul-Slots 
    7171         * @return Der Modul-Slot oder <code>null</code> 
     72         * @throws NoSuchSlotException Falls der angeforderte Slottyp nicht existiert 
    7273         */ 
    73         public ModuleSlot slot( String id ) { 
     74        public ModuleSlot slot( String id ) throws NoSuchSlotException { 
     75                if( !list.containsKey(id) ) { 
     76                        throw new NoSuchSlotException(id); 
     77                } 
    7478                return list.get(id); 
    7579        } 
  • src/net/driftingsouls/ds2/server/modules/ItemInfoController.java

    r953ed23 r741742d  
    4141import net.driftingsouls.ds2.server.config.Items; 
    4242import net.driftingsouls.ds2.server.config.ModuleSlots; 
     43import net.driftingsouls.ds2.server.config.NoSuchSlotException; 
    4344import net.driftingsouls.ds2.server.config.Rassen; 
    4445import net.driftingsouls.ds2.server.config.Weapon; 
     
    474475                                        targetslots.append(", ");        
    475476                                } 
    476                                 if( ModuleSlots.get().slot(aslot) != null )
     477                                try
    477478                                        targetslots.append(ModuleSlots.get().slot(aslot).getName()); 
     479                                } 
     480                                catch( NoSuchSlotException e ) { 
     481                                        targetslots.append("Ungueltiger Slot '"+aslot+"'"); 
    478482                                } 
    479483                        } 
  • src/net/driftingsouls/ds2/server/modules/SchiffInfoController.java

    r327b751 r741742d  
    2727import net.driftingsouls.ds2.server.cargo.Resources; 
    2828import net.driftingsouls.ds2.server.config.ModuleSlots; 
     29import net.driftingsouls.ds2.server.config.NoSuchSlotException; 
    2930import net.driftingsouls.ds2.server.config.NoSuchWeaponException; 
    3031import net.driftingsouls.ds2.server.config.Rassen; 
     
    357358                        for( int i=0; i < modulelist.length; i++ ) { 
    358359                                String[] amodule = StringUtils.split(modulelist[i],':'); 
    359                                 if( ModuleSlots.get().slot(amodule[1]) != null )
     360                                try
    360361                                        moduletooltip.append(ModuleSlots.get().slot(amodule[1]).getName()); 
    361362                                        moduletooltip.append("<br />"); 
    362363                                } 
    363                                 else
     364                                catch( NoSuchSlotException e )
    364365                                        moduletooltip.append("<span style='color:red'>UNGUELTIGER SLOTTYP "); 
    365366                                        moduletooltip.append(amodule[1]);