Changeset 41b87cf22d686eb1fcb3d4b6c7b454a07ebe90a4

Show
Ignore:
Timestamp:
09/07/08 11:16:55 (3 months ago)
Author:
Christopher Jung <bktheg@web.de>
git-committer:
Christopher Jung <bktheg@web.de> 1220779015 +0200
git-parent:

[8da5290caa4ed50d64e7b5eaed5e930e74c14791]

git-author:
Christopher Jung <bktheg@web.de> 1220779015 +0200
Message:

[bug] Sprungantriebe koennen nicht mehr in nicht existierende Systeme springen

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • src/net/driftingsouls/ds2/server/modules/schiffplugins/JumpdriveShivan.java

    re409332 r41b87cf  
    2323 
    2424import net.driftingsouls.ds2.server.Location; 
     25import net.driftingsouls.ds2.server.config.Systems; 
    2526import net.driftingsouls.ds2.server.entities.Jump; 
    2627import net.driftingsouls.ds2.server.framework.templates.TemplateEngine; 
     
    3536 * 
    3637 */ 
    37 public class JumpdriveShivan implements SchiffPlugin { 
    38  
    39         public String action(Parameters caller) { 
     38public class JumpdriveShivan implements SchiffPlugin 
     39
     40 
     41        public String action(Parameters caller) 
     42        { 
    4043                SchiffController controller = caller.controller; 
    4144                Ship ship = caller.ship; 
     
    4851                int system = controller.getInteger("system"); 
    4952                 
    50                 if( ship.getOwner().getId() < 0 ) { 
     53                if( ship.getOwner().getId() < 0 ) 
     54                { 
    5155                        controller.parameterNumber("x"); 
    5256                        controller.parameterNumber("y"); 
     
    5761                         
    5862                         
    59                         if( subaction.equals("set") && (system != 0) && (system < 99) ) { 
     63                        if( subaction.equals("set") && (system != 0) && (system < 99) && (Systems.get().system(system) != null) ) 
     64                        { 
    6065                                final Location targetLoc = new Location(system,x,y); 
    6166                                 
     
    7479                                                .list(); 
    7580                                         
    76                                         for( Iterator iter=sList.iterator(); iter.hasNext(); ) { 
     81                                        for( Iterator iter=sList.iterator(); iter.hasNext(); ) 
     82                                        { 
    7783                                                Ship aship = (Ship)iter.next(); 
    7884                                                 
    7985                                                ShipTypeData st = aship.getTypeData(); 
    80                                                 if( !st.hasFlag(ShipTypes.SF_JUMPDRIVE_SHIVAN) ) { 
     86                                                if( !st.hasFlag(ShipTypes.SF_JUMPDRIVE_SHIVAN) ) 
     87                                                { 
    8188                                                        continue;        
    8289                                                } 
     
    93100                                } 
    94101                        } 
    95                         else if ( subaction.equals("newtarget") && (system != 0) && (system < 99) ) { 
     102                        else if ( subaction.equals("newtarget") && (system != 0) && (system < 99) && (Systems.get().system(system) != null) ) 
     103                        { 
    96104                                Jump jump = (Jump)db.createQuery("from Jump where shipid=?") 
    97105                                        .setEntity(0, ship) 
    98106                                        .uniqueResult(); 
    99107                                 
    100                                 if( jump == null ) { 
     108                                if( jump == null ) 
     109                                { 
    101110                                        return output; 
    102111                                } 
     
    108117                                output += ship.getName()+" &auml;ndert das Sprungziel.<br />\n"; 
    109118                                 
    110                                 if( ship.getFleet() != null ) { 
     119                                if( ship.getFleet() != null ) 
     120                                { 
    111121                                        output += "<table class=\"noBorder\">\n"; 
    112122                 
     
    117127                                                .list(); 
    118128                                         
    119                                         for( Iterator iter=sList.iterator(); iter.hasNext(); ) { 
     129                                        for( Iterator iter=sList.iterator(); iter.hasNext(); ) 
     130                                        { 
    120131                                                Ship aship = (Ship)iter.next(); 
    121132                                         
    122133                                                ShipTypeData st = aship.getTypeData(); 
    123                                                 if( !st.hasFlag(ShipTypes.SF_JUMPDRIVE_SHIVAN) ) { 
     134                                                if( !st.hasFlag(ShipTypes.SF_JUMPDRIVE_SHIVAN) ) 
     135                                                { 
    124136                                                        continue;        
    125137                                                } 
     
    140152                                } 
    141153                        }        
    142                         else if ( subaction.equals("cancel") ) { 
     154                        else if ( subaction.equals("cancel") ) 
     155                        { 
    143156                                Jump jump = (Jump)db.createQuery("from Jump where shipid=?") 
    144157                                        .setEntity(0, ship) 
    145158                                        .uniqueResult(); 
    146159                                 
    147                                 if( jump == null ) { 
     160                                if( jump == null ) 
     161                                { 
    148162                                        return output; 
    149163                                } 
     
    153167                                db.delete(jump); 
    154168                                 
    155                                 if( ship.getFleet() != null ) { 
     169                                if( ship.getFleet() != null ) 
     170                                { 
    156171                                        output += "<table class=\"noBorder\">\n"; 
    157172                 
     
    162177                                                .list(); 
    163178                                         
    164                                         for( Iterator iter=sList.iterator(); iter.hasNext(); ) { 
     179                                        for( Iterator iter=sList.iterator(); iter.hasNext(); ) 
     180                                        { 
    165181                                                Ship aship = (Ship)iter.next(); 
    166182                                                ShipTypeData st = aship.getTypeData(); 
    167                                                 if( !st.hasFlag(ShipTypes.SF_JUMPDRIVE_SHIVAN) ) { 
     183                                                if( !st.hasFlag(ShipTypes.SF_JUMPDRIVE_SHIVAN) ) 
     184                                                { 
    168185                                                        continue;        
    169186                                                } 
     
    186203        } 
    187204 
    188         public void output(Parameters caller) { 
     205        public void output(Parameters caller) 
     206        { 
    189207                SchiffController controller = caller.controller; 
    190208                String pluginid = caller.pluginId;