megameknet-cvs Mailing List for MegaMekNET (Page 19)
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-25 20:32:43
|
Update of /cvsroot/megameknet/MegaMekNET/src/server/campaign/commands In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1858/src/server/campaign/commands Modified Files: CampaignConfigCommand.java Log Message: rewrite of data transfer at startup. compressed transfer of all-data. Checksum over all data and reload as needed. Everything should work now (beside of bugs) Index: CampaignConfigCommand.java =================================================================== RCS file: /cvsroot/megameknet/MegaMekNET/src/server/campaign/commands/CampaignConfigCommand.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** CampaignConfigCommand.java 20 Feb 2005 10:09:32 -0000 1.4 --- CampaignConfigCommand.java 25 Feb 2005 20:32:34 -0000 1.5 *************** *** 14,37 **** package server.campaign.commands; - import java.util.*; - import java.io.*; - import server.MMServ; ! import server.campaign.*; ! public class CampaignConfigCommand extends Command ! { ! public void process(StringTokenizer command,String userName) ! { ! if (CampaignMain.cm.getServer().isAdmin(userName)) ! { ! //Try to read the config file ! try { ! CampaignMain.cm.getConfig().load(new FileInputStream(CampaignMain.cm.getServer().getConfigParam("CAMPAIGNCONFIG"))); ! } catch (Exception ex) { ! MMServ.addToErrorLog(ex); ! } ! CampaignMain.cm.toUser("Campaign config reread!",userName,true); ! } ! } } \ No newline at end of file --- 14,46 ---- package server.campaign.commands; import server.MMServ; ! import server.campaign.CampaignMain; ! public class CampaignConfigCommand extends Command { ! ! public CampaignConfigCommand() { ! super("campaignconfig", 0); ! } ! ! public boolean isAdminCommand() { ! return true; ! } ! ! protected String usage() { ! return ""; ! } ! ! public String help() { ! return "Try to reload the campaignconfig.txt in the server directory."; ! } ! ! public void process(String[] param, String userName) { ! try { ! CampaignMain.cm.reloadCampaignConfig(); ! CampaignMain.cm.toUser("Campaign config reloaded.", userName, true); ! } catch (Exception ex) { ! MMServ.addToErrorLog(ex); ! CampaignMain.cm.toUser("Campaign config reloading failed.", userName, true); ! } ! } } \ No newline at end of file |
From: Immanuel S. <im...@us...> - 2005-02-25 20:32:43
|
Update of /cvsroot/megameknet/MegaMekNET/src/client/cmd In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1858/src/client/cmd Modified Files: UG.java Log Message: rewrite of data transfer at startup. compressed transfer of all-data. Checksum over all data and reload as needed. Everything should work now (beside of bugs) Index: UG.java =================================================================== RCS file: /cvsroot/megameknet/MegaMekNET/src/client/cmd/UG.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** UG.java 20 Feb 2005 20:10:09 -0000 1.4 --- UG.java 25 Feb 2005 20:32:35 -0000 1.5 *************** *** 16,20 **** import java.util.StringTokenizer; - import client.CUser; import client.MMClient; --- 16,19 ---- |
From: Immanuel S. <im...@us...> - 2005-02-25 20:32:43
|
Update of /cvsroot/megameknet/MegaMekNET/src/client In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1858/src/client Modified Files: MMClient.java Log Message: rewrite of data transfer at startup. compressed transfer of all-data. Checksum over all data and reload as needed. Everything should work now (beside of bugs) Index: MMClient.java =================================================================== RCS file: /cvsroot/megameknet/MegaMekNET/src/client/MMClient.java,v retrieving revision 1.52 retrieving revision 1.53 diff -C2 -d -r1.52 -r1.53 *** MMClient.java 23 Feb 2005 19:34:46 -0000 1.52 --- MMClient.java 25 Feb 2005 20:32:34 -0000 1.53 *************** *** 28,38 **** import java.awt.event.ActionEvent; import java.awt.event.ActionListener; - import java.io.BufferedInputStream; import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; - import java.io.FileNotFoundException; import java.io.FileOutputStream; - import java.io.FileWriter; import java.io.IOException; import java.io.InputStreamReader; --- 28,35 ---- *************** *** 45,49 **** import java.util.HashMap; import java.util.Iterator; - import java.util.Properties; import java.util.StringTokenizer; import java.util.TreeMap; --- 42,45 ---- *************** *** 75,79 **** import client.gui.commands.PingGCmd; import client.protocol.CConnector; - import client.protocol.CommunicationException; import client.protocol.DataFetchClient; import client.protocol.IClient; --- 71,74 ---- *************** *** 88,95 **** import common.PlanetEnvironment; import common.constants.PlayerStatus; - import common.util.MMNetXStream; - import common.visitor.HierarchyWriteVisitor; - import common.visitor.LoadVisitor; - import common.visitor.SaveVisitor; public class MMClient implements IClient, ServerInterface { --- 83,86 ---- *************** *** 160,169 **** Vector ignorePrivate = new Vector(); // people whose private messages are ignored Vector keyWords = new Vector(); // words announced with sound - - /** - * @author Torren - * place holder until I can thinlk of something better to say. - */ - private Properties serverConfigs = new Properties(); /** --- 151,154 ---- *************** *** 223,239 **** dataFetcher = new DataFetchClient(Integer.parseInt(config.getDataPort()), config.getServerIP()); // To the login now, just before accessing any server. ! if (!config.isDedicated()) { ! new LoginPage(this, false); ! dataFetcher.setData(config.getServerIP()); ! } ! ! JWindow splash = GraphicGimmicks.pleaseWaitSplash(); - try { - initData(); - } catch (RuntimeException x) { - System.exit(1); - } //Construct the GUI mainFrame = new CMainFrame(this); --- 208,232 ---- dataFetcher = new DataFetchClient(Integer.parseInt(config.getDataPort()), config.getServerIP()); + JWindow splash = null; // To the login now, just before accessing any server. ! do { ! ! if (!config.isDedicated()) { ! new LoginPage(this, false); ! dataFetcher.setData(config.getServerIP()); ! } ! ! splash = GraphicGimmicks.pleaseWaitSplash(); ! data = dataFetcher.initData(getServerCacheDir()); ! ! if (data == null) { ! if (config.isDedicated()) ! System.exit(1); ! splash.dispose(); ! JOptionPane.showMessageDialog(null, "Could not initialize data with this server."); ! } else ! dataFetcher.storeData(data, getServerCacheDir()); ! } while (data == null); //Construct the GUI mainFrame = new CMainFrame(this); *************** *** 320,393 **** } - /** - * Try to load the data from the current set cache directory. Then do - * an diff update on the server. If anything fails, reload all the stuff - * from the server. - */ - private void initData() { - MMNetXStream xml = new MMNetXStream(); - // initialize serverconfig - try { - serverConfigs = dataFetcher.getServerConfigData(); - System.out.println("serverConfig fetched from server."); - } catch (Exception e) { - e.printStackTrace(); - System.out.println("could not fetch serverConfig. Try loading old config from cache."); - try { - serverConfigs = (Properties)xml.fromFile(getServerCacheDir()+"serverConfigs.xml"); - System.out.println("serverConfig loaded from cache."); - } catch (Exception e2) { - // The client may work without campaignconfig. - e2.printStackTrace(); - JOptionPane.showMessageDialog(null, "Unable to load server campaign configuration. Expect strange things.."); - } - } - // initialize campaign data - 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. - FileInputStream input = new FileInputStream(getServerCacheDir()+"data.xml"); - LoadVisitor loader = new LoadVisitor(new BufferedInputStream(input)); - data = (CampaignData)loader.parse(); - input.close(); - System.out.println("successfull loaded cached data: " - +data.getAllPlanets().size()+" planets, " - +data.getAllHouses().size()+" houses, " - +data.getAllTerrains().size()+" planet environments."); - } catch (Exception t) { - if (!(t instanceof FileNotFoundException)) - t.printStackTrace(); - System.out.println("could not init data fetcher, fetch all data again."); - Date now = new Date(); - try { - // this will also set the lastTimestamp of datafetcher. - data = dataFetcher.getAllData(); - } catch (CommunicationException e) { - // This is fatal. We could not init data. The client does not - // work without the campaign-data - e.printStackTrace(); - JOptionPane.showMessageDialog(null, e.getMessage()); - System.exit(1); - } - 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(); - } - public synchronized void doParseDataInput(String input) { /* --- 313,316 ---- *************** *** 455,458 **** --- 378,388 ---- } + /** + * Return an helper object to communication with the data server. + */ + public DataFetchClient getDataFetcher() { + return dataFetcher; + } + public synchronized void parseDedDataInput(String data) { StringTokenizer st, own; *************** *** 1123,1127 **** new LoginPage(this, false); dataFetcher.setData(config.getServerIP()); ! initData(); return userName; } --- 1053,1057 ---- new LoginPage(this, false); dataFetcher.setData(config.getServerIP()); ! data = dataFetcher.initData(getServerCacheDir()); return userName; } *************** *** 1252,1256 **** try { connector.connect(ip, port); - serverConfigs = dataFetcher.getServerConfigData(); } // connect to specific ip and port catch (Exception ex) { --- 1182,1185 ---- *************** *** 1404,1408 **** sleep(120000); } catch (InterruptedException x) {} ! refreshData(false); } } --- 1333,1337 ---- sleep(120000); } catch (InterruptedException x) {} ! dataFetcher.refresh(data); } } *************** *** 1551,1607 **** /** - * Reloads new data from the server. - */ - public void refreshData(boolean reportAndReloadOnErrors) { - Date now = new Date(); - try { - data = dataFetcher.getPlanetDiff(data); - dataFetcher.getHouseDiff(data); - serverConfigs = dataFetcher.getServerConfigData(); - System.out.println("update for data finished"); - } catch (CommunicationException e) { - e.printStackTrace(); - if (reportAndReloadOnErrors) { - JOptionPane.showMessageDialog(null, - "An error occoured while refreshing data from the server:\n\n"+ - e.getMessage()+ - "\n\nThe client will try to download the whole dataset again. If this error happens recently,\n" + - "please report this as a bug, because actions like full data download are expensive for the server."); - try { - data = dataFetcher.getAllData(); - serverConfigs = dataFetcher.getServerConfigData(); - } catch (CommunicationException e1) { - e1.printStackTrace(); - JOptionPane.showMessageDialog(null, - "The client wasn't able to do the download. Maybe try again later. Reason:\n\n"+ - e.getMessage()); - } - } - } - storeData(now); - } - - /** - * Store all client campaign data to disk. - * - * @param now The current time to save with the data (for later use - * in diff requests) - */ - private void storeData(Date now) { - try { - MMNetXStream xml = new MMNetXStream(); - xml.toFile(now, getServerCacheDir()+"dataLastUpdated.xml"); - HierarchyWriteVisitor saver = new SaveVisitor(new FileWriter(getServerCacheDir()+"data.xml")); - data.visit(saver); - saver.close(); - xml.toFile(serverConfigs, getServerCacheDir()+"serverConfigs.xml"); - dataFetcher.setLastTimestamp(now); - } catch (Exception e) { - // ok.. no cache. your fault. phe! you have to reload next time. - e.printStackTrace(); - } - } - - /** * @return Returns the data. */ --- 1480,1483 ---- *************** *** 1680,1688 **** public String getServerConfigs(String key) { ! if (serverConfigs.getProperty(key) == null) { System.out.println("You're missing the config variable: " + key + " in serverconfig!"); return "-1"; } ! return serverConfigs.getProperty(key).trim(); } --- 1556,1565 ---- public String getServerConfigs(String key) { ! String configValue = (String)data.getServerConfig().get(key); ! if (configValue == null) { System.out.println("You're missing the config variable: " + key + " in serverconfig!"); return "-1"; } ! return configValue.trim(); } |
From: Immanuel S. <im...@us...> - 2005-02-25 20:32:42
|
Update of /cvsroot/megameknet/MegaMekNET/src/server/campaign In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1858/src/server/campaign Modified Files: CampaignMain.java Log Message: rewrite of data transfer at startup. compressed transfer of all-data. Checksum over all data and reload as needed. Everything should work now (beside of bugs) Index: CampaignMain.java =================================================================== RCS file: /cvsroot/megameknet/MegaMekNET/src/server/campaign/CampaignMain.java,v retrieving revision 1.90 retrieving revision 1.91 diff -C2 -d -r1.90 -r1.91 *** CampaignMain.java 22 Feb 2005 22:27:21 -0000 1.90 --- CampaignMain.java 25 Feb 2005 20:32:33 -0000 1.91 *************** *** 18,21 **** --- 18,22 ---- import java.io.FileInputStream; import java.io.FileOutputStream; + import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; *************** *** 109,114 **** MechStatsKeeper MechStats = new MechStatsKeeper(); - Properties config = new Properties(); - Random r = new Random(); --- 110,113 ---- *************** *** 152,157 **** //Try to read the config file try { ! config.load(new FileInputStream(this.myServer ! .getConfigParam("CAMPAIGNCONFIG"))); } catch (Exception ex) { MMServ.mmlog.errLog("Problems with loading campaing config"); --- 151,155 ---- //Try to read the config file try { ! reloadCampaignConfig(); } catch (Exception ex) { MMServ.mmlog.errLog("Problems with loading campaing config"); *************** *** 161,165 **** this.addToNewsFeed("MegamekNET Server Started!"); initializePilotSkills(); - data.clearHouses(); StringTokenizer st = new StringTokenizer(getConfig("OwnServerDescription"),"#"); --- 159,162 ---- *************** *** 172,178 **** serverDescriptions.load(getConfig("ServerDescription")); - //Load Data - //Init Data - data = new CampaignData(); //Parse Terrain XMLTerrainDataParser tParse = new XMLTerrainDataParser("terrain.xml"); --- 169,172 ---- *************** *** 328,333 **** voteManager = new VoteManager(this); ! rpcserver = new RPCServer( ! Integer.parseInt(myServer.getConfigParam("DATAPORT")), data, config); } --- 322,327 ---- voteManager = new VoteManager(this); ! rpcserver = new RPCServer(Integer.parseInt( ! myServer.getConfigParam("DATAPORT")), data); } *************** *** 491,495 **** public String getConfig(String key) { ! if (config.getProperty(key) == null) { System.out.println("You're missing the config variable: " + key + " in campaignconfig!"); --- 485,490 ---- public String getConfig(String key) { ! String configValue = (String)data.getServerConfig().get(key); ! if (configValue == null) { System.out.println("You're missing the config variable: " + key + " in campaignconfig!"); *************** *** 498,502 **** System.exit(1); } ! return config.getProperty(key).trim(); } --- 493,497 ---- System.exit(1); } ! return configValue.trim(); } *************** *** 1105,1109 **** commands.put("BLACKBOARD", new BlackBoardCommand()); commands.put("CALCDIST", new CalcDistCommand()); ! commands.put("CAMPAIGNCONFIG", new CampaignConfigCommand()); commands.put("CANCEL", new CancelCommand()); commands.put("CANCELOFFER", new CancelOfferCommand()); --- 1100,1104 ---- commands.put("BLACKBOARD", new BlackBoardCommand()); commands.put("CALCDIST", new CalcDistCommand()); ! commands.put("campaignconfig", new CampaignConfigCommand()); commands.put("CANCEL", new CancelCommand()); commands.put("CANCELOFFER", new CancelOfferCommand()); *************** *** 1853,1858 **** } ! public Properties getConfig() { ! return config; } --- 1848,1856 ---- } ! public void reloadCampaignConfig() throws IOException { ! Properties config = new Properties(); ! config.load(new FileInputStream( ! this.myServer.getConfigParam("CAMPAIGNCONFIG"))); ! data.setServerConfig(config); } |
From: Dima N. <nem...@us...> - 2005-02-25 14:19:07
|
Update of /cvsroot/megameknet/MegaMekNET In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20539 Modified Files: history.txt Log Message: Oopsie... I ballsed the last history.txt up a wee bit :) Index: history.txt =================================================================== RCS file: /cvsroot/megameknet/MegaMekNET/history.txt,v retrieving revision 1.175 retrieving revision 1.176 diff -C2 -d -r1.175 -r1.176 *** history.txt 25 Feb 2005 14:13:47 -0000 1.175 --- history.txt 25 Feb 2005 14:18:58 -0000 1.176 *************** *** 1,4 **** -> C Added FdL image and mechset entry, and changed the .blk file a little (name+model) ! nemchenk (2005-02-25) -> C New Feature: Enter "local://" in blackboard for references to local files Imi 2005-02-24 --- 1,4 ---- -> C Added FdL image and mechset entry, and changed the .blk file a little (name+model) ! nemchenk (2005-02-25) -> C New Feature: Enter "local://" in blackboard for references to local files Imi 2005-02-24 *************** *** 22,26 **** -> C Fixed Login Dialog (double-showed servers + null) McW (2005-02-20) - >>>>>>> 1.174 -> S Added ADMINSETHOUSEEXTRABAYS Command McW (2005-02-19) --- 22,25 ---- |
From: Dima N. <nem...@us...> - 2005-02-25 14:14:34
|
Update of /cvsroot/megameknet/MegaMekNET In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18934 Modified Files: history.txt Log Message: Added FdL image and mechset entry, and changed the .blk file a little (name+model) Index: history.txt =================================================================== RCS file: /cvsroot/megameknet/MegaMekNET/history.txt,v retrieving revision 1.174 retrieving revision 1.175 diff -C2 -d -r1.174 -r1.175 *** history.txt 24 Feb 2005 18:28:07 -0000 1.174 --- history.txt 25 Feb 2005 14:13:47 -0000 1.175 *************** *** 1,2 **** --- 1,4 ---- + -> C Added FdL image and mechset entry, and changed the .blk file a little (name+model) + nemchenk (2005-02-25) -> C New Feature: Enter "local://" in blackboard for references to local files Imi 2005-02-24 *************** *** 20,23 **** --- 22,26 ---- -> C Fixed Login Dialog (double-showed servers + null) McW (2005-02-20) + >>>>>>> 1.174 -> S Added ADMINSETHOUSEEXTRABAYS Command McW (2005-02-19) |
From: Dima N. <nem...@us...> - 2005-02-25 14:14:29
|
Update of /cvsroot/megameknet/MegaMekNET/client-dist/data/mechfiles In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18934/client-dist/data/mechfiles Modified Files: MMNetVehicles.zip Log Message: Added FdL image and mechset entry, and changed the .blk file a little (name+model) Index: MMNetVehicles.zip =================================================================== RCS file: /cvsroot/megameknet/MegaMekNET/client-dist/data/mechfiles/MMNetVehicles.zip,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 Binary files /tmp/cvsZuMSWu and /tmp/cvsz5bMzT differ |
From: Dima N. <nem...@us...> - 2005-02-25 14:14:12
|
Update of /cvsroot/megameknet/MegaMekNET/client-dist/data/mex In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18934/client-dist/data/mex Modified Files: mechset-mmnet.txt Added Files: V_FDL.gif Log Message: Added FdL image and mechset entry, and changed the .blk file a little (name+model) --- NEW FILE: V_FDL.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.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** mechset-mmnet.txt 22 Feb 2005 12:35:20 -0000 1.2 --- mechset-mmnet.txt 25 Feb 2005 14:13:55 -0000 1.3 *************** *** 676,677 **** --- 676,678 ---- chassis "Kruger Combat Car" "kruger.gif" chassis "Palyndrome" "palyndrome.gif" + chassis "Fleur de Lis" "V_FDL.gif" \ No newline at end of file |
From: Immanuel S. <im...@us...> - 2005-02-24 18:28:30
|
Update of /cvsroot/megameknet/MegaMekNET/src/client/gui/util In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7916/src/client/gui/util Added Files: AsynchronHtmlView.java Log Message: new local:// feature and better asynchronous loading of black board. --- NEW FILE: AsynchronHtmlView.java --- package client.gui.util; import javax.swing.JLabel; /** * An html displayable Component, which loads its content asynchronly * @author imi */ public class AsynchronHtmlView extends JLabel { public AsynchronHtmlView(String text) { setText(text); } public AsynchronHtmlView() {} /** * Sets the text as html-text. The actual view is loaded in a different * thread, while "loading..." is displayed in the meantime. */ public void setText(final String msg) { superSetText("loading..."); new Thread() { public void run() { superSetText(msg); } }.start(); } private void superSetText(String msg) { super.setText(msg); } } |
From: Immanuel S. <im...@us...> - 2005-02-24 18:28:15
|
Update of /cvsroot/megameknet/MegaMekNET/src/client/gui In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7916/src/client/gui Modified Files: BlackBoardPanel.java BlackBoardNewMessagePanel.java Log Message: new local:// feature and better asynchronous loading of black board. Index: BlackBoardNewMessagePanel.java =================================================================== RCS file: /cvsroot/megameknet/MegaMekNET/src/client/gui/BlackBoardNewMessagePanel.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** BlackBoardNewMessagePanel.java 26 Oct 2004 20:22:41 -0000 1.3 --- BlackBoardNewMessagePanel.java 24 Feb 2005 18:28:06 -0000 1.4 *************** *** 146,154 **** +"<li>use &lt; for <</li>" +"<li>use &gt; for ></li>" +"</ul></html>"); htmlMsg.setLineWrap(true); htmlMsg.addCaretListener(new CaretListener(){ public void caretUpdate(CaretEvent e) { ! regionSelectDrawer.setText("<html>"+htmlMsg.getText()+"</html>"); } }); --- 146,156 ---- +"<li>use &lt; for <</li>" +"<li>use &gt; for ></li>" + +"<li>use local:// for reference to install directory</li>" +"</ul></html>"); htmlMsg.setLineWrap(true); htmlMsg.addCaretListener(new CaretListener(){ public void caretUpdate(CaretEvent e) { ! String msg = BlackBoardMessage.convertMsg(htmlMsg.getText()); ! regionSelectDrawer.setText("<html>"+msg+"</html>"); } }); Index: BlackBoardPanel.java =================================================================== RCS file: /cvsroot/megameknet/MegaMekNET/src/client/gui/BlackBoardPanel.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** BlackBoardPanel.java 23 Feb 2005 21:52:32 -0000 1.6 --- BlackBoardPanel.java 24 Feb 2005 18:28:06 -0000 1.7 *************** *** 47,50 **** --- 47,51 ---- import javax.swing.event.ListSelectionListener; import client.MMClient; + import client.gui.util.AsynchronHtmlView; import common.gui.BlackBoardMessage; *************** *** 93,97 **** * Draws the rectangle for selecting the region */ ! private JLabel regionSelectDrawer = new JLabel(); private JButton newButton; --- 94,98 ---- * Draws the rectangle for selecting the region */ ! private JLabel regionSelectDrawer = new AsynchronHtmlView(); private JButton newButton; *************** *** 204,215 **** int pos = 0; for (Iterator it = msgList.iterator(); it.hasNext();++pos) { ! final BlackBoardMessage bbm = (BlackBoardMessage) it.next(); ! //JLabel text = new JLabel("<html>"+bbm.getHtmlMsg()+"</html>"); ! final JLabel text = new JLabel("<html>loading...</html>"); ! new Thread(){ ! public void run() { ! text.setText("<html>"+bbm.getHtmlMsg()+"</html>"); ! } ! }.start(); text.setBackground(bbm.getBackground()); text.setBorder(BorderFactory.createLineBorder(Color.BLACK)); --- 205,211 ---- int pos = 0; for (Iterator it = msgList.iterator(); it.hasNext();++pos) { ! BlackBoardMessage bbm = (BlackBoardMessage) it.next(); ! String msg = BlackBoardMessage.convertMsg(bbm.getHtmlMsg()); ! JLabel text = new AsynchronHtmlView("<html>"+msg+"</html>"); text.setBackground(bbm.getBackground()); text.setBorder(BorderFactory.createLineBorder(Color.BLACK)); *************** *** 297,306 **** regionSelectDrawer.setForeground(selectedBBM.getForeground()); regionSelectDrawer.setBackground(selectedBBM.getBackground()); ! regionSelectDrawer.setText("<html>"+selectedBBM.getHtmlMsg()+"</html>"); regionSelectDrawer.setVisible(true); // hide the other one for (Iterator it = msgComponents.iterator(); it.hasNext();) { JLabel l = (JLabel) it.next(); ! if (l.getText().equals("<html>"+selectedBBM.getHtmlMsg()+"</html>")) l.setVisible(false); } --- 293,303 ---- regionSelectDrawer.setForeground(selectedBBM.getForeground()); regionSelectDrawer.setBackground(selectedBBM.getBackground()); ! String msg = BlackBoardMessage.convertMsg(selectedBBM.getHtmlMsg()); ! regionSelectDrawer.setText("<html>"+msg+"</html>"); regionSelectDrawer.setVisible(true); // hide the other one for (Iterator it = msgComponents.iterator(); it.hasNext();) { JLabel l = (JLabel) it.next(); ! if (l.getText().equals("<html>"+msg+"</html>")) l.setVisible(false); } |
From: Immanuel S. <im...@us...> - 2005-02-24 18:28:15
|
Update of /cvsroot/megameknet/MegaMekNET In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7916 Modified Files: history.txt Log Message: new local:// feature and better asynchronous loading of black board. Index: history.txt =================================================================== RCS file: /cvsroot/megameknet/MegaMekNET/history.txt,v retrieving revision 1.173 retrieving revision 1.174 diff -C2 -d -r1.173 -r1.174 *** history.txt 23 Feb 2005 21:55:01 -0000 1.173 --- history.txt 24 Feb 2005 18:28:07 -0000 1.174 *************** *** 1,2 **** --- 1,4 ---- + -> C New Feature: Enter "local://" in blackboard for references to local files + Imi 2005-02-24 -> C Fixed a problem with freezes the client on huge BlackBoardMessages (asynchron loading now). Imi 2005-02-23 |
From: Immanuel S. <im...@us...> - 2005-02-24 18:28:15
|
Update of /cvsroot/megameknet/MegaMekNET/src/common/gui In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7916/src/common/gui Modified Files: BlackBoardMessage.java Log Message: new local:// feature and better asynchronous loading of black board. Index: BlackBoardMessage.java =================================================================== RCS file: /cvsroot/megameknet/MegaMekNET/src/common/gui/BlackBoardMessage.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** BlackBoardMessage.java 16 Feb 2005 22:17:18 -0000 1.5 --- BlackBoardMessage.java 24 Feb 2005 18:28:06 -0000 1.6 *************** *** 15,18 **** --- 15,19 ---- import java.awt.Color; + import java.io.File; import java.util.StringTokenizer; *************** *** 160,163 **** --- 161,165 ---- return htmlMsg; } + /** * @return Returns the ticks. *************** *** 212,214 **** --- 214,230 ---- return false; } + + /** + * @return The html message with all replacements and shortcuts done. + * So this is the message you can display in any html-container. + */ + public static String convertMsg(String msg) { + // replacing local:// with current dir + String current = new File(".").getAbsolutePath(); + if (current.endsWith(".")) + current = current.substring(0, current.length()-1); + msg = msg.replaceAll("local://", "file://"+current); + + return msg; + } } |
From: Immanuel S. <im...@us...> - 2005-02-24 18:28:04
|
Update of /cvsroot/megameknet/MegaMekNET/src/client/gui/util In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7848/src/client/gui/util Log Message: Directory /cvsroot/megameknet/MegaMekNET/src/client/gui/util added to the repository |
From: Immanuel S. <im...@us...> - 2005-02-23 21:55:09
|
Update of /cvsroot/megameknet/MegaMekNET In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1129 Modified Files: history.txt Log Message: asynchron message loading to prevent freezes because of huge messages Index: history.txt =================================================================== RCS file: /cvsroot/megameknet/MegaMekNET/history.txt,v retrieving revision 1.172 retrieving revision 1.173 diff -C2 -d -r1.172 -r1.173 *** history.txt 23 Feb 2005 20:02:07 -0000 1.172 --- history.txt 23 Feb 2005 21:55:01 -0000 1.173 *************** *** 1,2 **** --- 1,6 ---- + -> C Fixed a problem with freezes the client on huge BlackBoardMessages (asynchron loading now). + Imi 2005-02-23 + -> C Switched to compressed data update and Visitors + Imi 2005-02-23 -> S Fixed a problem with P having extreme amounts of components -> S Prevent ClassCastException in Market |
From: Helge R. <mcw...@us...> - 2005-02-23 21:53:29
|
Update of /cvsroot/megameknet/MegaMekNET/src/server/campaign In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv585/src/server/campaign Modified Files: SPlayer.java Log Message: removed debug output Index: SPlayer.java =================================================================== RCS file: /cvsroot/megameknet/MegaMekNET/src/server/campaign/SPlayer.java,v retrieving revision 1.63 retrieving revision 1.64 diff -C2 -d -r1.63 -r1.64 *** SPlayer.java 20 Feb 2005 23:13:13 -0000 1.63 --- SPlayer.java 23 Feb 2005 21:53:21 -0000 1.64 *************** *** 546,550 **** numBays += this.getTechnicians(); }//end if(Techs are use in calculation) - System.out.println("Total bays " + numBays); return numBays; }//end TotalMechBays() --- 546,549 ---- |
From: Immanuel S. <im...@us...> - 2005-02-23 21:52:44
|
Update of /cvsroot/megameknet/MegaMekNET/src/client/gui In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv329/src/client/gui Modified Files: BlackBoardPanel.java Log Message: asynchron message loading to prevent freezes because of huge messages Index: BlackBoardPanel.java =================================================================== RCS file: /cvsroot/megameknet/MegaMekNET/src/client/gui/BlackBoardPanel.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** BlackBoardPanel.java 19 Feb 2005 23:09:30 -0000 1.5 --- BlackBoardPanel.java 23 Feb 2005 21:52:32 -0000 1.6 *************** *** 33,37 **** import java.util.Random; import java.util.StringTokenizer; - import javax.swing.BorderFactory; import javax.swing.Box; --- 33,36 ---- *************** *** 47,53 **** import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionListener; - import client.MMClient; - import common.gui.BlackBoardMessage; --- 46,50 ---- *************** *** 207,212 **** int pos = 0; for (Iterator it = msgList.iterator(); it.hasNext();++pos) { ! BlackBoardMessage bbm = (BlackBoardMessage) it.next(); ! JLabel text = new JLabel("<html>"+bbm.getHtmlMsg()+"</html>"); text.setBackground(bbm.getBackground()); text.setBorder(BorderFactory.createLineBorder(Color.BLACK)); --- 204,215 ---- int pos = 0; for (Iterator it = msgList.iterator(); it.hasNext();++pos) { ! final BlackBoardMessage bbm = (BlackBoardMessage) it.next(); ! //JLabel text = new JLabel("<html>"+bbm.getHtmlMsg()+"</html>"); ! final JLabel text = new JLabel("<html>loading...</html>"); ! new Thread(){ ! public void run() { ! text.setText("<html>"+bbm.getHtmlMsg()+"</html>"); ! } ! }.start(); text.setBackground(bbm.getBackground()); text.setBorder(BorderFactory.createLineBorder(Color.BLACK)); |
From: Immanuel S. <im...@us...> - 2005-02-23 21:12:27
|
Update of /cvsroot/megameknet/MegaMekNET/src/server/campaign/commands In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18710/src/server/campaign/commands Modified Files: SetHouseLogoCommand.java Log Message: NullPointerException with illegal house fixed Index: SetHouseLogoCommand.java =================================================================== RCS file: /cvsroot/megameknet/MegaMekNET/src/server/campaign/commands/SetHouseLogoCommand.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** SetHouseLogoCommand.java 22 Feb 2005 20:21:09 -0000 1.10 --- SetHouseLogoCommand.java 23 Feb 2005 21:12:17 -0000 1.11 *************** *** 36,39 **** --- 36,41 ---- if (CampaignMain.cm.getServer().isModerator(userName)) { SHouse h = CampaignMain.getHouseFromPartialString(param[0], userName); + if (h == null) + return; h.setLogo(param[1]); String descTxt = ""; |
From: Immanuel S. <im...@us...> - 2005-02-23 20:51:25
|
Update of /cvsroot/megameknet/MegaMekNET/src/common/visitor In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10148/src/common/visitor Modified Files: FromXmlRpcValueVisitor.java Log Message: jdk1.4 ! not 1.5 Index: FromXmlRpcValueVisitor.java =================================================================== RCS file: /cvsroot/megameknet/MegaMekNET/src/common/visitor/FromXmlRpcValueVisitor.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** FromXmlRpcValueVisitor.java 23 Feb 2005 19:34:34 -0000 1.1 --- FromXmlRpcValueVisitor.java 23 Feb 2005 20:51:13 -0000 1.2 *************** *** 55,59 **** try { Method method = getClass().getMethod(methodName, new Class[]{Map.class}); ! return method.invoke(this, root); } catch (NoSuchMethodException e) { throw new RuntimeException("Member named "+methodName+" not found in FromXmlRpcValueVisitor.", e); --- 55,59 ---- try { Method method = getClass().getMethod(methodName, new Class[]{Map.class}); ! return method.invoke(this, new Object[]{root}); } catch (NoSuchMethodException e) { throw new RuntimeException("Member named "+methodName+" not found in FromXmlRpcValueVisitor.", e); |
From: Immanuel S. <im...@us...> - 2005-02-23 20:47:18
|
Update of /cvsroot/megameknet/MegaMekNET/src/common/visitor In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8441/src/common/visitor Modified Files: LoadVisitor.java Log Message: ups. forgot to remove debug stuff Index: LoadVisitor.java =================================================================== RCS file: /cvsroot/megameknet/MegaMekNET/src/common/visitor/LoadVisitor.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** LoadVisitor.java 23 Feb 2005 19:34:32 -0000 1.1 --- LoadVisitor.java 23 Feb 2005 20:47:09 -0000 1.2 *************** *** 92,96 **** } catch (Exception e) { e.printStackTrace(); - System.exit(1); return null; } --- 92,95 ---- *************** *** 147,151 **** public void recordElementStart(String tagname, Hashtable attr) throws ParseException { - System.out.println("start: "+tagname); HashMap h = new HashMap(); h.put(null, tagname); --- 146,149 ---- *************** *** 153,157 **** } public void recordCharData(String data) { - System.out.println("data: "+data); if (this.data != null) throw new RuntimeException("Double call to recordCharData."); --- 151,154 ---- *************** *** 159,163 **** } public void recordElementEnd(String tagname) throws ParseException { - System.out.println("end: "+tagname); HashMap h = (HashMap)result.pop(); if (!tagname.equals(h.get(null))) --- 156,159 ---- |
From: Helge R. <mcw...@us...> - 2005-02-23 20:02:16
|
Update of /cvsroot/megameknet/MegaMekNET In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3024 Modified Files: history.txt Log Message: -> S Fixed a problem with P having extreme amounts of components Index: history.txt =================================================================== RCS file: /cvsroot/megameknet/MegaMekNET/history.txt,v retrieving revision 1.171 retrieving revision 1.172 diff -C2 -d -r1.171 -r1.172 *** history.txt 23 Feb 2005 19:44:15 -0000 1.171 --- history.txt 23 Feb 2005 20:02:07 -0000 1.172 *************** *** 1,2 **** --- 1,3 ---- + -> S Fixed a problem with P having extreme amounts of components -> S Prevent ClassCastException in Market McW (2005-02-23) |
From: Helge R. <mcw...@us...> - 2005-02-23 20:02:04
|
Update of /cvsroot/megameknet/MegaMekNET/src/server/campaign/commands In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2930/src/server/campaign/commands Modified Files: HouseStatusCommand.java Log Message: -> S Fixed a problem with P having extreme amounts of components Index: HouseStatusCommand.java =================================================================== RCS file: /cvsroot/megameknet/MegaMekNET/src/server/campaign/commands/HouseStatusCommand.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** HouseStatusCommand.java 20 Feb 2005 10:09:32 -0000 1.7 --- HouseStatusCommand.java 23 Feb 2005 20:01:55 -0000 1.8 *************** *** 29,33 **** SHouse h = (SHouse)e.next(); result += "<FONT Color=\"" + h.getHouseColor() + "\">"; ! result += h.getName() + " has " + h.getPlanets().size() + " Planets and " + h.getMembers().size() + " Members. The total economy value is: "+ h.getComponentProduction() + "</font><br>"; } CampaignMain.cm.toUser("SM|" + result,userName,false); --- 29,33 ---- SHouse h = (SHouse)e.next(); result += "<FONT Color=\"" + h.getHouseColor() + "\">"; ! result += h.getName() + " has " + h.getPlanets().size() + " Planets and " + h.getMembers().size() + " Members. The total economy value is: "+ h.getTotalComponentProduction() + "</font><br>"; } CampaignMain.cm.toUser("SM|" + result,userName,false); |
From: Helge R. <mcw...@us...> - 2005-02-23 20:02:04
|
Update of /cvsroot/megameknet/MegaMekNET/src/server/campaign In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2930/src/server/campaign Modified Files: SHouse.java Log Message: -> S Fixed a problem with P having extreme amounts of components Index: SHouse.java =================================================================== RCS file: /cvsroot/megameknet/MegaMekNET/src/server/campaign/SHouse.java,v retrieving revision 1.80 retrieving revision 1.81 diff -C2 -d -r1.80 -r1.81 *** SHouse.java 20 Feb 2005 23:13:13 -0000 1.80 --- SHouse.java 23 Feb 2005 20:01:53 -0000 1.81 *************** *** 392,396 **** public int getComponentProduction() { ! return componentProduction + componentsFromOtherSources; } --- 392,400 ---- public int getComponentProduction() { ! return componentProduction; ! } ! ! public int getTotalComponentProduction(){ ! return getComponentProduction() + getComponentsFromOtherSources(); } *************** *** 699,705 **** public void addGeneralPP(double MekMiniticks, double VehMiniticks, double InfMiniticks) { // then add to the house PP pools ! int MekComp = (int)(MekMiniticks * getComponentProduction()); ! int VehComp = (int)(VehMiniticks * getComponentProduction()); ! int InfComp = (int)(InfMiniticks * getComponentProduction()); for (int i = 0; i < 4; i++) {//loop through each weight class, adding PP addPP(i, SUnit.MEK, MekComp); --- 703,709 ---- public void addGeneralPP(double MekMiniticks, double VehMiniticks, double InfMiniticks) { // then add to the house PP pools ! int MekComp = (int)(MekMiniticks * getTotalComponentProduction()); ! int VehComp = (int)(VehMiniticks * getTotalComponentProduction()); ! int InfComp = (int)(InfMiniticks * getTotalComponentProduction()); for (int i = 0; i < 4; i++) {//loop through each weight class, adding PP addPP(i, SUnit.MEK, MekComp); |
From: Helge R. <mcw...@us...> - 2005-02-23 19:44:56
|
Update of /cvsroot/megameknet/MegaMekNET/src/server/campaign/market In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32065/src/server/campaign/market Modified Files: Market.java Log Message: -> S Prevent ClassCastException in Market Index: Market.java =================================================================== RCS file: /cvsroot/megameknet/MegaMekNET/src/server/campaign/market/Market.java,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** Market.java 16 Feb 2005 22:17:02 -0000 1.15 --- Market.java 23 Feb 2005 19:44:14 -0000 1.16 *************** *** 342,354 **** int market_share = 0; try { ! int mod = (int)((SPlayer)m.getSeller()).getExperience()/150; ! int roll = 0; ! if (mod >= 10) { ! roll = CampaignMain.cm.getR().nextInt(5)+5; ! } else { ! roll = CampaignMain.cm.getR().nextInt(mod) + CampaignMain.cm.getR().nextInt(6) + 2 - mod; ! } ! double percent = Math.max(roll, 0)*.05; ! market_share = (int)Math.round(percent*b.getAmount()) + (int)Math.ceil(b.getAmount()*.01); } catch (Exception e1) { e1.printStackTrace(); --- 342,357 ---- int market_share = 0; try { ! double percent = 0; ! if (m.getSeller() instanceof SPlayer){ ! int mod = (int)((SPlayer)m.getSeller()).getExperience()/150; ! int roll = 0; ! if (mod >= 10) { ! roll = CampaignMain.cm.getR().nextInt(5)+5; ! } else { ! roll = CampaignMain.cm.getR().nextInt(mod) + CampaignMain.cm.getR().nextInt(6) + 2 - mod; ! } ! percent = Math.max(roll, 0)*.05; ! } ! market_share = (int)Math.round(percent*b.getAmount()) + (int)Math.ceil(b.getAmount()*.01); } catch (Exception e1) { e1.printStackTrace(); |
From: Helge R. <mcw...@us...> - 2005-02-23 19:44:35
|
Update of /cvsroot/megameknet/MegaMekNET In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32065 Modified Files: history.txt Log Message: -> S Prevent ClassCastException in Market Index: history.txt =================================================================== RCS file: /cvsroot/megameknet/MegaMekNET/history.txt,v retrieving revision 1.170 retrieving revision 1.171 diff -C2 -d -r1.170 -r1.171 *** history.txt 23 Feb 2005 12:22:01 -0000 1.170 --- history.txt 23 Feb 2005 19:44:15 -0000 1.171 *************** *** 1,2 **** --- 1,4 ---- + -> S Prevent ClassCastException in Market + McW (2005-02-23) -> C redirection of stdout to log.txt. startClient.bat becomes obsolete. Imi 2005-02-23 |
Update of /cvsroot/megameknet/MegaMekNET/src/common In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28987/src/common Modified Files: Planet.java Influences.java UnitFactory.java Continent.java House.java UnitFactories.java PlanetEnvironment.java Terrain.java Log Message: data transfer now uses compressed format and cache storage don't use xstream for data.xml anymore (memory issues) Index: UnitFactories.java =================================================================== RCS file: /cvsroot/megameknet/MegaMekNET/src/common/UnitFactories.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** UnitFactories.java 23 Feb 2005 01:12:53 -0000 1.5 --- UnitFactories.java 23 Feb 2005 19:34:37 -0000 1.6 *************** *** 59,72 **** } - /** - * Create unit factories from a XMLRPC value - */ - public static UnitFactories fromXmlRpcValue(Object value) { - UnitFactories uf = new UnitFactories(); - for (Iterator it = ((Vector)value).iterator(); it.hasNext();) - uf.add(UnitFactory.fromXmlRpcValue(it.next())); - return uf; - } - public void visit(AbstractVisitor visitor) { visitor.visitUnitFactories(this); --- 59,62 ---- Index: Terrain.java =================================================================== RCS file: /cvsroot/megameknet/MegaMekNET/src/common/Terrain.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Terrain.java 23 Feb 2005 01:12:53 -0000 1.3 --- Terrain.java 23 Feb 2005 19:34:38 -0000 1.4 *************** *** 17,21 **** import java.util.Iterator; import java.util.Random; - import java.util.Vector; import common.visitor.AbstractVisitor; import common.visitor.Visitorable; --- 17,20 ---- *************** *** 109,123 **** } - /** - * Create an PlanetEnvironments from a XMLRPC value - */ - public static Terrain fromXmlRpcValue(Object value) { - Terrain pe = new Terrain(); - Vector v = (Vector)value; - for (Iterator it = v.iterator(); it.hasNext();) - pe.add(Continent.fromXmlRpcValue(it.next())); - return pe; - } - public void visit(AbstractVisitor visitor) { visitor.visitTerrain(this); --- 108,111 ---- Index: Continent.java =================================================================== RCS file: /cvsroot/megameknet/MegaMekNET/src/common/Continent.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Continent.java 23 Feb 2005 01:12:53 -0000 1.5 --- Continent.java 23 Feb 2005 19:34:37 -0000 1.6 *************** *** 14,18 **** package common; - import java.util.Hashtable; import common.visitor.AbstractVisitor; import common.visitor.Visitorable; --- 14,17 ---- *************** *** 66,79 **** } - /** - * Create a continent from an XMLRPC value - */ - public static Continent fromXmlRpcValue(Object value) { - Hashtable h = (Hashtable)value; - return new Continent( - ((Integer)h.get("size")).intValue(), - PlanetEnvironment.fromXmlRpcValue(h.get("environment"))); - } - public void visit(AbstractVisitor visitor) { visitor.visitContinent(this); --- 65,68 ---- Index: House.java =================================================================== RCS file: /cvsroot/megameknet/MegaMekNET/src/common/House.java,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** House.java 22 Feb 2005 22:41:03 -0000 1.12 --- House.java 23 Feb 2005 19:34:37 -0000 1.13 *************** *** 15,19 **** package common; - import java.util.Hashtable; import common.visitor.AbstractVisitor; import common.visitor.Visitorable; --- 15,18 ---- *************** *** 244,270 **** houseUnitComponentMod[type][weight] = mod; } - - public static House fromXmlRpcValue(Object value) { - Hashtable h = (Hashtable)value; - House house = new House(((Integer)h.get("id")).intValue()); - house.setName(h.get("name").toString()); - house.setLogo(h.get("logo").toString()); - house.setBaseGunner(((Integer)h.get("baseGunner")).intValue()); - house.setBasePilot(((Integer)h.get("basePilot")).intValue()); - house.setInitialHouseRanking(((Integer)h.get("initialHouseRanking")).intValue()); - house.setHouseColor(h.get("houseColor").toString()); - house.setAbbreviation(h.get("abbreviation").toString()); - house.setDescription(h.get("description").toString()); - house.setConquerable(((Boolean)h.get("conquerable")).booleanValue()); - house.setInHouseAttacks(((Boolean)h.get("inHouseAttacks")).booleanValue()); - house.setMayUseBM(((Boolean)h.get("mayUseBM")).booleanValue()); - house.setMotd(h.get("motd").toString()); - for (int type = 0; type < Unit.TOTALTYPES; ++type) - for (int weight = 0; weight < Unit.WEIGHT_STR.length; ++weight) { - house.setHouseUnitComponentMod(type, weight, ((Integer)h.get("componentMod"+Unit.TYPE_STR[type]+Unit.WEIGHT_STR[weight])).intValue()); - house.setHouseUnitPriceMod(type, weight, ((Integer)h.get("priceMod"+Unit.TYPE_STR[type]+Unit.WEIGHT_STR[weight])).intValue()); - } - return house; - } /** --- 243,246 ---- Index: PlanetEnvironment.java =================================================================== RCS file: /cvsroot/megameknet/MegaMekNET/src/common/PlanetEnvironment.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** PlanetEnvironment.java 22 Feb 2005 22:41:04 -0000 1.10 --- PlanetEnvironment.java 23 Feb 2005 19:34:37 -0000 1.11 *************** *** 15,19 **** import java.io.File; - import java.util.Hashtable; import java.util.StringTokenizer; import java.util.Vector; --- 15,18 ---- *************** *** 511,549 **** } - /** - * Create a planet environment from an XMLRPC-value - */ - public static PlanetEnvironment fromXmlRpcValue(Object value) { - Hashtable h = (Hashtable)value; - PlanetEnvironment pe = new PlanetEnvironment(((Integer)h.get("id")).intValue()); - pe.setName(h.get("name").toString()); - pe.setCraterProb(((Integer)h.get("craterProb")).intValue()); - pe.setCraterMinNum(((Integer)h.get("craterMinNum")).intValue()); - pe.setCraterMaxNum(((Integer)h.get("craterMaxNum")).intValue()); - pe.setCraterMinRadius(((Integer)h.get("craterMinRadius")).intValue()); - pe.setCraterMaxRadius(((Integer)h.get("craterMaxRadius")).intValue()); - pe.setHillyness(((Integer)h.get("hillyness")).intValue()); - pe.setHillElevationRange(((Integer)h.get("hillElevationRange")).intValue()); - pe.setHillInvertProb(((Integer)h.get("hillInvertProb")).intValue()); - pe.setWaterMinSpots(((Integer)h.get("waterMinSpots")).intValue()); - pe.setWaterMaxSpots(((Integer)h.get("waterMaxSpots")).intValue()); - pe.setWaterMinHexes(((Integer)h.get("waterMinHexes")).intValue()); - pe.setWaterMaxHexes(((Integer)h.get("waterMaxHexes")).intValue()); - pe.setWaterDeepProb(((Integer)h.get("waterDeepProb")).intValue()); - pe.setForestMinSpots(((Integer)h.get("forestMinSpots")).intValue()); - pe.setForestMaxSpots(((Integer)h.get("forestMaxSpots")).intValue()); - pe.setForestMinHexes(((Integer)h.get("forestMinHexes")).intValue()); - pe.setForestMaxHexes(((Integer)h.get("forestMaxHexes")).intValue()); - pe.setForestHeavyProb(((Integer)h.get("forestHeavyProb")).intValue()); - pe.setRoughMinSpots(((Integer)h.get("roughMinSpots")).intValue()); - pe.setRoughMaxSpots(((Integer)h.get("roughMaxSpots")).intValue()); - pe.setRoughMinHexes(((Integer)h.get("roughMinHexes")).intValue()); - pe.setRoughMaxHexes(((Integer)h.get("roughMaxHexes")).intValue()); - pe.setRoadProb(((Integer)h.get("roadProb")).intValue()); - pe.setRiverProb(((Integer)h.get("riverProb")).intValue()); - pe.setAlgorithm(((Integer)h.get("algorithm")).intValue()); - return pe; - } - public void visit(AbstractVisitor visitor) { visitor.visitPlanetEnvironment(this); --- 510,513 ---- Index: Influences.java =================================================================== RCS file: /cvsroot/megameknet/MegaMekNET/src/common/Influences.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** Influences.java 23 Feb 2005 14:10:35 -0000 1.10 --- Influences.java 23 Feb 2005 19:34:37 -0000 1.11 *************** *** 201,217 **** } - /** - * Create a Influence object from a XMLRPC-value. - */ - public static Influences fromXmlRpcValue(Object value) { - Map flu = new Hashtable(); - Map h = (Map)value; - for (Iterator it = h.keySet().iterator(); it.hasNext();) { - String houseIdStr = (String)it.next(); - flu.put(new Integer(houseIdStr), h.get(houseIdStr)); - } - return new Influences(flu); - } - public void visit(AbstractVisitor visitor) { visitor.visitInfluences(this); --- 201,204 ---- Index: UnitFactory.java =================================================================== RCS file: /cvsroot/megameknet/MegaMekNET/src/common/UnitFactory.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** UnitFactory.java 22 Feb 2005 22:41:03 -0000 1.9 --- UnitFactory.java 23 Feb 2005 19:34:37 -0000 1.10 *************** *** 15,19 **** import java.io.Serializable; - import java.util.Hashtable; import common.visitor.AbstractVisitor; import common.visitor.Visitorable; --- 15,18 ---- *************** *** 256,275 **** } - /** - * Create an unit factory from a XMLRPC value. - */ - public static UnitFactory fromXmlRpcValue(Object value) { - UnitFactory uf = new UnitFactory(); - Hashtable h = (Hashtable)value; - uf.setName(h.get("name").toString()); - uf.setSize(h.get("size").toString()); - uf.setFounder(h.get("founder").toString()); - uf.setProductionTable(h.get("productionTable").toString()); - uf.setTicksUntilRefresh(((Integer)h.get("ticksUntilRefresh")).intValue()); - uf.setRefreshSpeed(((Integer)h.get("refreshSpeed")).intValue()); - uf.setType(((Integer)h.get("type")).intValue()); - return uf; - } - public void visit(AbstractVisitor visitor) { visitor.visitUnitFactory(this); --- 255,258 ---- Index: Planet.java =================================================================== RCS file: /cvsroot/megameknet/MegaMekNET/src/common/Planet.java,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** Planet.java 23 Feb 2005 01:12:53 -0000 1.30 --- Planet.java 23 Feb 2005 19:34:34 -0000 1.31 *************** *** 16,24 **** import java.io.File; - import java.util.Collection; - import java.util.Hashtable; import java.util.Iterator; import java.util.TreeSet; - import java.util.Vector; import client.MMClient; import common.dataFiles.PlanetData; --- 16,21 ---- *************** *** 33,51 **** public class Planet implements Comparable, Visitorable { - /** - * Thrown in fromXmlRpcValue if the PlanetEnvironment wasn't found - */ - public static class PlanetEnvironmentNotFound extends Exception { - private final int id; - public PlanetEnvironmentNotFound(int id) { - super("PlanetEnvironment with id "+id+" not found."); - this.id = id; - } - public int getPlanetId() { - return id; - } - } - - private PlanetData myData = new PlanetData(); --- 30,33 ---- *************** *** 279,283 **** while(it.hasNext()) { Continent pe = (Continent)it.next(); ! int curProb = (int)(pe.getSize()*100/maxProbab); result.append("<tr><td>"); if (curProb < 10) --- 261,265 ---- while(it.hasNext()) { Continent pe = (Continent)it.next(); ! int curProb = (pe.getSize()*100/maxProbab); result.append("<tr><td>"); if (curProb < 10) *************** *** 351,397 **** } - /** - * Create a Planet from a XMLRPC-value. - * - * @param planetEnvironments A list of at least all planet environments - * that occour on this planet. - * @throws PlanetEnvironmentNotFound When a planet environment that occoured - * in the XMLRPC-data was not found in the planetEnvironments list. - */ - public static Planet fromXmlRpcValue(Object value, Collection planetEnvironments) throws PlanetEnvironmentNotFound { - Hashtable h = (Hashtable)value; - Planet p = new Planet(); - p.setId(((Integer)h.get("id")).intValue()); - p.setName(h.get("name").toString()); - p.setPosition(new Position(((Double)h.get("x")).doubleValue(), ((Double)h.get("y")).doubleValue())); - p.setBaysProvided(((Integer)h.get("baysProvided")).intValue()); - p.setCompProduction(((Integer)h.get("compProduction")).intValue()); - p.setConquerable(((Boolean)h.get("isConquerable")).booleanValue()); - p.setDescription(h.get("description").toString()); - p.setUnitFactories(UnitFactories.fromXmlRpcValue(h.get("unitFactories"))); - p.setInfluence(Influences.fromXmlRpcValue(h.get("influence"))); - - // recreate the references to the planet environments. - Terrain terrain = new Terrain(); - Vector terrainIds = (Vector)h.get("terrain"); - for (Iterator it = terrainIds.iterator(); it.hasNext();) { - Hashtable ch = (Hashtable)it.next(); - PlanetEnvironment pe = null; - int id = ((Integer)ch.get("environmentId")).intValue(); - for (Iterator pit = planetEnvironments.iterator(); pit.hasNext();) { - PlanetEnvironment curPE = (PlanetEnvironment)pit.next(); - if (curPE.getId() == id) { - pe = curPE; - break; - } - } - if (pe == null) - throw new PlanetEnvironmentNotFound(id); - terrain.add(new Continent(((Integer)ch.get("size")).intValue(), pe)); - } - p.setTerrain(terrain); - return p; - } - public void visit(AbstractVisitor visitor) { visitor.visitPlanet(this); --- 333,336 ---- |