Changeset 1f8d57aa02c907deeb59c13ed1e8efb19a404267
- 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
| r4929635 |
r1f8d57a |
|
| 28 | 28 | import java.util.List; |
|---|
| 29 | 29 | import java.util.Map; |
|---|
| 30 | | import java.util.Random; |
|---|
| 31 | 30 | import java.util.Set; |
|---|
| 32 | | |
|---|
| 33 | | import org.apache.commons.lang.StringUtils; |
|---|
| 34 | | import org.apache.commons.lang.SystemUtils; |
|---|
| 35 | 31 | |
|---|
| 36 | 32 | import net.driftingsouls.ds2.server.ContextCommon; |
|---|
| … | … | |
| 53 | 49 | import net.driftingsouls.ds2.server.scripting.Quests; |
|---|
| 54 | 50 | import net.driftingsouls.ds2.server.scripting.ScriptParser; |
|---|
| | 51 | import net.driftingsouls.ds2.server.ships.ShipClasses; |
|---|
| 55 | 52 | import net.driftingsouls.ds2.server.ships.Ships; |
|---|
| 56 | | import net.driftingsouls.ds2.server.ships.ShipClasses; |
|---|
| 57 | 53 | import net.driftingsouls.ds2.server.tick.TickController; |
|---|
| 58 | 54 | import net.driftingsouls.ds2.server.tick.regular.SchiffsTick; |
|---|
| | 55 | |
|---|
| | 56 | import org.apache.commons.lang.StringUtils; |
|---|
| | 57 | import org.apache.commons.lang.SystemUtils; |
|---|
| | 58 | import org.apache.commons.lang.math.RandomUtils; |
|---|
| 59 | 59 | |
|---|
| 60 | 60 | /** |
|---|
| … | … | |
| 1847 | 1847 | if( relocate && (ship.getString("docked").length() == 0) ) { |
|---|
| 1848 | 1848 | StarSystem sys = Systems.get().system(this.system); |
|---|
| 1849 | | Random rand = new Random(); |
|---|
| 1850 | | |
|---|
| | 1849 | int maxRetries = 100; |
|---|
| | 1850 | |
|---|
| 1851 | 1851 | while( ((loc.getX() == this.x) && (loc.getY() == this.y)) || |
|---|
| 1852 | 1852 | (loc.getX() < 1) || (loc.getY() < 1) || |
|---|
| 1853 | 1853 | (loc.getX() > sys.getWidth()) || |
|---|
| 1854 | 1854 | (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 | } |
|---|
| 1857 | 1862 | } |
|---|
| 1858 | 1863 | } |
|---|