megameknet-cvs Mailing List for MegaMekNET
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: Helge R. <mcw...@us...> - 2005-05-16 23:41:58
|
Update of /cvsroot/megameknet/MegaMekNET/src/client In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22024/src/client Modified Files: ClientThread.java Log Message: Modified Client to fit with MM again, changed BB remove command to mod only Index: ClientThread.java =================================================================== RCS file: /cvsroot/megameknet/MegaMekNET/src/client/ClientThread.java,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** ClientThread.java 7 May 2005 16:42:40 -0000 1.16 --- ClientThread.java 16 May 2005 08:54:16 -0000 1.17 *************** *** 35,39 **** import megamek.common.QuadMech; import megamek.common.Tank; - import megamek.common.event.GameAttackEvent; import megamek.common.event.GameBoardChangeEvent; import megamek.common.event.GameBoardNewEvent; --- 35,38 ---- *************** *** 46,49 **** --- 45,49 ---- import megamek.common.event.GameListener; import megamek.common.event.GameMapQueryEvent; + import megamek.common.event.GameNewActionEvent; import megamek.common.event.GamePhaseChangeEvent; import megamek.common.event.GamePlayerChangeEvent; *************** *** 470,476 **** /* (non-Javadoc) ! * @see megamek.common.event.GameListener#gameAttack(megamek.common.event.GameAttackEvent) */ ! public void gameAttack(GameAttackEvent e) { // TODO Auto-generated method stub --- 470,476 ---- /* (non-Javadoc) ! * @see megamek.common.event.GameListener#gameNewAction(megamek.common.event.GameNewActionEvent) */ ! public void gameNewAction(GameNewActionEvent e) { // TODO Auto-generated method stub |
From: Helge R. <mcw...@us...> - 2005-05-16 22:45:47
|
Update of /cvsroot/megameknet/MegaMekNET/src/server/campaign/commands In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22024/src/server/campaign/commands Modified Files: BlackBoardCommand.java Log Message: Modified Client to fit with MM again, changed BB remove command to mod only Index: BlackBoardCommand.java =================================================================== RCS file: /cvsroot/megameknet/MegaMekNET/src/server/campaign/commands/BlackBoardCommand.java,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** BlackBoardCommand.java 11 Apr 2005 20:01:29 -0000 1.11 --- BlackBoardCommand.java 16 May 2005 08:54:14 -0000 1.12 *************** *** 71,76 **** newMessage(bbm, p); } else if (cmd.equals("remove")) { ! if (!CampaignMain.cm.getServer().isAdmin(username)) { ! CampaignMain.cm.toUser("Access denied. You need to be an admin to remove blackboard messages.", username, true); return; } --- 71,76 ---- newMessage(bbm, p); } else if (cmd.equals("remove")) { ! if (!CampaignMain.cm.getServer().isModerator(username)) { ! CampaignMain.cm.toUser("Access denied. You need to be a mod to remove blackboard messages.", username, true); return; } |
From: Helge R. <mcw...@us...> - 2005-05-16 22:23:06
|
Update of /cvsroot/megameknet/MegaMekNET/src/server/campaign In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22024/src/server/campaign Modified Files: SUnitFactory.java Log Message: Modified Client to fit with MM again, changed BB remove command to mod only Index: SUnitFactory.java =================================================================== RCS file: /cvsroot/megameknet/MegaMekNET/src/server/campaign/SUnitFactory.java,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** SUnitFactory.java 26 Mar 2005 12:22:13 -0000 1.11 --- SUnitFactory.java 16 May 2005 08:54:10 -0000 1.12 *************** *** 119,122 **** --- 119,123 ---- */ public void fromString(String s, SPlanet p, Random r) { + System.out.println("Reading: " + s + " on " + p.getName()); s = s.substring(3); StringTokenizer st = new StringTokenizer(s, "*"); |
From: Helge R. <mcw...@us...> - 2005-05-11 15:45:20
|
Update of /cvsroot/megameknet/MegaMekNET/src/client/cmd In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14307/src/client/cmd Modified Files: GO.java Log Message: adjusted to new MM versions Index: GO.java =================================================================== RCS file: /cvsroot/megameknet/MegaMekNET/src/client/cmd/GO.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** GO.java 7 May 2005 16:42:40 -0000 1.7 --- GO.java 11 May 2005 15:45:02 -0000 1.8 *************** *** 16,19 **** --- 16,22 ---- import java.util.StringTokenizer; + import megamek.common.options.GameOptions; + import megamek.common.options.Option; + import client.MMClient; *************** *** 33,40 **** StringTokenizer st = decode(input); client.getGameOptions().clear(); ! /*while (st.hasMoreElements()){ ! //TODO: Fix! ! //client.getGameOptions().add(new Option(client.getGameOptions(),st.nextToken(),new Boolean(st.nextToken()).booleanValue())); ! }*/ } } --- 36,44 ---- StringTokenizer st = decode(input); client.getGameOptions().clear(); ! while (st.hasMoreElements()) ! { ! String option = st.nextToken(); ! client.getGameOptions().add(new Option(new GameOptions(),option,new Boolean(st.nextToken()).booleanValue())); ! } } } |
From: Helge R. <mcw...@us...> - 2005-05-07 16:42:50
|
Update of /cvsroot/megameknet/MegaMekNET/src/client In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv995/src/client Modified Files: ClientThread.java Log Message: Made client capable of supporting latest megamek. One small thing is still missing.. Index: ClientThread.java =================================================================== RCS file: /cvsroot/megameknet/MegaMekNET/src/client/ClientThread.java,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** ClientThread.java 26 Feb 2005 20:44:23 -0000 1.15 --- ClientThread.java 7 May 2005 16:42:40 -0000 1.16 *************** *** 20,34 **** import java.util.Vector; - import client.campaign.CUnit; - - import common.MegaMekPilotOption; - import common.PlanetEnvironment; - import common.Unit; - import megamek.client.Client; import megamek.client.ClientGUI; import megamek.client.CloseClientListener; - import megamek.client.GameEvent; - import megamek.client.GameListener; import megamek.common.BattleArmor; import megamek.common.CriticalSlot; --- 20,26 ---- *************** *** 39,49 **** import megamek.common.MechWarrior; import megamek.common.Pilot; - import megamek.common.PilotOptions; import megamek.common.Player; import megamek.common.Protomech; import megamek.common.QuadMech; import megamek.common.Tank; ! import megamek.common.options.GameOption; ! import megamek.common.options.OptionGroup; --- 31,63 ---- import megamek.common.MechWarrior; import megamek.common.Pilot; import megamek.common.Player; import megamek.common.Protomech; import megamek.common.QuadMech; import megamek.common.Tank; ! import megamek.common.event.GameAttackEvent; ! import megamek.common.event.GameBoardChangeEvent; ! import megamek.common.event.GameBoardNewEvent; ! import megamek.common.event.GameEndEvent; ! import megamek.common.event.GameEntityChangeEvent; ! import megamek.common.event.GameEntityNewEvent; ! import megamek.common.event.GameEntityNewOffboardEvent; ! import megamek.common.event.GameEntityRemoveEvent; ! import megamek.common.event.GameEvent; ! import megamek.common.event.GameListener; ! import megamek.common.event.GameMapQueryEvent; ! import megamek.common.event.GamePhaseChangeEvent; ! import megamek.common.event.GamePlayerChangeEvent; ! import megamek.common.event.GamePlayerChatEvent; ! import megamek.common.event.GamePlayerConnectedEvent; ! import megamek.common.event.GamePlayerDisconnectedEvent; ! import megamek.common.event.GameReportEvent; ! import megamek.common.event.GameSettingsChangeEvent; ! import megamek.common.event.GameTurnChangeEvent; ! import megamek.common.options.IOption; ! import client.campaign.CUnit; ! ! import common.MegaMekPilotOption; ! import common.PlanetEnvironment; ! import common.Unit; *************** *** 81,85 **** public void run() { client = new Client(myname, serverip, serverport); ! client.addGameListener(this); client.addCloseClientListener(this); ClientGUI gui = new ClientGUI(client); --- 95,99 ---- public void run() { client = new Client(myname, serverip, serverport); ! client.game.addGameListener(this); client.addCloseClientListener(this); ClientGUI gui = new ClientGUI(client); *************** *** 126,138 **** while (iter.hasNext()) { MegaMekPilotOption po = (MegaMekPilotOption) iter.next(); ! for (Enumeration enumeration = pilot.getOptions().groups(); enumeration.hasMoreElements();) { ! OptionGroup group = (OptionGroup) enumeration.nextElement(); ! if (!group.getKey().equalsIgnoreCase(PilotOptions.LVL3_ADVANTAGES)) continue; ! for (Enumeration j = group.options(); j.hasMoreElements();) { ! GameOption option = (GameOption) j.nextElement(); ! System.out.println("Checking: " + option.getShortName() + " with " + po.getMmname()); ! if (option.getShortName().equals(po.getMmname())) option.setValue(po.isValue()); - } } } --- 140,148 ---- while (iter.hasNext()) { MegaMekPilotOption po = (MegaMekPilotOption) iter.next(); ! for (Enumeration enumeration = pilot.getOptions().getOptions(); enumeration.hasMoreElements();) { ! IOption option = (IOption) enumeration.nextElement(); ! System.out.println("Checking: " + option.getName() + " with " + po.getMmname()); ! if (option.getName().equals(po.getMmname())) option.setValue(po.isValue()); } } *************** *** 177,192 **** } } - public void gamePlayerStatusChange(GameEvent e) { - } - - public void gameTurnChange(GameEvent e) { - System.out.println("gTC: " + e.getMessage()); - //This is called twice as often as it should be.. - if (client != null) { - if (client.game.getRoundCount() == 0) - myClient.setGameState("Running"); - myClient.setGameTurn(client.game.getTurnIndex()); - } - } public String serializeEntity (Entity e) { --- 187,190 ---- *************** *** 251,314 **** } ! public void gamePhaseChange(GameEvent e) { ! String result = ""; ! if (client.game.getPhase() == Game.PHASE_VICTORY) { ! //result += this.myTaskID + "#"; ! //Parse the real playername from the Modified In game one.. ! String winnerName = ""; ! if (client.game.getVictoryTeam() != 0) { ! //Multiple Winners ! Enumeration en = client.game.getPlayers(); ! while (en.hasMoreElements()) { ! Player p = (Player) en.nextElement(); ! if (p.getTeam() == client.game.getVictoryTeam()) { ! StringTokenizer st = new StringTokenizer(p.getName().trim(), "~"); ! String name = ""; ! while (st.hasMoreElements()) { ! name = st.nextToken().trim(); ! } ! winnerName += name + "*"; ! } ! } ! winnerName += "#"; ! } else { ! //Only one winner ! winnerName = client.game.getPlayer(client.game.getVictoryPlayerId()).getName(); ! StringTokenizer st = new StringTokenizer(winnerName, "~"); ! String name = ""; ! while (st.hasMoreElements()) { ! name = st.nextToken().trim(); ! } ! winnerName = name + "#"; ! } ! result += winnerName; ! //Report the mech stati ! Enumeration en = client.game.getDevastatedEntities(); ! while (en.hasMoreElements()) { ! megamek.common.Entity ent = (Entity) en.nextElement(); ! result += this.serializeEntity(ent) + "#"; ! } ! en = client.game.getGraveyardEntities(); ! while (en.hasMoreElements()) { ! megamek.common.Entity ent = (Entity) en.nextElement(); ! result += this.serializeEntity(ent) + "#"; ! } ! en = client.game.getEntities(); ! while (en.hasMoreElements()) { ! megamek.common.Entity ent = (Entity) en.nextElement(); ! result += this.serializeEntity(ent) + "#"; ! } ! en = client.game.getRetreatedEntities(); ! while (en.hasMoreElements()) { ! megamek.common.Entity ent = (Entity) en.nextElement(); ! result += this.serializeEntity(ent) + "#"; ! } ! System.out.println("CR|" + result); ! myClient.serverSend("CR|" + result); ! System.out.println("GAME END"); ! } ! } ! ! public void gamePlayerChat(GameEvent e) { } --- 249,253 ---- } ! public void gamePlayerChat(GameEvent e) { } *************** *** 340,342 **** --- 279,478 ---- myClient.closingGame(gameid); } + + /* (non-Javadoc) + * @see megamek.common.event.GameListener#gamePlayerConnected(megamek.common.event.GamePlayerConnectedEvent) + */ + public void gamePlayerConnected(GamePlayerConnectedEvent e) { + // TODO Auto-generated method stub + + } + + /* (non-Javadoc) + * @see megamek.common.event.GameListener#gamePlayerDisconnected(megamek.common.event.GamePlayerDisconnectedEvent) + */ + public void gamePlayerDisconnected(GamePlayerDisconnectedEvent e) { + // TODO Auto-generated method stub + + } + + /* (non-Javadoc) + * @see megamek.common.event.GameListener#gamePlayerChange(megamek.common.event.GamePlayerChangeEvent) + */ + public void gamePlayerChange(GamePlayerChangeEvent e) { + // TODO Auto-generated method stub + + } + + /* (non-Javadoc) + * @see megamek.common.event.GameListener#gamePlayerChat(megamek.common.event.GamePlayerChatEvent) + */ + public void gamePlayerChat(GamePlayerChatEvent e) { + // TODO Auto-generated method stub + + } + + /* (non-Javadoc) + * @see megamek.common.event.GameListener#gameTurnChange(megamek.common.event.GameTurnChangeEvent) + */ + public void gameTurnChange(GameTurnChangeEvent e) { + //System.out.println("gTC: " + e.getMessage()); + //This is called twice as often as it should be.. + if (client != null) { + if (client.game.getRoundCount() == 0) + myClient.setGameState("Running"); + myClient.setGameTurn(client.game.getTurnIndex()); + } + + } + + /* (non-Javadoc) + * @see megamek.common.event.GameListener#gamePhaseChange(megamek.common.event.GamePhaseChangeEvent) + */ + public void gamePhaseChange(GamePhaseChangeEvent e) { + String result = ""; + if (client.game.getPhase() == Game.PHASE_VICTORY) { + //result += this.myTaskID + "#"; + //Parse the real playername from the Modified In game one.. + String winnerName = ""; + if (client.game.getVictoryTeam() != 0) { + //Multiple Winners + Enumeration en = client.game.getPlayers(); + while (en.hasMoreElements()) { + Player p = (Player) en.nextElement(); + if (p.getTeam() == client.game.getVictoryTeam()) { + StringTokenizer st = new StringTokenizer(p.getName().trim(), "~"); + String name = ""; + while (st.hasMoreElements()) { + name = st.nextToken().trim(); + } + winnerName += name + "*"; + } + } + winnerName += "#"; + } else { + //Only one winner + winnerName = client.game.getPlayer(client.game.getVictoryPlayerId()).getName(); + StringTokenizer st = new StringTokenizer(winnerName, "~"); + String name = ""; + while (st.hasMoreElements()) { + name = st.nextToken().trim(); + } + winnerName = name + "#"; + } + result += winnerName; + //Report the mech stati + Enumeration en = client.game.getDevastatedEntities(); + while (en.hasMoreElements()) { + megamek.common.Entity ent = (Entity) en.nextElement(); + result += this.serializeEntity(ent) + "#"; + } + en = client.game.getGraveyardEntities(); + while (en.hasMoreElements()) { + megamek.common.Entity ent = (Entity) en.nextElement(); + result += this.serializeEntity(ent) + "#"; + } + en = client.game.getEntities(); + while (en.hasMoreElements()) { + megamek.common.Entity ent = (Entity) en.nextElement(); + result += this.serializeEntity(ent) + "#"; + } + en = client.game.getRetreatedEntities(); + while (en.hasMoreElements()) { + megamek.common.Entity ent = (Entity) en.nextElement(); + result += this.serializeEntity(ent) + "#"; + } + System.out.println("CR|" + result); + myClient.serverSend("CR|" + result); + System.out.println("GAME END"); + } + + } + + /* (non-Javadoc) + * @see megamek.common.event.GameListener#gameReport(megamek.common.event.GameReportEvent) + */ + public void gameReport(GameReportEvent e) { + // TODO Auto-generated method stub + + } + + /* (non-Javadoc) + * @see megamek.common.event.GameListener#gameEnd(megamek.common.event.GameEndEvent) + */ + public void gameEnd(GameEndEvent e) { + // TODO Auto-generated method stub + + } + + /* (non-Javadoc) + * @see megamek.common.event.GameListener#gameBoardNew(megamek.common.event.GameBoardNewEvent) + */ + public void gameBoardNew(GameBoardNewEvent e) { + // TODO Auto-generated method stub + + } + + /* (non-Javadoc) + * @see megamek.common.event.GameListener#gameBoardChanged(megamek.common.event.GameBoardChangeEvent) + */ + public void gameBoardChanged(GameBoardChangeEvent e) { + // TODO Auto-generated method stub + + } + + /* (non-Javadoc) + * @see megamek.common.event.GameListener#gameSettingsChange(megamek.common.event.GameSettingsChangeEvent) + */ + public void gameSettingsChange(GameSettingsChangeEvent e) { + // TODO Auto-generated method stub + + } + + /* (non-Javadoc) + * @see megamek.common.event.GameListener#gameMapQuery(megamek.common.event.GameMapQueryEvent) + */ + public void gameMapQuery(GameMapQueryEvent e) { + // TODO Auto-generated method stub + + } + + /* (non-Javadoc) + * @see megamek.common.event.GameListener#gameEntityNew(megamek.common.event.GameEntityNewEvent) + */ + public void gameEntityNew(GameEntityNewEvent e) { + // TODO Auto-generated method stub + + } + + /* (non-Javadoc) + * @see megamek.common.event.GameListener#gameEntityNewOffboard(megamek.common.event.GameEntityNewOffboardEvent) + */ + public void gameEntityNewOffboard(GameEntityNewOffboardEvent e) { + // TODO Auto-generated method stub + + } + + /* (non-Javadoc) + * @see megamek.common.event.GameListener#gameEntityRemove(megamek.common.event.GameEntityRemoveEvent) + */ + public void gameEntityRemove(GameEntityRemoveEvent e) { + // TODO Auto-generated method stub + + } + + /* (non-Javadoc) + * @see megamek.common.event.GameListener#gameEntityChange(megamek.common.event.GameEntityChangeEvent) + */ + public void gameEntityChange(GameEntityChangeEvent e) { + // TODO Auto-generated method stub + + } + + /* (non-Javadoc) + * @see megamek.common.event.GameListener#gameAttack(megamek.common.event.GameAttackEvent) + */ + public void gameAttack(GameAttackEvent e) { + // TODO Auto-generated method stub + + } } \ No newline at end of file |
From: Helge R. <mcw...@us...> - 2005-05-07 16:42:50
|
Update of /cvsroot/megameknet/MegaMekNET/src/common/visitor In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv995/src/common/visitor Modified Files: XMLLoadVisitor.java Log Message: Made client capable of supporting latest megamek. One small thing is still missing.. Index: XMLLoadVisitor.java =================================================================== RCS file: /cvsroot/megameknet/MegaMekNET/src/common/visitor/XMLLoadVisitor.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** XMLLoadVisitor.java 9 Apr 2005 12:56:38 -0000 1.9 --- XMLLoadVisitor.java 7 May 2005 16:42:40 -0000 1.10 *************** *** 26,30 **** import java.util.Map; import java.util.StringTokenizer; ! import megamek.common.options.GameOption; import org.jdom.Attribute; import org.jdom.Element; --- 26,30 ---- import java.util.Map; import java.util.StringTokenizer; ! import megamek.common.options.IOption; import org.jdom.Attribute; import org.jdom.Element; *************** *** 415,419 **** Map options = new HashMap(); ! for (Iterator it = toVisitorable("gameOption", e, GameOption.class).iterator(); it.hasNext();) { PlayerOption po = (PlayerOption)it.next(); options.put(po.getDescription(), po); --- 415,419 ---- Map options = new HashMap(); ! for (Iterator it = toVisitorable("gameOption", e, IOption.class).iterator(); it.hasNext();) { PlayerOption po = (PlayerOption)it.next(); options.put(po.getDescription(), po); |
From: Helge R. <mcw...@us...> - 2005-05-07 16:42:50
|
Update of /cvsroot/megameknet/MegaMekNET/src/client/cmd In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv995/src/client/cmd Modified Files: GO.java Log Message: Made client capable of supporting latest megamek. One small thing is still missing.. Index: GO.java =================================================================== RCS file: /cvsroot/megameknet/MegaMekNET/src/client/cmd/GO.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** GO.java 19 Feb 2005 01:40:36 -0000 1.6 --- GO.java 7 May 2005 16:42:40 -0000 1.7 *************** *** 16,20 **** import java.util.StringTokenizer; - import megamek.common.options.GameOption; import client.MMClient; --- 16,19 ---- *************** *** 34,39 **** StringTokenizer st = decode(input); client.getGameOptions().clear(); ! while (st.hasMoreElements()) ! client.getGameOptions().add(new GameOption(st.nextToken(),"bla","bla",new Boolean(st.nextToken()).booleanValue())); } } --- 33,40 ---- StringTokenizer st = decode(input); client.getGameOptions().clear(); ! /*while (st.hasMoreElements()){ ! //TODO: Fix! ! //client.getGameOptions().add(new Option(client.getGameOptions(),st.nextToken(),new Boolean(st.nextToken()).booleanValue())); ! }*/ } } |
From: Helge R. <mcw...@us...> - 2005-04-24 12:02:35
|
Update of /cvsroot/megameknet/MegaMekNET In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20174 Modified Files: history.txt Log Message: CLIENT VERSION 0.510 SERVER VERSION 0.3 McW 2005-04-24 Index: history.txt =================================================================== RCS file: /cvsroot/megameknet/MegaMekNET/history.txt,v retrieving revision 1.204 retrieving revision 1.205 diff -C2 -d -r1.204 -r1.205 *** history.txt 23 Apr 2005 16:46:30 -0000 1.204 --- history.txt 24 Apr 2005 12:02:27 -0000 1.205 *************** *** 1,2 **** --- 1,5 ---- + CLIENT VERSION 0.510 + SERVER VERSION 0.3 + McW 2005-04-24 -> S RFE [ 1188608 ] Planetary % -- before, please! McW 2005-04-23 |
From: Helge R. <mcw...@us...> - 2005-04-23 16:46:42
|
Update of /cvsroot/megameknet/MegaMekNET/src/server/campaign/tasks In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1954/src/server/campaign/tasks Modified Files: ConquerTask.java Log Message: -> S RFE [ 1188608 ] Planetary % -- before, please! McW 2005-04-23 Index: ConquerTask.java =================================================================== RCS file: /cvsroot/megameknet/MegaMekNET/src/server/campaign/tasks/ConquerTask.java,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** ConquerTask.java 6 Mar 2005 16:59:40 -0000 1.24 --- ConquerTask.java 23 Apr 2005 16:46:30 -0000 1.25 *************** *** 29,32 **** --- 29,36 ---- public class ConquerTask extends Task { private int winnerGain = 0; + private int attackerGain = UNDEFINDED; + private int defenderGain = UNDEFINDED; + + private static final int UNDEFINDED = -1; public ConquerTask(){ *************** *** 159,163 **** attackerforces = getAttacker().getArmy().getDescription(accurate); defenderforces = getDefender().getArmy().getDescription(accurate); ! return "#" + this.getID() + " <b>" + attackingP.getColoredName() + "(" + attackerfightingFor.getName() + ")</b>" + " attacking " + getTarget().getName() + " with " + attackerforces + ". Defender is: " + defendingP.getColoredName() + "(" + defenderFightingFor.getName() + ")" + " with " + defenderforces + " Percentage at stake: " + this.getPercentAtStake() + "%<br>"; } --- 163,167 ---- attackerforces = getAttacker().getArmy().getDescription(accurate); defenderforces = getDefender().getArmy().getDescription(accurate); ! return "#" + this.getID() + " <b>" + attackingP.getColoredName() + "(" + attackerfightingFor.getName() + ")</b>" + " attacking " + getTarget().getName() + " with " + attackerforces + ". Defender is: " + defendingP.getColoredName() + "(" + defenderFightingFor.getName() + ")" + " with " + defenderforces + " Percentage at stake: " + this.getPossibleAttackerGain() + "/" + getPossibleDefenderGain() + "%<br>"; } *************** *** 203,206 **** --- 207,224 ---- public void doGrantEXPandMoney() {} */ + + public int getPossibleAttackerGain(){ + if (attackerGain == UNDEFINDED ){ + attackerGain = getPercentAtStake(getActor(), getDefender()); + } + return attackerGain; + } + + public int getPossibleDefenderGain() { + if (defenderGain == UNDEFINDED){ + defenderGain = getPercentAtStake(getDefender(), getActor()); + } + return defenderGain; + } public void processTaskResult() { *************** *** 213,246 **** return; } - int gainpercentage = this.getPercentAtStake(); TaskPlayer winner = (TaskPlayer) this.getPlayersWhich("win").elementAt(0); TaskPlayer loser = (TaskPlayer) this.getPlayersWhich("loss").elementAt(0); ! /*if (!winner.isAttacker()) { ! //Winner lost enough to justify no planetary gain. ! if (((double) loser.getLostBV() / (double) loser.getInitialBV()) > 0.2) ! gainpercentage = 0; ! else ! this.sendToAll(loser.getPlayer().getName() + "'s forces were routed; in pursuing the soundly-defeated enemy " + winner.getPlayer().getName() + "'s forces advanced into enemy territory!", true); ! }*/ //Store the old owner SHouse oldowner = getTarget().getOwner(); - //Get a mod to the land gain based on frontline positions - int planetsInRange = CampaignMain.cm.getData().getPlanetsInRange(getTarget(),null, 35, Integer.parseInt(CampaignMain.cm.getConfig("ConquerFrontlineRange"))); - int planetsControlled = CampaignMain.cm.getData().getPlanetsInRange(getTarget(), winner.getPlayer().getMyHouse(),35, Integer.parseInt(CampaignMain.cm.getConfig("ConquerFrontlineRange"))); - if (planetsInRange != 0){ - double percentControlled = (double)planetsControlled / (double)planetsInRange; - if (percentControlled >= Double.parseDouble(CampaignMain.cm.getConfig("ConquerFrontlineBonus"))) - gainpercentage += 5; - else if (percentControlled <= Double.parseDouble(CampaignMain.cm.getConfig("ConquerFrontlineMalus"))) - gainpercentage -= 5; - } - //Defender gets half - if (!winner.isAttacker()) - gainpercentage = gainpercentage / 2; - if (gainpercentage <= 0) - gainpercentage = 1; - //Do the Land gain winnerGain = getTarget().doGainInfluence(winner.getPlayer().getHouseFightingFor(), loser.getPlayer().getHouseFightingFor(), gainpercentage); --- 231,247 ---- return; } TaskPlayer winner = (TaskPlayer) this.getPlayersWhich("win").elementAt(0); TaskPlayer loser = (TaskPlayer) this.getPlayersWhich("loss").elementAt(0); ! ! int gainpercentage; ! if (winner.isAttacker()){ ! gainpercentage = getPossibleAttackerGain(); ! } else { ! gainpercentage = getPossibleDefenderGain(); ! } //Store the old owner SHouse oldowner = getTarget().getOwner(); //Do the Land gain winnerGain = getTarget().doGainInfluence(winner.getPlayer().getHouseFightingFor(), loser.getPlayer().getHouseFightingFor(), gainpercentage); *************** *** 262,271 **** } ! public int getPercentAtStake() { TaskPlayer a = this.getActor(); TaskPlayer b = this.getDefender(); ! return getPercentAtStake(a.getPlayer(), b.getPlayer()); } ! public int getPercentAtStake(SPlayer attacker, SPlayer defender){ //Calulate the lowest ELO double lowestELO = attacker.getConqElo(); --- 263,290 ---- } ! public int getPercentAtStake(TaskPlayer winner, TaskPlayer loser) { TaskPlayer a = this.getActor(); TaskPlayer b = this.getDefender(); ! int gainpercentage = getPercentAtStakeBase(a.getPlayer(), b.getPlayer()); ! //Get a mod to the land gain based on frontline positions ! int planetsInRange = CampaignMain.cm.getData().getPlanetsInRange(getTarget(),null, 35, Integer.parseInt(CampaignMain.cm.getConfig("ConquerFrontlineRange"))); ! int planetsControlled = CampaignMain.cm.getData().getPlanetsInRange(getTarget(), winner.getPlayer().getMyHouse(),35, Integer.parseInt(CampaignMain.cm.getConfig("ConquerFrontlineRange"))); ! if (planetsInRange != 0){ ! double percentControlled = (double)planetsControlled / (double)planetsInRange; ! if (percentControlled >= Double.parseDouble(CampaignMain.cm.getConfig("ConquerFrontlineBonus"))) ! gainpercentage += 5; ! else if (percentControlled <= Double.parseDouble(CampaignMain.cm.getConfig("ConquerFrontlineMalus"))) ! gainpercentage -= 5; ! } ! //Defender gets half ! if (!winner.isAttacker()) ! gainpercentage = gainpercentage / 2; ! if (gainpercentage <= 0) ! gainpercentage = 1; ! ! return gainpercentage; ! } ! public int getPercentAtStakeBase(SPlayer attacker, SPlayer defender){ //Calulate the lowest ELO double lowestELO = attacker.getConqElo(); *************** *** 282,293 **** else gainpercentage = 1; ! /* ! if (a.getInitialBV() > 10000) ! gainpercentage++; ! if (a.getInitialBV() > 5000) ! gainpercentage++; ! if (a.getInitialBV() > 3000) ! gainpercentage++; ! */ if (eloDifference > 100 && lowestELO < 1750) gainpercentage--; --- 301,306 ---- else gainpercentage = 1; ! ! //Elo Mods if (eloDifference > 100 && lowestELO < 1750) gainpercentage--; *************** *** 297,361 **** gainpercentage--; - //Minimum of 1% if (gainpercentage <= 0) gainpercentage = 1; - - /* OLD WAY - if (lowestELO > 2000) - gainpercentage = 18; - else if (lowestELO > 1950) - gainpercentage = 16; - else if (lowestELO > 1900) - gainpercentage = 14; - else if (lowestELO > 1850) - gainpercentage = 12; - else if (lowestELO > 1800) - gainpercentage = 10; - else if (lowestELO > 1750) - gainpercentage = 8; - else if (lowestELO > 1700) - gainpercentage = 6; - else if (lowestELO > 1650) - gainpercentage = 4; - else if (lowestELO > 1600) - gainpercentage = 3; - else if (lowestELO > 1500) - gainpercentage = 2; - else - gainpercentage = 1; - - //Same ELO = BONUS! - if (ELOdifference < 50) - gainpercentage += 2; - - //Malus for unfair games - if (ELOdifference > 50) - gainpercentage--; - if (ELOdifference > 100) - gainpercentage--; - if (ELOdifference > 170) - gainpercentage--; - if (ELOdifference > 250) - gainpercentage--; - if (ELOdifference > 350) - gainpercentage--; - if (ELOdifference > 450) - gainpercentage--; - //Won't ever happen. But to be sure.. - if (ELOdifference > 550) - gainpercentage = 1; - - if (this.getActorArmy().getBV() < 3000) - gainpercentage = (int)((double)gainpercentage * (double)this.getActorArmy().getBV() / (double)3000); - - //Minimum of 1% - if (gainpercentage <= 0) - gainpercentage = 1; - */ return gainpercentage * 5; } public int getTaskMod(SPlayer attacker, SPlayer defender){ ! return getPercentAtStake(attacker, defender); } public int getTypeID(){ --- 310,322 ---- gainpercentage--; //Minimum of 1% if (gainpercentage <= 0) gainpercentage = 1; return gainpercentage * 5; } + + //Attacker determines the counter worthiness public int getTaskMod(SPlayer attacker, SPlayer defender){ ! return getPossibleAttackerGain(); } public int getTypeID(){ |
From: Helge R. <mcw...@us...> - 2005-04-23 16:46:39
|
Update of /cvsroot/megameknet/MegaMekNET In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1954 Modified Files: history.txt Log Message: -> S RFE [ 1188608 ] Planetary % -- before, please! McW 2005-04-23 Index: history.txt =================================================================== RCS file: /cvsroot/megameknet/MegaMekNET/history.txt,v retrieving revision 1.203 retrieving revision 1.204 diff -C2 -d -r1.203 -r1.204 *** history.txt 28 Mar 2005 18:26:24 -0000 1.203 --- history.txt 23 Apr 2005 16:46:30 -0000 1.204 *************** *** 1,2 **** --- 1,4 ---- + -> S RFE [ 1188608 ] Planetary % -- before, please! + McW 2005-04-23 -> S Fix a problem with houses not getting the planets they conquered! -> C/S DATAPORT is now Serverport + 1 fixed. No need for 2 paramters. |
From: Helge R. <mcw...@us...> - 2005-04-13 18:14:40
|
Update of /cvsroot/megameknet/MegaMekNET/src/server/campaign/commands In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1236/src/server/campaign/commands Modified Files: ScrapCommand.java Log Message: Remove influence reference Index: ScrapCommand.java =================================================================== RCS file: /cvsroot/megameknet/MegaMekNET/src/server/campaign/commands/ScrapCommand.java,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** ScrapCommand.java 26 Mar 2005 18:37:54 -0000 1.13 --- ScrapCommand.java 13 Apr 2005 18:14:31 -0000 1.14 *************** *** 51,55 **** if (new Boolean(CampaignMain.cm.getConfig("ScrappingCostsBills")).booleanValue() && CampaignMain.cm.getCurrentTick() >= m.getScrappableUntil()) { mechscrapprize = p.getMyHouse().getPriceForMech(m.getWeightclass(), m.getType(), null) / 3; - int infToScrap = p.getMyHouse().getInfluenceForMech(m.getWeightclass(), m.getType(), null) / 3; if ((p.getMoney() >= mechscrapprize))// && (p.getInfluence() >= infToScrap)) { --- 51,54 ---- *************** *** 57,61 **** //p.addInfluence(-infToScrap); } else { ! CampaignMain.cm.toUser("You cannot afford to scrap this unit. You need " + mechscrapprize + " cbills and " + infToScrap + " influence.", userName, true); return; } --- 56,60 ---- //p.addInfluence(-infToScrap); } else { ! CampaignMain.cm.toUser("You cannot afford to scrap this unit. You need " + mechscrapprize + " cbills.", userName, true); return; } |
From: Immanuel S. <im...@us...> - 2005-04-11 20:19:25
|
Update of /cvsroot/megameknet/MegaMekNET/src/server/campaign In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29133/src/server/campaign Modified Files: CampaignMain.java Log Message: corrected synchronized. Index: CampaignMain.java =================================================================== RCS file: /cvsroot/megameknet/MegaMekNET/src/server/campaign/CampaignMain.java,v retrieving revision 1.126 retrieving revision 1.127 diff -C2 -d -r1.126 -r1.127 *** CampaignMain.java 11 Apr 2005 20:01:30 -0000 1.126 --- CampaignMain.java 11 Apr 2005 20:19:16 -0000 1.127 *************** *** 139,143 **** ServerDescriptionList serverDescriptions = new ServerDescriptionList(); ! LinkedList NewsFeed = new LinkedList(); //Hibernate --- 139,143 ---- ServerDescriptionList serverDescriptions = new ServerDescriptionList(); ! LinkedList newsFeed = new LinkedList(); //Hibernate *************** *** 654,658 **** } ! public void fromUser(String text, String userName) { if ((!isLoggedIn(userName)) && (text.toUpperCase().indexOf("ENROLL") == -1) --- 654,658 ---- } ! synchronized public void fromUser(String text, String userName) { if ((!isLoggedIn(userName)) && (text.toUpperCase().indexOf("ENROLL") == -1) *************** *** 1547,1551 **** * Gives influence to active players and adds busySlices to players engaged in tasks. */ ! public synchronized void slice() { //System.out.println("Slice Started"); --- 1547,1551 ---- * Gives influence to active players and adds busySlices to players engaged in tasks. */ ! synchronized public void slice() { //System.out.println("Slice Started"); *************** *** 1575,1579 **** }//end the slice... ! public synchronized void tick(boolean real, int tickid) { String result = ""; int totalstuff = 0; --- 1575,1579 ---- }//end the slice... ! synchronized public void tick(boolean real, int tickid) { String result = ""; int totalstuff = 0; *************** *** 1717,1721 **** System.gc(); } ! public boolean useHibernate() { boolean b = new Boolean(getConfig("Hibernate")).booleanValue(); --- 1717,1721 ---- System.gc(); } ! public boolean useHibernate() { boolean b = new Boolean(getConfig("Hibernate")).booleanValue(); *************** *** 1723,1727 **** } ! public TreeSet getHouseRanking() { /* The Planetary Control Way */ --- 1723,1727 ---- } ! public TreeSet getHouseRanking() { /* The Planetary Control Way */ *************** *** 1837,1841 **** * used to analyze statistiks over the last tasks done. */ ! synchronized public void addToTaskFeed(TaskInfo taskInfo) { /* try { --- 1837,1841 ---- * used to analyze statistiks over the last tasks done. */ ! public void addToTaskFeed(TaskInfo taskInfo) { /* try { *************** *** 1865,1871 **** } ! synchronized public void addToNewsFeed(String s) { ! NewsFeed.addLast(s); ! if (this.NewsFeed.size() > 200) this.NewsFeed.removeFirst(); try { --- 1865,1871 ---- } ! public void addToNewsFeed(String s) { ! newsFeed.addLast(s); ! if (this.newsFeed.size() > 200) this.newsFeed.removeFirst(); try { *************** *** 1882,1886 **** ps.println("</channel>"); ! for (Iterator it = NewsFeed.iterator(); it.hasNext();) { String entry = (String) it.next(); ps.println("<item>"); --- 1882,1886 ---- ps.println("</channel>"); ! for (Iterator it = newsFeed.iterator(); it.hasNext();) { String entry = (String) it.next(); ps.println("<item>"); *************** *** 2047,2052 **** } ! // Why synchronized? please comment. ! public synchronized int getAndUpdateCurrentUnitID(SUnit u){ if (useHibernate()) { UnitEntry entry; --- 2047,2051 ---- } ! public int getAndUpdateCurrentUnitID(SUnit u){ if (useHibernate()) { UnitEntry entry; |
From: Immanuel S. <im...@us...> - 2005-04-11 20:19:24
|
Update of /cvsroot/megameknet/MegaMekNET/src/server/campaign/visitor In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29133/src/server/campaign/visitor Modified Files: SXMLSaveVisitor.java Log Message: corrected synchronized. Index: SXMLSaveVisitor.java =================================================================== RCS file: /cvsroot/megameknet/MegaMekNET/src/server/campaign/visitor/SXMLSaveVisitor.java,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** SXMLSaveVisitor.java 11 Apr 2005 20:01:28 -0000 1.13 --- SXMLSaveVisitor.java 11 Apr 2005 20:19:16 -0000 1.14 *************** *** 55,58 **** --- 55,62 ---- public class SXMLSaveVisitor extends XMLSaveVisitor implements ServerVisitor, Visitor { + /** + * Lock all saving against the same lock. No two threads may ever access the + * same files. + */ private static Object lock = new Object(); |
From: Immanuel S. <im...@us...> - 2005-04-11 20:02:12
|
Update of /cvsroot/megameknet/MegaMekNET/src/server/campaign/commands In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15726/src/server/campaign/commands Modified Files: BlackBoardCommand.java SaveCampaignCommand.java Log Message: fixed xml saving, now featuring asynchron saves. Index: BlackBoardCommand.java =================================================================== RCS file: /cvsroot/megameknet/MegaMekNET/src/server/campaign/commands/BlackBoardCommand.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** BlackBoardCommand.java 11 Apr 2005 19:13:19 -0000 1.10 --- BlackBoardCommand.java 11 Apr 2005 20:01:29 -0000 1.11 *************** *** 108,112 **** SPlayer p = CampaignMain.cm.getPlayer(username); StringBuffer answer = new StringBuffer("BB|"); ! for (Iterator it = CampaignMain.cm.getBlackBoard().iterator(); it.hasNext();) { BlackBoardMessage bbm = (BlackBoardMessage) it.next(); SPlayer owner = CampaignMain.cm.getPlayer(bbm.getOwner()); --- 108,112 ---- SPlayer p = CampaignMain.cm.getPlayer(username); StringBuffer answer = new StringBuffer("BB|"); ! for (Iterator it = CampaignMain.cm.getBlackBoard().allMessages().iterator(); it.hasNext();) { BlackBoardMessage bbm = (BlackBoardMessage) it.next(); SPlayer owner = CampaignMain.cm.getPlayer(bbm.getOwner()); Index: SaveCampaignCommand.java =================================================================== RCS file: /cvsroot/megameknet/MegaMekNET/src/server/campaign/commands/SaveCampaignCommand.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** SaveCampaignCommand.java 29 Mar 2005 20:10:37 -0000 1.2 --- SaveCampaignCommand.java 11 Apr 2005 20:01:29 -0000 1.3 *************** *** 47,51 **** String saveString; if ("xml".equals(target.toLowerCase())) { ! CampaignMain.cm.saveData(); saveString = "XML"; } else if ("dat".equals(target.toLowerCase())) { --- 47,51 ---- String saveString; if ("xml".equals(target.toLowerCase())) { ! CampaignMain.cm.saveData(userName); saveString = "XML"; } else if ("dat".equals(target.toLowerCase())) { *************** *** 55,59 **** throw new IllegalUsageException(); if (userName != null) ! send(saveString+" saved!",userName); } catch (RuntimeException e) { e.printStackTrace(); --- 55,59 ---- throw new IllegalUsageException(); if (userName != null) ! send(saveString+" saving initiated.",userName); } catch (RuntimeException e) { e.printStackTrace(); |
From: Immanuel S. <im...@us...> - 2005-04-11 20:02:10
|
Update of /cvsroot/megameknet/MegaMekNET/src/server/campaign In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15726/src/server/campaign Modified Files: TickThread.java CampaignMain.java Log Message: fixed xml saving, now featuring asynchron saves. Index: TickThread.java =================================================================== RCS file: /cvsroot/megameknet/MegaMekNET/src/server/campaign/TickThread.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** TickThread.java 27 Mar 2005 08:36:36 -0000 1.5 --- TickThread.java 11 Apr 2005 20:01:29 -0000 1.6 *************** *** 73,77 **** try { myCampaign.toFile(); ! myCampaign.saveData(); myCampaign.toAllUsers("AutoSave succeeded!"); } --- 73,77 ---- try { myCampaign.toFile(); ! myCampaign.saveData(null); myCampaign.toAllUsers("AutoSave succeeded!"); } Index: CampaignMain.java =================================================================== RCS file: /cvsroot/megameknet/MegaMekNET/src/server/campaign/CampaignMain.java,v retrieving revision 1.125 retrieving revision 1.126 diff -C2 -d -r1.125 -r1.126 *** CampaignMain.java 11 Apr 2005 19:13:19 -0000 1.125 --- CampaignMain.java 11 Apr 2005 20:01:30 -0000 1.126 *************** *** 78,82 **** import common.BlackBoardMessage; import common.CampaignData; - import common.House; import common.Influences; import common.PlanetEnvironment; --- 78,81 ---- *************** *** 86,91 **** import common.constants.PlayerStatus; import common.util.MMNetXStream; - import common.visitor.Visitor; - import common.visitor.Visitorable; public class CampaignMain implements Serializable, StatusChangeListener { --- 85,88 ---- *************** *** 234,269 **** * Save the whole campaign state to xml */ ! public void saveData() { ! SXMLSaveVisitor saver = new SXMLSaveVisitor(); ! // Units updateUnitList(); ! saver.toXml("campaign/unit.xml", "units", units.values()); ! // Houses (one file for each house because memory concerns) ! for (Iterator it = data.getAllHouses().iterator(); it.hasNext();) { ! SHouse house = (SHouse)it.next(); ! saver.toXml("campaign/"+house.getName()+".xml", house); ! } ! // Write all house names (on the fly). ! saver.toXml("campaign/houses.xml", new Visitorable(){ ! public Object visit(Visitor visitor) { ! Element e = new Element("houses"); ! for (Iterator it = data.getAllHouses().iterator(); it.hasNext();) { ! House house = (House)it.next(); ! Element h = new Element("house"); ! h.setAttribute("class", house.getClass().getName()); ! h.setAttribute("file", "campaign/"+house.getName()+".xml"); ! e.addContent(h); ! } ! return e; ! } ! }); ! // Blackboard ! saver.toXml("campaign/blackboard.xml", getBlackBoard()); ! // Market ! saver.toXml("campaign/blackmarket.xml", getMarket()); ! // Planet environment ! saver.toXml("campaign/planetEnvironment.xml", "planetEnvironments", data.getAllTerrains()); ! // Planets ! saver.toXml("campaign/planet.xml", "planets", data.getAllPlanets()); } --- 231,237 ---- * Save the whole campaign state to xml */ ! public void saveData(String userToInform) { updateUnitList(); ! new SXMLSaveVisitor(units.values(), data, blackBoard, market, userToInform); } *************** *** 412,416 **** // saving in fresh xml format for the next run to make it better :) ! saveData(); } // end loading old .dat file format --- 380,384 ---- // saving in fresh xml format for the next run to make it better :) ! saveData(null); } // end loading old .dat file format *************** *** 626,630 **** out = new FileOutputStream("./campaign/blackboard.dat"); print = new PrintStream(out); ! for (Iterator it = blackBoard.iterator(); it.hasNext();) { BlackBoardMessage bbm = (BlackBoardMessage) it.next(); print.println(bbm.encode()); --- 594,598 ---- out = new FileOutputStream("./campaign/blackboard.dat"); print = new PrintStream(out); ! for (Iterator it = blackBoard.allMessages().iterator(); it.hasNext();) { BlackBoardMessage bbm = (BlackBoardMessage) it.next(); print.println(bbm.encode()); *************** *** 1731,1735 **** // BlackBoard ! for (Iterator it = blackBoard.iterator(); it.hasNext();) { BlackBoardMessage bbm = (BlackBoardMessage) it.next(); if (bbm.decreaseTick()) --- 1699,1703 ---- // BlackBoard ! for (Iterator it = blackBoard.allMessages().iterator(); it.hasNext();) { BlackBoardMessage bbm = (BlackBoardMessage) it.next(); if (bbm.decreaseTick()) *************** *** 1747,1752 **** // serverDescriptions.save(getConfig("ServerDescription")); - saveData(); - System.gc(); } --- 1715,1718 ---- |
From: Immanuel S. <im...@us...> - 2005-04-11 20:02:10
|
Update of /cvsroot/megameknet/MegaMekNET/src/server/campaign/visitor In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15726/src/server/campaign/visitor Modified Files: SXMLSaveVisitor.java Log Message: fixed xml saving, now featuring asynchron saves. Index: SXMLSaveVisitor.java =================================================================== RCS file: /cvsroot/megameknet/MegaMekNET/src/server/campaign/visitor/SXMLSaveVisitor.java,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** SXMLSaveVisitor.java 26 Mar 2005 17:44:26 -0000 1.12 --- SXMLSaveVisitor.java 11 Apr 2005 20:01:28 -0000 1.13 *************** *** 14,17 **** --- 14,19 ---- package server.campaign.visitor; + import java.util.ArrayList; + import java.util.Collection; import java.util.Iterator; import java.util.LinkedList; *************** *** 19,22 **** --- 21,26 ---- import java.util.Map; import org.jdom.Element; + import server.MMServ; + import server.campaign.CampaignMain; import server.campaign.NewbieHouse; import server.campaign.NewbiePlanet; *************** *** 36,41 **** --- 40,49 ---- import server.campaign.pilot.SPilot; import server.campaign.util.TimeZoneData; + import common.BlackBoard; + import common.CampaignData; + import common.House; import common.Unit; import common.visitor.Visitor; + import common.visitor.Visitorable; import common.visitor.XMLSaveVisitor; *************** *** 47,50 **** --- 55,113 ---- public class SXMLSaveVisitor extends XMLSaveVisitor implements ServerVisitor, Visitor { + private static Object lock = new Object(); + + public SXMLSaveVisitor(Collection units_, CampaignData data, + BlackBoard blackboard_, Market market_, final String userToInform) { + final long starttime = System.currentTimeMillis(); + // make a defensive copy of all data structures to write them asynchron + final Collection units = new ArrayList(units_); + final Collection planets = new ArrayList(data.getAllPlanets()); + final Collection planetEnvironment = new ArrayList(data.getAllTerrains()); + final Collection houses = new ArrayList(data.getAllHouses()); + final BlackBoard blackboard = new BlackBoard(blackboard_.allMessages()); + final Market market = new Market(market_); + + new Thread(){ + public void run() { + synchronized(lock) { + // Units + toXml("campaign/unit.xml", "units", units); + // Houses (one file for each house because memory concerns) + for (Iterator it = houses.iterator(); it.hasNext();) { + SHouse house = (SHouse)it.next(); + toXml("campaign/"+house.getName()+".xml", house); + } + // Write all house names (on the fly). + toXml("campaign/houses.xml", new Visitorable(){ + public Object visit(Visitor visitor) { + Element e = new Element("houses"); + for (Iterator it = houses.iterator(); it.hasNext();) { + House house = (House)it.next(); + Element h = new Element("house"); + h.setAttribute("class", house.getClass().getName()); + h.setAttribute("file", "campaign/"+house.getName()+".xml"); + e.addContent(h); + } + return e; + } + }); + // Blackboard + toXml("campaign/blackboard.xml", blackboard); + // Market + toXml("campaign/blackmarket.xml", market); + // Planet environment + toXml("campaign/planetEnvironment.xml", "planetEnvironments", planetEnvironment); + // Planets + toXml("campaign/planet.xml", "planets", planets); + String msg = "XML save finished after "+((System.currentTimeMillis()-starttime)/1000)+"s"; + if (userToInform != null) + CampaignMain.cm.toUser(msg, userToInform, true); + else + MMServ.mmlog.infoLog(msg); + } + } + }.start(); + } + public Object visitSPlayer(SPlayer data) { Element e = (Element)visitPlayer(data); |
From: Immanuel S. <im...@us...> - 2005-04-11 20:02:10
|
Update of /cvsroot/megameknet/MegaMekNET/src/server/campaign/market In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15726/src/server/campaign/market Modified Files: Market.java Log Message: fixed xml saving, now featuring asynchron saves. Index: Market.java =================================================================== RCS file: /cvsroot/megameknet/MegaMekNET/src/server/campaign/market/Market.java,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** Market.java 26 Mar 2005 17:44:24 -0000 1.22 --- Market.java 11 Apr 2005 20:01:27 -0000 1.23 *************** *** 61,68 **** public Market() { marketStatistic = new MarketStatisticKeeper(); ! ReadMarketStatistic(); addStatusListener(CampaignMain.cm); } public Collection getAllUnits() { return Collections.unmodifiableCollection(units.values()); --- 61,77 ---- public Market() { marketStatistic = new MarketStatisticKeeper(); ! readMarketStatistic(); addStatusListener(CampaignMain.cm); } + /** + * Copy constructor + */ + public Market(Market market) { + marketStatistic = market.marketStatistic; + units = new Hashtable(market.units); + newMechsSinceTick = market.newMechsSinceTick; + } + public Collection getAllUnits() { return Collections.unmodifiableCollection(units.values()); *************** *** 387,391 **** } ! public void ReadMarketStatistic() { if (CampaignMain.cm.useHibernate()) { marketStatistic = new MarketStatisticKeeper(); --- 396,400 ---- } ! public void readMarketStatistic() { if (CampaignMain.cm.useHibernate()) { marketStatistic = new MarketStatisticKeeper(); |
From: Immanuel S. <im...@us...> - 2005-04-11 20:01:43
|
Update of /cvsroot/megameknet/MegaMekNET/src/common/visitor In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15726/src/common/visitor Modified Files: XMLSaveVisitor.java Log Message: fixed xml saving, now featuring asynchron saves. Index: XMLSaveVisitor.java =================================================================== RCS file: /cvsroot/megameknet/MegaMekNET/src/common/visitor/XMLSaveVisitor.java,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** XMLSaveVisitor.java 11 Apr 2005 19:13:21 -0000 1.12 --- XMLSaveVisitor.java 11 Apr 2005 20:01:33 -0000 1.13 *************** *** 468,475 **** public Object visitBlackBoard(BlackBoard data) { Element e = start("blackBoard", data, BlackBoard.class); ! LinkedList l = new LinkedList(); ! for (Iterator it = data.iterator(); it.hasNext();) ! l.add(it.next()); ! addAllVisitorables(e, null, l); return e; } --- 468,472 ---- public Object visitBlackBoard(BlackBoard data) { Element e = start("blackBoard", data, BlackBoard.class); ! addAllVisitorables(e, null, data.allMessages()); return e; } |
From: Immanuel S. <im...@us...> - 2005-04-11 20:01:41
|
Update of /cvsroot/megameknet/MegaMekNET/src/server In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15726/src/server Modified Files: MMServ.java Log Message: fixed xml saving, now featuring asynchron saves. Index: MMServ.java =================================================================== RCS file: /cvsroot/megameknet/MegaMekNET/src/server/MMServ.java,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** MMServ.java 9 Apr 2005 09:47:46 -0000 1.37 --- MMServ.java 11 Apr 2005 20:01:32 -0000 1.38 *************** *** 906,910 **** writeToLog(); campaign.toFile(); ! campaign.saveData(); mmlog.infoLog("Server exiting... Bye bye..."); System.exit(0); --- 906,910 ---- writeToLog(); campaign.toFile(); ! campaign.saveData(null); mmlog.infoLog("Server exiting... Bye bye..."); System.exit(0); |
From: Immanuel S. <im...@us...> - 2005-04-11 20:01:40
|
Update of /cvsroot/megameknet/MegaMekNET/src/common In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15726/src/common Modified Files: BlackBoard.java Log Message: fixed xml saving, now featuring asynchron saves. Index: BlackBoard.java =================================================================== RCS file: /cvsroot/megameknet/MegaMekNET/src/common/BlackBoard.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** BlackBoard.java 11 Apr 2005 19:13:20 -0000 1.3 --- BlackBoard.java 11 Apr 2005 20:01:31 -0000 1.4 *************** *** 14,17 **** --- 14,18 ---- package common; + import java.util.Collection; import java.util.Iterator; import java.util.Vector; *************** *** 29,36 **** * Vector because access via Iterator has to be synchronized. */ ! private Vector data = new Vector(); ! public Iterator iterator() { ! return data.iterator(); } --- 30,49 ---- * Vector because access via Iterator has to be synchronized. */ ! private Vector data; ! /** ! * Clones from a list of BlackBoardMessages. ! * ! */ ! public BlackBoard(Collection blackBoardMessages) { ! data = new Vector(blackBoardMessages); ! } ! ! public BlackBoard() { ! data = new Vector(); ! } ! ! public Collection allMessages() { ! return data; } |
From: Immanuel S. <im...@us...> - 2005-04-11 19:14:00
|
Update of /cvsroot/megameknet/MegaMekNET/src/server/campaign In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20235/src/server/campaign Modified Files: CampaignMain.java Log Message: fixed concurent modification bug in blackboard Index: CampaignMain.java =================================================================== RCS file: /cvsroot/megameknet/MegaMekNET/src/server/campaign/CampaignMain.java,v retrieving revision 1.124 retrieving revision 1.125 diff -C2 -d -r1.124 -r1.125 *** CampaignMain.java 9 Apr 2005 12:56:38 -0000 1.124 --- CampaignMain.java 11 Apr 2005 19:13:19 -0000 1.125 *************** *** 626,630 **** out = new FileOutputStream("./campaign/blackboard.dat"); print = new PrintStream(out); ! for (Iterator it = blackBoard.allMessages().iterator(); it.hasNext();) { BlackBoardMessage bbm = (BlackBoardMessage) it.next(); print.println(bbm.encode()); --- 626,630 ---- out = new FileOutputStream("./campaign/blackboard.dat"); print = new PrintStream(out); ! for (Iterator it = blackBoard.iterator(); it.hasNext();) { BlackBoardMessage bbm = (BlackBoardMessage) it.next(); print.println(bbm.encode()); *************** *** 1731,1738 **** // BlackBoard ! for (Iterator it = blackBoard.allMessages().iterator(); it.hasNext();) { BlackBoardMessage bbm = (BlackBoardMessage) it.next(); if (bbm.decreaseTick()) ! blackBoard.removeMessage(bbm.getTitle()); } --- 1731,1738 ---- // BlackBoard ! for (Iterator it = blackBoard.iterator(); it.hasNext();) { BlackBoardMessage bbm = (BlackBoardMessage) it.next(); if (bbm.decreaseTick()) ! it.remove(); } |
From: Immanuel S. <im...@us...> - 2005-04-11 19:13:30
|
Update of /cvsroot/megameknet/MegaMekNET/src/common/visitor In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20235/src/common/visitor Modified Files: XMLSaveVisitor.java Log Message: fixed concurent modification bug in blackboard Index: XMLSaveVisitor.java =================================================================== RCS file: /cvsroot/megameknet/MegaMekNET/src/common/visitor/XMLSaveVisitor.java,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** XMLSaveVisitor.java 9 Apr 2005 09:47:45 -0000 1.11 --- XMLSaveVisitor.java 11 Apr 2005 19:13:21 -0000 1.12 *************** *** 468,472 **** public Object visitBlackBoard(BlackBoard data) { Element e = start("blackBoard", data, BlackBoard.class); ! addAllVisitorables(e, null, data.allMessages()); return e; } --- 468,475 ---- public Object visitBlackBoard(BlackBoard data) { Element e = start("blackBoard", data, BlackBoard.class); ! LinkedList l = new LinkedList(); ! for (Iterator it = data.iterator(); it.hasNext();) ! l.add(it.next()); ! addAllVisitorables(e, null, l); return e; } |
From: Immanuel S. <im...@us...> - 2005-04-11 19:13:29
|
Update of /cvsroot/megameknet/MegaMekNET/src/common In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20235/src/common Modified Files: BlackBoard.java Log Message: fixed concurent modification bug in blackboard Index: BlackBoard.java =================================================================== RCS file: /cvsroot/megameknet/MegaMekNET/src/common/BlackBoard.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** BlackBoard.java 26 Mar 2005 12:22:16 -0000 1.2 --- BlackBoard.java 11 Apr 2005 19:13:20 -0000 1.3 *************** *** 14,21 **** package common; - import java.util.Collection; - import java.util.Collections; import java.util.Iterator; ! import java.util.LinkedList; import common.visitor.Visitor; import common.visitor.Visitorable; --- 14,19 ---- package common; import java.util.Iterator; ! import java.util.Vector; import common.visitor.Visitor; import common.visitor.Visitorable; *************** *** 28,39 **** public class BlackBoard implements Visitorable { - private LinkedList data = new LinkedList(); - /** ! * Return all messages. To delete black board messages, please use ! * removeMessage. */ ! public Collection allMessages() { ! return Collections.unmodifiableCollection(data); } --- 26,36 ---- public class BlackBoard implements Visitorable { /** ! * Vector because access via Iterator has to be synchronized. */ ! private Vector data = new Vector(); ! ! public Iterator iterator() { ! return data.iterator(); } |
From: Immanuel S. <im...@us...> - 2005-04-11 19:13:28
|
Update of /cvsroot/megameknet/MegaMekNET/src/server/campaign/commands In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20235/src/server/campaign/commands Modified Files: BlackBoardCommand.java Log Message: fixed concurent modification bug in blackboard Index: BlackBoardCommand.java =================================================================== RCS file: /cvsroot/megameknet/MegaMekNET/src/server/campaign/commands/BlackBoardCommand.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** BlackBoardCommand.java 26 Mar 2005 12:22:15 -0000 1.9 --- BlackBoardCommand.java 11 Apr 2005 19:13:19 -0000 1.10 *************** *** 108,112 **** SPlayer p = CampaignMain.cm.getPlayer(username); StringBuffer answer = new StringBuffer("BB|"); ! for (Iterator it = CampaignMain.cm.getBlackBoard().allMessages().iterator(); it.hasNext();) { BlackBoardMessage bbm = (BlackBoardMessage) it.next(); SPlayer owner = CampaignMain.cm.getPlayer(bbm.getOwner()); --- 108,112 ---- SPlayer p = CampaignMain.cm.getPlayer(username); StringBuffer answer = new StringBuffer("BB|"); ! for (Iterator it = CampaignMain.cm.getBlackBoard().iterator(); it.hasNext();) { BlackBoardMessage bbm = (BlackBoardMessage) it.next(); SPlayer owner = CampaignMain.cm.getPlayer(bbm.getOwner()); |
From: Helge R. <mcw...@us...> - 2005-04-11 18:35:54
|
Update of /cvsroot/megameknet/MegaMekNET/src/client/gui In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26162/src/client/gui Modified Files: CMainFrame.java Log Message: Make Planetname for Training Missions fixed Index: CMainFrame.java =================================================================== RCS file: /cvsroot/megameknet/MegaMekNET/src/client/gui/CMainFrame.java,v retrieving revision 1.60 retrieving revision 1.61 diff -C2 -d -r1.60 -r1.61 *** CMainFrame.java 2 Apr 2005 14:29:10 -0000 1.60 --- CMainFrame.java 11 Apr 2005 18:35:45 -0000 1.61 *************** *** 1663,1669 **** public void jMenuTaskTraining_actionPerformed(ActionEvent e, int lid) { String Planetname, LanceID; ! Planetname = JOptionPane.showInputDialog(this.getContentPane(), "Planetname"); ! if (Planetname == null) ! return; if (lid == -1) { LanceID = JOptionPane.showInputDialog(this.getContentPane(), "Army Number"); --- 1663,1670 ---- public void jMenuTaskTraining_actionPerformed(ActionEvent e, int lid) { String Planetname, LanceID; ! // Planetname = JOptionPane.showInputDialog(this.getContentPane(), "Planetname"); ! // if (Planetname == null) ! // return; ! Planetname = "Solaris VII"; if (lid == -1) { LanceID = JOptionPane.showInputDialog(this.getContentPane(), "Army Number"); |