Changeset d230b2f35546b981310b027ee99cd9f7e0e12506
- Timestamp:
- 07/10/07 16:16:11 (1 year ago)
- git-parent:
- Files:
-
- src/ehcache.xml (modified) (3 diffs)
- src/net/driftingsouls/ds2/server/bases/Academy.java (modified) (3 diffs)
- src/net/driftingsouls/ds2/server/bases/Base.java (modified) (1 diff)
- src/net/driftingsouls/ds2/server/bases/Building.java (modified) (21 diffs)
- src/net/driftingsouls/ds2/server/bases/DefaultBuilding.java (modified) (3 diffs)
- src/net/driftingsouls/ds2/server/bases/Forschungszentrum.java (modified) (2 diffs)
- src/net/driftingsouls/ds2/server/bases/Kommandozentrale.java (modified) (2 diffs)
- src/net/driftingsouls/ds2/server/bases/Waffenfabrik.java (modified) (3 diffs)
- src/net/driftingsouls/ds2/server/bases/Werft.java (modified) (3 diffs)
- src/net/driftingsouls/ds2/server/modules/ActivateAllController.java (modified) (4 diffs)
- src/net/driftingsouls/ds2/server/modules/BaseController.java (modified) (6 diffs)
- src/net/driftingsouls/ds2/server/modules/BasenController.java (modified) (1 diff)
- src/net/driftingsouls/ds2/server/modules/BuildController.java (modified) (1 diff)
- src/net/driftingsouls/ds2/server/modules/BuildingController.java (modified) (3 diffs)
- src/net/driftingsouls/ds2/server/modules/BuildingsController.java (modified) (1 diff)
- src/net/driftingsouls/ds2/server/modules/ForschinfoController.java (modified) (1 diff)
- src/net/driftingsouls/ds2/server/modules/PortalController.java (modified) (2 diffs)
- src/net/driftingsouls/ds2/server/modules/schiffplugins/SensorsDefault.java (modified) (2 diffs)
- web/WEB-INF/cfg/hibernatemappings.xml (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
src/ehcache.xml
r6760ac9 rd230b2f 8 8 timeToLiveSeconds="10" 9 9 overflowToDisk="false" 10 /> 11 <cache name="net.driftingsouls.ds2.server.bases.Building" 12 maxElementsInMemory="30" 13 eternal="true" 14 timeToIdleSeconds="60" 15 timeToLiveSeconds="600" 16 overflowToDisk="false" 10 17 /> 11 <cache name="net.driftingsouls.ds2.server.bases.Cargo"18 <cache name="net.driftingsouls.ds2.server.bases.Core" 12 19 maxElementsInMemory="20" 13 20 eternal="true" … … 15 22 timeToLiveSeconds="600" 16 23 overflowToDisk="false" 17 /> 24 /> 25 <cache name="net.driftingsouls.ds2.server.entities.Nebel" 26 maxElementsInMemory="200" 27 eternal="false" 28 timeToIdleSeconds="60" 29 timeToLiveSeconds="600" 30 overflowToDisk="false" 31 /> 18 32 <cache name="net.driftingsouls.ds2.server.ships.ShipType" 19 33 maxElementsInMemory="100" … … 22 36 timeToLiveSeconds="10" 23 37 overflowToDisk="false" 24 /> 25 <cache name="net.driftingsouls.ds2.server.entities.Nebel" 26 maxElementsInMemory="200" 27 eternal="false" 28 timeToIdleSeconds="60" 29 timeToLiveSeconds="600" 30 overflowToDisk="false" 31 /> 38 /> 32 39 </ehcache> src/net/driftingsouls/ds2/server/bases/Academy.java
r283e6c7 rd230b2f 23 23 import java.util.Map; 24 24 25 import javax.persistence.DiscriminatorValue; 26 import javax.persistence.Entity; 27 25 28 import net.driftingsouls.ds2.server.Offizier; 26 29 import net.driftingsouls.ds2.server.cargo.Cargo; … … 38 41 import org.apache.commons.lang.StringEscapeUtils; 39 42 import org.apache.commons.lang.StringUtils; 40 41 class Academy extends DefaultBuilding { 43 import org.hibernate.annotations.Immutable; 44 45 /** 46 * Die Akademie 47 * @author Christopher Jung 48 * 49 */ 50 @Entity(name="AcademyBuilding") 51 @Immutable 52 @DiscriminatorValue("net.driftingsouls.ds2.server.bases.Academy") 53 public class Academy extends DefaultBuilding { 42 54 private static final Map<Integer,String> offis = new HashMap<Integer,String>(); 43 55 private static final Map<Integer,String> attributes = new HashMap<Integer,String>(); … … 58 70 /** 59 71 * Erstellt eine neue Academy-Instanz 60 * @param row Die SQL-Ergebniszeile mit den Gebaeudedaten der Akademie61 72 */ 62 public Academy( SQLResultRow row) {63 super(row);73 public Academy() { 74 // EMPTY 64 75 } 65 76 src/net/driftingsouls/ds2/server/bases/Base.java
r6760ac9 rd230b2f 555 555 } 556 556 557 Building building = Building.getBuilding( context.getDatabase(),bebauung[o]);557 Building building = Building.getBuilding(bebauung[o]); 558 558 559 559 if( !buildinglocs.containsKey(building.getID()) ) { src/net/driftingsouls/ds2/server/bases/Building.java
ra6ba521 rd230b2f 19 19 package net.driftingsouls.ds2.server.bases; 20 20 21 import java.lang.reflect.Constructor; 22 import java.util.HashMap; 23 import java.util.Map; 21 import javax.persistence.Column; 22 import javax.persistence.Entity; 23 import javax.persistence.Id; 24 import javax.persistence.Inheritance; 25 import javax.persistence.InheritanceType; 26 import javax.persistence.Table; 24 27 25 28 import net.driftingsouls.ds2.server.cargo.Cargo; 29 import net.driftingsouls.ds2.server.cargo.UnmodifiableCargo; 26 30 import net.driftingsouls.ds2.server.framework.Context; 31 import net.driftingsouls.ds2.server.framework.ContextMap; 27 32 import net.driftingsouls.ds2.server.framework.Loggable; 28 import net.driftingsouls.ds2.server.framework.caches.CacheManager;29 import net.driftingsouls.ds2.server.framework.caches.ControllableCache;30 import net.driftingsouls.ds2.server.framework.db.Database;31 import net.driftingsouls.ds2.server.framework.db.SQLResultRow;32 33 import net.driftingsouls.ds2.server.framework.templates.TemplateEngine; 34 35 import org.hibernate.annotations.Cache; 36 import org.hibernate.annotations.CacheConcurrencyStrategy; 37 import org.hibernate.annotations.DiscriminatorFormula; 38 import org.hibernate.annotations.Immutable; 39 import org.hibernate.annotations.Type; 33 40 34 41 // TODO: Warum Verbrauch/Produktion unterscheiden? … … 39 46 * 40 47 */ 48 @Entity 49 @Table(name="buildings") 50 @Immutable 51 @Inheritance(strategy=InheritanceType.SINGLE_TABLE) 52 @DiscriminatorFormula("module") 53 @Cache(usage=CacheConcurrencyStrategy.READ_ONLY) 41 54 public abstract class Building implements Loggable { 42 55 /** … … 44 57 */ 45 58 public static final int KOMMANDOZENTRALE = 1; 46 47 private static Map<Integer,Building> buildingCache = new HashMap<Integer,Building>();48 49 static {50 CacheManager.getInstance().registerCache(51 new ControllableCache() {52 public void clear() {53 Building.clearCache();54 }55 }56 );57 }58 59 static void clearCache() {60 synchronized(buildingCache) {61 buildingCache.clear();62 }63 }64 59 65 60 /** … … 67 62 * Sollte kein passender Gebaeudetyp existieren, wird <code>null</code> zurueckgegeben. 68 63 * 69 * @param db Eine Datenbankverbindung70 64 * @param id Die ID des Gebaudetyps 71 65 * @return Eine Instanz der zugehoerigen Gebaeudeklasse 72 66 */ 73 public static synchronized Building getBuilding(Database db, int id) { 74 if( !buildingCache.containsKey(id) ) { 75 SQLResultRow row = db.first("SELECT * FROM buildings WHERE id='",id,"'"); 76 if( row.isEmpty() ) { 77 return null; 78 } 79 String module = row.getString("module"); 80 try { 81 Class<?> cls = Class.forName(module); 82 Class<? extends Building> buildingCls = cls.asSubclass(Building.class); 83 Constructor<? extends Building> constr = buildingCls.getConstructor(SQLResultRow.class); 84 buildingCache.put(id, constr.newInstance(row)); 85 } 86 catch( Exception e ) { 87 LOG.fatal(e, e); 88 return null; 89 } 90 } 91 return buildingCache.get(id); 67 public static Building getBuilding(int id) { 68 org.hibernate.Session db = ContextMap.getContext().getDB(); 69 70 return (Building)db.get(Building.class, id); 71 } 72 73 @Id 74 private int id; 75 @SuppressWarnings("unused") 76 private String module; 77 private int bewohner; 78 private int arbeiter; 79 private String name; 80 private String picture; 81 @Type(type="cargo") 82 @Column(name="buildcosts") 83 private Cargo buildCosts; 84 @Type(type="cargo") 85 private Cargo produces; 86 @Type(type="cargo") 87 private Cargo consumes; 88 @Column(name="ever") 89 private int eVerbrauch; 90 @Column(name="eprodu") 91 private int eProduktion; 92 @Column(name="techreq") 93 private int techReq; 94 private int eps; 95 @Column(name="perplanet") 96 private int perPlanet; 97 @Column(name="perowner") 98 private int perOwner; 99 private int category; 100 private int ucomplex; 101 private boolean deakable; 102 103 /** 104 * Konstruktor 105 * 106 */ 107 public Building() { 108 // EMPTY 92 109 } 93 110 … … 96 113 * @return Die ID des Gebaeudetyps 97 114 */ 98 public abstract int getID(); 115 public final int getID() { 116 return this.id; 117 } 99 118 100 119 /** … … 102 121 * @return Der Name 103 122 */ 104 public abstract String getName(); 123 public String getName() { 124 return name; 125 } 105 126 106 127 /** … … 108 129 * @return Das Bild 109 130 */ 110 public abstract String getPicture(); 131 public String getPicture() { 132 return picture; 133 } 111 134 112 135 /** … … 114 137 * @return Die Baukosten 115 138 */ 116 public abstract Cargo getBuildCosts(); 139 public Cargo getBuildCosts() { 140 return new UnmodifiableCargo(buildCosts); 141 } 117 142 118 143 /** … … 120 145 * @return Die Produktion 121 146 */ 122 public abstract Cargo getProduces(); 147 public Cargo getProduces() { 148 return new UnmodifiableCargo(produces); 149 } 123 150 124 151 /** … … 126 153 * @return Der Verbrauch 127 154 */ 128 public abstract Cargo getConsumes(); 155 public Cargo getConsumes() { 156 return new UnmodifiableCargo(consumes); 157 } 129 158 130 159 /** … … 132 161 * @return Der Wohnraum 133 162 */ 134 public abstract int getBewohner(); 163 public int getBewohner() { 164 return bewohner; 165 } 135 166 136 167 /** … … 138 169 * @return Die Anzahl der Arbeiter 139 170 */ 140 public abstract int getArbeiter(); 171 public int getArbeiter() { 172 return arbeiter; 173 } 141 174 142 175 /** … … 144 177 * @return Der Energieverbrauch 145 178 */ 146 public abstract int getEVerbrauch(); 179 public int getEVerbrauch() { 180 return eVerbrauch; 181 } 147 182 148 183 /** … … 150 185 * @return die Energieproduktion 151 186 */ 152 public abstract int getEProduktion(); 187 public int getEProduktion() { 188 return eProduktion; 189 } 153 190 154 191 /** … … 156 193 * @return die benoetigte Forschung 157 194 */ 158 public abstract int getTechRequired(); 195 public int getTechRequired() { 196 return techReq; 197 } 159 198 160 199 /** … … 162 201 * @return ???? 163 202 */ 164 public abstract int getEPS(); 203 public int getEPS() { 204 return eps; 205 } 165 206 166 207 /** … … 169 210 * @return Die max. Anzahl pro Basis 170 211 */ 171 public abstract int getPerPlanetCount(); 212 public int getPerPlanetCount() { 213 return perPlanet; 214 } 172 215 173 216 /** … … 176 219 * @return Die max. Anzahl pro Benutzer 177 220 */ 178 public abstract int getPerUserCount(); 221 public int getPerUserCount() { 222 return perOwner; 223 } 179 224 180 225 /** … … 182 227 * @return die ID der Kategorie 183 228 */ 184 public abstract int getCategory(); 229 public int getCategory() { 230 return category; 231 } 185 232 186 233 /** … … 188 235 * @return <code>true</code>, falls es ein unterirdischer Komplex ist 189 236 */ 190 public abstract boolean isUComplex(); 237 public boolean isUComplex() { 238 return ucomplex == 1; 239 } 191 240 192 241 /** … … 194 243 * @return <code>true</code>, falls das Gebaeude deaktivierbar ist 195 244 */ 196 public abstract boolean isDeakAble(); 245 public boolean isDeakAble() { 246 return deakable; 247 } 197 248 198 249 /** src/net/driftingsouls/ds2/server/bases/DefaultBuilding.java
rb81fb15 rd230b2f 19 19 package net.driftingsouls.ds2.server.bases; 20 20 21 import javax.persistence.DiscriminatorValue; 22 import javax.persistence.Entity; 23 21 24 import net.driftingsouls.ds2.server.cargo.Cargo; 22 25 import net.driftingsouls.ds2.server.cargo.ResourceEntry; 23 26 import net.driftingsouls.ds2.server.cargo.ResourceList; 24 import net.driftingsouls.ds2.server.cargo.UnmodifiableCargo;25 27 import net.driftingsouls.ds2.server.framework.Configuration; 26 28 import net.driftingsouls.ds2.server.framework.Context; 27 import net.driftingsouls.ds2.server.framework.db.SQLResultRow;28 29 import net.driftingsouls.ds2.server.framework.templates.TemplateEngine; 30 31 import org.hibernate.annotations.Immutable; 29 32 30 33 /** … … 35 38 * 36 39 */ 37 class DefaultBuilding extends Building { 38 private SQLResultRow data; 39 40 @Entity 41 @Immutable 42 @DiscriminatorValue("net.driftingsouls.ds2.server.bases.DefaultBuilding") 43 public class DefaultBuilding extends Building { 40 44 /** 41 45 * Erstellt eine neue Gebaeude-Instanz 42 * @param row Die SQL-Ergebniszeile mit den Gebaeudedaten43 46 */ 44 public DefaultBuilding(SQLResultRow row) { 45 data = row; 46 data.put("consumes", new UnmodifiableCargo(new Cargo(Cargo.Type.STRING, data.getString("consumes"))) ); 47 data.put("produces", new UnmodifiableCargo(new Cargo(Cargo.Type.STRING, data.getString("produces"))) ); 48 data.put("buildcosts", new UnmodifiableCargo(new Cargo(Cargo.Type.STRING, data.getString("buildcosts"))) ); 49 } 50 51 @Override 52 public int getBewohner() { 53 return data.getInt("bewohner"); 54 } 55 56 @Override 57 public int getArbeiter() { 58 return data.getInt("arbeiter"); 47 public DefaultBuilding() { 48 // EMPTY 59 49 } 60 50 … … 135 125 return buffer.toString(); 136 126 } 137 138 @Override139 public int getID() {140 return data.getInt("id");141 }142 143 @Override144 public String getName() {145 return data.getString("name");146 }147 148 @Override149 public String getPicture() {150 return data.getString("picture");151 }152 153 @Override154 public Cargo getBuildCosts() {155 return (Cargo)data.get("buildcosts");156 }157 158 @Override159 public Cargo getProduces() {160 return (Cargo)data.get("produces");161 }162 163 @Override164 public Cargo getConsumes() {165 return (Cargo)data.get("consumes");166 }167 168 @Override169 public int getEVerbrauch() {170 return data.getInt("ever");171 }172 173 @Override174 public int getEProduktion() {175 return data.getInt("eprodu");176 }177 178 @Override179 public int getTechRequired() {180 return data.getInt("techreq");181 }182 183 @Override184 public int getEPS() {185 return data.getInt("eps");186 }187 188 @Override189 public int getPerPlanetCount() {190 return data.getInt("perplanet");191 }192 193 @Override194 public int getPerUserCount() {195 return data.getInt("perowner");196 }197 198 @Override199 public int getCategory() {200 return data.getInt("category");201 }202 203 @Override204 public boolean isUComplex() {205 return data.getInt("ucomplex") == 1;206 }207 208 @Override209 public boolean isDeakAble() {210 return data.getBoolean("deakable");211 }212 213 127 } src/net/driftingsouls/ds2/server/bases/Forschungszentrum.java
r283e6c7 rd230b2f 22 22 import java.util.List; 23 23 24 import javax.persistence.DiscriminatorValue; 25 import javax.persistence.Entity; 26 24 27 import net.driftingsouls.ds2.server.cargo.Cargo; 25 28 import net.driftingsouls.ds2.server.cargo.ResourceEntry; … … 38 41 39 42 import org.apache.commons.lang.StringEscapeUtils; 40 41 class Forschungszentrum extends DefaultBuilding { 43 import org.hibernate.annotations.Immutable; 44 45 /** 46 * Das Forschungszentrum 47 * @author Christopher Jung 48 * 49 */ 50 @Entity(name="ForschungszentrumBuilding") 51 @Immutable 52 @DiscriminatorValue("net.driftingsouls.ds2.server.bases.Forschungszentrum") 53 public class Forschungszentrum extends DefaultBuilding { 42 54 /** 43 55 * Erstellt eine neue Forschungszentrum-Instanz 44 * @param row Die SQL-Ergebniszeile mit den Gebaeudedaten des Forschungszentrums45 56 */ 46 public Forschungszentrum( SQLResultRow row) {47 super(row);57 public Forschungszentrum() { 58 // EMPTY 48 59 } 49 60 src/net/driftingsouls/ds2/server/bases/Kommandozentrale.java
r8e3cf9b rd230b2f 21 21 import java.util.ArrayList; 22 22 import java.util.List; 23 24 import javax.persistence.DiscriminatorValue; 25 import javax.persistence.Entity; 26 27 import org.hibernate.annotations.Immutable; 23 28 24 29 import net.driftingsouls.ds2.server.ContextCommon; … … 44 49 import net.driftingsouls.ds2.server.werften.BaseWerft; 45 50 46 class Kommandozentrale extends DefaultBuilding { 51 /** 52 * Die Kommandozentrale 53 * @author Christopher Jung 54 * 55 */ 56 @Entity(name="KommandozentraleBuilding") 57 @Immutable 58 @DiscriminatorValue("net.driftingsouls.ds2.server.bases.Kommandozentrale") 59 public class Kommandozentrale extends DefaultBuilding { 47 60 /** 48 61 * Erstellt eine neue Instanz der Kommandozentrale 49 * @param row Die SQL-Ergebniszeile mit den Gebaeudedaten der Kommandozentrale50 62 */ 51 public Kommandozentrale( SQLResultRow row) {52 super(row);63 public Kommandozentrale() { 64 // EMPTY 53 65 } 54 66 src/net/driftingsouls/ds2/server/bases/Waffenfabrik.java
rcc2ad1e rd230b2f 30 30 import java.util.Set; 31 31 32 import javax.persistence.DiscriminatorValue; 33 import javax.persistence.Entity; 34 32 35 import net.driftingsouls.ds2.server.cargo.Cargo; 33 36 import net.driftingsouls.ds2.server.cargo.ItemCargoEntry; … … 47 50 import net.driftingsouls.ds2.server.framework.Context; 48 51 import net.driftingsouls.ds2.server.framework.ContextMap; 49 import net.driftingsouls.ds2.server.framework.db.SQLResultRow;50 52 import net.driftingsouls.ds2.server.framework.templates.TemplateEngine; 51 53 52 54 import org.apache.commons.lang.ArrayUtils; 53 55 import org.apache.commons.lang.StringEscapeUtils; 54 55 class Waffenfabrik extends DefaultBuilding { 56 import org.hibernate.annotations.Immutable; 57 58 /** 59 * Die Waffenfabrik 60 * @author Christopher Jung 61 * 62 */ 63 @Entity(name="WaffenfabrikBuilding") 64 @Immutable 65 @DiscriminatorValue("net.driftingsouls.ds2.server.bases.Waffenfabrik") 66 public class Waffenfabrik extends DefaultBuilding { 56 67 private static class ContextVars { 57 68 Set<Ammo> ownerammobase = new HashSet<Ammo>(); … … 66 77 /** 67 78 * Erstellt eine neue Instanz der Waffenfabrik 68 * @param row Die SQL-Ergebniszeile mit den Gebaeudedaten der Waffenfabrik69 79 */ 70 public Waffenfabrik( SQLResultRow row) {71 super(row);80 public Waffenfabrik() { 81 // EMPTY 72 82 } 73 83 src/net/driftingsouls/ds2/server/bases/Werft.java
r8e3cf9b rd230b2f 19 19 package net.driftingsouls.ds2.server.bases; 20 20 21 import javax.persistence.DiscriminatorValue; 22 import javax.persistence.Entity; 23 21 24 import net.driftingsouls.ds2.server.config.Items; 22 25 import net.driftingsouls.ds2.server.framework.Common; … … 24 27 import net.driftingsouls.ds2.server.framework.Context; 25 28 import net.driftingsouls.ds2.server.framework.ContextMap; 26 import net.driftingsouls.ds2.server.framework.db.SQLResultRow;27 29 import net.driftingsouls.ds2.server.framework.templates.TemplateEngine; 28 30 import net.driftingsouls.ds2.server.ships.ShipTypeData; … … 31 33 32 34 import org.apache.commons.lang.StringEscapeUtils; 33 34 class Werft extends DefaultBuilding { 35 import org.hibernate.annotations.Immutable; 36 37 /** 38 * Die Werft 39 * @author Christopher Jung 40 * 41 */ 42 @Entity(name="WerftBuilding") 43 @Immutable 44 @DiscriminatorValue("net.driftingsouls.ds2.server.bases.Werft") 45 public class Werft extends DefaultBuilding { 35 46 /** 36 47 * Erstellt eine neue Instanz der Werft 37 * @param row Die SQL-Ergebniszeile mit den Gebaeudedaten der Werft38 48 */ 39 public Werft( SQLResultRow row) {40 super(row);49 public Werft() { 50 // EMPTY 41 51 } 42 52 src/net/driftingsouls/ds2/server/modules/ActivateAllController.java
r6760ac9 rd230b2f 25 25 import net.driftingsouls.ds2.server.framework.Common; 26 26 import net.driftingsouls.ds2.server.framework.Context; 27 import net.driftingsouls.ds2.server.framework.db.Database;28 27 import net.driftingsouls.ds2.server.framework.pipeline.generators.DSGenerator; 29 28 import net.driftingsouls.ds2.server.framework.templates.TemplateEngine; … … 77 76 public void defaultAction() { 78 77 TemplateEngine t = getTemplateEngine(); 79 Database db = getDatabase();80 78 81 79 t.set_var("base.id", base.getID()); … … 107 105 for( int i=0; i < base.getWidth()*base.getHeight(); i++ ) { 108 106 if( (base.getBebauung()[i] != 0) && (ondb[i] == 1 ) ) { 109 Building building = Building.getBuilding( db,base.getBebauung()[i]);107 Building building = Building.getBuilding(base.getBebauung()[i]); 110 108 111 109 if( building.isDeakAble() ) { … … 144 142 for( int i=0; i < base.getWidth()*base.getHeight(); i++ ) { 145 143 if( base.getBebauung()[i] != 0 ) { 146 Building building = Building.getBuilding( db,base.getBebauung()[i]);144 Building building = Building.getBuilding(base.getBebauung()[i]); 147 145 148 146 if( building.isDeakAble() && (base.getBewohner() >= base.getArbeiter()+building.getArbeiter()) ) { src/net/driftingsouls/ds2/server/modules/BaseController.java
r6760ac9 rd230b2f 34 34 import net.driftingsouls.ds2.server.framework.Configuration; 35 35 import net.driftingsouls.ds2.server.framework.Context; 36 import net.driftingsouls.ds2.server.framework.db.Database;37 36 import net.driftingsouls.ds2.server.framework.pipeline.generators.DSGenerator; 38 37 import net.driftingsouls.ds2.server.framework.templates.TemplateEngine; … … 150 149 */ 151 150 public void changeBuildingStatusAction() { 152 Database db = getDatabase();153 151 TemplateEngine t = getTemplateEngine(); 154 152 … … 164 162 } 165 163 166 Building building = Building.getBuilding( db,buildingonoff);164 Building building = Building.getBuilding(buildingonoff); 167 165 if( building.isDeakAble() ) { 168 166 int count = 0; … … 209 207 @Override 210 208 public void defaultAction() { 211 Database db = getDatabase();212 209 TemplateEngine t = getTemplateEngine(); 213 210 … … 299 296 } 300 297 else { 301 Building building = Building.getBuilding( db,base.getBebauung()[i]);298 Building building = Building.getBuilding(base.getBebauung()[i]); 302 299 base.getActive()[i] = basedata.getActiveBuildings()[i]; 303 300 … … 414 411 } 415 412 416 Building building = Building.getBuilding( db,bid);413 Building building = Building.getBuilding(bid); 417 414 t.set_var( "building.name", Common._plaintitle(building.getName()), 418 415 "building.id", bid, src/net/driftingsouls/ds2/server/modules/BasenController.java
r283e6c7 rd230b2f 186 186 187 187 for( Integer bid : basedata.getBuildingLocations().keySet() ) { 188 Building building = Building.getBuilding( db,bid);188 Building building = Building.getBuilding(bid); 189 189 190 190 shortcuts.append(building.echoShortcut( getContext(), base, basedata.getBuildingLocations().get(bid), bid )); src/net/driftingsouls/ds2/server/modules/BuildController.java
r4a172a3 rd230b2f 99 99 int field = getInteger("field"); 100 100 101 Building building = Building.getBuilding( db,build);101 Building building = Building.getBuilding(build); 102 102 103 103 if( building == null ) { src/net/driftingsouls/ds2/server/modules/BuildingController.java
r4a172a3 rd230b2f 28 28 import net.driftingsouls.ds2.server.framework.Configuration; 29 29 import net.driftingsouls.ds2.server.framework.Context; 30 import net.driftingsouls.ds2.server.framework.db.Database;31 30 import net.driftingsouls.ds2.server.framework.pipeline.generators.DSGenerator; 32 31 … … 56 55 @Override 57 56 protected boolean validateAndPrepare(String action) { 58 Database db = getDatabase();59 57 User user = (User)getUser(); 60 58 … … 75 73 } 76 74 77 building = Building.getBuilding( db,base.getBebauung()[field]);75 building = Building.getBuilding(base.getBebauung()[field]); 78 76 79 77 return true; src/net/driftingsouls/ds2/server/modules/BuildingsController.java
r6760ac9 rd230b2f 91 91 SQLQuery buildingID = db.query("SELECT id FROM buildings ORDER BY name" ); 92 92 while( buildingID.next() ) { 93 Building building = Building.getBuilding( db,buildingID.getInt("id"));93 Building building = Building.getBuilding(buildingID.getInt("id")); 94 94 if( !user.hasResearched(building.getTechRequired()) ) { 95 95 continue; src/net/driftingsouls/ds2/server/modules/ForschinfoController.java
r6760ac9 rd230b2f 212 212 SQLQuery buildingRow = db.query("SELECT id FROM buildings WHERE techreq=",this.research.getID()); 213 213 while( buildingRow.next() ) { 214 Building building = Building.getBuilding( db,buildingRow.getInt("id"));214 Building building = Building.getBuilding(buildingRow.getInt("id")); 215 215 216 216 t.start_record(); src/net/driftingsouls/ds2/server/modules/PortalController.java
r7a698da rd230b2f
