Changeset 1f8d57aa02c907deeb59c13ed1e8efb19a404267

Show
Ignore:
Timestamp:
02/25/07 11:14:25 (2 years ago)
Author:
Christopher Jung <bktheg@web.de>
git-committer:
Christopher Jung <bktheg@web.de> 1172398465 +0100
git-parent:

[f893d48fe61df73547fa433cb8114324c3c76a00]

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

Schlachttick gefixt

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • src/net/driftingsouls/ds2/server/battles/Battle.java

    r4929635 r1f8d57a  
    2828import java.util.List; 
    2929import java.util.Map; 
    30 import java.util.Random; 
    3130import java.util.Set; 
    32  
    33 import org.apache.commons.lang.StringUtils; 
    34 import org.apache.commons.lang.SystemUtils; 
    3531 
    3632import net.driftingsouls.ds2.server.ContextCommon; 
     
    5349import net.driftingsouls.ds2.server.scripting.Quests; 
    5450import net.driftingsouls.ds2.server.scripting.ScriptParser; 
     51import net.driftingsouls.ds2.server.ships.ShipClasses; 
    5552import net.driftingsouls.ds2.server.ships.Ships; 
    56 import net.driftingsouls.ds2.server.ships.ShipClasses; 
    5753import net.driftingsouls.ds2.server.tick.TickController; 
    5854import net.driftingsouls.ds2.server.tick.regular.SchiffsTick; 
     55 
     56import org.apache.commons.lang.StringUtils; 
     57import org.apache.commons.lang.SystemUtils; 
     58import org.apache.commons.lang.math.RandomUtils; 
    5959 
    6060/** 
     
    18471847                if( relocate && (ship.getString("docked").length() == 0) ) { 
    18481848                        StarSystem sys = Systems.get().system(this.system); 
    1849                         Random rand = new Random()
    1850                          
     1849                        int maxRetries = 100
     1850 
    18511851                        while( ((loc.getX() == this.x) && (loc.getY() == this.y)) || 
    18521852                                        (loc.getX() < 1) || (loc.getY() < 1) ||  
    18531853                                        (loc.getX() > sys.getWidth()) || 
    18541854                                        (loc.getY() > sys.getHeight()) ) { 
    1855                                 loc.setX(this.x + rand.nextInt(3) - 1); 
    1856                                 loc.setY(this.y + rand.nextInt(3) - 1); 
     1855                                loc = loc.setX(this.x + RandomUtils.nextInt(3) - 1); 
     1856                                loc = loc.setY(this.y + RandomUtils.nextInt(3) - 1); 
     1857                                 
     1858                                maxRetries--; 
     1859                                if( maxRetries == 0 ) { 
     1860                                        break; 
     1861                                } 
    18571862                        } 
    18581863                }