megameknet-cvs Mailing List for MegaMekNET (Page 21)
Status: Inactive
Brought to you by:
mcwizard
You can subscribe to this list here.
2005 |
Jan
|
Feb
(203) |
Mar
(268) |
Apr
(41) |
May
(7) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
---|
From: Immanuel S. <im...@us...> - 2005-02-22 22:41:15
|
Update of /cvsroot/megameknet/MegaMekNET/src/client/campaign In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11673/src/client/campaign Modified Files: CUnit.java Log Message: new visitor pattern, first used for toXmlRpcValue. Other uses will follow shortly. Index: CUnit.java =================================================================== RCS file: /cvsroot/megameknet/MegaMekNET/src/client/campaign/CUnit.java,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** CUnit.java 19 Feb 2005 21:05:21 -0000 1.16 --- CUnit.java 22 Feb 2005 22:41:06 -0000 1.17 *************** *** 22,28 **** import client.gui.MechDetailDisplay; import common.MegaMekPilotOption; import common.Unit; - import common.campaign.pilot.Pilot; - import common.campaign.pilot.skills.PilotSkill; /* --- 22,28 ---- import client.gui.MechDetailDisplay; import common.MegaMekPilotOption; + import common.Pilot; + import common.PilotSkill; import common.Unit; /* |
From: Immanuel S. <im...@us...> - 2005-02-22 22:41:15
|
Update of /cvsroot/megameknet/MegaMekNET/src/common/visitor In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11673/src/common/visitor Added Files: Visitorable.java AbstractVisitor.java ToXmlRpcValueVisitor.java Log Message: new visitor pattern, first used for toXmlRpcValue. Other uses will follow shortly. --- NEW FILE: Visitorable.java --- package common.visitor; /** * Classes implementing this interface are usable together with the different * Visitor classes in common.visitor. * * @author imi */ public interface Visitorable { /** * User may call this function to initalize the visitor process. The * implementing class should first call to its corresponding * visitor.visit* function and then call visit(AbstractVisitor) for * every child class it contains. */ void visit(AbstractVisitor visitor); } --- NEW FILE: ToXmlRpcValueVisitor.java --- package common.visitor; import java.util.Hashtable; import java.util.Iterator; import java.util.Vector; import common.Continent; import common.House; import common.Influences; import common.Planet; import common.PlanetEnvironment; import common.Terrain; import common.Unit; import common.UnitFactories; import common.UnitFactory; /** * Convert the object tree to an xmlrpc-compatible value format. * * @author imi */ public class ToXmlRpcValueVisitor extends AbstractVisitor { /** * The resulting object to feed the xmlrpc-convertion */ private Object result; /** * The current subobject to modify within the result-tree. */ private Object currentObject; /** * Return the result */ public Object getResult() { return result; } /** * Planets are top-level */ public void visitPlanet(Planet data) { if (result != null) throw new IllegalStateException("Planets must be the top-level types for this converter."); result = new Hashtable(); currentObject = result; Hashtable h = (Hashtable)result; h.put("id", new Integer(data.getId())); h.put("name", data.getName()); h.put("x", new Double(data.getPosition().getX())); h.put("y", new Double(data.getPosition().getY())); h.put("baysProvided", new Integer(data.getBaysProvided())); h.put("compProduction", new Integer(data.getCompProduction())); h.put("isConquerable", new Boolean(data.isConquerable())); h.put("description", data.getDescription()); } /** * UnitFactories are tag "unitFactories" in Planets. */ public void visitUnitFactories(UnitFactories data) { currentObject = new Vector(); ((Hashtable)result).put("unitFactories", currentObject); } /** * UnitFactory's are elements in UnitFactories. */ public void visitUnitFactory(UnitFactory data) { Hashtable h = new Hashtable(); ((Vector)currentObject).add(h); h.put("name", data.getName()); h.put("size", data.getSize()); h.put("founder", data.getFounder()); h.put("productionTable", data.getProductionTable()); h.put("ticksUntilRefresh", new Integer(data.getTicksUntilRefresh())); h.put("refreshSpeed", new Integer(data.getRefreshSpeed())); h.put("type", new Integer(data.getType())); } /** * Terrains are tag "terrain" in planets */ public void visitTerrain(Terrain data) { currentObject = new Vector(); ((Hashtable)result).put("terrain", currentObject); } /** * Continents are elements of Terrains */ public void visitContinent(Continent data) { Hashtable h = new Hashtable(); ((Vector)currentObject).add(h); h.put("size", new Integer(data.getSize())); h.put("environmentId", new Integer(data.getEnvironment().getId())); } /** * PlanetEnvironments are either in Continents or top-level */ public void visitPlanetEnvironment(PlanetEnvironment data) { // do only something if we are converting planet environments // directly, since pe's in planets are stored by id only. if (result == null) { result = new Hashtable(); Hashtable h = (Hashtable)result; h.put("id", new Integer(data.getId())); h.put("name", data.getName()); h.put("craterProb", new Integer(data.getCraterProb())); h.put("craterMinNum", new Integer(data.getCraterMinNum())); h.put("craterMaxNum", new Integer(data.getCraterMaxNum())); h.put("craterMinRadius", new Integer(data.getCraterMinRadius())); h.put("craterMaxRadius", new Integer(data.getCraterMaxRadius())); h.put("hillyness", new Integer(data.getHillyness())); h.put("hillElevationRange", new Integer(data.getHillElevationRange())); h.put("hillInvertProb", new Integer(data.getHillInvertProb())); h.put("waterMinSpots", new Integer(data.getWaterMinSpots())); h.put("waterMaxSpots", new Integer(data.getWaterMaxSpots())); h.put("waterMinHexes", new Integer(data.getWaterMinHexes())); h.put("waterMaxHexes", new Integer(data.getWaterMaxHexes())); h.put("waterDeepProb", new Integer(data.getWaterDeepProb())); h.put("forestMinSpots", new Integer(data.getForestMinSpots())); h.put("forestMaxSpots", new Integer(data.getForestMaxSpots())); h.put("forestMinHexes", new Integer(data.getForestMinHexes())); h.put("forestMaxHexes", new Integer(data.getForestMaxHexes())); h.put("forestHeavyProb", new Integer(data.getForestHeavyProb())); h.put("roughMinSpots", new Integer(data.getRoughMinSpots())); h.put("roughMaxSpots", new Integer(data.getRoughMaxSpots())); h.put("roughMinHexes", new Integer(data.getRoughMinHexes())); h.put("roughMaxHexes", new Integer(data.getRoughMaxHexes())); h.put("roadProb", new Integer(data.getRoadProb())); h.put("riverProb", new Integer(data.getRiverProb())); h.put("algorithm", new Integer(data.getAlgorithm())); } } /** * Influences are tag "influence" in planets. */ public void visitInfluences(Influences data) { Hashtable h = new Hashtable(); for (Iterator it = data.getHouseIds().iterator(); it.hasNext();) { Integer i = (Integer)it.next(); h.put(i.toString(), new Integer(data.getInfluence(i.intValue()))); } ((Hashtable)result).put("influence", h); } /** * Houses are top-level */ public void visitHouse(House data) { if (result != null) throw new IllegalStateException("Houses must be the top-level types for this converter."); result = new Hashtable(); Hashtable h = (Hashtable)result; h.put("id", new Integer(data.getId())); h.put("name", data.getName()); h.put("logo", data.getLogo()); h.put("baseGunner", new Integer(data.getBaseGunner())); h.put("basePilot", new Integer(data.getBasePilot())); h.put("initialHouseRanking", new Integer(data.getInitialHouseRanking())); h.put("houseColor", data.getHouseColor()); h.put("abbreviation", data.getAbbreviation()); h.put("description", data.getDescription()); h.put("conquerable", new Boolean(data.isConquerable())); h.put("inHouseAttacks", new Boolean(data.isInHouseAttacks())); h.put("mayUseBM", new Boolean(data.isMayUseBM())); h.put("motd", data.getMotd()); for (int type = 0; type < Unit.TOTALTYPES; ++type) { for (int weight = 0; weight < Unit.WEIGHT_STR.length; ++weight) { h.put("componentMod"+Unit.TYPE_STR[type]+Unit.WEIGHT_STR[weight], new Integer(data.getHouseUnitComponentMod(type, weight))); h.put("priceMod"+Unit.TYPE_STR[type]+Unit.WEIGHT_STR[weight], new Integer(data.getHouseUnitPriceMod(type, weight))); } } } } --- NEW FILE: AbstractVisitor.java --- package common.visitor; import common.Army; import common.CampaignData; import common.Continent; import common.House; import common.Influences; import common.MegaMekPilotOption; import common.Pilot; import common.PilotSkill; import common.PilotSkills; import common.Planet; import common.PlanetEnvironment; import common.Player; import common.TaskInfo; import common.Terrain; import common.Unit; import common.UnitFactories; import common.UnitFactory; /** * Interface for the visitor-pattern as described in "design patterns". * Data classes in common call member functions of this interface to do * different operations for there class hierarchy. * * @author imi */ public abstract class AbstractVisitor { public void visitArmy(Army data) {throw new IllegalStateException("conversation not allowed for this type.");} public void visitCampaignData(CampaignData data) {throw new IllegalStateException("conversation not allowed for this type.");} public void visitContinent(Continent data) {throw new IllegalStateException("conversation not allowed for this type.");} public void visitHouse(House data) {throw new IllegalStateException("conversation not allowed for this type.");} public void visitInfluences(Influences data) {throw new IllegalStateException("conversation not allowed for this type.");} public void visitMegaMekPilotOption(MegaMekPilotOption data) {throw new IllegalStateException("conversation not allowed for this type.");} public void visitPlanet(Planet data) {throw new IllegalStateException("conversation not allowed for this type.");} public void visitPlanetEnvironment(PlanetEnvironment data) {throw new IllegalStateException("conversation not allowed for this type.");} public void visitPlayer(Player data) {throw new IllegalStateException("conversation not allowed for this type.");} public void visitTaskInfo(TaskInfo data) {throw new IllegalStateException("conversation not allowed for this type.");} public void visitTerrain(Terrain data) {throw new IllegalStateException("conversation not allowed for this type.");} public void visitUnit(Unit data) {throw new IllegalStateException("conversation not allowed for this type.");} public void visitUnitFactories(UnitFactories data) {throw new IllegalStateException("conversation not allowed for this type.");} public void visitUnitFactory(UnitFactory data) {throw new IllegalStateException("conversation not allowed for this type.");} public void visitPilot(Pilot data) {throw new IllegalStateException("conversation not allowed for this type.");} public void visitPilotSkills(PilotSkills data) {throw new IllegalStateException("conversation not allowed for this type.");} public void visitPilotSkill(PilotSkill data) {throw new IllegalStateException("conversation not allowed for this type.");} } |
From: Immanuel S. <im...@us...> - 2005-02-22 22:41:14
|
Update of /cvsroot/megameknet/MegaMekNET/src/common/campaign/pilot/skills In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11673/src/common/campaign/pilot/skills Removed Files: IPilotSkill.java PilotSkill.java PilotSkills.java Log Message: new visitor pattern, first used for toXmlRpcValue. Other uses will follow shortly. --- PilotSkills.java DELETED --- --- IPilotSkill.java DELETED --- --- PilotSkill.java DELETED --- |
From: Immanuel S. <im...@us...> - 2005-02-22 22:40:40
|
Update of /cvsroot/megameknet/MegaMekNET/src/common/visitor In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11635/src/common/visitor Log Message: Directory /cvsroot/megameknet/MegaMekNET/src/common/visitor added to the repository |
From: Immanuel S. <im...@us...> - 2005-02-22 22:39:25
|
Update of /cvsroot/megameknet/MegaMekNET/src/client In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11231/src/client Modified Files: MMClient.java Log Message: reordered data init to fix the problem of "could not load serverconfig" if only the lastTimestamp is missing. Index: MMClient.java =================================================================== RCS file: /cvsroot/megameknet/MegaMekNET/src/client/MMClient.java,v retrieving revision 1.47 retrieving revision 1.48 diff -C2 -d -r1.47 -r1.48 *** MMClient.java 20 Feb 2005 18:59:05 -0000 1.47 --- MMClient.java 22 Feb 2005 22:39:15 -0000 1.48 *************** *** 316,323 **** private void initData() { MMNetXStream xml = new MMNetXStream(); ! // initialize last timestamp and serverconfig try { - Date lastTS = (Date)xml.fromFile(getServerCacheDir()+"dataLastUpdated.xml"); - dataFetcher.setLastTimestamp(lastTS); serverConfigs = dataFetcher.getServerConfigData(); System.out.println("serverConfig fetched from server."); --- 316,321 ---- private void initData() { MMNetXStream xml = new MMNetXStream(); ! // initialize serverconfig try { serverConfigs = dataFetcher.getServerConfigData(); System.out.println("serverConfig fetched from server."); *************** *** 337,340 **** --- 335,344 ---- JWindow splash = GraphicGimmicks.pleaseWaitSplash(); try { + // if lastTimestamp can not be read, the cache is worthless, since + // we don't know how up-to-date it is. So handle this in the same + // try block as data loading. + Date lastTS = (Date)xml.fromFile(getServerCacheDir()+"dataLastUpdated.xml"); + dataFetcher.setLastTimestamp(lastTS); + // try to load the data cache. data = (CampaignData)xml.fromFile(getServerCacheDir()+"data.xml"); System.out.println("successfull loaded cached data: " *************** *** 342,346 **** +data.getAllHouses().size()+" houses, " +data.getAllTerrains().size()+" planet environments."); - refreshData(false); } catch (Exception t) { t.printStackTrace(); --- 346,349 ---- *************** *** 348,351 **** --- 351,355 ---- Date now = new Date(); try { + // this will also set the lastTimestamp of datafetcher. data = dataFetcher.getAllData(); } catch (CommunicationException e) { *************** *** 358,361 **** --- 362,375 ---- storeData(now); } + try { + refreshData(false); + } catch (Exception e) { + e.printStackTrace(); + // no problem, except that the client has outdated information. + // refresh, however, will be called shortly again (from the + // background thread) and this will report any error, so do nothing + // here (to not terrify the user with too many error messages in + // case of server problems ;). + } splash.dispose(); } |
From: Helge R. <mcw...@us...> - 2005-02-22 22:27:38
|
Update of /cvsroot/megameknet/MegaMekNET/src/server/campaign/commands In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8467/src/server/campaign/commands Modified Files: PurgeInactiveCommand.java Log Message: purge of inactive accounts won't fill SOL bays anymore Index: PurgeInactiveCommand.java =================================================================== RCS file: /cvsroot/megameknet/MegaMekNET/src/server/campaign/commands/PurgeInactiveCommand.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** PurgeInactiveCommand.java 20 Feb 2005 10:09:32 -0000 1.8 --- PurgeInactiveCommand.java 22 Feb 2005 22:27:20 -0000 1.9 *************** *** 29,32 **** --- 29,50 ---- } } + + public boolean isAdminCommand() { + return true; + } + + public String help() { + return "Deletes inactive accounts"; + } + + protected String usage() { + return getName(); + } + + public PurgeInactiveCommand(){ + super("purgeinactive", 0); + } + + public static String purgeInactive(int daysInactive) { *************** *** 40,44 **** SPlayer p = (SPlayer) f.nextElement(); if (((System.currentTimeMillis() - p.getLastOnlineDate().getTime()) / 86400000) > daysInactive) { ! h.removePlayer(p.getName(), true); deleted += p.getName() + ", "; } --- 58,66 ---- SPlayer p = (SPlayer) f.nextElement(); if (((System.currentTimeMillis() - p.getLastOnlineDate().getTime()) / 86400000) > daysInactive) { ! if (h.isNewbieHouse()){ ! h.removePlayer(p.getName(), false); ! } else { ! h.removePlayer(p.getName(), true); ! } deleted += p.getName() + ", "; } |
From: Helge R. <mcw...@us...> - 2005-02-22 22:27:32
|
Update of /cvsroot/megameknet/MegaMekNET/src/server/campaign In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8467/src/server/campaign Modified Files: CampaignMain.java Log Message: purge of inactive accounts won't fill SOL bays anymore Index: CampaignMain.java =================================================================== RCS file: /cvsroot/megameknet/MegaMekNET/src/server/campaign/CampaignMain.java,v retrieving revision 1.89 retrieving revision 1.90 diff -C2 -d -r1.89 -r1.90 *** CampaignMain.java 22 Feb 2005 21:08:31 -0000 1.89 --- CampaignMain.java 22 Feb 2005 22:27:21 -0000 1.90 *************** *** 1189,1193 **** commands.put("PLANET", new PlanetCommand()); commands.put("PLAYERS", new PlayersCommand()); ! commands.put("PURGEINACTIVE", new PurgeInactiveCommand()); commands.put("RANGE", new RangeCommand()); commands.put("RECALL", new RecallCommand()); --- 1189,1193 ---- commands.put("PLANET", new PlanetCommand()); commands.put("PLAYERS", new PlayersCommand()); ! commands.put("purgeinactive", new PurgeInactiveCommand()); commands.put("RANGE", new RangeCommand()); commands.put("RECALL", new RecallCommand()); |
From: Immanuel S. <im...@us...> - 2005-02-22 22:08:00
|
Update of /cvsroot/megameknet/MegaMekNET/src/client/gui In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2428/src/client/gui Modified Files: InnerStellarMap.java Log Message: removed obsolete function Index: InnerStellarMap.java =================================================================== RCS file: /cvsroot/megameknet/MegaMekNET/src/client/gui/InnerStellarMap.java,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** InnerStellarMap.java 20 Feb 2005 18:03:23 -0000 1.34 --- InnerStellarMap.java 22 Feb 2005 22:07:52 -0000 1.35 *************** *** 52,56 **** import client.MMClient; import common.House; - import common.Influences; import common.Planet; import common.PlanetEnvironment; --- 52,55 ---- *************** *** 1074,1090 **** /** - * Solves events of data fetches by adding the changes to the current - * change set. - */ - public void dataFetched(Map changes) { - for (Iterator it = changes.keySet().iterator(); it.hasNext();) { - Integer id = (Integer)it.next(); - Influences addinf = (Influences) changes.get(id); - Influences oldinf = (Influences) blinkingPlanets.get(id); - if (oldinf != null) addinf.add(oldinf); - blinkingPlanets.put(id,addinf); - } - } - /** * @return Returns the changesSinceLastRefresh. */ --- 1073,1076 ---- |
From: Immanuel S. <im...@us...> - 2005-02-22 21:08:46
|
Update of /cvsroot/megameknet/MegaMekNET/src/server/campaign In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22082/src/server/campaign Modified Files: CampaignMain.java Log Message: beautified and transfered to new command system Index: CampaignMain.java =================================================================== RCS file: /cvsroot/megameknet/MegaMekNET/src/server/campaign/CampaignMain.java,v retrieving revision 1.88 retrieving revision 1.89 diff -C2 -d -r1.88 -r1.89 *** CampaignMain.java 22 Feb 2005 20:46:29 -0000 1.88 --- CampaignMain.java 22 Feb 2005 21:08:31 -0000 1.89 *************** *** 1076,1080 **** commands.put("ADMINCREATESOLARIS", new AdminCreateSolarisCommand()); commands.put("ADMINCREATETERRAIN", new AdminCreateTerrainCommand()); ! commands.put("ADMINDESTROYFACTORY", new AdminDestroyFactoryCommand()); commands.put("ADMINDESTROYPLANET", new AdminDestroyPlanetCommand()); commands.put("ADMINDESTROYTERRAIN", new AdminDestroyTerrainCommand()); --- 1076,1080 ---- commands.put("ADMINCREATESOLARIS", new AdminCreateSolarisCommand()); commands.put("ADMINCREATETERRAIN", new AdminCreateTerrainCommand()); ! commands.put("admindestroyfactory", new AdminDestroyFactoryCommand()); commands.put("ADMINDESTROYPLANET", new AdminDestroyPlanetCommand()); commands.put("ADMINDESTROYTERRAIN", new AdminDestroyTerrainCommand()); |
From: Immanuel S. <im...@us...> - 2005-02-22 21:06:51
|
Update of /cvsroot/megameknet/MegaMekNET/src/server/campaign/commands In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21492/src/server/campaign/commands Modified Files: AdminDestroyFactoryCommand.java Log Message: beautified and transfered to new command system Index: AdminDestroyFactoryCommand.java =================================================================== RCS file: /cvsroot/megameknet/MegaMekNET/src/server/campaign/commands/AdminDestroyFactoryCommand.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** AdminDestroyFactoryCommand.java 20 Feb 2005 10:09:32 -0000 1.7 --- AdminDestroyFactoryCommand.java 22 Feb 2005 21:06:37 -0000 1.8 *************** *** 14,71 **** package server.campaign.commands; ! import java.util.*; ! ! import server.campaign.SUnitFactory; ! import server.campaign.SPlanet; import server.campaign.CampaignMain; ! public class AdminDestroyFactoryCommand extends Command ! { ! public void process(StringTokenizer command,String userName) ! { ! if (CampaignMain.cm.getServer().isAdmin(userName)) ! { ! try{ ! SPlanet p = CampaignMain.cm.getPlanetFromPartialString(command.nextToken(),userName); ! String factoryname = command.nextToken(); ! if ( p == null ) ! { ! CampaignMain.cm.toUser("Planet not found:",userName,true); ! return; ! } ! ! SUnitFactory UF = null; ! ! Iterator it = p.getUnitFactories().iterator(); ! ! if ( !it.hasNext() ) ! { ! CampaignMain.cm.toUser("This planet does not have any factories!",userName,true); ! return; ! } ! ! int count = 0; ! while (it.hasNext()){ ! UF = (SUnitFactory)it.next(); ! if ( UF.getName().equalsIgnoreCase(factoryname) ) ! { ! p.getUnitFactories().removeElementAt(count); ! p.getUnitFactories().trimToSize(); ! break; ! } ! count++; ! } ! ! if ( UF == null ){ ! CampaignMain.cm.toUser("Factory " + factoryname + " not found",userName,true); ! return; ! } ! server.MMServ.mmlog.modLog("Factory " + factoryname + " has been removed."); ! CampaignMain.cm.toUser("Factory " + factoryname + " has been removed.",userName,true); ! } ! catch (Exception ex){ ! ex.printStackTrace(); ! } ! } ! } ! } \ No newline at end of file --- 14,64 ---- package server.campaign.commands; ! import java.util.Iterator; import server.campaign.CampaignMain; + import server.campaign.SPlanet; + import server.campaign.SUnitFactory; ! public class AdminDestroyFactoryCommand extends Command { ! ! public AdminDestroyFactoryCommand() { ! super("admindestroyfactory", 2); ! } ! ! protected String usage() { ! return "planetname#factoryname"; ! } ! ! public String help() { ! return "Destroys a unit factory on a planet. The planetname has to be" + ! "any partial planet name, while the factory must be exactly the" + ! "name of a factory on that planet (but case insensetive)."; ! } ! ! public void process(String[] param, String userName) throws IllegalUsageException { ! SPlanet p = CampaignMain.cm.getPlanetFromPartialString(param[0], userName); ! if (p == null) { ! CampaignMain.cm.toUser("Planet not found:", userName, true); ! return; ! } ! String factoryname = param[1]; ! Iterator it = p.getUnitFactories().iterator(); ! if (!it.hasNext()) { ! CampaignMain.cm.toUser("This planet does not have any factories.", userName, true); ! return; ! } ! SUnitFactory unitFactory = null; ! while (it.hasNext()) { ! unitFactory = (SUnitFactory)it.next(); ! if (unitFactory.getName().equalsIgnoreCase(factoryname)) { ! it.remove(); ! break; ! } ! } ! if (unitFactory == null) { ! CampaignMain.cm.toUser("Factory " + factoryname + " not found", userName, true); ! return; ! } ! server.MMServ.mmlog.modLog("Factory " + factoryname + " has been removed."); ! CampaignMain.cm.toUser("Factory " + factoryname + " has been removed.", userName, true); ! } ! } |
From: Helge R. <mcw...@us...> - 2005-02-22 20:47:16
|
Update of /cvsroot/megameknet/MegaMekNET/src/server/campaign In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14728/src/server/campaign Modified Files: CampaignMain.java Log Message: -> S Fixed Hangar Bugs -> S Added AdminSetFactory Command Index: CampaignMain.java =================================================================== RCS file: /cvsroot/megameknet/MegaMekNET/src/server/campaign/CampaignMain.java,v retrieving revision 1.87 retrieving revision 1.88 diff -C2 -d -r1.87 -r1.88 *** CampaignMain.java 22 Feb 2005 20:21:23 -0000 1.87 --- CampaignMain.java 22 Feb 2005 20:46:29 -0000 1.88 *************** *** 1092,1095 **** --- 1092,1096 ---- commands.put("ADMINSETHOUSEEXTRABAYS", new AdminSetHouseExtraBaysCommand()); commands.put("ADMINSETHOUSEPRICEMOD", new AdminSetHousePriceModCommand()); + commands.put("ADMINSETFACTORY", new AdminSetFactoryCommand()); commands.put("ADMINSCRAP", new AdminScrapCommand()); commands.put("ADMINTRANSFER", new AdminTransferCommand()); |
From: Helge R. <mcw...@us...> - 2005-02-22 20:46:58
|
Update of /cvsroot/megameknet/MegaMekNET In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14728 Modified Files: history.txt Log Message: -> S Fixed Hangar Bugs -> S Added AdminSetFactory Command Index: history.txt =================================================================== RCS file: /cvsroot/megameknet/MegaMekNET/history.txt,v retrieving revision 1.168 retrieving revision 1.169 diff -C2 -d -r1.168 -r1.169 *** history.txt 20 Feb 2005 22:28:37 -0000 1.168 --- history.txt 22 Feb 2005 20:46:31 -0000 1.169 *************** *** 1,2 **** --- 1,5 ---- + -> S Fixed Hangar Bugs + -> S Added AdminSetFactory Command + McW (2005-02-22) SERVER RESTART ON 2005-02-20 CLIENT VERSION 0.500 |
From: Helge R. <mcw...@us...> - 2005-02-22 20:46:39
|
Update of /cvsroot/megameknet/MegaMekNET/src/server/campaign/commands In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14728/src/server/campaign/commands Added Files: AdminSetFactoryCommand.java Log Message: -> S Fixed Hangar Bugs -> S Added AdminSetFactory Command --- NEW FILE: AdminSetFactoryCommand.java --- /** * MegaMekNET * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free * Software Foundation; either version 2 of the License, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * for more details. */ package server.campaign.commands; import java.util.*; import server.campaign.SUnitFactory; import server.campaign.SPlanet; import server.campaign.CampaignMain; public class AdminSetFactoryCommand extends Command { public void process(StringTokenizer command,String userName) { if (CampaignMain.cm.getServer().isAdmin(userName)) { try{ SPlanet p = CampaignMain.cm.getPlanetFromPartialString(command.nextToken(),userName); String factoryname = command.nextToken(); int newType = Integer.parseInt(command.nextToken()); if ( p == null ) { CampaignMain.cm.toUser("Planet not found:",userName,true); return; } SUnitFactory UF = null; Iterator it = p.getUnitFactories().iterator(); if ( !it.hasNext() ) { CampaignMain.cm.toUser("This planet does not have any factories!",userName,true); return; } int count = 0; while (it.hasNext()){ UF = (SUnitFactory)it.next(); if ( UF.getName().equalsIgnoreCase(factoryname) ) { UF.setType(newType) break; } count++; } if ( UF == null ){ CampaignMain.cm.toUser("Factory " + factoryname + " not found",userName,true); return; } server.MMServ.mmlog.modLog("Factory " + factoryname + " has been set to mode: " + newType); CampaignMain.cm.toUser("Factory " + factoryname + " has been set to mode: " + newType,userName,true); } catch (Exception ex){ ex.printStackTrace(); } } } } |
From: Immanuel S. <im...@us...> - 2005-02-22 20:38:37
|
Update of /cvsroot/megameknet/MegaMekNET/src/client/gui In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12291/src/client/gui Modified Files: HSMek.java Log Message: beautified Index: HSMek.java =================================================================== RCS file: /cvsroot/megameknet/MegaMekNET/src/client/gui/HSMek.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** HSMek.java 22 Feb 2005 19:04:58 -0000 1.8 --- HSMek.java 22 Feb 2005 20:38:25 -0000 1.9 *************** *** 15,100 **** import java.util.StringTokenizer; - - import megamek.common.BattleArmor; import megamek.common.Entity; - import megamek.common.MechFileParser; - import megamek.common.Protomech; - import megamek.common.QuadMech; - - import java.io.File; - import common.Unit; ! public class HSMek ! { ! String MekFile; ! StringBuffer name = new StringBuffer(); ! int Gunnery; ! int Piloting; ! int bv; ! String type; ! String skills = ""; ! public HSMek(String s) ! { ! StringTokenizer ST = new StringTokenizer(s,"$"); ! this.MekFile = ST.nextToken(); ! Gunnery = Integer.parseInt(ST.nextToken()); ! Piloting = Integer.parseInt(ST.nextToken()); ! bv = Integer.parseInt(ST.nextToken()); ! if (ST.hasMoreTokens ()) { ! skills = ST.nextToken(); ! }; ! Entity m = getEntity(); ! if (m instanceof megamek.common.Tank) ! setType("Vehicle"); ! else if (m instanceof megamek.common.Infantry) ! setType("Infantry"); ! else ! setType("Mech"); ! // Vehicles and Inf prepend Chasis ! if (type.equalsIgnoreCase("Vehicle") || type.equalsIgnoreCase("Infantry")) { ! name.append(m.getChassis()).append(" "); ! }; ! name.append(m.getModel()).append(" "); ! } ! public Entity getEntity() ! { ! return Unit.loadMech(getMekFile()); ! } ! public int getGunnery() { ! return Gunnery; ! } ! public String getMekFile() { ! return MekFile; ! } ! public String getName() { ! return name.toString(); ! } ! public int getPiloting() { ! return Piloting; ! } ! public String getType() { ! return type; ! } ! public int getBV() { ! return bv; ! } ! /** ! * @return Returns the skills. ! */ ! public String getSkills() { ! return skills; ! } ! public void setType(String type) { ! this.type = type; ! } } --- 15,92 ---- import java.util.StringTokenizer; import megamek.common.Entity; import common.Unit; ! public class HSMek { ! String MekFile; ! StringBuffer name = new StringBuffer(); ! int Gunnery; ! int Piloting; ! int bv; ! String type; ! String skills = ""; + public HSMek(String s) { + StringTokenizer ST = new StringTokenizer(s, "$"); + this.MekFile = ST.nextToken(); + Gunnery = Integer.parseInt(ST.nextToken()); + Piloting = Integer.parseInt(ST.nextToken()); + bv = Integer.parseInt(ST.nextToken()); + if (ST.hasMoreTokens()) { + skills = ST.nextToken(); + } + ; + Entity m = getEntity(); + if (m instanceof megamek.common.Tank) + setType("Vehicle"); + else if (m instanceof megamek.common.Infantry) + setType("Infantry"); + else + setType("Mech"); + // Vehicles and Inf prepend Chasis + if (type.equalsIgnoreCase("Vehicle") || type.equalsIgnoreCase("Infantry")) { + name.append(m.getChassis()).append(" "); + } + ; + name.append(m.getModel()).append(" "); + } ! public Entity getEntity() { ! return Unit.loadMech(getMekFile()); ! } ! public int getGunnery() { ! return Gunnery; ! } ! public String getMekFile() { ! return MekFile; ! } + public String getName() { + return name.toString(); + } + public int getPiloting() { + return Piloting; + } ! public String getType() { ! return type; ! } + public int getBV() { + return bv; + } ! /** ! * @return Returns the skills. ! */ ! public String getSkills() { ! return skills; ! } ! ! public void setType(String type) { ! this.type = type; ! } } |
From: Immanuel S. <im...@us...> - 2005-02-22 20:22:20
|
Update of /cvsroot/megameknet/MegaMekNET/src/server/campaign/commands In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7166/src/server/campaign/commands Modified Files: Command.java SetHouseLogoCommand.java Log Message: sethouselogo is not an admincommand, but a moderator command. Index: Command.java =================================================================== RCS file: /cvsroot/megameknet/MegaMekNET/src/server/campaign/commands/Command.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Command.java 20 Feb 2005 10:09:32 -0000 1.4 --- Command.java 22 Feb 2005 20:21:09 -0000 1.5 *************** *** 97,110 **** } ! public String toString() { return getName(); } public boolean isAdminCommand() { return name.startsWith("admin"); } ! public String getName() { return name; } ! public int getRequiredParameter() { return requiredParameter; } --- 97,115 ---- } ! public final String toString() { return getName(); } + + /** + * You may overwrite this, if the check of starting with "admin" is not + * suitable for this command. + */ public boolean isAdminCommand() { return name.startsWith("admin"); } ! public final String getName() { return name; } ! public final int getRequiredParameter() { return requiredParameter; } *************** *** 114,118 **** * message */ ! public String getUsage(String errorPrefix) { String usage = usage() == null ? "" : "<br>usage: "+getName()+"#"+usage(); usage = usage.replaceAll("\\|", "|"); --- 119,123 ---- * message */ ! public final String getUsage(String errorPrefix) { String usage = usage() == null ? "" : "<br>usage: "+getName()+"#"+usage(); usage = usage.replaceAll("\\|", "|"); Index: SetHouseLogoCommand.java =================================================================== RCS file: /cvsroot/megameknet/MegaMekNET/src/server/campaign/commands/SetHouseLogoCommand.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** SetHouseLogoCommand.java 20 Feb 2005 10:09:32 -0000 1.9 --- SetHouseLogoCommand.java 22 Feb 2005 20:21:09 -0000 1.10 *************** *** 14,19 **** package server.campaign.commands; - import java.util.StringTokenizer; - import server.campaign.CampaignMain; import server.campaign.SHouse; --- 14,17 ---- *************** *** 21,43 **** public class SetHouseLogoCommand extends Command { ! public void usage(String userName) { ! CampaignMain.cm.toUser("syntax: sethouselogo#housename#logourl[#description]", userName, true); } ! public void process(StringTokenizer command, String userName) { ! if (CampaignMain.cm.getServer().isAdmin(userName)) { ! if (!command.hasMoreTokens()) { ! usage(userName); ! return; ! } ! SHouse h = CampaignMain.getHouseFromPartialString(command.nextToken(), userName); ! if (!command.hasMoreTokens()) { ! usage(userName); ! return; ! } ! h.setLogo(command.nextToken()); String descTxt = ""; ! if (command.hasMoreTokens()) { ! h.setDescription(command.nextToken()); descTxt = " and the desciption to '"+h.getDescription()+"'"; } --- 19,43 ---- public class SetHouseLogoCommand extends Command { ! public SetHouseLogoCommand() { ! super("sethouselogo", 2); ! } ! ! protected String usage() { ! return "housename#logourl[#description]"; } ! public String help() { ! return "Set the house logo and optional the house description. These " + ! "are used as example in the defection menu of the client. You " + ! "can specify html-code in the description."; ! } ! ! public void process(String[] param, String userName) throws IllegalUsageException { ! if (CampaignMain.cm.getServer().isModerator(userName)) { ! SHouse h = CampaignMain.getHouseFromPartialString(param[0], userName); ! h.setLogo(param[1]); String descTxt = ""; ! if (param.length > 2) { ! h.setDescription(param[2]); descTxt = " and the desciption to '"+h.getDescription()+"'"; } *************** *** 46,50 **** h.updated(); } else ! CampaignMain.cm.toUser("Only admins can set the house logo.", userName, true); } ! } \ No newline at end of file --- 46,50 ---- h.updated(); } else ! CampaignMain.cm.toUser("Only moderators can set the house logo.", userName, true); } ! } |
From: Immanuel S. <im...@us...> - 2005-02-22 20:21:59
|
Update of /cvsroot/megameknet/MegaMekNET/src/server/campaign In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7166/src/server/campaign Modified Files: CampaignMain.java Log Message: sethouselogo is not an admincommand, but a moderator command. Index: CampaignMain.java =================================================================== RCS file: /cvsroot/megameknet/MegaMekNET/src/server/campaign/CampaignMain.java,v retrieving revision 1.86 retrieving revision 1.87 diff -C2 -d -r1.86 -r1.87 *** CampaignMain.java 20 Feb 2005 19:49:43 -0000 1.86 --- CampaignMain.java 22 Feb 2005 20:21:23 -0000 1.87 *************** *** 1208,1212 **** commands.put("SETARMYMAPSIZE", new SetArmyMapSizeCommand()); commands.put("SETELO", new SetEloCommand()); ! commands.put("SETHOUSELOGO", new SetHouseLogoCommand()); commands.put("SETMAINTAINED", new SetMaintainedCommand()); commands.put("SETMOTD", new SetMOTDCommand()); --- 1208,1212 ---- commands.put("SETARMYMAPSIZE", new SetArmyMapSizeCommand()); commands.put("SETELO", new SetEloCommand()); ! commands.put("sethouselogo", new SetHouseLogoCommand()); commands.put("SETMAINTAINED", new SetMaintainedCommand()); commands.put("SETMOTD", new SetMOTDCommand()); |
From: Immanuel S. <im...@us...> - 2005-02-22 20:18:55
|
Update of /cvsroot/megameknet/MegaMekNET/src/common In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6360/src/common Modified Files: Unit.java Log Message: loadMech fix again Index: Unit.java =================================================================== RCS file: /cvsroot/megameknet/MegaMekNET/src/common/Unit.java,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** Unit.java 20 Feb 2005 23:13:13 -0000 1.22 --- Unit.java 22 Feb 2005 20:18:22 -0000 1.23 *************** *** 314,318 **** if (zEntry.getName().toLowerCase().endsWith(".txt")) continue; ! if (zEntry.getName().endsWith(fileName)) { mechLocation.put(zEntry.getName(), zips[i]); mech = new MechFileParser(zips[i], zEntry.getName()).getEntity(); --- 314,320 ---- if (zEntry.getName().toLowerCase().endsWith(".txt")) continue; ! if (zEntry.getName().equals(fileName) || ! zEntry.getName().endsWith('/'+fileName) || ! zEntry.getName().endsWith('\\'+fileName)) { mechLocation.put(zEntry.getName(), zips[i]); mech = new MechFileParser(zips[i], zEntry.getName()).getEntity(); |
From: Helge R. <mcw...@us...> - 2005-02-22 19:06:01
|
Update of /cvsroot/megameknet/MegaMekNET/src/client/gui In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21371/src/client/gui Modified Files: HSMek.java CHSPanel.java Log Message: fix the Hangar Bug Index: HSMek.java =================================================================== RCS file: /cvsroot/megameknet/MegaMekNET/src/client/gui/HSMek.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** HSMek.java 16 Feb 2005 22:17:01 -0000 1.7 --- HSMek.java 22 Feb 2005 19:04:58 -0000 1.8 *************** *** 15,22 **** --- 15,29 ---- import java.util.StringTokenizer; + + import megamek.common.BattleArmor; import megamek.common.Entity; import megamek.common.MechFileParser; + import megamek.common.Protomech; + import megamek.common.QuadMech; + import java.io.File; + import common.Unit; + public class HSMek { *************** *** 40,95 **** skills = ST.nextToken(); }; ! Entity e = getEntity(); // Vehicles and Inf prepend Chasis if (type.equalsIgnoreCase("Vehicle") || type.equalsIgnoreCase("Infantry")) { ! name.append(e.getChassis()).append(" "); }; ! name.append(e.getModel()).append(" "); } public Entity getEntity() { ! ! Entity MekEntity = null; ! try ! { ! MekEntity = new MechFileParser (new File("./data/mechfiles/MMNetMechs.zip"), MekFile).getEntity(); ! type = "Mek"; ! } ! catch (Exception ex) ! { ! // ex.printStackTrace(); ! } ! if (MekEntity == null) ! { ! try ! { ! MekEntity = new MechFileParser (new File("./data/mechfiles/MMNetVehicles.zip"), MekFile).getEntity(); ! type = "Vehicle"; ! } ! catch (Exception exe) ! { ! try ! { ! MekEntity = new MechFileParser (new File("./data/mechfiles/MMNetInfantry.zip"), MekFile).getEntity(); ! type = "Infantry"; ! } ! catch (Exception exep) ! { ! try ! { ! MekEntity = new MechFileParser (new File("./data/mechfiles/MMNetMechs.zip"),"Wasp WSP-1A.blk").getEntity(); ! type = "Mek"; ! } ! catch (Exception exepe) ! { ! exep.printStackTrace(); ! System.err.println("Mech Loading failed. I tried to prevent this but I've to exit now!"); ! System.exit(1); ! } ! } ! } ! } ! return MekEntity; } --- 47,68 ---- skills = ST.nextToken(); }; ! Entity m = getEntity(); ! if (m instanceof megamek.common.Tank) ! setType("Vehicle"); ! else if (m instanceof megamek.common.Infantry) ! setType("Infantry"); ! else ! setType("Mech"); ! // Vehicles and Inf prepend Chasis if (type.equalsIgnoreCase("Vehicle") || type.equalsIgnoreCase("Infantry")) { ! name.append(m.getChassis()).append(" "); }; ! name.append(m.getModel()).append(" "); } public Entity getEntity() { ! return Unit.loadMech(getMekFile()); } *************** *** 120,122 **** --- 93,100 ---- return skills; } + + + public void setType(String type) { + this.type = type; + } } Index: CHSPanel.java =================================================================== RCS file: /cvsroot/megameknet/MegaMekNET/src/client/gui/CHSPanel.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** CHSPanel.java 16 Feb 2005 22:17:01 -0000 1.8 --- CHSPanel.java 22 Feb 2005 19:04:59 -0000 1.9 *************** *** 42,45 **** --- 42,46 ---- import client.campaign.CUnit; import common.House; + import common.Unit; /** *************** *** 378,397 **** public void showInfoWindow(String MekFile, int BV) { ! Entity MekEntity = null; ! try { ! MekEntity = new MechFileParser(new File("./data/mechfiles/MMNetMechs.zip"), MekFile).getEntity(); ! } catch (Exception ex) { ! // ex.printStackTrace(); ! } ! if (MekEntity == null) { ! try { ! MekEntity = new MechFileParser(new File("./data/mechfiles/MMNetVehicles.zip"), MekFile).getEntity(); ! } catch (Exception exe) { ! try { ! MekEntity = new MechFileParser(new File("./data/mechfiles/MMNetInfantry.zip"), MekFile).getEntity(); ! } catch (Exception exep) { ! return; ! } ! } } JFrame InfoWindow = new JFrame(); --- 379,385 ---- public void showInfoWindow(String MekFile, int BV) { ! Entity MekEntity = Unit.loadMech(MekFile); ! if (MekEntity == null){ ! return; } JFrame InfoWindow = new JFrame(); |
From: Dima N. <nem...@us...> - 2005-02-22 12:35:31
|
Update of /cvsroot/megameknet/MegaMekNET/client-dist/data/mex In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9091 Modified Files: mechset-mmnet.txt Added Files: palyndrome.gif Log Message: Added the Palyndrome courtesy of Vertigo --- NEW FILE: palyndrome.gif --- (This appears to be a binary file; contents omitted.) Index: mechset-mmnet.txt =================================================================== RCS file: /cvsroot/megameknet/MegaMekNET/client-dist/data/mex/mechset-mmnet.txt,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** mechset-mmnet.txt 19 Feb 2005 15:56:49 -0000 1.1 --- mechset-mmnet.txt 22 Feb 2005 12:35:20 -0000 1.2 *************** *** 675,676 **** --- 675,677 ---- chassis "Taurus Medium Combat Vehicle" "taurus.gif" chassis "Kruger Combat Car" "kruger.gif" + chassis "Palyndrome" "palyndrome.gif" |