Changeset 7f0a2d954e9670f22011e0ff0ebc390401b1343d
- Timestamp:
- 05/01/07 14:58:50
(1 year ago)
- Author:
- Christopher Jung <bktheg@web.de>
- git-committer:
- Christopher Jung <bktheg@web.de> 1178024330 +0200
- git-parent:
[0f80e75ad3bc135cf584aa7b3e6f74c91464688b]
- git-author:
- Christopher Jung <bktheg@web.de> 1178024330 +0200
- Message:
Jaegerflotten aufsammeln eingebaut
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r0f80e75 |
r7f0a2d9 |
|
| 301 | 301 | */ |
|---|
| 302 | 302 | |
|---|
| | 303 | // Cache fuer Jaegerflotten. Key ist die Flotten-ID. Value die Liste der Schiffs-IDs der Flotte |
|---|
| | 304 | Map<Integer,List<Integer>> jaegerFleetCache = new HashMap<Integer,List<Integer>>(); |
|---|
| | 305 | |
|---|
| | 306 | // Die ID des Schiffes, an dem das aktuell ausgewaehlte Schiff angedockt ist |
|---|
| 303 | 307 | int currentDockID = 0; |
|---|
| 304 | 308 | if( data.getString("docked").length() > 0 ) { |
|---|
| … | … | |
| 311 | 315 | } |
|---|
| 312 | 316 | |
|---|
| | 317 | int user_wrapfactor = Integer.parseInt(user.getUserValue("TBLORDER/schiff/wrapfactor")); |
|---|
| | 318 | |
|---|
| | 319 | // dockCount - die Anzahl der aktuell angedockten Schiffe |
|---|
| | 320 | final int dockCount = db.first("SELECT count(*) count FROM ships WHERE id>0 AND docked='",data.getInt("id"),"'").getInt("count"); |
|---|
| | 321 | |
|---|
| | 322 | // superdock - Kann der aktuelle Benutzer alles andocken? |
|---|
| 313 | 323 | boolean superdock = false; |
|---|
| 314 | | int user_wrapfactor = Integer.parseInt(user.getUserValue("TBLORDER/schiff/wrapfactor")); |
|---|
| 315 | | final int dockCount = db.first("SELECT count(*) count FROM ships WHERE id>0 AND docked='",data.getInt("id"),"'").getInt("count"); |
|---|
| 316 | | |
|---|
| 317 | 324 | if( datatype.getInt("adocks") > dockCount ) { |
|---|
| 318 | 325 | superdock = user.hasFlag( User.FLAG_SUPER_DOCK ); |
|---|
| 319 | 326 | } |
|---|
| 320 | 327 | |
|---|
| | 328 | // fullcount - Die Anzahl der freien Landeplaetze auf dem aktuell ausgewaehlten Traeger |
|---|
| | 329 | // spaceToLand - Ist ueberhaupt noch Platz auf dem aktuell ausgewaehlten Traeger? |
|---|
| 321 | 330 | boolean spaceToLand = false; |
|---|
| 322 | 331 | int fullcount = db.first("SELECT count(*) fullcount FROM ships WHERE id>0 AND docked='l ",data.getInt("id"),"'").getInt("fullcount"); |
|---|
| … | … | |
| 657 | 666 | if( data.getInt("fleet") > 0 ) { |
|---|
| 658 | 667 | boolean ok = true; |
|---|
| | 668 | // Falls noch nicht geschehen die Flotte des Jaegers ermitteln |
|---|
| 659 | 669 | if( fleetlist == null ) { |
|---|
| 660 | 670 | fleetlist = new ArrayList<Integer>(); |
|---|
| … | … | |
| 688 | 698 | if( (datas.getInt("owner") == user.getID()) && spaceToLand && ShipTypes.hasShipTypeFlag(ashiptype, ShipTypes.SF_JAEGER) ) { |
|---|
| 689 | 699 | t.set_var("sships.action.landthis",1); |
|---|
| | 700 | |
|---|
| | 701 | // Flotte des aktuellen Jaegers landen lassen |
|---|
| | 702 | if( datas.getInt("fleet") != 0 ) { |
|---|
| | 703 | if( !jaegerFleetCache.containsKey(datas.getInt("fleet"))) { |
|---|
| | 704 | List<Integer> thisFleetList = new ArrayList<Integer>(); |
|---|
| | 705 | |
|---|
| | 706 | boolean ok = true; |
|---|
| | 707 | SQLQuery tmp = db.query("SELECT id,type,status FROM ships WHERE id>0 AND fleet='"+datas.getInt("fleet")+"'"); |
|---|
| | 708 | while( tmp.next() ) { |
|---|
| | 709 | SQLResultRow tmptype = ShipTypes.getShipType( tmp.getRow() ); |
|---|
| | 710 | if( !ShipTypes.hasShipTypeFlag(tmptype, ShipTypes.SF_JAEGER) ) { |
|---|
| | 711 | ok = false; |
|---|
| | 712 | break; |
|---|
| | 713 | } |
|---|
| | 714 | thisFleetList.add(tmp.getInt("id")); |
|---|
| | 715 | } |
|---|
| | 716 | tmp.free(); |
|---|
| | 717 | if( !ok ) { |
|---|
| | 718 | thisFleetList.clear(); |
|---|
| | 719 | } |
|---|
| | 720 | |
|---|
| | 721 | jaegerFleetCache.put(datas.getInt("fleet"), thisFleetList); |
|---|
| | 722 | } |
|---|
| | 723 | List<Integer> thisFleetList = jaegerFleetCache.get(datas.getInt("fleet")); |
|---|
| | 724 | |
|---|
| | 725 | if( !thisFleetList.isEmpty() && (thisFleetList.size() <= datatype.getInt("jdocks")) ) { |
|---|
| | 726 | if( fullcount + thisFleetList.size() <= datatype.getInt("jdocks") ) |
|---|
| | 727 | t.set_var( "sships.action.landthisfleet", 1, |
|---|
| | 728 | "sships.shiplist", Common.implode("|",thisFleetList) ); |
|---|
| | 729 | } |
|---|
| | 730 | } |
|---|
| 690 | 731 | } |
|---|
| 691 | 732 | |
|---|
| rae09dfe |
r7f0a2d9 |
|
| 315 | 315 | {/endif}{if sships.action.landthis} |
|---|
| 316 | 316 | <a class="greenborder" onmouseover="return helpme('{sships.type.name} landen lassen');" onmouseout="return nd();" href="./main.php?module=schiff&sess={global.sess}&action=land&land={global.ship}&ship={global.ship}&shiplist={sships.id}"><img src="{URL}data/interface/schiffe/schiff_landen.gif" alt="" /></a> |
|---|
| | 317 | {/endif}{if sships.action.landthisfleet} |
|---|
| | 318 | <a class="greenborder" onmouseover="return helpme('{sships.type.name}\'s Flotte landen lassen');" onmouseout="return nd();" href="./main.php?module=schiff&sess={global.sess}&action=land&land={global.ship}&ship={global.ship}&shiplist={sships.shiplist}"><img src="{URL}data/interface/schiffe/schiff_flottelanden.gif" alt="" /></a> |
|---|
| 317 | 319 | {/endif}{if sships.action.joinfleet} |
|---|
| 318 | 320 | <a class="greenborder" onmouseover="return helpme('an {sships.type.name}s Flotte anschliessen');" onmouseout="return nd();" href="./main.php?module=schiff&sess={global.sess}&action=join&join={sships.id}&ship={global.ship}"><img src="{URL}data/interface/schiffe/schiff_anschliessen.gif" alt="" /></a> |
|---|