Changeset 144f38e652b3cb03a9e5d3030e748cfdcab97870

Show
Ignore:
Timestamp:
10/20/07 13:41:52 (10 months ago)
Author:
Christopher Jung <bktheg@web.de>
git-committer:
Christopher Jung <bktheg@web.de> 1192880512 +0200
git-parent:

[eced142f5b156696231a4ed3dcb315ee38937303]

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

Foreign Key fuer Ships.battle eingebaut

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • db/tables/ships.sql

    r390f9f1 r144f38e  
    2828  `destcom` text NOT NULL default '', 
    2929  `bookmark` tinyint(1) unsigned NOT NULL default '0', 
    30   `battle` int(11) NOT NULL default '0'
     30  `battle` smallint(5) unsigned
    3131  `battleAction` tinyint(1) unsigned NOT NULL default '0', 
    3232  `jumptarget` varchar(100) NOT NULL default '', 
     
    5555ALTER TABLE ships ADD CONSTRAINT ships_type_fk FOREIGN KEY (type) REFERENCES ship_types(id); 
    5656ALTER TABLE ships ADD CONSTRAINT ships_fk_ship_fleets FOREIGN KEY (fleet) REFERENCES ship_fleets(id); 
     57ALTER TABLE ships ADD CONSTRAINT ships_fk_battles FOREIGN KEY (battle) REFERENCES battles(id); 
    5758 
    58 INSERT INTO `ships` (`id`, `owner`, `name`, `type`, `cargo`, `x`, `y`, `system`, `status`, `crew`, `e`, `s`, `hull`, `shields`, `heat`, `engine`, `weapons`, `comm`, `sensors`, `docked`, `alarm`, `fleet`, `destsystem`, `destx`, `desty`, `destcom`, `bookmark`, `battle`, `battleAction`, `jumptarget`, `autodeut`, `history`, `script`, `scriptexedata`, `oncommunicate`, `lock`, `visibility`, `onmove`, `respawn`) VALUES (2, -1, 'Frachter', 27, '0,0,0,0,50,0,0,0,0,0,0,0,0,0,0,0,0,0,', 1, 1, 0, 'noconsign', 50, 80, 0, 5000, 0, '', 100, 100, 100, 100, '', 0, null, 0, 0, 0, '', 0, 0, 0, '', 1, '', NULL, NULL, NULL, NULL, NULL, NULL, NULL); 
    59 INSERT INTO `ships` (`id`, `owner`, `name`, `type`, `cargo`, `x`, `y`, `system`, `status`, `crew`, `e`, `s`, `hull`, `shields`, `heat`, `engine`, `weapons`, `comm`, `sensors`, `docked`, `alarm`, `fleet`, `destsystem`, `destx`, `desty`, `destcom`, `bookmark`, `battle`, `battleAction`, `jumptarget`, `autodeut`, `history`, `script`, `scriptexedata`, `oncommunicate`, `lock`, `visibility`, `onmove`, `respawn`) VALUES (3, -1, 'Tanker', 2, '0,300,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,', 1, 2, 0, 'noconsign', 30, 40, 0, 10000, 0, '', 100, 100, 100, 100, '', 0, null, 0, 0, 0, '', 0, 0, 0, '', 1, '', NULL, NULL, NULL, NULL, NULL, NULL, NULL); 
    60 INSERT INTO `ships` (`id`, `owner`, `name`, `type`, `cargo`, `x`, `y`, `system`, `status`, `crew`, `e`, `s`, `hull`, `shields`, `heat`, `engine`, `weapons`, `comm`, `sensors`, `docked`, `alarm`, `fleet`, `destsystem`, `destx`, `desty`, `destcom`, `bookmark`, `battle`, `battleAction`, `jumptarget`, `autodeut`, `history`, `script`, `scriptexedata`, `oncommunicate`, `lock`, `visibility`, `onmove`, `respawn`) VALUES (5, -1, 'Frachter', 31, '0,60,0,0,50,0,0,0,0,0,0,0,0,0,0,0,0,0,', 2, 1, 0, 'noconsign', 30, 80, 0, 8500, 0, '', 100, 100, 100, 100, '', 0, null, 0, 0, 0, '', 0, 0, 0, '', 1, '', NULL, NULL, NULL, NULL, NULL, NULL, NULL); 
    61 INSERT INTO `ships` (`id`, `owner`, `name`, `type`, `cargo`, `x`, `y`, `system`, `status`, `crew`, `e`, `s`, `hull`, `shields`, `heat`, `engine`, `weapons`, `comm`, `sensors`, `docked`, `alarm`, `fleet`, `destsystem`, `destx`, `desty`, `destcom`, `bookmark`, `battle`, `battleAction`, `jumptarget`, `autodeut`, `history`, `script`, `scriptexedata`, `oncommunicate`, `lock`, `visibility`, `onmove`, `respawn`) VALUES (6, -1, 'Tanker', 30, '0,240,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,', 2, 2, 0, 'noconsign', 30, 50, 0, 4000, 0, '', 100, 100, 100, 100, '', 0, null, 0, 0, 0, '', 0, 0, 0, '', 1, '', NULL, NULL, NULL, NULL, NULL, NULL, NULL); 
    62 INSERT INTO `ships` (`id`, `owner`, `name`, `type`, `cargo`, `x`, `y`, `system`, `status`, `crew`, `e`, `s`, `hull`, `shields`, `heat`, `engine`, `weapons`, `comm`, `sensors`, `docked`, `alarm`, `fleet`, `destsystem`, `destx`, `desty`, `destcom`, `bookmark`, `battle`, `battleAction`, `jumptarget`, `autodeut`, `history`, `script`, `scriptexedata`, `oncommunicate`, `lock`, `visibility`, `onmove`, `respawn`) VALUES (666, -2, 'GTU Handelsposten Delta Serpentis', 10, '0,2000,0,0,500,2000,0,0,0,0,0,0,5000,0,0,0,0,0,300|10|0|0;301|3|0|0;325|3|0|0;326|3|0|0;161|500|0|0;170|500|0|0;150|500|0|0;154|500|0|0;172|500|0|0', 75, 75, 1, 'tradepost nocrew', 0, 4700, 0, 100000, 0, '', 100, 100, 100, 100, '', 0, null, 0, 0, 0, '', 0, 0, 0, '2:150/150', 1, '', NULL, NULL, '*:26:0', NULL, NULL, NULL, NULL); 
     59INSERT INTO `ships` (`id`, `owner`, `name`, `type`, `cargo`, `x`, `y`, `system`, `status`, `crew`, `e`, `s`, `hull`, `shields`, `heat`, `engine`, `weapons`, `comm`, `sensors`, `docked`, `alarm`, `fleet`, `destsystem`, `destx`, `desty`, `destcom`, `bookmark`, `battle`, `battleAction`, `jumptarget`, `autodeut`, `history`, `script`, `scriptexedata`, `oncommunicate`, `lock`, `visibility`, `onmove`, `respawn`) VALUES (2, -1, 'Frachter', 27, '0,0,0,0,50,0,0,0,0,0,0,0,0,0,0,0,0,0,', 1, 1, 0, 'noconsign', 50, 80, 0, 5000, 0, '', 100, 100, 100, 100, '', 0, null, 0, 0, 0, '', 0, null, 0, '', 1, '', NULL, NULL, NULL, NULL, NULL, NULL, NULL); 
     60INSERT INTO `ships` (`id`, `owner`, `name`, `type`, `cargo`, `x`, `y`, `system`, `status`, `crew`, `e`, `s`, `hull`, `shields`, `heat`, `engine`, `weapons`, `comm`, `sensors`, `docked`, `alarm`, `fleet`, `destsystem`, `destx`, `desty`, `destcom`, `bookmark`, `battle`, `battleAction`, `jumptarget`, `autodeut`, `history`, `script`, `scriptexedata`, `oncommunicate`, `lock`, `visibility`, `onmove`, `respawn`) VALUES (3, -1, 'Tanker', 2, '0,300,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,', 1, 2, 0, 'noconsign', 30, 40, 0, 10000, 0, '', 100, 100, 100, 100, '', 0, null, 0, 0, 0, '', 0, null, 0, '', 1, '', NULL, NULL, NULL, NULL, NULL, NULL, NULL); 
     61INSERT INTO `ships` (`id`, `owner`, `name`, `type`, `cargo`, `x`, `y`, `system`, `status`, `crew`, `e`, `s`, `hull`, `shields`, `heat`, `engine`, `weapons`, `comm`, `sensors`, `docked`, `alarm`, `fleet`, `destsystem`, `destx`, `desty`, `destcom`, `bookmark`, `battle`, `battleAction`, `jumptarget`, `autodeut`, `history`, `script`, `scriptexedata`, `oncommunicate`, `lock`, `visibility`, `onmove`, `respawn`) VALUES (5, -1, 'Frachter', 31, '0,60,0,0,50,0,0,0,0,0,0,0,0,0,0,0,0,0,', 2, 1, 0, 'noconsign', 30, 80, 0, 8500, 0, '', 100, 100, 100, 100, '', 0, null, 0, 0, 0, '', 0, null, 0, '', 1, '', NULL, NULL, NULL, NULL, NULL, NULL, NULL); 
     62INSERT INTO `ships` (`id`, `owner`, `name`, `type`, `cargo`, `x`, `y`, `system`, `status`, `crew`, `e`, `s`, `hull`, `shields`, `heat`, `engine`, `weapons`, `comm`, `sensors`, `docked`, `alarm`, `fleet`, `destsystem`, `destx`, `desty`, `destcom`, `bookmark`, `battle`, `battleAction`, `jumptarget`, `autodeut`, `history`, `script`, `scriptexedata`, `oncommunicate`, `lock`, `visibility`, `onmove`, `respawn`) VALUES (6, -1, 'Tanker', 30, '0,240,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,', 2, 2, 0, 'noconsign', 30, 50, 0, 4000, 0, '', 100, 100, 100, 100, '', 0, null, 0, 0, 0, '', 0, null, 0, '', 1, '', NULL, NULL, NULL, NULL, NULL, NULL, NULL); 
     63INSERT INTO `ships` (`id`, `owner`, `name`, `type`, `cargo`, `x`, `y`, `system`, `status`, `crew`, `e`, `s`, `hull`, `shields`, `heat`, `engine`, `weapons`, `comm`, `sensors`, `docked`, `alarm`, `fleet`, `destsystem`, `destx`, `desty`, `destcom`, `bookmark`, `battle`, `battleAction`, `jumptarget`, `autodeut`, `history`, `script`, `scriptexedata`, `oncommunicate`, `lock`, `visibility`, `onmove`, `respawn`) VALUES (666, -2, 'GTU Handelsposten Delta Serpentis', 10, '0,2000,0,0,500,2000,0,0,0,0,0,0,5000,0,0,0,0,0,300|10|0|0;301|3|0|0;325|3|0|0;326|3|0|0;161|500|0|0;170|500|0|0;150|500|0|0;154|500|0|0;172|500|0|0', 75, 75, 1, 'tradepost nocrew', 0, 4700, 0, 100000, 0, '', 100, 100, 100, 100, '', 0, null, 0, 0, 0, '', 0, null, 0, '2:150/150', 1, '', NULL, NULL, '*:26:0', NULL, NULL, NULL, NULL); 
  • db/updates.xml

    r99f84cc r144f38e  
    415415                ALTER TABLE `werft_queues` DROP INDEX `queueentry`; 
    416416        ]]></update> 
     417        <update type="structure" datum="2007-10-20"><![CDATA[ 
     418                ALTER TABLE `ships` CHANGE `battle` `battle` SMALLINT UNSIGNED NULL DEFAULT NULL; 
     419                UPDATE ships SET battle=NULL WHERE battle=0; 
     420                ALTER TABLE ships ADD CONSTRAINT ships_fk_battles FOREIGN KEY (battle) REFERENCES battles(id); 
     421        ]]></update> 
    417422</updates> 
  • src/net/driftingsouls/ds2/server/bases/Kommandozentrale.java

    rfc49840 r144f38e  
    390390                                        "where id>0 and (x between :minx and :maxx) and " + 
    391391                                                        "(y between :miny and :maxy) and " + 
    392                                                         "system= :sys and locate('l ',docked)=0 and battle=0 " + 
     392                                                        "system= :sys and locate('l ',docked)=0 and battle is null " + 
    393393                                        "order by x,y,owner,id") 
    394394                                .setInteger("minx", base.getX()-base.getSize()) 
  • src/net/driftingsouls/ds2/server/battles/Battle.java

    reced142 r144f38e  
    780780                List shiplist = db.createQuery("from Ship as s inner join fetch s.owner as u "+ 
    781781                                "where s.id>0 and s.x=? and s.y=? and " + 
    782                                 "s.system=? and s.battle=0 and " + 
     782                                "s.system=? and s.battle is null and " + 
    783783                                "(ncp(u.ally,:ally1)=1 or " +  
    784784                                "ncp(u.ally,:ally2)=1) and " + 
     
    10841084                        return false; 
    10851085                } 
    1086                 if( shipd.getBattle() != 0 ) { 
     1086                if( shipd.getBattle() != null ) { 
    10871087                        context.addError("Das angegebene Schiff befindet sich bereits in einer Schlacht!"); 
    10881088                        return false; 
     
    11631163                // Handelt es sich um eine Flotte? 
    11641164                if( shipd.getFleet() != null ) { 
    1165                         sid = db.createQuery("from Ship as s where s.id>0 and s.fleet=? and s.battle=0 and s.x=? and s.y=? and s.system=? and s.lock is null") 
     1165                        sid = db.createQuery("from Ship as s where s.id>0 and s.fleet=? and s.battle is null and s.x=? and s.y=? and s.system=? and s.lock is null") 
    11661166                                        .setEntity(0, shipd.getFleet()) 
    11671167                                        .setInteger(1, shipd.getX()) 
     
    11711171                } 
    11721172                else { 
    1173                         sid = db.createQuery("from Ship as s where s.id>0 and s.id=? and s.battle=0 and s.x=? and s.y=? and s.system=? and s.lock is null") 
     1173                        sid = db.createQuery("from Ship as s where s.id>0 and s.id=? and s.battle is null and s.x=? and s.y=? and s.system=? and s.lock is null") 
    11741174                                        .setInteger(0, shipd.getId()) 
    11751175                                        .setInteger(1, shipd.getX()) 
     
    11901190                                 
    11911191                        // ggf. gedockte Schiffe auch beruecksichtigen 
    1192                         List docked = db.createQuery("from Ship where id>0 and battle=0 and docked in (?,?)") 
     1192                        List docked = db.createQuery("from Ship where id>0 and battle is null and docked in (?,?)") 
    11931193                                .setString(0, Integer.toString(aship.getId())) 
    11941194                                .setString(1, "l "+aship.getId()) 
     
    12871287         
    12881288                if( battledata.isEmpty() ) { 
    1289                         db.createQuery("update Ship set battle=0 where id>0 and battle=?") 
     1289                        db.createQuery("update Ship set battle=null where id>0 and battle=?") 
    12901290                                .setInteger(0, battleID) 
    12911291                                .executeUpdate(); 
     
    13701370                                                long shipcount = ((Number)db.createQuery("select count(*) from Ship " + 
    13711371                                                                "where owner= :user and x= :x and y= :y and system= :sys and " + 
    1372                                                                         "battle=0 and shiptype.shipClass in (11,13)") 
     1372                                                                        "battle is null and shiptype.shipClass in (11,13)") 
    13731373                                                                .setEntity("user", auser) 
    13741374                                                                .setInteger("x", this.x) 
     
    18771877                        .setInteger(0, this.id) 
    18781878                        .executeUpdate(); 
    1879                 db.createQuery("update Ship set battle=0,battleAction=0 where id>0 and battle=?") 
     1879                db.createQuery("update Ship set battle=null,battleAction=0 where id>0 and battle=?") 
    18801880                        .setInteger(0, this.id) 
    18811881                        .executeUpdate(); 
     
    18881888                new File(Configuration.getSetting("LOXPATH")+"battles/battle_id"+this.id+".log").renameTo(new File(newlog)); 
    18891889                 
    1890                 db.createQuery("update ShipLost set battle=0,battleLog=? where battle=?") 
     1890                db.createQuery("update ShipLost set battle=null,battleLog=? where battle=?") 
    18911891                        .setString(0, newlog) 
    18921892                        .setInteger(1, this.id) 
     
    20102010                } 
    20112011 
    2012                 if( ship.getShip().getBattle() == 0 ) { 
     2012                if( ship.getShip().getBattle() == null ) { 
    20132013                        // Es kann vorkommen, dass das Schiff bereits entfernt wurde (wegen einer dock-Beziehung) 
    20142014                        return; 
     
    20472047                        .iterate().next(); 
    20482048                 
    2049                 ship.getShip().setBattle(0); 
     2049                ship.getShip().setBattle(null); 
    20502050                ship.getShip().setX(loc.getX()); 
    20512051                ship.getShip().setY(loc.getY()); 
     
    20832083                                dockcount--; 
    20842084                                 
    2085                                 aship.getShip().setBattle(0); 
     2085                                aship.getShip().setBattle(null); 
    20862086                                aship.getShip().setBattleAction(false); 
    20872087                                aship.getShip().setX(loc.getX()); 
  • src/net/driftingsouls/ds2/server/modules/FleetMgntController.java

    r734a9da r144f38e  
    520520                        List<Integer> idlist = new ArrayList<Integer>(); 
    521521                         
    522                         List shiplist = db.createQuery("from Ship where fleet=? and battle=0" ) 
     522                        List shiplist = db.createQuery("from Ship where fleet=? and battle is null" ) 
    523523                                .setInteger(0, this.fleet.getId()) 
    524524                                .list(); 
     
    571571                StringBuilder message = new StringBuilder(100); 
    572572                 
    573                 List ships = db.createQuery("from Ship as s where s.fleet=? and (s.shields < s.shiptype.shields or s.shields < s.modules.shields) and s.battle=0") 
     573                List ships = db.createQuery("from Ship as s where s.fleet=? and (s.shields < s.shiptype.shields or s.shields < s.modules.shields) and s.battle is null") 
    574574                        .setEntity(0, this.fleet) 
    575575                        .list(); 
     
    612612                StringBuilder message = new StringBuilder(100); 
    613613                 
    614                 List ships = db.createQuery("from Ship as s WHERE s.fleet=? and (s.energy < s.shiptype.eps or s.eps < s.modules.eps) and s.battle=0") 
     614                List ships = db.createQuery("from Ship as s WHERE s.fleet=? and (s.energy < s.shiptype.eps or s.eps < s.modules.eps) and s.battle is null") 
    615615                        .setEntity(0, this.fleet) 
    616616                        .list(); 
     
    654654                StringBuilder message = new StringBuilder(100); 
    655655                 
    656                 List ships = db.createQuery("from Ship as s WHERE s.fleet=? and s.battle=0") 
     656                List ships = db.createQuery("from Ship as s WHERE s.fleet=? and s.battle is null") 
    657657                        .setEntity(0, this.fleet) 
    658658                        .list(); 
     
    719719                org.hibernate.Session db = getDB(); 
    720720                 
    721                 List ships = db.createQuery("from Ship where id>0 and fleet=? and battle=0") 
     721                List ships = db.createQuery("from Ship where id>0 and fleet=? and battle is null") 
    722722                        .setEntity(0, this.fleet) 
    723723                        .list(); 
     
    743743                User user = (User)getUser(); 
    744744                 
    745                 List ships = db.createQuery("from Ship where id>0 and fleet=? and battle=0" ) 
     745                List ships = db.createQuery("from Ship where id>0 and fleet=? and battle is null" ) 
    746746                        .setEntity(0, this.fleet) 
    747747                        .list(); 
     
    763763                        List containers = db.createQuery("from Ship as s " + 
    764764                                        "where s.owner=? and s.system=? and s.x=? and s.y=? and s.docked='' and " + 
    765                                                         "s.shiptype.class=? and s.battle=0 " + 
     765                                                        "s.shiptype.class=? and s.battle is null " + 
    766766                                        "order by fleet,type ") 
    767767                                .setEntity(0, user) 
     
    802802                org.hibernate.Session db = getDB(); 
    803803                 
    804                 List ships = db.createQuery("from Ship where id>0 and fleet=? and battle=0") 
     804                List ships = db.createQuery("from Ship where id>0 and fleet=? and battle is null") 
    805805                        .setEntity(0, this.fleet) 
    806806                        .list(); 
     
    829829                int jaegertypeID = getInteger("jaegertype"); 
    830830                 
    831                 List ships = db.createQuery("from Ship where id>0 and fleet=? and battle=0" ) 
     831                List ships = db.createQuery("from Ship where id>0 and fleet=? and battle is null" ) 
    832832                        .setEntity(0, this.fleet) 
    833833                        .list(); 
     
    848848                        List jaegerliste = db.createQuery("from Ship as s " + 
    849849                                        "where "+(jaegertypeID > 0 ? "s.type="+jaegertypeID+" and " : "")+"s.owner=? and s.system=? and " + 
    850                                                         "s.x=? and s.y=? and s.docked='' and (locate(?,s.shiptype.flags)!=0 or locate(?,s.modules.flags)!=0) and s.battle=0 " + 
     850                                                        "s.x=? and s.y=? and s.docked='' and (locate(?,s.shiptype.flags)!=0 or locate(?,s.modules.flags)!=0) and s.battle is null " + 
    851851                                        "order by fleet,type ") 
    852852                                .setEntity(0, user) 
  • src/net/driftingsouls/ds2/server/modules/KapernController.java

    ra9d0954 r144f38e  
    183183                 
    184184                //In einem Kampf? 
    185                 if( (datan.getBattle() != 0) || (datas.getBattle() != 0) ) { 
     185                if( (datan.getBattle() != null) || (datas.getBattle() != null) ) { 
    186186                        addError("Eines der Schiffe ist zur Zeit in einen Kampf verwickelt", errorurl); 
    187187                                         
     
    288288                                int shipcount = 0; 
    289289                                List shipList = db.createQuery("from Ship as s where s.x=? and s.y=? and s.system=? and " + 
    290                                                                         "s.owner in ("+Common.implode(",",ownerlist)+") and s.id>0 and s.battle=0 and " + 
     290                                                                        "s.owner in ("+Common.implode(",",ownerlist)+") and s.id>0 and s.battle is null and " + 
    291291                                                                        "(locate('=',s.shiptype.weapons)!=0 or locate('=',s.modules.weapons)) and locate('nocrew',s.status)=0") 
    292292                                                                        .setInteger(0, this.targetShip.getX()) 
  • src/net/driftingsouls/ds2/server/modules/PluendernController.java

    r7375108 r144f38e  
    123123                } 
    124124 
    125                 if( (shipFrom.getBattle() != 0) || (shipTo.getBattle() != 0) ) { 
     125                if( (shipFrom.getBattle() != null) || (shipTo.getBattle() != null) ) { 
    126126                        addError("Eines der Schiffe ist in einen Kampf verwickelt", errorurl); 
    127127                                         
  • src/net/driftingsouls/ds2/server/modules/ScanController.java

    r145b7b4 r144f38e  
    386386                         
    387387                        List shiplist = db.createQuery("from Ship s inner join fetch s.owner " + 
    388                                         "where s.id>0 and s.x= :x and s.y= :y and s.system= :sys and s.battle=0 and " + 
     388                                        "where s.id>0 and s.x= :x and s.y= :y and s.system= :sys and s.battle is null and " + 
    389389                                                "((s.shiptype not in ("+Common.implode(",",verysmallshiptypes)+")) or locate('tblmodules',s.status)!=0) and " + 
    390390                                                "(s.visibility is null or s.visibility= :user) and locate('l ',s.docked)=0 " + 
  • src/net/driftingsouls/ds2/server/modules/SchiffController.java

    r16c162a r144f38e  
    138138                } 
    139139 
    140                 if( ship.getBattle() > 0 ) { 
     140                if( ship.getBattle() != null ) { 
    141141                        addError("Das Schiff ist in einen Kampf verwickelt (hier klicken um zu diesem zu gelangen)!", Common.buildUrl("default", "module", "angriff", "battle", ship.getBattle(), "ship", shipid) ); 
    142142                        return false; 
     
    11971197                shiptype = ship.getTypeData(); 
    11981198                 
    1199                 if( ship.getBattle() > 0 ) { 
     1199                if( ship.getBattle() != null ) { 
    12001200                        if( (scriptparser != null) && (scriptparser.getContext().getOutput().length() > 0) ) { 
    12011201                                t.setVar("ship.scriptparseroutput", 
  • src/net/driftingsouls/ds2/server/modules/TCController.java

    r7375108 r144f38e  
    8181                } 
    8282                 
    83                 if( ship.getBattle() != 0 ) { 
     83                if( ship.getBattle() != null ) { 
    8484                        addError("Das angegebene Schiff befindet sich in einer Schlacht", Common.buildUrl("default", "module", "schiffe" ) ); 
    8585                         
     
    158158                } 
    159159                 
    160                 if( tarShip.getBattle() != 0 ) { 
     160                if( tarShip.getBattle() != null ) { 
    161161                        addError("Das Zielschiff befindet sich in einer Schlacht", Common.buildUrl("default","module", "schiffe" ) ); 
    162162                         
  • src/net/driftingsouls/ds2/server/modules/TransportController.java

    r7375108 r144f38e  
    308308                        super.create(role, ship.getId()); 
    309309                         
    310                         if( ship.getBattle() != 0 ) { 
     310                        if( ship.getBattle() != null ) { 
    311311                                throw new Exception("Das Schiff (id:"+ship.getId()+") ist in einen Kampf verwickelt"); 
    312312                        } 
  • src/net/driftingsouls/ds2/server/modules/schiffplugins/SensorsDefault.java

    ra5861df r144f38e  
    405405                                ships = db.createQuery("from Ship s inner join fetch s.owner " + 
    406406                                                "where s.id!= :id and s.id>0 and s.x= :x and s.y= :y and s.system= :sys and " + 
    407                                                         "s.battle=0 and (s.visibility is null or s.visibility= :user) and " + 
     407                                                        "s.battle is null and (s.visibility is null or s.visibility= :user) and " + 
    408408                                                        "locate('l ',s.docked)=0 and s.shiptype= :showonly and s.owner= :showid and " + 
    409409                                                        "locate('disable_iff',s.status)=0 "+ 
     
    427427                                        List typeList = db.createQuery("select count(*),s.shiptype,s.owner.id " + 
    428428                                                        "from Ship s " + 
    429                                                         "where s.id!= :id and s.id>0 and s.x= :x and s.y= :y and s.system= :sys and s.battle=0 and " + 
     429                                                        "where s.id!= :id and s.id>0 and s.x= :x and s.y= :y and s.system= :sys and s.battle is null and " + 
    430430                                                                "(s.visibility is null or s.visibility= :user ) and locate('disable_iff',s.status)=0 and " + 
    431431                                                                "locate('l ',s.docked)=0 " + 
     
    449449                                ships = db.createQuery("from Ship s inner join fetch s.owner " + 
    450450                                                "where s.id!= :id and s.id>0 and s.x= :x and s.y=:y and s.system= :sys and " + 
    451                                                         "s.battle=0 and (s.visibility is null or s.visibility= :user ) and locate('l ',s.docked)=0 " + 
     451                                                        "s.battle is null and (s.visibility is null or s.visibility= :user ) and locate('l ',s.docked)=0 " + 
    452452                                                "order by "+thisorder+",case when s.docked!='' then s.docked else s.id end, fleet") 
    453453                                        .setInteger("id", ship.getId()) 
     
    621621 
    622622                                        //Angreifen 
    623                                         if( !disableIFF && (aship.getOwner().getID() != user.getID()) && (aship.getBattle()==0) && shiptype.isMilitary() ) { 
     623                                        if( !disableIFF && (aship.getOwner().getID() != user.getID()) && (aship.getBattle()==null) && shiptype.isMilitary() ) { 
    624624                                                if( ( (user.getAlly() != null) && (aship.getOwner().getAlly() != user.getAlly()) ) || (user.getAlly() == null) ) { 
    625625                                                        t.setVar("sships.action.angriff",1); 
  • src/net/driftingsouls/ds2/server/scripting/ActionFunctions.java

    refe50c3 r144f38e  
    352352                         
    353353                        Ship ship = scriptparser.getShip(); 
    354                         Ship aship = (Ship)db.createQuery("from Ship where owner=? and system=? and x=? and y=? amd battle=0") 
     354                        Ship aship = (Ship)db.createQuery("from Ship where owner=? and system=? and x=? and y=? amd battle is null") 
    355355                                .setInteger(0, playerid) 
    356356                                .setInteger(1, ship.getSystem()) 
  • src/net/driftingsouls/ds2/server/ships/Ship.java

    r21a765a r144f38e  
    135135        private String destcom; 
    136136        private boolean bookmark; 
    137         private int battle; 
     137        private Integer battle; 
    138138        private boolean battleAction; 
    139139        private String jumptarget; 
     
    335335 
    336336        /** 
    337          * Gibt die ID der Schlacht zurueck, in der dich das Schiff befindet (0 bei keiner). 
    338          * @return Die ID der Schlacht oder <code>0</code> 
    339          */ 
    340         public int getBattle() { 
     337         * Gibt die ID der Schlacht zurueck, in der dich das Schiff befindet (<code>null</code> bei keiner). 
     338         * @return Die ID der Schlacht oder <code>null</code> 
     339         */ 
     340        public Integer getBattle() { 
    341341                return battle; 
    342342        } 
     
    346346         * @param battle Die Schlacht 
    347347         */ 
    348         public void setBattle(int battle) { 
     348        public void setBattle(Integer battle) { 
    349349                this.battle = battle; 
    350350        } 
     
    13221322                                        "system=? and lock is null and docked='' and e>0 and " + 
    13231323                                        "owner in ("+Common.implode(",",attackers)+") and alarm=1 and " + 
    1324                         "locate('nocrew',status)=0 and battle=0 order by owner") 
     1324                        "locate('nocrew',status)=0 and battle is null order by owner") 
    13251325                        .setInteger(0, this.x) 
    13261326                        .setInteger(1, this.y) 
     
    13391339                                                "system=? and lock is null and docked='' and e>0 and " + 
    13401340                                                "owner in ("+Common.implode(",",attackers)+") and alarm=1 and " + 
    1341                                 "locate('nocrew',status)=0 and battle!=0 order by owner") 
     1341                                "locate('nocrew',status)=0 and battle is not null order by owner") 
    13421342                                .setInteger(0, this.x) 
    13431343                                .setInteger(1, this.y) 
     
    16551655                List fleetships = db.createQuery("from Ship " + 
    16561656                                "where id>0 and fleet=? AND x=? AND y=? and system=? and owner=? and " + 
    1657                 "docked='' and id!=? and e>0 and battle=0") 
     1657                "docked='' and id!=? and e>0 and battle is null") 
    16581658                .setEntity(0, this.fleet) 
    16591659                .setInteger(1, this.x) 
     
    18391839                } 
    18401840 
    1841                 if( this.battle > 0 ) { 
     1841                if( this.battle != null ) { 
    18421842                        out.append("Fehler: Das Schiff ist in einen Kampf verwickelt\n"); 
    18431843                        return true; 
  • src/net/driftingsouls/ds2/server/tick/regular/NPCScriptTick.java

    rf034a00 r144f38e  
    7676 
    7777                        this.log("+++++++++ User: "+user.getID()+" +++++++++"); 
    78                         List ships = db.createQuery("from Ship where id>0 and owner=? and battle=0 and script is not null") 
     78                        List ships = db.createQuery("from Ship where id>0 and owner=? and battle is null and script is not null") 
    7979                                .setEntity(0, user) 
    8080                                .list(); 
  • src/net/driftingsouls/ds2/server/tick/regular/SchiffsTick.java

    r390f9f1 r144f38e  
    239239 
    240240                // Schiff bei Bedarf und falls moeglich reparieren 
    241                 if( (shipd.getBattle() == 0) && (shipd.getStatus().indexOf("lowmoney") == -1) && 
     241                if( (shipd.getBattle() == null) && (shipd.getStatus().indexOf("lowmoney") == -1) && 
    242242                                ( (shipd.getEngine() < 100) || (shipd.getWeapons() < 100) || (shipd.getComm() < 100) || (shipd.getSensors() < 100) ) && 
    243243                                (Ships.getNebula(shipd.getLocation()) != 6)  ) { 
     
    457457                else { 
    458458                        this.calledByBattle = false; 
    459                         battle = "s.battle=0"; 
     459                        battle = "s.battle is null"; 
    460460                } 
    461461 
     
    467467                if( !this.calledByBattle ) { 
    468468                        db.createQuery("update Ship set heat=heat-(case when heat>=70 then 70 else heat end) " + 
    469                         "where heat>0 and owner in (from User where vaccount=0 or wait4vac>0) and id>0 and system!=0 and battle=0") 
     469                        "where heat>0 and owner in (from User where vaccount=0 or wait4vac>0) and id>0 and system!=0 and battle is null") 
    470470                        .executeUpdate(); 
    471471                } 
  • src/net/driftingsouls/ds2/server/werften/WerftGUI.java

    r7375108 r144f38e  
    351351                List ships = db.createQuery("from Ship s inner join fetch s.owner as u left join fetch s.modules " + 
    352352                                                                "where s.id>0 and (s.x between ? and ?) and (s.y between ? and ?) and s.system=? and " + 
    353                                                                 "locate('l ',s.docked)=0 and s.battle=0 order by u.id,s.id") 
     353                                                                "locate('l ',s.docked)=0 and s.battle is null order by u.id,s.id") 
    354354                                                                .setInteger(0, werft.getX()-werft.getSize()) 
    355355                                                                .setInteger(1, werft.getX()+werft.getSize()) 
     
    558558                } 
    559559                 
    560                 if( ship.getBattle() != 0 ) { 
     560                if( ship.getBattle() != null ) { 
    561561                        context.addError("Das Schiff befindet sich in einer Schlacht", werft.getUrlBase()+"&amp;sess="+sess);                    
    562562                        return;