SHOW:
|
|
- or go back to the newest paste.
| 1 | - | public static class Area |
| 1 | + | public static class Area |
| 2 | {
| |
| 3 | - | private int _id; |
| 3 | + | private int _id; |
| 4 | - | private SuperArea _superArea; |
| 4 | + | private SuperArea _superArea; |
| 5 | - | private String _name; |
| 5 | + | private String _name; |
| 6 | - | private ArrayList<SubArea> _subAreas = new ArrayList<SubArea>(); |
| 6 | + | private ArrayList<SubArea> _subAreas = new ArrayList<SubArea>(); |
| 7 | - | private final int[] cemetery; |
| 7 | + | private final int[] cemetery; |
| 8 | - | |
| 8 | + | |
| 9 | - | public Area(int id, int superArea,String name, String cemetery) |
| 9 | + | public Area(int id, int superArea,String name, String cemetery) |
| 10 | {
| |
| 11 | - | _id = id; |
| 11 | + | _id = id; |
| 12 | - | _name = name; |
| 12 | + | _name = name; |
| 13 | - | _superArea = World.getSuperArea(superArea); |
| 13 | + | _superArea = World.getSuperArea(superArea); |
| 14 | - | //this.cemetery; |
| 14 | + | //Si le continent n'est pas encore créer, on le créer et on l'ajoute au monde |
| 15 | - | _cemetery = cemetery; |
| 15 | + | if(_superArea == null) |
| 16 | - | //Si le continent n'est pas encore créer, on le créer et on l'ajoute au monde |
| 16 | + | |
| 17 | - | if(_superArea == null) |
| 17 | + | _superArea = new SuperArea(superArea); |
| 18 | - | {
|
| 18 | + | World.addSuperArea(_superArea); |
| 19 | - | _superArea = new SuperArea(superArea); |
| 19 | + | |
| 20 | - | World.addSuperArea(_superArea); |
| 20 | + | this.cemetery = {Integer.parseInt(cemetery.split(";")[0]), Integer.parseInt(cemetery.split(";")[1])};
|
| 21 | - | } |
| 21 | + | } |
| 22 | - | cemetery = new int[]{Integer.parseInt(cemetery.split(";")[0],Integer.parseInt(cemetery.split(";")[1])
|
| 22 | + | |
| 23 | public int[] getCemetery() | |
| 24 | - | |
| 24 | + | |
| 25 | - | public int[] getCemetery() |
| 25 | + | return cemetery; |
| 26 | } | |
| 27 | - | return cemetery; |
| 27 | + | |
| 28 | public String get_name() | |
| 29 | - | |
| 29 | + | |
| 30 | - | public String get_name() |
| 30 | + | return _name; |
| 31 | } | |
| 32 | - | return _name; |
| 32 | + | |
| 33 | public int get_id() | |
| 34 | - | public int get_id() |
| 34 | + | |
| 35 | return _id; | |
| 36 | - | return _id; |
| 36 | + | } |
| 37 | ||
| 38 | - | |
| 38 | + | public SuperArea get_superArea() |
| 39 | - | public SuperArea get_superArea() |
| 39 | + | |
| 40 | return _superArea; | |
| 41 | - | return _superArea; |
| 41 | + | } |
| 42 | ||
| 43 | - | |
| 43 | + | public void addSubArea(SubArea sa) |
| 44 | - | public void addSubArea(SubArea sa) |
| 44 | + | |
| 45 | _subAreas.add(sa); | |
| 46 | - | _subAreas.add(sa); |
| 46 | + | } |
| 47 | ||
| 48 | - | |
| 48 | + | public ArrayList<Carte> getMaps() |
| 49 | - | public ArrayList<Carte> getMaps() |
| 49 | + | |
| 50 | ArrayList<Carte> maps = new ArrayList<Carte>(); | |
| 51 | - | ArrayList<Carte> maps = new ArrayList<Carte>(); |
| 51 | + | for(SubArea SA : _subAreas)maps.addAll(SA.getMaps()); |
| 52 | - | for(SubArea SA : _subAreas)maps.addAll(SA.getMaps()); |
| 52 | + | return maps; |
| 53 | - | return maps; |
| 53 | + | } |
| 54 | } |