jcrossclient-cvs Mailing List for JCrossClient
Status: Alpha
Brought to you by:
cavesomething
You can subscribe to this list here.
2006 |
Jan
(23) |
Feb
(4) |
Mar
(4) |
Apr
(8) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
---|
From: <jcr...@li...> - 2006-04-20 02:20:56
|
Update of /cvsroot/jcrossclient/jcrossclient In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24029 Modified Files: CFclient.java Log Message: bump version number Index: CFclient.java =================================================================== RCS file: /cvsroot/jcrossclient/jcrossclient/CFclient.java,v retrieving revision 1.39 retrieving revision 1.40 diff -C2 -d -r1.39 -r1.40 *** CFclient.java 19 Apr 2006 23:05:27 -0000 1.39 --- CFclient.java 20 Apr 2006 02:20:52 -0000 1.40 *************** *** 1548,1552 **** void writePVersion() { try { ! mConnection.writeBytes("version "+protocol_version + " 1027 JCrossclient 1.0 alpha-3CVS"); /* make the server use the new map style commands */ mConnection.writeBytes("setup map1cmd 1 itemcmd 2 exp64 1 spellmon 1 newmapcmd 1 mapsize " + mapwin.XMAX + "x" + mapwin.YMAX); --- 1548,1552 ---- void writePVersion() { try { ! mConnection.writeBytes("version "+protocol_version + " 1027 JCrossclient 1.0 alpha-4"); /* make the server use the new map style commands */ mConnection.writeBytes("setup map1cmd 1 itemcmd 2 exp64 1 spellmon 1 newmapcmd 1 mapsize " + mapwin.XMAX + "x" + mapwin.YMAX); |
From: <jcr...@li...> - 2006-04-20 01:55:19
|
Update of /cvsroot/jcrossclient/jcrossclient In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5331 Modified Files: TabPanel.java Log Message: fix bad tabpanel commit Index: TabPanel.java =================================================================== RCS file: /cvsroot/jcrossclient/jcrossclient/TabPanel.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** TabPanel.java 20 Apr 2006 01:49:36 -0000 1.4 --- TabPanel.java 20 Apr 2006 01:55:15 -0000 1.5 *************** *** 110,115 **** ((CardLayout) getLayout()).show(this, (String) names.elementAt(i)); repaint(); ! Component c = getComponent(i); ! c.dispatchEvent(new WindowEvent(new Window(null), WindowEvent.WINDOW_ACTIVATED)); }} Applet applet = null; --- 110,114 ---- ((CardLayout) getLayout()).show(this, (String) names.elementAt(i)); repaint(); ! Component c = getComponent(i); }} Applet applet = null; |
From: <jcr...@li...> - 2006-04-20 01:49:40
|
Update of /cvsroot/jcrossclient/jcrossclient In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv706 Modified Files: TabPanel.java Log Message: update comment Index: TabPanel.java =================================================================== RCS file: /cvsroot/jcrossclient/jcrossclient/TabPanel.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** TabPanel.java 20 Apr 2006 00:18:47 -0000 1.3 --- TabPanel.java 20 Apr 2006 01:49:36 -0000 1.4 *************** *** 25,32 **** You probably want to setBackground() to a color contrasting that of the parent and the components. - <P> - Whenever a card is selected (whether by software or mouse), an event with - id = Event.WINDOW_EXPOSE is sent to the selected component. Handling this - event may be useful for deferred initialization. @author Bruce R. Miller (bru...@ni...) --- 25,28 ---- *************** *** 114,118 **** ((CardLayout) getLayout()).show(this, (String) names.elementAt(i)); repaint(); ! Component c = getComponent(i); }} Applet applet = null; --- 110,115 ---- ((CardLayout) getLayout()).show(this, (String) names.elementAt(i)); repaint(); ! Component c = getComponent(i); ! c.dispatchEvent(new WindowEvent(new Window(null), WindowEvent.WINDOW_ACTIVATED)); }} Applet applet = null; |
From: <jcr...@li...> - 2006-04-20 00:18:51
|
Update of /cvsroot/jcrossclient/jcrossclient In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31128 Modified Files: Changelog Settings.java TabPanel.java Log Message: update some deprecated code Index: TabPanel.java =================================================================== RCS file: /cvsroot/jcrossclient/jcrossclient/TabPanel.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** TabPanel.java 19 Apr 2006 12:57:15 -0000 1.2 --- TabPanel.java 20 Apr 2006 00:18:47 -0000 1.3 *************** *** 11,14 **** --- 11,15 ---- import java.awt.*; import java.util.*; + import java.awt.event.*; /** ************************************************************************** *************** *** 33,37 **** @author not subject to copyright. */ ! public class TabPanel extends Panel { /** The width of the margins around the cards. */ public int margin = 3; // width of margins around cards --- 34,38 ---- @author not subject to copyright. */ ! public class TabPanel extends Panel implements MouseListener, MouseMotionListener { /** The width of the margins around the cards. */ public int margin = 3; // width of margins around cards *************** *** 53,56 **** --- 54,59 ---- public TabPanel() { setLayout(new CardLayout()); + addMouseListener(this); + addMouseMotionListener(this); setTabFont(new Font("Helvetica",Font.BOLD,12)); } *************** *** 111,116 **** ((CardLayout) getLayout()).show(this, (String) names.elementAt(i)); repaint(); ! Component c = getComponent(i); ! c.postEvent(new Event(c,Event.WINDOW_EXPOSE,this)); }} /** Select the first card in the Panel. */ --- 114,144 ---- ((CardLayout) getLayout()).show(this, (String) names.elementAt(i)); repaint(); ! Component c = getComponent(i); }} ! ! Applet applet = null; ! ! public void mouseDragged(MouseEvent evt) {} ! public void mouseMoved(MouseEvent evt) { ! if (applet == null) { ! Component c = getParent(); ! while (c != null) { ! if (c instanceof Applet) applet = (Applet) c; ! c = c.getParent(); }} ! if (applet != null) { ! int i=cardAt(evt.getX(),evt.getY()); ! if (i != -1) ! applet.showStatus(documentCard((String) names.elementAt(i))); }} ! ! public void mousePressed(MouseEvent evt) { ! int i = cardAt(evt.getX(),evt.getY()); ! if (i != -1) { ! setSelected(i,false); }} ! ! public void mouseClicked(MouseEvent evt) {} ! public void mouseReleased(MouseEvent evt) {} ! public void mouseEntered(MouseEvent evt) {} ! public void mouseExited(MouseEvent evt) { ! if (applet != null) ! applet.showStatus(""); } /** Select the first card in the Panel. */ *************** *** 150,176 **** return "Select tab card " + name; } ! Applet applet = null; ! ! /** Handle mouse clicks and documentation line for Tab selection. */ ! public boolean handleEvent(Event e) { ! if (e.id == Event.MOUSE_DOWN) { ! int i = cardAt(e.x,e.y); ! if (i != -1) { ! setSelected(i,false); ! return true; }} ! else if (e.id == Event.MOUSE_MOVE) { ! if (applet == null) { ! Component c = getParent(); ! while (c != null) { ! if (c instanceof Applet) applet = (Applet) c; ! c = c.getParent(); }} ! if (applet != null) { ! int i=cardAt(e.x,e.y); ! if (i != -1) ! applet.showStatus(documentCard((String) names.elementAt(i))); }} ! else if (e.id == Event.MOUSE_EXIT) { ! if (applet != null) ! applet.showStatus(""); } ! return super.handleEvent(e); } /*************************************************** --- 178,182 ---- return "Select tab card " + name; } ! /*************************************************** *************** *** 178,182 **** /** Allocates extra margins to give the cards some `body'. */ ! public Insets insets() { return new Insets(tabH+margin,margin,margin,margin); } --- 184,188 ---- /** Allocates extra margins to give the cards some `body'. */ ! public Insets getInsets() { return new Insets(tabH+margin,margin,margin,margin); } *************** *** 213,217 **** x += width[i]; } pos[nCards] = x; ! int w = size().width; if ((offscreen==null) || (offscreen.getHeight(this)<tabH) || (offscreen.getWidth(this)<w)){ --- 219,223 ---- x += width[i]; } pos[nCards] = x; ! int w = getSize().width; if ((offscreen==null) || (offscreen.getHeight(this)<tabH) || (offscreen.getWidth(this)<w)){ *************** *** 256,260 **** /** Paint the tabs in a row atop the cards. */ public void paint(Graphics gg) { ! Dimension sz = size(); Graphics g = offscreen.getGraphics(); int x,w = sz.width-1, h = sz.height-1, r = tabH/2; --- 262,266 ---- /** Paint the tabs in a row atop the cards. */ public void paint(Graphics gg) { ! Dimension sz = getSize(); Graphics g = offscreen.getGraphics(); int x,w = sz.width-1, h = sz.height-1, r = tabH/2; Index: Settings.java =================================================================== RCS file: /cvsroot/jcrossclient/jcrossclient/Settings.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** Settings.java 19 Apr 2006 12:57:15 -0000 1.7 --- Settings.java 20 Apr 2006 00:18:47 -0000 1.8 *************** *** 187,191 **** public void reload (String buf) { ! StringBufferInputStream bais = new StringBufferInputStream(buf); try { val.load(bais); } catch(IOException err) { } } --- 187,197 ---- public void reload (String buf) { ! /* This change (replacing a StringBufferInputStream with a ! * ByteArrayInputStream) removes a deprecation warning, it doesn't ! * actually fix the problem that caused the old function to be ! * deprecated. Sun provide no proper way to do this, so we are ! * left with this horrible way to do it. ! */ ! ByteArrayInputStream bais = new ByteArrayInputStream(buf.getBytes()); try { val.load(bais); } catch(IOException err) { } } Index: Changelog =================================================================== RCS file: /cvsroot/jcrossclient/jcrossclient/Changelog,v retrieving revision 1.46 retrieving revision 1.47 diff -C2 -d -r1.46 -r1.47 *** Changelog 19 Apr 2006 23:05:27 -0000 1.46 --- Changelog 20 Apr 2006 00:18:47 -0000 1.47 *************** *** 343,344 **** --- 343,348 ---- README - update to mention 't' doubling for the quote key + + Settings - change some deprecated code + + Tabpanel - change some deprecated code |
From: <jcr...@li...> - 2006-04-19 23:05:31
|
Update of /cvsroot/jcrossclient/jcrossclient In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10581 Modified Files: CFclient.java Changelog InvWin.java README Log Message: add a put in container option to inventory items Index: README =================================================================== RCS file: /cvsroot/jcrossclient/jcrossclient/README,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** README 23 Jan 2006 19:36:08 -0000 1.4 --- README 19 Apr 2006 23:05:27 -0000 1.5 *************** *** 75,80 **** will take commands. ! Use the quote (') key to give focus to the command window. - here you can issue ! various commands eg "shout hello" "party join foo", type help to see what all of these are. --- 75,80 ---- will take commands. ! Use the quote (') key (or press 't') to give focus to the command window. - ! here you can issue various commands eg "shout hello" "party join foo", type help to see what all of these are. Index: CFclient.java =================================================================== RCS file: /cvsroot/jcrossclient/jcrossclient/CFclient.java,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -d -r1.38 -r1.39 *** CFclient.java 19 Apr 2006 17:12:37 -0000 1.38 --- CFclient.java 19 Apr 2006 23:05:27 -0000 1.39 *************** *** 724,728 **** /* if the object has been newly closed, show the map */ if (((thisobj.getFlags() & F_OPEN) > 0) && ((val & F_OPEN) == 0)) { ! allobjects.setOpenContainer(thisobj); showmap(); } --- 724,728 ---- /* if the object has been newly closed, show the map */ if (((thisobj.getFlags() & F_OPEN) > 0) && ((val & F_OPEN) == 0)) { ! allobjects.setOpenContainer(null); showmap(); } *************** *** 1767,1772 **** public void dropObj(int tag, int quantity) { try { ! mConnection.writeBytes("move 0 "+ tag + " " + quantity ); } catch (Exception e) { errmsg("oops. error writing to server: "+e.getMessage()); --- 1767,1780 ---- public void dropObj(int tag, int quantity) { + moveObj(0, tag, quantity); + } + + public void moveObj(int destination, int tag) { + moveObj(destination, tag, 0); + } + + public void moveObj(int destination, int tag, int quantity) { try { ! mConnection.writeBytes("move " + destination + " "+ tag + " " + quantity ); } catch (Exception e) { errmsg("oops. error writing to server: "+e.getMessage()); *************** *** 1774,1779 **** } - - /* these two commands are speshul, they take the item number in binary form, * rather than the string representation --- 1782,1785 ---- *************** *** 1805,1813 **** public void pickupObj(int tag, int quantity) { int playertag=allobjects.getPlayerTag(); ! try { ! mConnection.writeBytes("move "+Integer.toString(playertag)+" "+Integer.toString(tag)+" " + quantity); ! } catch (Exception e) { ! errmsg("oops. error writing to server: "+e.getMessage()); ! } } --- 1811,1815 ---- public void pickupObj(int tag, int quantity) { int playertag=allobjects.getPlayerTag(); ! moveObj(playertag, tag, quantity); } Index: InvWin.java =================================================================== RCS file: /cvsroot/jcrossclient/jcrossclient/InvWin.java,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** InvWin.java 15 Apr 2006 17:45:01 -0000 1.14 --- InvWin.java 19 Apr 2006 23:05:27 -0000 1.15 *************** *** 135,138 **** --- 135,139 ---- class InvWin extends Canvas implements MouseListener, ActionListener { PopupMenu item_single, item_plural; + MenuItem PutInmenu; int objpixheight=MapWin.pixheight+8; CFclient toplevel; *************** *** 171,174 **** --- 172,179 ---- item_single.add(newMenuItem("Rename")); this.add(item_single); + /* special menu option for when a container is open */ + PutInmenu = new MenuItem("Put In Container"); + PutInmenu.addActionListener(this); + } *************** *** 219,222 **** --- 224,232 ---- rename_menu.setVisible(true); } + else if (cmd.equals("Put In Container")) { + toplevel.moveObj(toplevel.allobjects.getOpenContainer().getTag(), + last_clicked_object.getTag()); + + } } *************** *** 247,253 **** --- 257,271 ---- if ((buttonmask&InputEvent.BUTTON3_MASK)>0) { if (clickobj.getNumObjs() > 1) { + if (toplevel.allobjects.getOpenContainer() != null) + item_plural.add(PutInmenu); + else + item_plural.remove(PutInmenu); item_plural.show(this.getParent(), evt.getX()-(int)offset.getX(), evt.getY()-(int)offset.getY()); } else { + if (toplevel.allobjects.getOpenContainer() != null) + item_single.add(PutInmenu); + else + item_single.remove(PutInmenu); item_single.show(this.getParent(), evt.getX()-(int)offset.getX(), evt.getY()-(int)offset.getY()); Index: Changelog =================================================================== RCS file: /cvsroot/jcrossclient/jcrossclient/Changelog,v retrieving revision 1.45 retrieving revision 1.46 diff -C2 -d -r1.45 -r1.46 *** Changelog 19 Apr 2006 17:12:37 -0000 1.45 --- Changelog 19 Apr 2006 23:05:27 -0000 1.46 *************** *** 337,338 **** --- 337,344 ---- Metaserver - allow pressing enter in the url box to connect also. + + 20/04/2006 - CFClient - create a MoveObj function to handle item moving + + InvWin - add a 'put in container' menu option when a container is open + + README - update to mention 't' doubling for the quote key |
From: <jcr...@li...> - 2006-04-19 17:12:40
|
Update of /cvsroot/jcrossclient/jcrossclient In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32233 Modified Files: CFclient.java Changelog ContainerWin.java MapWin.java Metaserver.java Log Message: tidy up container and metaserver code, make the 't' key also focus the talk window Index: Changelog =================================================================== RCS file: /cvsroot/jcrossclient/jcrossclient/Changelog,v retrieving revision 1.44 retrieving revision 1.45 diff -C2 -d -r1.44 -r1.45 *** Changelog 19 Apr 2006 12:57:15 -0000 1.44 --- Changelog 19 Apr 2006 17:12:37 -0000 1.45 *************** *** 327,328 **** --- 327,338 ---- CFClient - removal of some metaserver-related code from here. + + Mapwin - remove some needless mouseListener calls + + CFClient - make the 't' key focus the talk window as well as the quote key + + ContainerWin - Remove some useless sizing code + - display the container on the top of the container view + - make clicking on it close the container + + Metaserver - allow pressing enter in the url box to connect also. Index: Metaserver.java =================================================================== RCS file: /cvsroot/jcrossclient/jcrossclient/Metaserver.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Metaserver.java 19 Apr 2006 12:57:15 -0000 1.4 --- Metaserver.java 19 Apr 2006 17:12:37 -0000 1.5 *************** *** 258,261 **** --- 258,262 ---- urlentry.add(new Label("Hostname/IP")); urlbar = new TextField(40); + urlbar.addActionListener(this); urlentry.add(urlbar); connect = new Button("Connect"); Index: CFclient.java =================================================================== RCS file: /cvsroot/jcrossclient/jcrossclient/CFclient.java,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** CFclient.java 19 Apr 2006 12:57:15 -0000 1.37 --- CFclient.java 19 Apr 2006 17:12:37 -0000 1.38 *************** *** 258,268 **** String keytext=evt.getKeyText(keycode); ! ! /* speshul hack here to allow ' to focus the talkwindow */ ! if (keytext.equals("Quote")) { focus_talkwin(); return; } ! // Using the parameter 'key' string that will grab // the correct command string from the params table. --- 258,273 ---- String keytext=evt.getKeyText(keycode); ! ! /* speshul hack here to allow ' to focus the talkwindow ! * There seems to be an issue with some foreign keyboard ! * layouts that the quote key isn't typable without ! * setting some modifiers, we'll use the 't' key as an ! * alternitive for now - this may change eventually ! */ ! if (keytext.equals("Quote") || keytext.equals("T")) { focus_talkwin(); return; } ! // Using the parameter 'key' string that will grab // the correct command string from the params table. Index: ContainerWin.java =================================================================== RCS file: /cvsroot/jcrossclient/jcrossclient/ContainerWin.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ContainerWin.java 19 Apr 2006 12:57:15 -0000 1.1 --- ContainerWin.java 19 Apr 2006 17:12:37 -0000 1.2 *************** *** 30,35 **** Vector ContainerObjects; int invsize=0; - int winwidth=80; // recalc'd every time contents changed - // but lets have a reasonable start! public ContainerWin(CFclient tl, Vector objs) { --- 30,33 ---- *************** *** 85,92 **** public void mouseClicked(MouseEvent evt) { int objpos=evt.getY() / objpixheight; ! if (objpos>=ContainerObjects.size()) return; int buttonmask=evt.getModifiers(); ! CFObject clickobj= (CFObject)ContainerObjects.elementAt(objpos); last_clicked_object = clickobj; Point offset = toplevel.iscrollp.getScrollPosition(); --- 83,95 ---- public void mouseClicked(MouseEvent evt) { int objpos=evt.getY() / objpixheight; ! if (objpos>ContainerObjects.size()) return; + if (objpos == 0) { + /* close the currently open container */ + toplevel.applyObj(toplevel.allobjects.getOpenContainer().getTag()); + return; + } int buttonmask=evt.getModifiers(); ! CFObject clickobj= (CFObject)ContainerObjects.elementAt(objpos-1); last_clicked_object = clickobj; Point offset = toplevel.iscrollp.getScrollPosition(); *************** *** 123,143 **** public void updateDisplay() { synchronized(ContainerObjects) { - int curwidth=0, maxwidth=0; - - int objcount = ContainerObjects.size(); - CFObject item; - String itemname; - Graphics gc = getGraphics(); - FontMetrics fm = gc.getFontMetrics(); - - for (int oc=0; oc<objcount; oc++) { - item=(CFObject)ContainerObjects.elementAt(oc); - itemname=item.getName(); - curwidth=fm.stringWidth(itemname); - - if (curwidth> maxwidth) - maxwidth=curwidth; - } - winwidth=maxwidth+objpixheight+10; repaint(); } --- 126,129 ---- *************** *** 147,161 **** synchronized(ContainerObjects) { int objcount = ContainerObjects.size(); ! CFObject item; ! if (objcount==0) { gc.drawString("(No container open)", 10,10); return; } for (int oc=0; oc<objcount; oc++) { item=(CFObject)ContainerObjects.elementAt(oc); ! int Ypos=objpixheight * oc; int Textpos=Ypos+ (objpixheight>>1) +3; ! Image pixmap = toplevel.getScaledPixmap(item.getFace()); if (pixmap==null) { toplevel.askForFace(item.getFace()); --- 133,155 ---- synchronized(ContainerObjects) { int objcount = ContainerObjects.size(); ! CFObject item, container; ! Image pixmap; ! container = toplevel.allobjects.getOpenContainer(); ! if (container == null) { gc.drawString("(No container open)", 10,10); return; } + pixmap = toplevel.getScaledPixmap(container.getFace()); + gc.drawImage(pixmap, 0, 0, this); + gc.drawString("Items in " + container.getObjName() + " (click to close)", + objpixheight+10, (objpixheight>>1) +3); + gc.drawLine(0, objpixheight, 1000, objpixheight); + for (int oc=0; oc<objcount; oc++) { item=(CFObject)ContainerObjects.elementAt(oc); ! int Ypos=objpixheight * (oc+1); int Textpos=Ypos+ (objpixheight>>1) +3; ! pixmap = toplevel.getScaledPixmap(item.getFace()); if (pixmap==null) { toplevel.askForFace(item.getFace()); Index: MapWin.java =================================================================== RCS file: /cvsroot/jcrossclient/jcrossclient/MapWin.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** MapWin.java 15 Apr 2006 17:45:01 -0000 1.9 --- MapWin.java 19 Apr 2006 17:12:37 -0000 1.10 *************** *** 310,322 **** } - public void keyPressed(KeyEvent evt) { } - - - public void keyReleased(KeyEvent evt) { } - - - public void keyTyped(KeyEvent evt) { } - - public void actionPerformed(ActionEvent evt) { String time = evt.getActionCommand(); --- 310,313 ---- |
From: <jcr...@li...> - 2006-04-19 12:57:24
|
Update of /cvsroot/jcrossclient/jcrossclient In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14626 Modified Files: CFclient.java Changelog Metaserver.java Settings.java TabPanel.java Added Files: ContainerWin.java Log Message: add a URL bar to the metaserver list, actually commit the container window code (mostly) remove some deprecated stuff Index: Settings.java =================================================================== RCS file: /cvsroot/jcrossclient/jcrossclient/Settings.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Settings.java 1 Feb 2006 19:14:29 -0000 1.6 --- Settings.java 19 Apr 2006 12:57:15 -0000 1.7 *************** *** 146,150 **** void saveSettings () { try { ! val.save(new FileOutputStream(rcfilename),"java crossfire rc file"); } catch (IOException e) { --- 146,150 ---- void saveSettings () { try { ! val.store(new FileOutputStream(rcfilename),"java crossfire rc file"); } catch (IOException e) { Index: Changelog =================================================================== RCS file: /cvsroot/jcrossclient/jcrossclient/Changelog,v retrieving revision 1.43 retrieving revision 1.44 diff -C2 -d -r1.43 -r1.44 *** Changelog 15 Apr 2006 17:45:00 -0000 1.43 --- Changelog 19 Apr 2006 12:57:15 -0000 1.44 *************** *** 316,317 **** --- 316,328 ---- CFClient - container support + + 19/04/2006 - ContainerWin - actually commit this file (after having deleted all copies and rewriting it) + + TabPanel - replace some deprecated code + + Settings - replace some deprecated code + + Metaserver - move more of the metaserver logic into this file, + - add a URL bar to allow connecting to arbitrary servers + + CFClient - removal of some metaserver-related code from here. Index: Metaserver.java =================================================================== RCS file: /cvsroot/jcrossclient/jcrossclient/Metaserver.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Metaserver.java 25 Mar 2006 01:25:42 -0000 1.3 --- Metaserver.java 19 Apr 2006 12:57:15 -0000 1.4 *************** *** 102,171 **** } ! ! class Metaserver extends Canvas implements MouseListener, MouseMotionListener { int objpixheight=MapWin.pixheight+8; ! CFclient toplevel; ! Socket metaserver; ! BufferedReader server_data; ! ! Vector Servers; ! int serversize=0; ! public Metaserver(CFclient tl) { ! toplevel = tl; addMouseListener(this); addMouseMotionListener(this); - Servers = new Vector(); - } - - /* open a socket to the metaserver, parse the data recieved, and update the server list */ - public void sync_to_metaserver() { - Servers = new Vector(); /* we need to dump the old data */ - try { - metaserver = new Socket("crossfire.real-time.com", 13326); - server_data = new BufferedReader(new - InputStreamReader(metaserver.getInputStream())); - parse_metaserver(); - metaserver.close(); - } catch(UnknownHostException e) { - debug("can't connect to metaserver"); - return; - } catch (IOException e) { - debug("socket i/o error:"+e.getMessage()); - return; - } - } - - /* read in the data on the socket, and populate the server list */ - void parse_metaserver() throws IOException { - String current_server; - StringTokenizer parser; - ServerData new_server; - while ((current_server = server_data.readLine()) != null) { - new_server = new ServerData(); - try { - parser = new StringTokenizer(current_server, "|"); - new_server.setIP(parser.nextToken()); - new_server.setUpdateTime(parser.nextToken()); - new_server.setHostname(parser.nextToken()); - new_server.setPlayerCount(parser.nextToken()); - new_server.setVersion(parser.nextToken()); - new_server.setComment(parser.nextToken()); - new_server.setBytesIn(parser.nextToken()); - new_server.setBytesOut(parser.nextToken()); - new_server.setUptime(parser.nextToken()); - Servers.add(new_server); - System.out.println("new server " + new_server.hostname + " with " - + new_server.player_count + " players"); - } - catch (NoSuchElementException e) { - /* try and add the server anyway, we might have enough data to be useful */ - Servers.add(new_server); - System.out.println("broken server " + new_server.hostname + " with " - + new_server.player_count + " players"); - } - } - Collections.sort(Servers, new ServerCompare()); - toplevel.showmap("metaserver"); } --- 102,113 ---- } ! class Metaserverlist extends Canvas implements MouseListener, MouseMotionListener { int objpixheight=MapWin.pixheight+8; ! Metaserver mspanel; ! public Metaserverlist(Metaserver ms) { ! mspanel=ms; addMouseListener(this); addMouseMotionListener(this); } *************** *** 190,195 **** void debug(String msg) { ! if(toplevel.debugflag) ! System.out.println(msg); } --- 132,136 ---- void debug(String msg) { ! System.out.println(msg); } *************** *** 204,239 **** int buttonmask=evt.getModifiers(); int serverpos=(evt.getY()) / 30; ! if (serverpos > Servers.size() || serverpos <= 0) { ! toplevel.metadesc.setText( "Right Click to join server, Left Click to view Comment"); return; } ! clicked_server = (ServerData)Servers.elementAt(serverpos-1); if ((buttonmask&InputEvent.BUTTON1_MASK)>0) { ! toplevel.metadesc.setText(clicked_server.comment); } else if ((buttonmask&InputEvent.BUTTON3_MASK)>0) { ! toplevel.showmap(); ! toplevel.initConnection(clicked_server.ip_address, clicked_server.hostname); } } ! public void mouseEntered(MouseEvent evt) { ! } ! public void mouseExited(MouseEvent evt) { ! } ! public void mousePressed(MouseEvent evt) { ! } ! public void mouseReleased(MouseEvent evt) { ! } ! public void mouseDragged(MouseEvent evt) { ! } public void mouseMoved(MouseEvent evt) { ServerData clicked_server = null; int serverpos= (evt.getY())/ 30; ! for (int i=0; i < Servers.size(); i++) ! ((ServerData)Servers.elementAt(i)).set_mouse_over(false); ! if (serverpos <= Servers.size() && serverpos > 0) ! ((ServerData)Servers.elementAt(serverpos-1)).set_mouse_over(true); repaint(); } --- 145,175 ---- int buttonmask=evt.getModifiers(); int serverpos=(evt.getY()) / 30; ! if (serverpos > mspanel.Servers.size() || serverpos <= 0) { ! mspanel.setDescText( "Right Click to join server, Left Click to view Comment"); return; } ! clicked_server = (ServerData)mspanel.Servers.elementAt(serverpos-1); if ((buttonmask&InputEvent.BUTTON1_MASK)>0) { ! mspanel.setDescText(clicked_server.comment); ! mspanel.setURL(clicked_server.ip_address); } else if ((buttonmask&InputEvent.BUTTON3_MASK)>0) { ! mspanel.connectTo(clicked_server.ip_address, clicked_server.hostname); } } ! public void mouseEntered(MouseEvent evt) {} ! public void mouseExited(MouseEvent evt) {} ! public void mousePressed(MouseEvent evt) {} ! public void mouseReleased(MouseEvent evt) {} ! public void mouseDragged(MouseEvent evt) {} public void mouseMoved(MouseEvent evt) { ServerData clicked_server = null; int serverpos= (evt.getY())/ 30; ! for (int i=0; i < mspanel.Servers.size(); i++) ! ((ServerData)mspanel.Servers.elementAt(i)).set_mouse_over(false); ! if (serverpos <= mspanel.Servers.size() && serverpos > 0) ! ((ServerData)mspanel.Servers.elementAt(serverpos-1)).set_mouse_over(true); repaint(); } *************** *** 253,263 **** int playersx=fm.stringWidth("Players"); int y_height; ! if (Servers == null) { gc.drawString("(Metaserver window)", 10,10); return; } else { ! for (int i=0; i < Servers.size(); i++) { ! server = (ServerData)Servers.elementAt(i); if (hostnamex < fm.stringWidth(server.hostname)) hostnamex = fm.stringWidth(server.hostname); --- 189,199 ---- int playersx=fm.stringWidth("Players"); int y_height; ! if (mspanel.Servers == null) { gc.drawString("(Metaserver window)", 10,10); return; } else { ! for (int i=0; i < mspanel.Servers.size(); i++) { ! server = (ServerData)mspanel.Servers.elementAt(i); if (hostnamex < fm.stringWidth(server.hostname)) hostnamex = fm.stringWidth(server.hostname); *************** *** 272,278 **** gc.drawString("Uptime", hostnamex +playersx +versionx +18, 10); gc.drawLine(0, 30,1000, 30); ! for (int i=0; i < Servers.size(); i++) { y_height = 30*(i+1) + 18; ! server = (ServerData)Servers.elementAt(i); if (server.get_mouse_over()) gc.setColor(Color.gray); --- 208,214 ---- gc.drawString("Uptime", hostnamex +playersx +versionx +18, 10); gc.drawLine(0, 30,1000, 30); ! for (int i=0; i < mspanel.Servers.size(); i++) { y_height = 30*(i+1) + 18; ! server = (ServerData)mspanel.Servers.elementAt(i); if (server.get_mouse_over()) gc.setColor(Color.gray); *************** *** 290,291 **** --- 226,344 ---- } + class Metaserver extends Panel implements ActionListener { + Vector Servers; + Socket metaserver; + TextArea metadesc; + Panel urlentry; + Button connect; + TextField urlbar; + Metaserverlist mlist; + ScrollPane mscrollp; + CFclient toplevel; + BufferedReader server_data; + int serversize=0; + + public Metaserver(CFclient tl) { + super(new BorderLayout()); + toplevel = tl; + Servers = new Vector(); + metadesc = new TextArea( + "Right Click to join server, Left Click to view Comment", + 4, 60, TextArea.SCROLLBARS_VERTICAL_ONLY); + metadesc.setEditable(false); + mlist = new Metaserverlist(this); + mscrollp = new ScrollPane(ScrollPane.SCROLLBARS_AS_NEEDED); + /* make the server list occupy ~80% of the map pane, + * the remaining 20% should then go to the description box + */ + mscrollp.setSize(MapWin.pixwidth*MapWin.XMAX, (int)(0.8*MapWin.pixheight*MapWin.YMAX)); + mscrollp.add(mlist); + (mscrollp.getVAdjustable()).setUnitIncrement(10); + urlentry = new Panel(); + urlentry.add(new Label("Hostname/IP")); + urlbar = new TextField(40); + urlentry.add(urlbar); + connect = new Button("Connect"); + connect.addActionListener(this); + urlentry.add(connect); + + /* having defined the metaserver widgets, let's set them up now */ + add(urlentry, BorderLayout.NORTH); + add(mscrollp); + add(metadesc, BorderLayout.SOUTH); + } + + /* open a socket to the metaserver, parse the data recieved, and update the server list */ + public void sync_to_metaserver() { + Servers = new Vector(); /* we need to dump the old data */ + try { + metaserver = new Socket("crossfire.real-time.com", 13326); + server_data = new BufferedReader(new + InputStreamReader(metaserver.getInputStream())); + parse_metaserver(); + metaserver.close(); + } catch(UnknownHostException e) { + debug("can't connect to metaserver"); + return; + } catch (IOException e) { + debug("socket i/o error:"+e.getMessage()); + return; + } + } + + void setDescText(String text) { + metadesc.setText(text); + } + + void setURL(String text) { + urlbar.setText(text); + } + + public void actionPerformed(ActionEvent evt) { + connectTo(urlbar.getText(), urlbar.getText()); + } + + void debug(String msg) { + System.out.println(msg); + } + + /* read in the data on the socket, and populate the server list */ + void parse_metaserver() throws IOException { + String current_server; + StringTokenizer parser; + ServerData new_server; + while ((current_server = server_data.readLine()) != null) { + new_server = new ServerData(); + try { + parser = new StringTokenizer(current_server, "|"); + new_server.setIP(parser.nextToken()); + new_server.setUpdateTime(parser.nextToken()); + new_server.setHostname(parser.nextToken()); + new_server.setPlayerCount(parser.nextToken()); + new_server.setVersion(parser.nextToken()); + new_server.setComment(parser.nextToken()); + new_server.setBytesIn(parser.nextToken()); + new_server.setBytesOut(parser.nextToken()); + new_server.setUptime(parser.nextToken()); + Servers.add(new_server); + System.out.println("new server " + new_server.hostname + " with " + + new_server.player_count + " players"); + } + catch (NoSuchElementException e) { + /* try and add the server anyway, we might have enough data to be useful */ + Servers.add(new_server); + System.out.println("broken server " + new_server.hostname + " with " + + new_server.player_count + " players"); + } + } + Collections.sort(Servers, new ServerCompare()); + toplevel.showmap("metaserver"); + } + + void connectTo(String ipaddress, String hostname) { + toplevel.showmap(); + toplevel.initConnection(ipaddress, hostname); + } + } + + Index: CFclient.java =================================================================== RCS file: /cvsroot/jcrossclient/jcrossclient/CFclient.java,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -d -r1.36 -r1.37 *** CFclient.java 15 Apr 2006 17:45:00 -0000 1.36 --- CFclient.java 19 Apr 2006 12:57:15 -0000 1.37 *************** *** 101,107 **** MagicMap magicmap; Metaserver metaserver; ! public ScrollPane iscrollp, escrollp, sscrollp, spscrollp, mscrollp; ! Panel viewpane, metapanel; ! TextArea metadesc; ServerCon mConnection; --- 101,107 ---- MagicMap magicmap; Metaserver metaserver; ! public ScrollPane iscrollp, escrollp, sscrollp, spscrollp; ! Panel viewpane; ! ServerCon mConnection; *************** *** 1232,1241 **** metaserver = new Metaserver(this); - metapanel = new Panel(new BorderLayout()); - metadesc = new TextArea( - "Right Click to join server, Left Click to view Comment", - 4, 60, TextArea.SCROLLBARS_VERTICAL_ONLY); - metadesc.setEditable(false); - TabPanel leftside = new TabPanel(); Panel topside = new VertPanel(); --- 1232,1235 ---- *************** *** 1249,1253 **** escrollp = new ScrollPane(ScrollPane.SCROLLBARS_ALWAYS); sscrollp = new ScrollPane(ScrollPane.SCROLLBARS_AS_NEEDED); - mscrollp = new ScrollPane(ScrollPane.SCROLLBARS_AS_NEEDED); iscrollp.setSize(290,210); --- 1243,1246 ---- *************** *** 1266,1280 **** (spscrollp.getVAdjustable()).setUnitIncrement(10); - /* make the server list occupy ~80% of the map pane, - * the remaining 20% should then go to the description box - */ - mscrollp.setSize(MapWin.pixwidth*MapWin.XMAX, (int)(0.8*MapWin.pixheight*MapWin.YMAX)); - mscrollp.add(metaserver); - (mscrollp.getVAdjustable()).setUnitIncrement(10); - - /* having defined the metaserver widgets, let's set them up now */ - metapanel.add(mscrollp); - metapanel.add(metadesc, BorderLayout.SOUTH); - sscrollp.add(skillwin); items.add(iscrollp); --- 1259,1262 ---- *************** *** 1287,1291 **** viewpane.add("map", mapwin); viewpane.add("magicmap", magicmap); ! viewpane.add("metaserver", metapanel); viewpane.add("container", containerwin); topside.add(viewpane); --- 1269,1273 ---- viewpane.add("map", mapwin); viewpane.add("magicmap", magicmap); ! viewpane.add("metaserver", metaserver); viewpane.add("container", containerwin); topside.add(viewpane); --- NEW FILE: ContainerWin.java --- /* * Copyright (c) 2006, Brendan Lally, bre...@gm... * * This file is part of jcrossclient. * * Jcrossclient is free software; you can redistribute it and/or modify it under * the terms of the GNU General Public License as published by the Free Software * Foundation; either version 2 of the License, or (at your option) any later version. * * Jcrossclient is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A * PARTICULAR PURPOSE. See the GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along with * Jcrossclient; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ import java.awt.*; import java.util.Vector; import java.awt.event.*; /* handles everything related to displaying containers */ class ContainerWin extends Canvas implements MouseListener, ActionListener { PopupMenu item_single, item_plural; int objpixheight=MapWin.pixheight+8; CFclient toplevel; CFObject last_clicked_object; Vector ContainerObjects; int invsize=0; int winwidth=80; // recalc'd every time contents changed // but lets have a reasonable start! public ContainerWin(CFclient tl, Vector objs) { toplevel = tl; ContainerObjects = objs; addMouseListener(this); /* rather than dynamically constructing these menus, we'll * create two, one for the single item case, one for the stack * of items case. */ item_plural = new PopupMenu(); item_plural.add(newMenuItem("Examine")); item_plural.add(newMenuItem("Use")); item_plural.add(newMenuItem("Drop")); this.add(item_plural); item_single = new PopupMenu(); item_single.add(newMenuItem("Examine")); item_single.add(newMenuItem("Use")); item_single.add(newMenuItem("Drop")); item_single.add(newMenuItem("Pick Up")); this.add(item_single); } MenuItem newMenuItem(String label) { MenuItem mi = new MenuItem(label); mi.addActionListener(this); return mi; } public void actionPerformed(ActionEvent evt) { String cmd = evt.getActionCommand(); debug("got action "+cmd); if (cmd.equals("Examine")) { toplevel.examineObj(last_clicked_object.getTag()); } else if (cmd.equals("Drop")) { toplevel.dropObj(last_clicked_object.getTag()); } else if (cmd.equals("Use")) { toplevel.applyObj(last_clicked_object.getTag()); } else if (cmd.equals("Pick Up")) { toplevel.pickupObj(last_clicked_object.getTag()); updateDisplay(); } } void debug(String msg) { if(toplevel.debugflag) System.out.println(msg); } public void mouseClicked(MouseEvent evt) { int objpos=evt.getY() / objpixheight; if (objpos>=ContainerObjects.size()) return; int buttonmask=evt.getModifiers(); CFObject clickobj= (CFObject)ContainerObjects.elementAt(objpos); last_clicked_object = clickobj; Point offset = toplevel.iscrollp.getScrollPosition(); if ((buttonmask&InputEvent.BUTTON2_MASK)>0 ||evt.isControlDown()) { debug("Applying object "+clickobj.getName()); toplevel.applyObj(clickobj.getTag()); } else if ((buttonmask&InputEvent.BUTTON3_MASK)>0) { if (clickobj.getNumObjs() > 1) { item_plural.show(this.getParent(), evt.getX()-(int)offset.getX(), evt.getY()-(int)offset.getY()); } else { item_single.show(this.getParent(), evt.getX()-(int)offset.getX(), evt.getY()-(int)offset.getY()); } } else // yes, we want this LAST! if ((buttonmask&InputEvent.BUTTON1_MASK)>0) { debug("Examining object "+clickobj.getName()); toplevel.examineObj(clickobj.getTag()); } toplevel.focusGained(null); } public void mouseEntered(MouseEvent evt) { } public void mouseExited(MouseEvent evt) { } public void mousePressed(MouseEvent evt) { } public void mouseReleased(MouseEvent evt) { } public void updateDisplay() { synchronized(ContainerObjects) { int curwidth=0, maxwidth=0; int objcount = ContainerObjects.size(); CFObject item; String itemname; Graphics gc = getGraphics(); FontMetrics fm = gc.getFontMetrics(); for (int oc=0; oc<objcount; oc++) { item=(CFObject)ContainerObjects.elementAt(oc); itemname=item.getName(); curwidth=fm.stringWidth(itemname); if (curwidth> maxwidth) maxwidth=curwidth; } winwidth=maxwidth+objpixheight+10; repaint(); } } public void paint(Graphics gc) { synchronized(ContainerObjects) { int objcount = ContainerObjects.size(); CFObject item; if (objcount==0) { gc.drawString("(No container open)", 10,10); return; } for (int oc=0; oc<objcount; oc++) { item=(CFObject)ContainerObjects.elementAt(oc); int Ypos=objpixheight * oc; int Textpos=Ypos+ (objpixheight>>1) +3; Image pixmap = toplevel.getScaledPixmap(item.getFace()); if (pixmap==null) { toplevel.askForFace(item.getFace()); pixmap=toplevel.getPixmap(0); } gc.drawImage(pixmap, 0,Ypos, this); gc.drawString(item.getFlaggedName(), objpixheight+10, Textpos); } } } } Index: TabPanel.java =================================================================== RCS file: /cvsroot/jcrossclient/jcrossclient/TabPanel.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** TabPanel.java 23 Jan 2006 19:36:08 -0000 1.1 --- TabPanel.java 19 Apr 2006 12:57:15 -0000 1.2 *************** *** 220,225 **** /** Computes tab geometry while laying out the panels components.*/ ! public void layout() { ! super.layout(); computeTabs(); } // make sure tabs are computed. --- 220,225 ---- /** Computes tab geometry while laying out the panels components.*/ ! public void doLayout() { ! super.doLayout(); computeTabs(); } // make sure tabs are computed. |
From: <jcr...@li...> - 2006-04-15 17:45:11
|
Update of /cvsroot/jcrossclient/jcrossclient In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29338 Modified Files: CFObjectStore.java CFclient.java Changelog InvWin.java MapWin.java Log Message: Initial support for a container view Index: Changelog =================================================================== RCS file: /cvsroot/jcrossclient/jcrossclient/Changelog,v retrieving revision 1.42 retrieving revision 1.43 diff -C2 -d -r1.42 -r1.43 *** Changelog 25 Mar 2006 01:25:42 -0000 1.42 --- Changelog 15 Apr 2006 17:45:00 -0000 1.43 *************** *** 304,305 **** --- 304,317 ---- Metaserver - display text of the server the mouse is currently over in a different colour + + 15/04/2006 - InvWin - Remove special case code for items in containers + + Mapwin - update the container view in the map thread + + ContainerWin - new file, handles viewing containers' contents + + CFObjectStore - track the currently open container. + - place items in containers into a special container vector + - add appropriate deletion/updating and inserting code for containers + + CFClient - container support Index: InvWin.java =================================================================== RCS file: /cvsroot/jcrossclient/jcrossclient/InvWin.java,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** InvWin.java 19 Feb 2006 23:33:49 -0000 1.13 --- InvWin.java 15 Apr 2006 17:45:01 -0000 1.14 *************** *** 337,352 **** //for(int oc=objcount-1; oc>=0; oc--) for (int oc=0; oc<objcount; oc++) { - int inbag_offset=0; - CFObject item = (CFObject)PlayerInventory.elementAt(oc); int Ypos=objpixheight * oc; int Textpos=Ypos+ (objpixheight>>1) +3; - if ((item.getLocation() != playertag) && - (item.getTag() != playertag)) { - inbag_offset=15; - gc.drawString("=>", 0, Textpos); - } - Image face = toplevel.getPixmap(item.getFace()); if (face==null) { --- 337,344 ---- *************** *** 354,359 **** face=toplevel.getPixmap(0); } ! gc.drawImage(face, inbag_offset,Ypos, this); ! gc.drawString(item.getFlaggedName(), objpixheight+10+inbag_offset, Textpos); } --- 346,351 ---- face=toplevel.getPixmap(0); } ! gc.drawImage(face, 0, Ypos, this); ! gc.drawString(item.getFlaggedName(), objpixheight+10, Textpos); } Index: CFclient.java =================================================================== RCS file: /cvsroot/jcrossclient/jcrossclient/CFclient.java,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** CFclient.java 25 Mar 2006 00:49:15 -0000 1.35 --- CFclient.java 15 Apr 2006 17:45:00 -0000 1.36 *************** *** 96,99 **** --- 96,100 ---- MapWin mapwin; ExamineWin examinewin; + ContainerWin containerwin; TalkWin talkwin; StatbarWin miscwin; *************** *** 328,332 **** cl.show(viewpane, panel); } ! /* Okay, this is somewhat ugly. We register ourselves as the * focus Listener for the mapwin, and other windows, --- 329,342 ---- cl.show(viewpane, panel); } ! ! /* figures out which object is open, and closes it, then sets focus back to ! * the map window. It does not reset the view, this will be done when the ! * appropriate upditem packet is recieved */ ! public void closeContainer() { ! applyObj(allobjects.getOpenContainer().getTag()); ! allobjects.setOpenContainer(null); ! focusGained(null); ! } ! /* Okay, this is somewhat ugly. We register ourselves as the * focus Listener for the mapwin, and other windows, *************** *** 591,594 **** --- 601,607 ---- } + /* if the item is sent to us in an open state, we need to mark it as the container */ + static final int F_OPEN =0x2000; + // add possibly multiple objects, to a single "location" // "location" can be either the floor, the player, or some object. *************** *** 655,661 **** debug("ItemCmd: added object "+tag+", location "+loc+", name "+name+" flags "+flags); ! // need to update, even if location is BAG that ! // player is holding. I suppose. sigh. ! // loc==0, means on floor } } --- 668,672 ---- debug("ItemCmd: added object "+tag+", location "+loc+", name "+name+" flags "+flags); ! if ((flags & F_OPEN) > 0) allobjects.setOpenContainer(newobj); } } *************** *** 669,672 **** --- 680,684 ---- static char UPD_ANIMSPEED =0x40; static char UPD_NROF =0x80; + // delete item(s), no matter where they are located *************** *** 700,703 **** --- 712,725 ---- val = itemdata.readInt(); valpos += 4; + /* if the object has been newly opened, show its contents */ + if (((thisobj.getFlags() & F_OPEN) == 0) && ((val & F_OPEN) > 0)) { + allobjects.setOpenContainer(thisobj); + showmap("container"); + } + /* if the object has been newly closed, show the map */ + if (((thisobj.getFlags() & F_OPEN) > 0) && ((val & F_OPEN) == 0)) { + allobjects.setOpenContainer(thisobj); + showmap(); + } thisobj.setFlags(val); should_update = true; *************** *** 1204,1207 **** --- 1226,1230 ---- mapwin = new MapWin(this); examinewin = new ExamineWin(this, allobjects.getObjsOnFloor()); + containerwin = new ContainerWin(this, allobjects.getContainerObjects()); talkwin = new TalkWin(this); miscwin = new StatbarWin(this); *************** *** 1265,1268 **** --- 1288,1292 ---- viewpane.add("magicmap", magicmap); viewpane.add("metaserver", metapanel); + viewpane.add("container", containerwin); topside.add(viewpane); topside.add(miscwin); *************** *** 1814,1817 **** --- 1838,1846 ---- floorchanged=true; } + + boolean containerchanged=false; + public void updateContainer() { + containerchanged=true; + } // called by MapUpdater thread, in MapWin *************** *** 1823,1826 **** --- 1852,1863 ---- } } + + // called by MapUpdater thread, in MapWin + public void drawContainer() { + if(containerchanged==true) { + containerchanged=false; + containerwin.updateDisplay(); + } + } public void lookat(int dx, int dy) { Index: MapWin.java =================================================================== RCS file: /cvsroot/jcrossclient/jcrossclient/MapWin.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** MapWin.java 1 Feb 2006 19:14:29 -0000 1.8 --- MapWin.java 15 Apr 2006 17:45:01 -0000 1.9 *************** *** 72,75 **** --- 72,76 ---- } toplevel.drawFloor(); + toplevel.drawContainer(); try { Thread.sleep(sleepms); Index: CFObjectStore.java =================================================================== RCS file: /cvsroot/jcrossclient/jcrossclient/CFObjectStore.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** CFObjectStore.java 1 Feb 2006 19:14:29 -0000 1.4 --- CFObjectStore.java 15 Apr 2006 17:45:00 -0000 1.5 *************** *** 48,51 **** --- 48,53 ---- Vector objs_on_floor; // cache Vector PlayerInv; // cache + Vector ContainerObjects; + CFObject OpenContainer; /* the currently open container */ Hashtable AllObjects; *************** *** 73,76 **** --- 75,86 ---- } + CFObject getOpenContainer() { + return OpenContainer; + } + + void setOpenContainer(CFObject container) { + OpenContainer = container; + } + // Maybe we should cache THIS, as well as the floor thing. // dunno. sigh. *************** *** 97,105 **** deleteObjOnFloor(oldobj); toplevel.updateFloor(); ! } ! else { // probably should recurse or something? maybe not. deleteObjInInv(oldobj); toplevel.updateInventory(); } } --- 107,117 ---- deleteObjOnFloor(oldobj); toplevel.updateFloor(); ! } else if (oldobj.getLocation() == PlayerTag) { // probably should recurse or something? maybe not. deleteObjInInv(oldobj); toplevel.updateInventory(); + } else { + deleteObjInCon(oldobj); + toplevel.updateContainer(); } } *************** *** 147,168 **** if(oldloc==0) toplevel.updateFloor(); ! else toplevel.updateInventory(); ! return; } // else... if(oldloc==0) { deleteObjOnFloor(oldobj); ! } ! else { ! if(oldloc >0) { ! deleteObjInInv(oldobj); ! } } if(newloc==0) { objs_on_floor.addElement(newobj); ! } else { PlayerInv.addElement(newobj); Collections.sort(PlayerInv, new CFObjcompare()); } if(oldloc==0 || newloc ==0) --- 159,182 ---- if(oldloc==0) toplevel.updateFloor(); ! else { toplevel.updateInventory(); ! toplevel.updateContainer(); ! } return; } // else... if(oldloc==0) { deleteObjOnFloor(oldobj); ! } else if(oldloc ==PlayerTag) { ! deleteObjInInv(oldobj); ! } else { ! deleteObjInCon(oldobj); } if(newloc==0) { objs_on_floor.addElement(newobj); ! } else if(newloc==PlayerTag) { PlayerInv.addElement(newobj); Collections.sort(PlayerInv, new CFObjcompare()); + } else { + ContainerObjects.addElement(newobj); } if(oldloc==0 || newloc ==0) *************** *** 170,173 **** --- 184,188 ---- if(oldloc>0 || newloc > 0) toplevel.updateInventory(); + toplevel.updateContainer(); } *************** *** 184,202 **** } ! // return Ennumeration of objects carried by the object objtag ! // note: this means DIRECTLY carried. ! // It does not recurse into bags, for example ! public Vector getCarriedBy(int objtag) { ! Vector carried=new Vector(); ! Enumeration objs = AllObjects.elements(); ! CFObject tmpobj; ! while(objs.hasMoreElements()) { ! tmpobj= (CFObject)objs.nextElement(); ! ! if(tmpobj.getLocation() == objtag) { ! carried.addElement(tmpobj); ! } ! } ! return carried; } --- 199,204 ---- } ! public Vector getContainerObjects() { ! return ContainerObjects; } *************** *** 215,218 **** --- 217,226 ---- } } + public void deleteObjInCon(CFObject obj) { + synchronized (objs_on_floor) { + ContainerObjects.removeElement(obj); + } + } + // This is called a lot, so it deserves a special-case // Note that we do NOT trigger a floor update, because *************** *** 248,260 **** debug("delete: trying to delete obj "+tag); ! if(location==0) { ! deleteObjOnFloor(oldobj); ! } ! else { ! deleteObjInInv(oldobj); ! } AllObjects.remove(new Integer(tag)); } ! toplevel.updateInventory(); } --- 256,264 ---- debug("delete: trying to delete obj "+tag); ! deleteObjInCon(oldobj); AllObjects.remove(new Integer(tag)); } ! ContainerObjects.removeAllElements(); ! toplevel.updateContainer(); } *************** *** 265,268 **** --- 269,273 ---- objs_on_floor = new Vector(); PlayerInv = new Vector(); + ContainerObjects = new Vector(); toplevel = top; } |
From: <jcr...@li...> - 2006-03-25 01:25:46
|
Update of /cvsroot/jcrossclient/jcrossclient In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5789 Modified Files: Changelog Metaserver.java Log Message: highlight the server the mouse is currently over Index: Metaserver.java =================================================================== RCS file: /cvsroot/jcrossclient/jcrossclient/Metaserver.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Metaserver.java 24 Mar 2006 16:29:55 -0000 1.2 --- Metaserver.java 25 Mar 2006 01:25:42 -0000 1.3 *************** *** 48,51 **** --- 48,52 ---- int bytes_out; int uptime; + boolean mouse_over; public ServerData() { *************** *** 92,99 **** uptime = Integer.parseInt(time); } } ! class Metaserver extends Canvas implements MouseListener { int objpixheight=MapWin.pixheight+8; CFclient toplevel; --- 93,107 ---- uptime = Integer.parseInt(time); } + + boolean get_mouse_over() { + return mouse_over; + } + void set_mouse_over(boolean state) { + mouse_over = state; + } } ! class Metaserver extends Canvas implements MouseListener, MouseMotionListener { int objpixheight=MapWin.pixheight+8; CFclient toplevel; *************** *** 107,110 **** --- 115,119 ---- toplevel = tl; addMouseListener(this); + addMouseMotionListener(this); Servers = new Vector(); } *************** *** 218,221 **** --- 227,245 ---- public void mouseReleased(MouseEvent evt) { } + public void mouseDragged(MouseEvent evt) { + } + public void mouseMoved(MouseEvent evt) { + ServerData clicked_server = null; + int serverpos= (evt.getY())/ 30; + for (int i=0; i < Servers.size(); i++) + ((ServerData)Servers.elementAt(i)).set_mouse_over(false); + if (serverpos <= Servers.size() && serverpos > 0) + ((ServerData)Servers.elementAt(serverpos-1)).set_mouse_over(true); + repaint(); + } + + public void update(Graphics gc) { + paint(gc); + } /* We draw each line of metaserver data 30 pixels apart, *************** *** 251,254 **** --- 275,280 ---- y_height = 30*(i+1) + 18; server = (ServerData)Servers.elementAt(i); + if (server.get_mouse_over()) + gc.setColor(Color.gray); gc.drawString(server.hostname, 3, y_height); gc.drawString(server.version, hostnamex +9, y_height); *************** *** 257,260 **** --- 283,287 ---- gc.drawString(convert_uptime(server.uptime), hostnamex +versionx +playersx+21, y_height); + gc.setColor(Color.black); gc.drawLine(0, 30*(i+2)-1,1000, 30*(i+2)-1); } Index: Changelog =================================================================== RCS file: /cvsroot/jcrossclient/jcrossclient/Changelog,v retrieving revision 1.41 retrieving revision 1.42 diff -C2 -d -r1.41 -r1.42 *** Changelog 25 Mar 2006 00:49:15 -0000 1.41 --- Changelog 25 Mar 2006 01:25:42 -0000 1.42 *************** *** 302,303 **** --- 302,305 ---- StatWin - Make the player's name a button, which brings up a dialog to set title when pressed. + + Metaserver - display text of the server the mouse is currently over in a different colour |
From: <jcr...@li...> - 2006-03-25 00:49:29
|
Update of /cvsroot/jcrossclient/jcrossclient In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17142 Modified Files: CFclient.java Changelog StatWin.java Log Message: add a change title dialog to the stats window Index: CFclient.java =================================================================== RCS file: /cvsroot/jcrossclient/jcrossclient/CFclient.java,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** CFclient.java 24 Mar 2006 16:29:50 -0000 1.34 --- CFclient.java 25 Mar 2006 00:49:15 -0000 1.35 *************** *** 1197,1201 **** void addWindows(Container parent) { ! statwin = new StatWin(playerstats); skillwin = new SkillWin(this); invwin = new InvWin(this, allobjects.getPlayerInv()); --- 1197,1201 ---- void addWindows(Container parent) { ! statwin = new StatWin(this, playerstats); skillwin = new SkillWin(this); invwin = new InvWin(this, allobjects.getPlayerInv()); Index: StatWin.java =================================================================== RCS file: /cvsroot/jcrossclient/jcrossclient/StatWin.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** StatWin.java 24 Mar 2006 16:29:55 -0000 1.6 --- StatWin.java 25 Mar 2006 00:49:15 -0000 1.7 *************** *** 19,26 **** import java.awt.*; ! class StatWin extends TextArea ! { PlayerStats playerstats; static public void errmsg(String str) { --- 19,82 ---- import java.awt.*; + import java.awt.event.*; ! class SetTitle extends Dialog implements ActionListener { ! TextField newname; ! CFclient Parent; ! ! public void actionPerformed(ActionEvent evt) { ! String cmd = evt.getActionCommand(); ! if(cmd.equals("Set") ||evt.getSource().equals(newname)) { ! setVisible(false); ! Parent.send_command("title " + get_newtitle()); ! return; ! } ! else if (cmd.equals("Cancel")) { ! setVisible(false); ! return; ! } ! } ! ! public String get_newtitle() { ! return newname.getText(); ! } ! ! public SetTitle(CFclient parent, PlayerStats playerstats) { ! super(parent); ! Parent = parent; ! ! setTitle(new String("Set Title")); ! ! add(new Label("How do you wish to be addressed?"), "North"); ! newname=new TextField(40); ! newname.addActionListener(this); ! add(newname); ! /* make the initial text be the current title, defined as the ! * bit after the first space after player: */ ! newname.setText(playerstats.playerTitle.substring( ! playerstats.playerTitle.indexOf(' ', 8))); ! ! Button set, cancel; ! ! set=new Button("Set"); ! cancel =new Button("Cancel"); ! Panel buttonholder=new Panel(); ! buttonholder.setLayout(new FlowLayout()); ! set.addActionListener(this); ! cancel.addActionListener(this); ! buttonholder.add(set); ! buttonholder.add(cancel); ! add(buttonholder, "South"); ! } ! } ! ! ! class StatWin extends Panel implements ActionListener { PlayerStats playerstats; + TextArea MainArea; + ScrollPane scrollpane; + Button namebutton; + CFclient toplevel; + SetTitle set_title; static public void errmsg(String str) { *************** *** 30,36 **** /* redraw the stats box */ public void updateStats() { StringBuffer newtext = new StringBuffer(); - - newtext.append(playerstats.playerTitle+"\n"); newtext.append("Exp: "+playerstats.exp+" Level: "+playerstats.level+"\n"); newtext.append("Hp: "+playerstats.hp+"/"+playerstats.maxhp+"\n"); --- 86,91 ---- /* redraw the stats box */ public void updateStats() { + namebutton.setLabel(playerstats.playerTitle); StringBuffer newtext = new StringBuffer(); newtext.append("Exp: "+playerstats.exp+" Level: "+playerstats.level+"\n"); newtext.append("Hp: "+playerstats.hp+"/"+playerstats.maxhp+"\n"); *************** *** 62,77 **** newtext.append(playerstats.attunements_display(-2)); } ! setText(newtext.toString()); } ! public StatWin(PlayerStats pl) { ! // evil, evil! But no other way. sigh. ! super("", 0, 0, SCROLLBARS_VERTICAL_ONLY); playerstats = pl; ! setEditable(false); ! setRows(7); ! setColumns(30); updateStats(); --- 117,146 ---- newtext.append(playerstats.attunements_display(-2)); } ! MainArea.setText(newtext.toString()); } ! public void actionPerformed(ActionEvent evt) { ! set_title=new SetTitle(toplevel, playerstats); ! set_title.pack(); ! set_title.setVisible(true); ! } ! ! public StatWin(CFclient tl, PlayerStats pl) { ! ! super(new BorderLayout()); ! MainArea = new TextArea("", 0, 0, TextArea.SCROLLBARS_NONE); ! namebutton = new Button(); ! namebutton.addActionListener(this); ! scrollpane = new ScrollPane(ScrollPane.SCROLLBARS_AS_NEEDED); ! scrollpane.add(MainArea); ! this.add(namebutton, "North"); ! this.add(scrollpane); playerstats = pl; + toplevel = tl; ! MainArea.setEditable(false); ! MainArea.setRows(7); ! MainArea.setColumns(30); updateStats(); Index: Changelog =================================================================== RCS file: /cvsroot/jcrossclient/jcrossclient/Changelog,v retrieving revision 1.40 retrieving revision 1.41 diff -C2 -d -r1.40 -r1.41 *** Changelog 24 Mar 2006 16:29:54 -0000 1.40 --- Changelog 25 Mar 2006 00:49:15 -0000 1.41 *************** *** 298,299 **** --- 298,303 ---- - paint the server list + 25/03/2006 - CFclient - pass the CFclient object to StatWin + + StatWin - Make the player's name a button, which brings up + a dialog to set title when pressed. |
From: <jcr...@li...> - 2006-03-24 16:30:04
|
Update of /cvsroot/jcrossclient/jcrossclient In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8945 Modified Files: CFclient.java Changelog Metaserver.java StatWin.java Log Message: implement metaserver interface Index: Metaserver.java =================================================================== RCS file: /cvsroot/jcrossclient/jcrossclient/Metaserver.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Metaserver.java 22 Mar 2006 23:55:30 -0000 1.1 --- Metaserver.java 24 Mar 2006 16:29:55 -0000 1.2 *************** *** 25,28 **** --- 25,40 ---- import java.util.*; + /* small class to allow servers to be sorted by version */ + class ServerCompare implements java.util.Comparator { + public int compare(Object o1, Object o2) { + int version; + ServerData s1 = (ServerData)o1; + ServerData s2 = (ServerData)o2; + version = s2.version.compareTo(s1.version); + if (version !=0) return version; + else return s2.uptime-s1.uptime; + } + } + class ServerData { String ip_address; *************** *** 83,87 **** ! class Metaserver extends Canvas implements MouseListener, ActionListener { int objpixheight=MapWin.pixheight+8; CFclient toplevel; --- 95,99 ---- ! class Metaserver extends Canvas implements MouseListener { int objpixheight=MapWin.pixheight+8; CFclient toplevel; *************** *** 91,96 **** Vector Servers; int serversize=0; - int winwidth=80; // recalc'd every time contents changed - // but lets have a reasonable start! public Metaserver(CFclient tl) { --- 103,106 ---- *************** *** 98,106 **** addMouseListener(this); Servers = new Vector(); - sync_to_metaserver(); } /* open a socket to the metaserver, parse the data recieved, and update the server list */ ! void sync_to_metaserver() { try { metaserver = new Socket("crossfire.real-time.com", 13326); --- 108,116 ---- addMouseListener(this); Servers = new Vector(); } /* open a socket to the metaserver, parse the data recieved, and update the server list */ ! public void sync_to_metaserver() { ! Servers = new Vector(); /* we need to dump the old data */ try { metaserver = new Socket("crossfire.real-time.com", 13326); *************** *** 135,152 **** new_server.setBytesIn(parser.nextToken()); new_server.setBytesOut(parser.nextToken()); Servers.add(new_server); ! System.out.println("new server " + new_server.hostname + " with " + new_server.player_count + " players"); } catch (NoSuchElementException e) { /* try and add the server anyway, we might have enough data to be useful */ Servers.add(new_server); ! System.out.println("broken server " + new_server.hostname + " with " + new_server.player_count + " players"); } } } ! public void actionPerformed(ActionEvent evt) { ! } --- 145,181 ---- new_server.setBytesIn(parser.nextToken()); new_server.setBytesOut(parser.nextToken()); + new_server.setUptime(parser.nextToken()); Servers.add(new_server); ! System.out.println("new server " + new_server.hostname + " with " ! + new_server.player_count + " players"); } catch (NoSuchElementException e) { /* try and add the server anyway, we might have enough data to be useful */ Servers.add(new_server); ! System.out.println("broken server " + new_server.hostname + " with " ! + new_server.player_count + " players"); } } + Collections.sort(Servers, new ServerCompare()); + toplevel.showmap("metaserver"); } + /* Takes a time in seconds, and turns it into the string representation of that time */ + String convert_uptime(int time) { + StringBuffer returntime; + int days, hours, minutes; ! days = time/(60*60*24); ! hours = time/(60*60)%24; ! minutes = time/(60)%60; ! if (days+hours+minutes <=1) return "unknown"; ! returntime= new StringBuffer(); ! if (days >1) returntime.append(days + " days "); ! else if (days == 1) returntime.append(days + " day "); ! if (hours > 1) returntime.append(hours + " hours "); ! else if (hours == 1) returntime.append(hours + " hour "); ! if (minutes > 1) returntime.append(minutes + " minutes"); ! else if (minutes == 0) returntime.append(minutes + "minute"); ! return returntime.toString(); } *************** *** 163,167 **** public void mouseClicked(MouseEvent evt) { ! } --- 192,211 ---- public void mouseClicked(MouseEvent evt) { ! ServerData clicked_server; ! int buttonmask=evt.getModifiers(); ! int serverpos=(evt.getY()) / 30; ! if (serverpos > Servers.size() || serverpos <= 0) { ! toplevel.metadesc.setText( ! "Right Click to join server, Left Click to view Comment"); ! return; ! } ! clicked_server = (ServerData)Servers.elementAt(serverpos-1); ! if ((buttonmask&InputEvent.BUTTON1_MASK)>0) { ! toplevel.metadesc.setText(clicked_server.comment); ! } ! else if ((buttonmask&InputEvent.BUTTON3_MASK)>0) { ! toplevel.showmap(); ! toplevel.initConnection(clicked_server.ip_address, clicked_server.hostname); ! } } *************** *** 175,183 **** } ! public void paint(Graphics gc) { ! gc.drawString("(Metaserver window)", 10,10); ! return; } ! } --- 219,264 ---- } ! /* We draw each line of metaserver data 30 pixels apart, ! * using the same spacing convention as the inventory windows ! */ public void paint(Graphics gc) { ! ServerData server; ! FontMetrics fm = gc.getFontMetrics(); ! int hostnamex=fm.stringWidth("Server"); ! int versionx=fm.stringWidth("Version"); ! int playersx=fm.stringWidth("Players"); ! int y_height; ! if (Servers == null) { ! gc.drawString("(Metaserver window)", 10,10); ! return; ! } ! else { ! for (int i=0; i < Servers.size(); i++) { ! server = (ServerData)Servers.elementAt(i); ! if (hostnamex < fm.stringWidth(server.hostname)) ! hostnamex = fm.stringWidth(server.hostname); ! if (versionx < fm.stringWidth(server.version)) ! versionx = fm.stringWidth(server.version); ! if (playersx < fm.stringWidth(""+server.player_count)) ! playersx = fm.stringWidth(""+server.player_count); ! } ! gc.drawString("Server", 0, 10); ! gc.drawString("Version", hostnamex +6, 10); ! gc.drawString("Players", hostnamex +versionx +12, 10); ! gc.drawString("Uptime", hostnamex +playersx +versionx +18, 10); ! gc.drawLine(0, 30,1000, 30); ! for (int i=0; i < Servers.size(); i++) { ! y_height = 30*(i+1) + 18; ! server = (ServerData)Servers.elementAt(i); ! gc.drawString(server.hostname, 3, y_height); ! gc.drawString(server.version, hostnamex +9, y_height); ! gc.drawString("" + server.player_count, ! hostnamex +versionx +15, y_height); ! gc.drawString(convert_uptime(server.uptime), ! hostnamex +versionx +playersx+21, y_height); ! gc.drawLine(0, 30*(i+2)-1,1000, 30*(i+2)-1); ! } ! } } ! } Index: CFclient.java =================================================================== RCS file: /cvsroot/jcrossclient/jcrossclient/CFclient.java,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** CFclient.java 22 Mar 2006 23:55:30 -0000 1.33 --- CFclient.java 24 Mar 2006 16:29:50 -0000 1.34 *************** *** 66,119 **** } - // popup to ask user what server he'd like to connect to. - // usually only called if we have a problem connecting to default - class ServerDialog extends Dialog implements ActionListener { - TextField servername; - CFclient Parent; - - public void actionPerformed(ActionEvent evt) { - String cmd = evt.getActionCommand(); - if(cmd.equals("Connect to server") ||evt.getSource().equals(servername)) { - setVisible(false); - Parent.initConnection(getServerName()); - return; - } - } - - public String getServerName() { - // perhaps might filter out carriage-returns? - return servername.getText(); - } - - public ServerDialog(CFclient parent) { - super(parent); // Dialog(Frame) call. - - Parent = parent; - - // I dont believe in model dialogs - setModal(false); - setTitle(new String("Server Connect")); - - add(new Label("What server should we connect to?"), "North"); - servername=new TextField(40); - servername.addActionListener(this); - add(servername); - Button connect, quit; - - connect=new Button("Connect to server"); - quit=new Button("Quit"); - Panel buttonholder=new Panel(); - buttonholder.setLayout(new FlowLayout()); - connect.addActionListener(this); - quit.addActionListener(Parent); - buttonholder.add(connect); - buttonholder.add(quit); - - add(buttonholder, "South"); - - // have parent call pack(); - } - } - class CFclient extends Frame implements KeyListener, ActionListener, ComponentListener, FocusListener { --- 66,69 ---- *************** *** 150,157 **** MagicMap magicmap; Metaserver metaserver; ! public ScrollPane iscrollp, escrollp, sscrollp, spscrollp; ! Panel viewpane; - ServerDialog chooseserver; ServerCon mConnection; --- 100,107 ---- MagicMap magicmap; Metaserver metaserver; ! public ScrollPane iscrollp, escrollp, sscrollp, spscrollp, mscrollp; ! Panel viewpane, metapanel; ! TextArea metadesc; ServerCon mConnection; *************** *** 520,525 **** /*When the server read thread detects * connection no longer valid, it should ! * automatically put up a new ServerDialog, ! * and stop itself */ } --- 470,474 ---- /*When the server read thread detects * connection no longer valid, it should ! * automatically display the metaserver data. */ } *************** *** 1034,1038 **** err.getMessage()+"\n"); err.printStackTrace(); ! askForServername(); Thread.currentThread().stop(); } --- 983,987 ---- err.getMessage()+"\n"); err.printStackTrace(); ! metaserver.sync_to_metaserver(); Thread.currentThread().stop(); } *************** *** 1259,1263 **** magicmap = new MagicMap(this); metaserver = new Metaserver(this); ! TabPanel leftside = new TabPanel(); Panel topside = new VertPanel(); --- 1208,1218 ---- magicmap = new MagicMap(this); metaserver = new Metaserver(this); ! ! metapanel = new Panel(new BorderLayout()); ! metadesc = new TextArea( ! "Right Click to join server, Left Click to view Comment", ! 4, 60, TextArea.SCROLLBARS_VERTICAL_ONLY); ! metadesc.setEditable(false); ! TabPanel leftside = new TabPanel(); Panel topside = new VertPanel(); *************** *** 1271,1274 **** --- 1226,1230 ---- escrollp = new ScrollPane(ScrollPane.SCROLLBARS_ALWAYS); sscrollp = new ScrollPane(ScrollPane.SCROLLBARS_AS_NEEDED); + mscrollp = new ScrollPane(ScrollPane.SCROLLBARS_AS_NEEDED); iscrollp.setSize(290,210); *************** *** 1286,1289 **** --- 1242,1256 ---- spscrollp.add(spellwin); (spscrollp.getVAdjustable()).setUnitIncrement(10); + + /* make the server list occupy ~80% of the map pane, + * the remaining 20% should then go to the description box + */ + mscrollp.setSize(MapWin.pixwidth*MapWin.XMAX, (int)(0.8*MapWin.pixheight*MapWin.YMAX)); + mscrollp.add(metaserver); + (mscrollp.getVAdjustable()).setUnitIncrement(10); + + /* having defined the metaserver widgets, let's set them up now */ + metapanel.add(mscrollp); + metapanel.add(metadesc, BorderLayout.SOUTH); sscrollp.add(skillwin); *************** *** 1297,1301 **** viewpane.add("map", mapwin); viewpane.add("magicmap", magicmap); ! viewpane.add("metaserver", metaserver); topside.add(viewpane); topside.add(miscwin); --- 1264,1268 ---- viewpane.add("map", mapwin); viewpane.add("magicmap", magicmap); ! viewpane.add("metaserver", metapanel); topside.add(viewpane); topside.add(miscwin); *************** *** 1553,1566 **** } - // This will be called EITHer if we cannot make initial connection, - // OR, if current connection breaks. - public void askForServername() { - if(chooseserver==null) { - chooseserver=new ServerDialog(this); - chooseserver.pack(); - } - chooseserver.setVisible(true); - } - // Random stuff that needs to be set up at end of things. // like Thread timings --- 1520,1523 ---- *************** *** 1593,1610 **** // To avoid nasty thread loops, This should be called ONLY FROM ! // either CFclient.CFclient(), or ! // CFclient.actionPerformed(). [aka ServerDialog callback] ! void initConnection(String serv) { if(loopcheck != null) { loopcheck.stop(); } ! debug("Connecting to "+serv+"..."); ! setTitle("Crossfire@"+serv); mConnection = new ServerCon(this, serv); if(mConnection.isBroke()) { ! debug("Sigh... cannot make connection to "+serv); ! talkwin.addDisplayLine("ERROR: cannot connect to server "+serv+"\n"); ! askForServername(); return; } --- 1550,1567 ---- // To avoid nasty thread loops, This should be called ONLY FROM ! // either CFclient.CFclient(), or the metaserver panel. ! void initConnection(String serv, String name) { if(loopcheck != null) { loopcheck.stop(); } ! debug("Connecting to "+name+"..."); ! setTitle("Crossfire - "+name); mConnection = new ServerCon(this, serv); if(mConnection.isBroke()) { ! debug("Sigh... cannot make connection to "+name); ! talkwin.addDisplayLine("ERROR: cannot connect to server "+name+"\n"); ! /* contact the metaserver, to get a new list of servers to choose from */ ! metaserver.sync_to_metaserver(); return; } *************** *** 1618,1621 **** --- 1575,1583 ---- loopcheck.start(); } + + /* if we aren't connecting via the metaserver, we'll use the ip_address as the name instead */ + void initConnection(String serv) { + initConnection(serv, serv); + } boolean doneBlank=false; Index: StatWin.java =================================================================== RCS file: /cvsroot/jcrossclient/jcrossclient/StatWin.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** StatWin.java 26 Jan 2006 14:53:48 -0000 1.5 --- StatWin.java 24 Mar 2006 16:29:55 -0000 1.6 *************** *** 67,71 **** public StatWin(PlayerStats pl) { // evil, evil! But no other way. sigh. ! super("", 0, 0, SCROLLBARS_NONE); playerstats = pl; --- 67,71 ---- public StatWin(PlayerStats pl) { // evil, evil! But no other way. sigh. ! super("", 0, 0, SCROLLBARS_VERTICAL_ONLY); playerstats = pl; Index: Changelog =================================================================== RCS file: /cvsroot/jcrossclient/jcrossclient/Changelog,v retrieving revision 1.39 retrieving revision 1.40 diff -C2 -d -r1.39 -r1.40 *** Changelog 22 Mar 2006 23:55:30 -0000 1.39 --- Changelog 24 Mar 2006 16:29:54 -0000 1.40 *************** *** 286,287 **** --- 286,299 ---- CFclient - Add a metaserver pane to the main window. + + 24/02/2006 - StatWin - Use Scrollbars where appropriate for the stat window + + CFClient - Remove server dialog + - Add metaserver panel to the layout + - remove askForServername() replace with metaserver.sync_to_metaserver + + Metaserver - Sort servers by version and uptime + - parse uptime and convert into a readable string + - monitor mouse click events to show comment or connect to server + - paint the server list + |
From: <jcr...@li...> - 2006-03-22 23:55:34
|
Update of /cvsroot/jcrossclient/jcrossclient In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28556 Modified Files: CFclient.java Changelog ServerCon.java Added Files: Metaserver.java Log Message: initial metaserver support Index: ServerCon.java =================================================================== RCS file: /cvsroot/jcrossclient/jcrossclient/ServerCon.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** ServerCon.java 1 Feb 2006 19:14:29 -0000 1.4 --- ServerCon.java 22 Mar 2006 23:55:30 -0000 1.5 *************** *** 200,214 **** } ! public ServerCon(CFclient parent, String hostname) { ! //InputStream infromserv; tmpbuf = new byte[2]; // timesaver try{ mParent = parent; ! myconn = new Socket(hostname, 13327); ! //infromserv = myconn.getInputStream(); ! //fromserver = new BufferedInputStream(infromserv, 16384); mInStream = new DataInputStream(myconn.getInputStream()); - //toserver = new DataOutputStream(myconn.getOutputStream()); mBAOS = new ByteArrayOutputStream(0); mDOS = new DataOutputStream(mBAOS); --- 200,210 ---- } ! public ServerCon(CFclient parent, String hostname, int port) { tmpbuf = new byte[2]; // timesaver try{ mParent = parent; ! myconn = new Socket(hostname, port); mInStream = new DataInputStream(myconn.getInputStream()); mBAOS = new ByteArrayOutputStream(0); mDOS = new DataOutputStream(mBAOS); *************** *** 230,232 **** --- 226,232 ---- debug("GOT CONNECTION(I hope)"); } + + public ServerCon(CFclient parent, String hostname) { + this(parent, hostname, 13327); + } } --- NEW FILE: Metaserver.java --- /* * Copyright (c) 2006, Brendan Lally, bre...@gm... * * This file is part of jcrossclient. * * Jcrossclient is free software; you can redistribute it and/or modify it under * the terms of the GNU General Public License as published by the Free Software * Foundation; either version 2 of the License, or (at your option) any later version. * * Jcrossclient is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A * PARTICULAR PURPOSE. See the GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along with * Jcrossclient; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ import java.awt.*; import java.util.Vector; import java.awt.event.*; import java.net.*; import java.io.*; import java.lang.Integer; import java.util.*; class ServerData { String ip_address; int update_time; String hostname; int port; int player_count; String version; String comment; int bytes_in; int bytes_out; int uptime; public ServerData() { } void setIP(String ip) { ip_address = ip; } void setUpdateTime(String time) { update_time = Integer.parseInt(time); } /* If we have a hostname containing a colon, treat the bit after * the colon as a port number */ void setHostname(String host) { StringTokenizer parsehost = new StringTokenizer(host, ":"); hostname = parsehost.nextToken(); if (parsehost.hasMoreTokens()) port = Integer.parseInt(parsehost.nextToken()); } void setPlayerCount(String count) { player_count = Integer.parseInt(count); } void setVersion(String ver) { version = ver; } void setComment(String comm) { comment = comm; } void setBytesIn(String in_bytes) { bytes_in = Integer.parseInt(in_bytes); } void setBytesOut(String out_bytes) { bytes_in = Integer.parseInt(out_bytes); } void setUptime(String time) { uptime = Integer.parseInt(time); } } class Metaserver extends Canvas implements MouseListener, ActionListener { int objpixheight=MapWin.pixheight+8; CFclient toplevel; Socket metaserver; BufferedReader server_data; Vector Servers; int serversize=0; int winwidth=80; // recalc'd every time contents changed // but lets have a reasonable start! public Metaserver(CFclient tl) { toplevel = tl; addMouseListener(this); Servers = new Vector(); sync_to_metaserver(); } /* open a socket to the metaserver, parse the data recieved, and update the server list */ void sync_to_metaserver() { try { metaserver = new Socket("crossfire.real-time.com", 13326); server_data = new BufferedReader(new InputStreamReader(metaserver.getInputStream())); parse_metaserver(); metaserver.close(); } catch(UnknownHostException e) { debug("can't connect to metaserver"); return; } catch (IOException e) { debug("socket i/o error:"+e.getMessage()); return; } } /* read in the data on the socket, and populate the server list */ void parse_metaserver() throws IOException { String current_server; StringTokenizer parser; ServerData new_server; while ((current_server = server_data.readLine()) != null) { new_server = new ServerData(); try { parser = new StringTokenizer(current_server, "|"); new_server.setIP(parser.nextToken()); new_server.setUpdateTime(parser.nextToken()); new_server.setHostname(parser.nextToken()); new_server.setPlayerCount(parser.nextToken()); new_server.setVersion(parser.nextToken()); new_server.setComment(parser.nextToken()); new_server.setBytesIn(parser.nextToken()); new_server.setBytesOut(parser.nextToken()); Servers.add(new_server); System.out.println("new server " + new_server.hostname + " with " + new_server.player_count + " players"); } catch (NoSuchElementException e) { /* try and add the server anyway, we might have enough data to be useful */ Servers.add(new_server); System.out.println("broken server " + new_server.hostname + " with " + new_server.player_count + " players"); } } } public void actionPerformed(ActionEvent evt) { } void debug(String msg) { if(toplevel.debugflag) System.out.println(msg); } /* * It sucks that we have to register for ALL THESE * just to listen for mouse clicks. Sigh. * Dont forget to match up with the paint() order */ public void mouseClicked(MouseEvent evt) { } public void mouseEntered(MouseEvent evt) { } public void mouseExited(MouseEvent evt) { } public void mousePressed(MouseEvent evt) { } public void mouseReleased(MouseEvent evt) { } public void paint(Graphics gc) { gc.drawString("(Metaserver window)", 10,10); return; } } Index: CFclient.java =================================================================== RCS file: /cvsroot/jcrossclient/jcrossclient/CFclient.java,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** CFclient.java 12 Feb 2006 20:52:12 -0000 1.32 --- CFclient.java 22 Mar 2006 23:55:30 -0000 1.33 *************** *** 148,152 **** TalkWin talkwin; StatbarWin miscwin; ! MagicMap magicmap; public ScrollPane iscrollp, escrollp, sscrollp, spscrollp; Panel viewpane; --- 148,153 ---- TalkWin talkwin; StatbarWin miscwin; ! MagicMap magicmap; ! Metaserver metaserver; public ScrollPane iscrollp, escrollp, sscrollp, spscrollp; Panel viewpane; *************** *** 1257,1260 **** --- 1258,1262 ---- miscwin = new StatbarWin(this); magicmap = new MagicMap(this); + metaserver = new Metaserver(this); TabPanel leftside = new TabPanel(); *************** *** 1295,1298 **** --- 1297,1301 ---- viewpane.add("map", mapwin); viewpane.add("magicmap", magicmap); + viewpane.add("metaserver", metaserver); topside.add(viewpane); topside.add(miscwin); Index: Changelog =================================================================== RCS file: /cvsroot/jcrossclient/jcrossclient/Changelog,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -d -r1.38 -r1.39 *** Changelog 20 Feb 2006 18:54:36 -0000 1.38 --- Changelog 22 Mar 2006 23:55:30 -0000 1.39 *************** *** 279,280 **** --- 279,287 ---- 20/02/2006 - Spell - Don't break if passed a zero as the skill number in an addspell packet + + 22/02/2006 - Metaserver - if there is no defined server to connect to, query the + metaserver at startup and parse its output for later use. + + ServerCon - Allow connections to non-standard ports + + CFclient - Add a metaserver pane to the main window. |
From: <jcr...@li...> - 2006-02-20 18:54:46
|
Update of /cvsroot/jcrossclient/jcrossclient In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7736 Modified Files: Changelog Spell.java Log Message: deal properly with the case where zero is sent as a spell number in an addspell packet Index: Spell.java =================================================================== RCS file: /cvsroot/jcrossclient/jcrossclient/Spell.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Spell.java 1 Feb 2006 19:14:29 -0000 1.4 --- Spell.java 20 Feb 2006 18:54:36 -0000 1.5 *************** *** 42,46 **** public String print() { StringBuffer retval = new StringBuffer(); ! retval.append(name + "\nA level " + level + " " + skill.getName() +" spell"); if (path > 0) retval.append(" with path " + stats.get_path_name(path)); retval.append(" \nCosts "); --- 42,46 ---- public String print() { StringBuffer retval = new StringBuffer(); ! retval.append(name + "\nA level " + level + " " + ((skill==null)?"generic":skill.getName()) +" spell"); if (path > 0) retval.append(" with path " + stats.get_path_name(path)); retval.append(" \nCosts "); Index: Changelog =================================================================== RCS file: /cvsroot/jcrossclient/jcrossclient/Changelog,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** Changelog 19 Feb 2006 23:33:49 -0000 1.37 --- Changelog 20 Feb 2006 18:54:36 -0000 1.38 *************** *** 277,278 **** --- 277,280 ---- ExamineWin - ditto. + + 20/02/2006 - Spell - Don't break if passed a zero as the skill number in an addspell packet |
From: <jcr...@li...> - 2006-02-19 23:33:56
|
Update of /cvsroot/jcrossclient/jcrossclient In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11133 Modified Files: Changelog ExamineWin.java InvWin.java Log Message: create two seperate item context menus for single and multiple item stacks Index: ExamineWin.java =================================================================== RCS file: /cvsroot/jcrossclient/jcrossclient/ExamineWin.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** ExamineWin.java 1 Feb 2006 19:14:29 -0000 1.8 --- ExamineWin.java 19 Feb 2006 23:33:49 -0000 1.9 *************** *** 79,83 **** class ExamineWin extends Canvas implements MouseListener, ActionListener { CFclient toplevel; // need this for pixmap handling; ! PopupMenu ritem; Picksome pickupsome; --- 79,83 ---- class ExamineWin extends Canvas implements MouseListener, ActionListener { CFclient toplevel; // need this for pixmap handling; ! PopupMenu item_single, item_plural; Picksome pickupsome; *************** *** 93,102 **** groundobjs = floorobjs; addMouseListener(this); ! ritem = new PopupMenu(); ! ritem.add(newMenuItem("Examine")); ! ritem.add(newMenuItem("Use")); ! ritem.add(newMenuItem("Pick Up")); ! ritem.add(newMenuItem("Pick Up Some")); ! this.add(ritem); } --- 93,111 ---- groundobjs = floorobjs; addMouseListener(this); ! ! /* rather than dynamically constructing these menus, we'll ! * create two, one for the single item case, one for the stack ! * of items case. */ ! item_plural = new PopupMenu(); ! item_plural.add(newMenuItem("Examine")); ! item_plural.add(newMenuItem("Use")); ! item_plural.add(newMenuItem("Pick Up All")); ! item_plural.add(newMenuItem("Pick Up Some")); ! this.add(item_plural); ! item_single = new PopupMenu(); ! item_single.add(newMenuItem("Examine")); ! item_single.add(newMenuItem("Use")); ! item_single.add(newMenuItem("Pick Up")); ! this.add(item_single); } *************** *** 132,136 **** } else if ((buttonmask&InputEvent.BUTTON3_MASK)>0) { ! ritem.show( this.getParent(), evt.getX()-(int)offset.getX(), evt.getY()-(int)offset.getY()); } else // yes, we want this LAST! if ((buttonmask&InputEvent.BUTTON1_MASK)>0) { --- 141,151 ---- } else if ((buttonmask&InputEvent.BUTTON3_MASK)>0) { ! if (clickobj.getNumObjs() > 1) { ! item_plural.show(this.getParent(), ! evt.getX()-(int)offset.getX(), evt.getY()-(int)offset.getY()); ! } else { ! item_single.show(this.getParent(), ! evt.getX()-(int)offset.getX(), evt.getY()-(int)offset.getY()); ! } } else // yes, we want this LAST! if ((buttonmask&InputEvent.BUTTON1_MASK)>0) { *************** *** 147,151 **** toplevel.examineObj(last_clicked_object.getTag()); } ! else if (cmd.equals("Pick Up")) { toplevel.pickupObj(last_clicked_object.getTag()); updateDisplay(); --- 162,166 ---- toplevel.examineObj(last_clicked_object.getTag()); } ! else if (cmd.equals("Pick Up") || cmd.equals("Pick Up All")) { toplevel.pickupObj(last_clicked_object.getTag()); updateDisplay(); Index: InvWin.java =================================================================== RCS file: /cvsroot/jcrossclient/jcrossclient/InvWin.java,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** InvWin.java 1 Feb 2006 19:14:29 -0000 1.12 --- InvWin.java 19 Feb 2006 23:33:49 -0000 1.13 *************** *** 134,138 **** // displays, AND HOLDS actual inventory of player class InvWin extends Canvas implements MouseListener, ActionListener { ! PopupMenu ritem; int objpixheight=MapWin.pixheight+8; CFclient toplevel; --- 134,138 ---- // displays, AND HOLDS actual inventory of player class InvWin extends Canvas implements MouseListener, ActionListener { ! PopupMenu item_single, item_plural; int objpixheight=MapWin.pixheight+8; CFclient toplevel; *************** *** 150,162 **** PlayerInventory = objs; addMouseListener(this); ! ritem = new PopupMenu(); ! ritem.add(newMenuItem("Examine")); ! ritem.add(newMenuItem("Use")); ! ritem.add(newMenuItem("Drop")); ! ritem.add(newMenuItem("Drop Some")); ! ritem.add(newMenuItem("Lock")); ! ritem.add(newMenuItem("Mark")); ! ritem.add(newMenuItem("Rename")); ! this.add(ritem); } --- 150,174 ---- PlayerInventory = objs; addMouseListener(this); ! ! /* rather than dynamically constructing these menus, we'll ! * create two, one for the single item case, one for the stack ! * of items case. */ ! item_plural = new PopupMenu(); ! item_plural.add(newMenuItem("Examine")); ! item_plural.add(newMenuItem("Use")); ! item_plural.add(newMenuItem("Drop All")); ! item_plural.add(newMenuItem("Drop Some")); ! item_plural.add(newMenuItem("Lock")); ! item_plural.add(newMenuItem("Mark")); ! item_plural.add(newMenuItem("Rename")); ! this.add(item_plural); ! item_single = new PopupMenu(); ! item_single.add(newMenuItem("Examine")); ! item_single.add(newMenuItem("Use")); ! item_single.add(newMenuItem("Drop")); ! item_single.add(newMenuItem("Lock")); ! item_single.add(newMenuItem("Mark")); ! item_single.add(newMenuItem("Rename")); ! this.add(item_single); } *************** *** 173,177 **** toplevel.examineObj(last_clicked_object.getTag()); } ! else if (cmd.equals("Drop")) { if (last_clicked_object.isLocked()) { toplevel.talkwin.addDisplayLine("This object is locked.\n"); --- 185,189 ---- toplevel.examineObj(last_clicked_object.getTag()); } ! else if (cmd.equals("Drop") || cmd.equals("Drop All")) { if (last_clicked_object.isLocked()) { toplevel.talkwin.addDisplayLine("This object is locked.\n"); *************** *** 234,238 **** } else if ((buttonmask&InputEvent.BUTTON3_MASK)>0) { ! ritem.show(this.getParent(), evt.getX()-(int)offset.getX(), evt.getY()-(int)offset.getY()); } else // yes, we want this LAST! if ((buttonmask&InputEvent.BUTTON1_MASK)>0) { --- 246,256 ---- } else if ((buttonmask&InputEvent.BUTTON3_MASK)>0) { ! if (clickobj.getNumObjs() > 1) { ! item_plural.show(this.getParent(), ! evt.getX()-(int)offset.getX(), evt.getY()-(int)offset.getY()); ! } else { ! item_single.show(this.getParent(), ! evt.getX()-(int)offset.getX(), evt.getY()-(int)offset.getY()); ! } } else // yes, we want this LAST! if ((buttonmask&InputEvent.BUTTON1_MASK)>0) { Index: Changelog =================================================================== RCS file: /cvsroot/jcrossclient/jcrossclient/Changelog,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -d -r1.36 -r1.37 *** Changelog 12 Feb 2006 20:52:12 -0000 1.36 --- Changelog 19 Feb 2006 23:33:49 -0000 1.37 *************** *** 3,6 **** --- 3,7 ---- # Unlike with the server changelog, the most recent entry is last + 09/11/2005 - Mapwin/CFclient/Examinewin - scale images in examine view. 09/11/2005 - CFClient - implement the reccomendations of *************** *** 269,274 **** 01/02/2006 - everything - ran pmd on the code, fixed most of what it found, also some misc cleanups. ! 02/12/2006 - build.xml - told javac to warn about deprecations CFclient - added first stab at an actions menu TalkWin - added setAction public method, which is used by some actions menu entries ! \ No newline at end of file --- 270,278 ---- 01/02/2006 - everything - ran pmd on the code, fixed most of what it found, also some misc cleanups. ! 12/02/2006 - build.xml - told javac to warn about deprecations CFclient - added first stab at an actions menu TalkWin - added setAction public method, which is used by some actions menu entries ! ! 19/02/2006 - InvWin - create two menus for handling items, one for single items, one for multiple items ! ! ExamineWin - ditto. |
From: <jcr...@li...> - 2006-02-12 20:52:19
|
Update of /cvsroot/jcrossclient/jcrossclient In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17185 Modified Files: CFclient.java Changelog TalkWin.java build.xml Log Message: Added beginnings of an actions menu, which I hope will eventually contain most in-game actions turned on javac deprecations warnings in build file Index: TalkWin.java =================================================================== RCS file: /cvsroot/jcrossclient/jcrossclient/TalkWin.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** TalkWin.java 1 Feb 2006 19:14:29 -0000 1.6 --- TalkWin.java 12 Feb 2006 20:52:12 -0000 1.7 *************** *** 253,256 **** --- 253,264 ---- } + /* used if some other object wants to set the text in the input box */ + + public void setAction(String str){ + input.setText(str + " "); + input.setCaretPosition(str.length() + 1); + + } + public TalkWin(CFclient parent) { Parent = parent; Index: build.xml =================================================================== RCS file: /cvsroot/jcrossclient/jcrossclient/build.xml,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** build.xml 14 Jan 2006 16:41:07 -0000 1.4 --- build.xml 12 Feb 2006 20:52:12 -0000 1.5 *************** *** 16,20 **** <!-- Compile the java code from ${src} into ${src} --> <javac srcdir="${src}" destdir="${src}" ! classpath=".:${javapng}" source="1.4" target="1.4" debug="true"/> </target> --- 16,21 ---- <!-- Compile the java code from ${src} into ${src} --> <javac srcdir="${src}" destdir="${src}" ! classpath=".:${javapng}" source="1.4" target="1.4" ! deprecation="true" debug="true"/> </target> Index: CFclient.java =================================================================== RCS file: /cvsroot/jcrossclient/jcrossclient/CFclient.java,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** CFclient.java 1 Feb 2006 19:14:29 -0000 1.31 --- CFclient.java 12 Feb 2006 20:52:12 -0000 1.32 *************** *** 9,32 **** import com.sixlegs.png.*; /* I'd like to remove this last import eventually, but the javax libraries cause ! * exceptions, the javax equivilents are commented out in various places. */ /* ! * Copyright (c) 1997, Phil Brown, ph...@bo... ! * Copyright (c) 2005, Brendan Lally, bre...@gm... ! * ! * This file is part of jcrossclient. ! * [...2433 lines suppressed...] } ! // only print these messages if in debug mode void debug(String str) { ! if ( debugflag ) System.out.println(str); } // ALWAYS print, whether debug or not void print(String str) { ! System.out.println(str); } ! static void errmsg(String str) { // IS there ever a reason why we dont want error messages? // if(params.getBoolean("errmsg")) { ! System.err.println(str); // } } ! public static void main(String args[]) { CFclient me = new CFclient(args); Index: Changelog =================================================================== RCS file: /cvsroot/jcrossclient/jcrossclient/Changelog,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** Changelog 1 Feb 2006 19:14:29 -0000 1.35 --- Changelog 12 Feb 2006 20:52:12 -0000 1.36 *************** *** 267,269 **** InvWin - tidy up item locking, and make it actually work. ! 01/02/2006 - everything - ran pmd on the code, fixed most of what it found, also some misc cleanups. \ No newline at end of file --- 267,274 ---- InvWin - tidy up item locking, and make it actually work. ! 01/02/2006 - everything - ran pmd on the code, fixed most of what it found, also some misc cleanups. ! ! 02/12/2006 - build.xml - told javac to warn about deprecations ! CFclient - added first stab at an actions menu ! TalkWin - added setAction public method, which is used by some actions menu entries ! \ No newline at end of file |
From: <jcr...@li...> - 2006-02-01 19:14:38
|
Update of /cvsroot/jcrossclient/jcrossclient In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3735 Modified Files: CFObject.java CFObjectStore.java CFclient.java Changelog ExamineWin.java InvWin.java MapWin.java PlayerStats.java ServerCon.java Settings.java Spell.java SpellWin.java StatbarWin.java TalkWin.java Log Message: ran pmd on code and fixed many minor things as a result Index: ServerCon.java =================================================================== RCS file: /cvsroot/jcrossclient/jcrossclient/ServerCon.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** ServerCon.java 30 Nov 2005 17:13:26 -0000 1.3 --- ServerCon.java 1 Feb 2006 19:14:29 -0000 1.4 *************** *** 25,40 **** ! class ServerCon ! { ! CFclient mParent = null; ! Socket myconn; ! DataInputStream mInStream; ! DataOutputStream mOutStream; ! DataOutputStream mDOS; ByteArrayOutputStream mBAOS; ! byte last_command_sent; ! byte last_command_recieved; ! int response_time; ! boolean bad = false; byte[] tmpbuf; // timesaver --- 25,39 ---- ! class ServerCon { ! CFclient mParent = null; ! Socket myconn; ! DataInputStream mInStream; ! DataOutputStream mOutStream; ! DataOutputStream mDOS; ByteArrayOutputStream mBAOS; ! byte last_command_sent; ! byte last_command_recieved; ! int response_time; ! boolean bad = false; byte[] tmpbuf; // timesaver *************** *** 45,50 **** static boolean debugflag=false; ! static void debug(String str) ! { if(debugflag) System.out.println(str); --- 44,48 ---- static boolean debugflag=false; ! static void debug(String str) { if(debugflag) System.out.println(str); *************** *** 54,59 **** // connection "with extreme prejudice", // instead of just deleting the class ! public void disconnect() ! { try { mOutStream.close(); --- 52,56 ---- // connection "with extreme prejudice", // instead of just deleting the class ! public void disconnect() { try { mOutStream.close(); *************** *** 64,69 **** } ! public synchronized boolean dataWaiting() throws IOException ! { return (mInStream.available() > 0) ? true : false; } --- 61,65 ---- } ! public synchronized boolean dataWaiting() throws IOException { return (mInStream.available() > 0) ? true : false; } *************** *** 71,93 **** public boolean isBroke(){ return bad;} - // nasty experimental throwaway read - public synchronized byte[] rawread(int count) throws IOException - { - debug("HACK: raw-reading "+count+" bytes"); - byte tmpbuf[] = new byte[count]; - int bytesread = 0, offset=0; - - //mInStream.readFully(tmpbuf, offset, count); - - return tmpbuf; - } - // This isn't actually a LINE, but a logical unit in // the datastream. A crossfire 'packet' if you will. ! public synchronized void readLine() throws IOException ! { ! int data_read=0, offset=0; int i, j, datalen; - int available = mInStream.available(); String cmdstr = ""; --- 67,74 ---- public boolean isBroke(){ return bad;} // This isn't actually a LINE, but a logical unit in // the datastream. A crossfire 'packet' if you will. ! public synchronized void readLine() throws IOException { int i, j, datalen; String cmdstr = ""; *************** *** 128,133 **** // Also assume simple ASCII, so 'UTF' should be fine. I hope. // The server does NOT actually expect UTF encoding ! public synchronized void writeLine(String str) throws IOException ! { //toserver.writeUTF(str); //toserver.flush(); --- 109,113 ---- // Also assume simple ASCII, so 'UTF' should be fine. I hope. // The server does NOT actually expect UTF encoding ! public synchronized void writeLine(String str) throws IOException { //toserver.writeUTF(str); //toserver.flush(); *************** *** 141,168 **** // Also, only looks at lower-eight-bit value of string chars. // Should be identical for OUR purposes ! public synchronized void writeBytes(String data) throws IOException ! { debug("Writing data: "+data); int arraylen=data.length(); - - /*byte len_def[] = new byte[2]; - len_def[0] = (byte)((arraylen>>8) &0xFF); - len_def[1] = (byte)((arraylen) &0xFF);*/ - mDOS.writeShort((short) arraylen); mDOS.writeBytes(data); mBAOS.writeTo(mOutStream); - - //mOutStream.writeShort((short) arraylen); - //mOutStream.writeBytes(data); mOutStream.flush(); mBAOS.reset(); - - /*toserver.write(len_def, 0, 2); - toserver.writeBytes(data); - toserver.flush();*/ } --- 121,135 ---- // Also, only looks at lower-eight-bit value of string chars. // Should be identical for OUR purposes ! public synchronized void writeBytes(String data) throws IOException { debug("Writing data: "+data); int arraylen=data.length(); mDOS.writeShort((short) arraylen); mDOS.writeBytes(data); mBAOS.writeTo(mOutStream); mOutStream.flush(); mBAOS.reset(); } *************** *** 251,288 **** response_time = 0; ! } catch(UnknownHostException e) ! { debug("cant find host "+hostname); // should really exit here or something bad=true; return; ! } catch (IOException e) ! { debug("socket i/o error:"+e.getMessage()); bad=true; return; } - debug("GOT CONNECTION(I hope)"); - } - - /*public static int TwoByteConv(String str, int start) - { - int val; - val=(int)str.charAt(start) <<8; - val+=(int)str.charAt(start+1); - - return val; - } - public static int FourByteConv(String str, int start) - { - int val; - val =(int)str.charAt(start) <<24; - val+=(int)str.charAt(start+1) <<16; - val+=(int)str.charAt(start+2) <<8; - val+=(int)str.charAt(start+3); - - return val; - }*/ } --- 218,232 ---- response_time = 0; ! } catch(UnknownHostException e) { debug("cant find host "+hostname); // should really exit here or something bad=true; return; ! } catch (IOException e) { debug("socket i/o error:"+e.getMessage()); bad=true; return; } debug("GOT CONNECTION(I hope)"); } } Index: Spell.java =================================================================== RCS file: /cvsroot/jcrossclient/jcrossclient/Spell.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Spell.java 24 Jan 2006 18:56:31 -0000 1.3 --- Spell.java 1 Feb 2006 19:14:29 -0000 1.4 *************** *** 18,24 **** */ - - import java.lang.String; - public class Spell { int tag, level, time, mana, grace, damage, path, face; --- 18,21 ---- Index: Settings.java =================================================================== RCS file: /cvsroot/jcrossclient/jcrossclient/Settings.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Settings.java 25 Jan 2006 01:35:40 -0000 1.5 --- Settings.java 1 Feb 2006 19:14:29 -0000 1.6 *************** *** 187,191 **** public void reload (String buf) { - StringReader input = new StringReader(buf); StringBufferInputStream bais = new StringBufferInputStream(buf); try { val.load(bais); } catch(IOException err) { } --- 187,190 ---- Index: Changelog =================================================================== RCS file: /cvsroot/jcrossclient/jcrossclient/Changelog,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** Changelog 31 Jan 2006 00:28:49 -0000 1.34 --- Changelog 1 Feb 2006 19:14:29 -0000 1.35 *************** *** 267,268 **** --- 267,269 ---- InvWin - tidy up item locking, and make it actually work. + 01/02/2006 - everything - ran pmd on the code, fixed most of what it found, also some misc cleanups. \ No newline at end of file Index: InvWin.java =================================================================== RCS file: /cvsroot/jcrossclient/jcrossclient/InvWin.java,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** InvWin.java 31 Jan 2006 00:28:49 -0000 1.11 --- InvWin.java 1 Feb 2006 19:14:29 -0000 1.12 *************** *** 19,25 **** import java.awt.*; - import java.util.Hashtable; import java.util.Vector; - import java.util.Enumeration; import java.awt.event.*; --- 19,23 ---- *************** *** 246,250 **** public void mouseEntered(MouseEvent evt) { - return; } public void mouseExited(MouseEvent evt) { --- 244,247 ---- Index: StatbarWin.java =================================================================== RCS file: /cvsroot/jcrossclient/jcrossclient/StatbarWin.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** StatbarWin.java 25 Jan 2006 01:35:40 -0000 1.3 --- StatbarWin.java 1 Feb 2006 19:14:29 -0000 1.4 *************** *** 23,28 **** import java.awt.event.*; ! class StatbarWin extends Canvas implements ComponentListener ! { PlayerStats playerstats; --- 23,27 ---- import java.awt.event.*; ! class StatbarWin extends Canvas implements ComponentListener { PlayerStats playerstats; *************** *** 59,70 **** } ! public void componentMoved(ComponentEvent evt) { ! } ! public void componentHidden(ComponentEvent evt) { ! } public void componentShown(ComponentEvent evt) { // cheat... ! if(barheight==0) ! { debug("cheating to init statbar"); componentResized(evt); --- 58,66 ---- } ! public void componentMoved(ComponentEvent evt) {} ! public void componentHidden(ComponentEvent evt) {} public void componentShown(ComponentEvent evt) { // cheat... ! if(barheight==0) { debug("cheating to init statbar"); componentResized(evt); *************** *** 85,106 **** void errmsg(String str) { System.out.println(str); } ! public void setFireFlag(boolean flag) ! { fire_on=flag; drawFlagInfo(getGraphics()); } ! public void setRunFlag(boolean flag) ! { run_on=flag; drawFlagInfo(getGraphics()); } ! public void setLoadingFlag(boolean flag) ! { loading_pixmaps=flag; drawFlagInfo(getGraphics()); } // draw special status things that are either "on" or "off" ! void drawFlagInfo(Graphics gc) ! { // This would probably be better done by using "Label" // classes, and using Label.setText() --- 81,98 ---- void errmsg(String str) { System.out.println(str); } ! public void setFireFlag(boolean flag) { fire_on=flag; drawFlagInfo(getGraphics()); } ! public void setRunFlag(boolean flag) { run_on=flag; drawFlagInfo(getGraphics()); } ! public void setLoadingFlag(boolean flag) { loading_pixmaps=flag; drawFlagInfo(getGraphics()); } // draw special status things that are either "on" or "off" ! void drawFlagInfo(Graphics gc) { // This would probably be better done by using "Label" // classes, and using Label.setText() *************** *** 127,132 **** } ! void setStats () ! { hp = playerstats.hp; maxhp = playerstats.maxhp; --- 119,123 ---- } ! void setStats () { hp = playerstats.hp; maxhp = playerstats.maxhp; *************** *** 141,152 **** CFclient Parent; ! public StatbarWin(CFclient parent) ! { Parent = parent; addComponentListener(this); - int fontsize = parent.params.iget("fontsize"); - // note: this is INITIAL sizing. we'll dynamically // scale if we are resized. I hope. --- 132,140 ---- CFclient Parent; ! public StatbarWin(CFclient parent) { Parent = parent; addComponentListener(this); // note: this is INITIAL sizing. we'll dynamically // scale if we are resized. I hope. *************** *** 155,177 **** barxspace = parent.params.iget("StatbarWin.barSpace"); - // Now, adjust bar parameters based on our font (we've - // normalized everything to a 14pt font). - // - // Nah. This translation isnt too good, lets just let - // the user do it if they really want to change fonts - // barheight *= (fontsize/14.0); - // barwidth *= (fontsize/14.0); - // barxspace *= (fontsize/14.0); - setForeground(Color.black); - playerstats=parent.playerstats; setStats(); - } // called by CFclient, when stats are updated by server ! public void updateStats() ! { setStats(); fillBars(getGraphics()); --- 143,153 ---- barxspace = parent.params.iget("StatbarWin.barSpace"); setForeground(Color.black); playerstats=parent.playerstats; setStats(); } // called by CFclient, when stats are updated by server ! public void updateStats() { setStats(); fillBars(getGraphics()); *************** *** 182,190 **** // starting x,y pos are for the upper lefthand corner of BAR. // We, however, will draw AROUND that bar. ! void drawBarBox(Graphics gc, int minx, int miny) ! { ! int maxx = minx+barwidth; ! int maxy = miny+barheight; ! Color defcolor = gc.getColor(); --- 158,162 ---- // starting x,y pos are for the upper lefthand corner of BAR. // We, however, will draw AROUND that bar. ! void drawBarBox(Graphics gc, int minx, int miny) { Color defcolor = gc.getColor(); *************** *** 196,206 **** gc.drawRect(minx-2, miny-2, barwidth+2, barheight+2); - // return to default color, whatever that might be - /* - // Brian, this is an alternative. See if you like it - gc.setColor(Color.lightGray); - gc.draw3DRect(minx-1, miny-1, barwidth+2, barheight+2,false); - */ - gc.setColor(defcolor); --- 168,171 ---- *************** *** 209,214 **** // "full"-ness // This needs to mesh with drawStatBars() ! void fillBars(Graphics gc) ! { int xpos; --- 174,178 ---- // "full"-ness // This needs to mesh with drawStatBars() ! void fillBars(Graphics gc) { int xpos; *************** *** 236,251 **** void fillBar(Graphics gc, int x, int val, int maxval) { - int minx = x; int miny = ybaroffset; int maxy = barheight+ybaroffset; - - int yheight; - if(maxval==0) - yheight=0; - else - yheight= (val *barheight)/maxval; gc.clearRect(minx,miny,barwidth,barheight-yheight); --- 200,210 ---- void fillBar(Graphics gc, int x, int val, int maxval) { int minx = x; int miny = ybaroffset; int maxy = barheight+ybaroffset; int yheight; + if(maxval==0) yheight=0; + else yheight= (val *barheight)/maxval; gc.clearRect(minx,miny,barwidth,barheight-yheight); *************** *** 259,278 **** gc.setColor(Color.red); } ! ! gc.fillRect(minx,maxy-yheight,barwidth, ! yheight); ! // return to def color gc.setColor(defcolor); } - else - { - //debug("SKIPPING a statbar: maxval="+maxval+",val="+val); - } } // draw Centered String ! void drawCString(Graphics gc, String str, int xcenter, int yval){ FontMetrics fm =gc.getFontMetrics(); int stringwidth=fm.stringWidth(str); --- 218,230 ---- gc.setColor(Color.red); } ! gc.fillRect(minx, maxy-yheight, barwidth, yheight); // return to def color gc.setColor(defcolor); } } // draw Centered String ! void drawCString(Graphics gc, String str, int xcenter, int yval) { FontMetrics fm =gc.getFontMetrics(); int stringwidth=fm.stringWidth(str); *************** *** 281,286 **** } ! void drawStatBars(Graphics gc) ! { int xpos; int halfwidth=(barwidth/2); --- 233,237 ---- } ! void drawStatBars(Graphics gc) { int xpos; int halfwidth=(barwidth/2); *************** *** 308,319 **** } ! ! ! public void paint(Graphics gc) ! { drawStatBars(gc); fillBars(gc); drawFlagInfo(gc); } - } --- 259,266 ---- } ! public void paint(Graphics gc) { drawStatBars(gc); fillBars(gc); drawFlagInfo(gc); } } Index: MapWin.java =================================================================== RCS file: /cvsroot/jcrossclient/jcrossclient/MapWin.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** MapWin.java 25 Jan 2006 01:35:40 -0000 1.7 --- MapWin.java 1 Feb 2006 19:14:29 -0000 1.8 *************** *** 75,79 **** Thread.sleep(sleepms); //Thread.yield(); - } catch (Exception err) { --- 75,78 ---- *************** *** 81,87 **** err.getMessage()); } - } - } --- 80,84 ---- *************** *** 95,100 **** class MapSquare { - - // ugly and hardcoded public final static int NUMBER_OF_LAYERS = 3; --- 92,95 ---- *************** *** 102,106 **** private int xSize[] = new int[NUMBER_OF_LAYERS]; private int ySize[] = new int[NUMBER_OF_LAYERS]; - private boolean offmap[] = new boolean[NUMBER_OF_LAYERS]; private int darkness; --- 97,100 ---- *************** *** 111,120 **** public synchronized void setFace(int face, int layer) { ! if (layer > NUMBER_OF_LAYERS || layer < 1) { ! return; ! } ! if (face == -1) { ! return; ! } faces[layer - 1] = face; xSize[layer - 1] = 1; --- 105,109 ---- public synchronized void setFace(int face, int layer) { ! if (layer > NUMBER_OF_LAYERS || layer < 1 || face == -1) return; faces[layer - 1] = face; xSize[layer - 1] = 1; *************** *** 123,137 **** public synchronized void setFace(int face, int layer, ! int x, int y, boolean off_map) { ! if (layer > NUMBER_OF_LAYERS || layer < 1) { ! return; ! } ! if (face == -1) { ! return; ! } faces[layer - 1] = face; xSize[layer - 1] = x; ySize[layer - 1] = y; - offmap[layer - 1] = off_map; } --- 112,120 ---- public synchronized void setFace(int face, int layer, ! int x, int y) { ! if (layer > NUMBER_OF_LAYERS || layer < 1 || face == -1) return; faces[layer - 1] = face; xSize[layer - 1] = x; ySize[layer - 1] = y; } *************** *** 158,162 **** // return true iff this square contains any layer bigger than 1x1 - public synchronized boolean isBig() { for (int i = 0; i < NUMBER_OF_LAYERS; i++) { --- 141,144 ---- *************** *** 170,174 **** // return the largest x dimension of all the layers in the square - public synchronized int biggestX() { int maxX = 0; --- 152,155 ---- *************** *** 183,187 **** // return the largest Y dimension of all the layers in the square - public synchronized int biggestY() { int maxY = 0; --- 164,167 ---- *************** *** 194,211 **** } ! ! /* ! clones the square from this to target ! */ ! public synchronized void copyTo(MapSquare target) { for (int i = 0; i < NUMBER_OF_LAYERS; i++) { target.setFace(this.faces[i], i + 1, ! xSize[i], ySize[i], false); } target.setDarkness(this.darkness); ! /* ! FIXME ! */ } --- 174,185 ---- } ! /** clones the square from this to target */ public synchronized void copyTo(MapSquare target) { for (int i = 0; i < NUMBER_OF_LAYERS; i++) { target.setFace(this.faces[i], i + 1, ! xSize[i], ySize[i]); } target.setDarkness(this.darkness); ! /* FIXME */ } *************** *** 214,221 **** * if this square contains this face, we need to redraw it * ! * @param dirty_face Description of the Parameter */ public synchronized boolean containsFace(int face) { - for (int i = 0; i < NUMBER_OF_LAYERS; i++) { if (faces[i] == face) { --- 188,194 ---- * if this square contains this face, we need to redraw it * ! * @param dirty_face The face to redraw */ public synchronized boolean containsFace(int face) { for (int i = 0; i < NUMBER_OF_LAYERS; i++) { if (faces[i] == face) { *************** *** 226,230 **** } - public synchronized void clear() { for (int i = 0; i < NUMBER_OF_LAYERS; i++) { --- 199,202 ---- *************** *** 236,250 **** } - public static int getLayerCount() { return NUMBER_OF_LAYERS; } - public synchronized int getDarkness() { return this.darkness; } - public synchronized boolean setDarkness(int newvalue) { if (newvalue >= 0 && newvalue < 256) { --- 208,219 ---- *************** *** 629,651 **** // Cells[x][y].clear(); continue; ! /* ! if empty mask, none of the checks will be true. ! */ } if ((mask & DARKNESS_MASK) != 0) { ! /* ! darkness bit ! */ darkness = mapdata.readUnsignedByte(); pos += 1; - // System.out.println("darkness value is set, it is " + darkness); } else { darkness = -1; } ! /* correct? maybe we ought to leave ! darkness alone ! */ /* Reduce redundancy by putting the get image --- 598,613 ---- // Cells[x][y].clear(); continue; ! /* if empty mask, none of the checks will be true. */ } if ((mask & DARKNESS_MASK) != 0) { ! /* darkness bit */ darkness = mapdata.readUnsignedByte(); pos += 1; } else { darkness = -1; } ! /* correct? maybe we ought to leave darkness alone */ /* Reduce redundancy by putting the get image *************** *** 679,683 **** int width = next_face.getWidth(null); int height = next_face.getHeight(null); - boolean is_off_map = (x > XMAX + MAX_FACE_SIZE || y > YMAX + MAX_FACE_SIZE); x_size = (width % pixwidth == 0 ? 0 : 1) + width / pixwidth; y_size = (height % pixheight == 0 ? 0 : 1) + height / pixheight; --- 641,644 ---- *************** *** 697,701 **** Math.max(y, top + Cells[left][top].biggestY() - 1) ) ); Cells[left][top].setFace(faces[layer], layer + 1, x_size, ! y_size, is_off_map); } else if ((x < XMAX) && (y < YMAX)) { addDirtyRectangle(clippedRectangle(x + MAX_FACE_SIZE, --- 658,662 ---- Math.max(y, top + Cells[left][top].biggestY() - 1) ) ); Cells[left][top].setFace(faces[layer], layer + 1, x_size, ! y_size); } else if ((x < XMAX) && (y < YMAX)) { addDirtyRectangle(clippedRectangle(x + MAX_FACE_SIZE, *************** *** 709,717 **** } - - /* - It sucks that we have to register for ALL THESE - just to listen for mouse clicks. Sigh. - */ public void mouseClicked(MouseEvent evt) { int dx = (evt.getX() / pixwidth) - XMAX / 2; --- 670,673 ---- *************** *** 725,738 **** } - public void mouseEntered(MouseEvent evt) {} - - public void mouseExited(MouseEvent evt) {} - - public void mousePressed(MouseEvent evt) {} - - public void mouseReleased(MouseEvent evt) {} --- 681,687 ---- *************** *** 740,746 **** // given the cell coords, clear the cell on the // back-buffer - - - public void clearCell(int cellx, int celly) { --- 689,692 ---- Index: SpellWin.java =================================================================== RCS file: /cvsroot/jcrossclient/jcrossclient/SpellWin.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** SpellWin.java 10 Jan 2006 16:22:45 -0000 1.3 --- SpellWin.java 1 Feb 2006 19:14:29 -0000 1.4 *************** *** 19,25 **** import java.awt.*; - import java.util.Hashtable; import java.util.LinkedList; - import java.util.Enumeration; import java.awt.event.*; --- 19,23 ---- *************** *** 174,186 **** } ! public void mouseEntered(MouseEvent evt) { ! return; ! } ! public void mouseExited(MouseEvent evt) { ! } ! public void mousePressed(MouseEvent evt) { ! } ! public void mouseReleased(MouseEvent evt) { ! } String create_status_string(Spell spell) { --- 172,179 ---- } ! public void mouseEntered(MouseEvent evt) {} ! public void mouseExited(MouseEvent evt) {} ! public void mousePressed(MouseEvent evt) {} ! public void mouseReleased(MouseEvent evt) {} String create_status_string(Spell spell) { Index: CFObject.java =================================================================== RCS file: /cvsroot/jcrossclient/jcrossclient/CFObject.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** CFObject.java 31 Jan 2006 00:28:49 -0000 1.8 --- CFObject.java 1 Feb 2006 19:14:29 -0000 1.9 *************** *** 26,31 **** */ - import java.lang.String; - public class CFObject { int Location; /* 0 for on ground, non-zero for object it is inside of*/ --- 26,29 ---- Index: TalkWin.java =================================================================== RCS file: /cvsroot/jcrossclient/jcrossclient/TalkWin.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** TalkWin.java 12 Jan 2006 02:03:20 -0000 1.5 --- TalkWin.java 1 Feb 2006 19:14:29 -0000 1.6 *************** *** 23,35 **** import java.awt.*; - import java.awt.event.TextListener; import java.awt.event.ActionListener; import java.awt.event.KeyListener; - import java.awt.event.TextEvent; import java.awt.event.ActionEvent; import java.awt.event.KeyEvent; ! class TalkWin extends Panel implements ActionListener,KeyListener ! { CFclient Parent; --- 23,32 ---- import java.awt.*; import java.awt.event.ActionListener; import java.awt.event.KeyListener; import java.awt.event.ActionEvent; import java.awt.event.KeyEvent; ! class TalkWin extends Panel implements ActionListener,KeyListener { CFclient Parent; *************** *** 69,77 **** * "wait-for-single-char" input mode. */ ! public boolean waitingForSingleKey(){ if((querymode&QUERYSINGLECHAR)==0) return false; return true; } ! public boolean waitingForQuery(){ return ((querymode>0)); } --- 66,74 ---- * "wait-for-single-char" input mode. */ ! public boolean waitingForSingleKey() { if((querymode&QUERYSINGLECHAR)==0) return false; return true; } ! public boolean waitingForQuery() { return ((querymode>0)); } *************** *** 79,83 **** // When in query mode, need to call this, to set the focus // to the text input box ! public void setInputFocus(){ input.requestFocus(); } --- 76,80 ---- // When in query mode, need to call this, to set the focus // to the text input box ! public void setInputFocus() { input.requestFocus(); } *************** *** 88,93 **** * AND sets Parent to handle single-key entry for TextInput */ ! public void query(String querystring) ! { querymode=querystring.charAt(0); --- 85,89 ---- * AND sets Parent to handle single-key entry for TextInput */ ! public void query(String querystring) { querymode=querystring.charAt(0); *************** *** 99,112 **** if((querymode & QUERYSINGLECHAR) >0){ input.setBackground(Color.red); - // Yeah, kinda ugly. But since it has to - // listen to keys anyway, use it for us too. - // Turn off once we get the key. } if((querymode & QUERYPRIVATE)>0){ input.setBackground(input.getForeground()); - - //Well, I wouldd LIKE to use setEchoChar, but theres - // no way of UNsetting it... ??? - //input.setEchoChar('*'); } --- 95,101 ---- *************** *** 118,124 **** addDisplayLine(querystring.substring(startmsg)); } - - return; - } --- 107,110 ---- *************** *** 128,132 **** * important, because it does stuff after this is called. */ ! public void replytoserver(String reply){ debug("entered text in query mode"); input.setBackground(Color.white); --- 114,118 ---- * important, because it does stuff after this is called. */ ! public void replytoserver(String reply) { debug("entered text in query mode"); input.setBackground(Color.white); *************** *** 147,152 **** * than the originally generating component */ ! public void keyPressed(KeyEvent evt){ ! } public void keyReleased(KeyEvent evt){ --- 133,137 ---- * than the originally generating component */ ! public void keyPressed(KeyEvent evt){} public void keyReleased(KeyEvent evt){ *************** *** 167,172 **** } ! public void keyTyped(KeyEvent evt){ ! } /* This can only be called as a result of RETURN --- 152,156 ---- } ! public void keyTyped(KeyEvent evt){} /* This can only be called as a result of RETURN *************** *** 183,192 **** * tweaking to get it all working properly again. */ ! public void actionPerformed(ActionEvent evt) ! { String newtext = input.getText(); ! if(querymode>0) ! { //Any and all input is redirected to the server, // because it has asked a question. --- 167,174 ---- * tweaking to get it all working properly again. */ ! public void actionPerformed(ActionEvent evt) { String newtext = input.getText(); ! if(querymode>0) { //Any and all input is redirected to the server, // because it has asked a question. *************** *** 266,277 **** } ! void debug(String str) ! { if(Parent.debugflag) System.out.println(str); } ! public TalkWin(CFclient parent) ! { Parent = parent; setLayout(new BorderLayout()); --- 248,257 ---- } ! void debug(String str) { if(Parent.debugflag) System.out.println(str); } ! public TalkWin(CFclient parent) { Parent = parent; setLayout(new BorderLayout()); *************** *** 303,308 **** } ! public void paint(Graphics gc) ! { gc.drawString("Talk win", 10,10); } --- 283,287 ---- } ! public void paint(Graphics gc) { gc.drawString("Talk win", 10,10); } Index: CFObjectStore.java =================================================================== RCS file: /cvsroot/jcrossclient/jcrossclient/CFObjectStore.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** CFObjectStore.java 27 Jan 2006 17:16:05 -0000 1.3 --- CFObjectStore.java 1 Feb 2006 19:14:29 -0000 1.4 *************** *** 18,25 **** */ - import java.util.Hashtable; - import java.util.Vector; - import java.util.Enumeration; - import java.lang.String; import java.util.*; --- 18,21 ---- *************** *** 116,124 **** int newloc = newobj.getLocation(); Integer key=new Integer(newtag); ! if(AllObjects.size()==0) { ! if(newtag != PlayerTag) { ! debug("ERROR: trying to add object "+newtag+"before player object!"); ! return; ! } } --- 112,118 ---- int newloc = newobj.getLocation(); Integer key=new Integer(newtag); ! if(AllObjects.size()==0 && newtag != PlayerTag) { ! debug("ERROR: trying to add object "+newtag+"before player object!"); ! return; } Index: PlayerStats.java =================================================================== RCS file: /cvsroot/jcrossclient/jcrossclient/PlayerStats.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** PlayerStats.java 25 Jan 2006 02:57:58 -0000 1.7 --- PlayerStats.java 1 Feb 2006 19:14:29 -0000 1.8 *************** *** 277,284 **** public void modifyspell(DataInputStream spelldata) throws IOException { ! int i,type = spelldata.readByte(); int num = spelldata.readInt(); ! Spell tmp; ! tmp = find_spell(type); if (tmp != null) { if ((type & 1) > 0) tmp.setmana(spelldata.readShort()); --- 277,283 ---- public void modifyspell(DataInputStream spelldata) throws IOException { ! int type = spelldata.readByte(); int num = spelldata.readInt(); ! Spell tmp = find_spell(num); if (tmp != null) { if ((type & 1) > 0) tmp.setmana(spelldata.readShort()); *************** *** 289,293 **** public void removespell(DataInputStream spelldata) throws IOException { - int i; Spell tmp; int spellnum = spelldata.readInt(); --- 288,291 ---- Index: ExamineWin.java =================================================================== RCS file: /cvsroot/jcrossclient/jcrossclient/ExamineWin.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** ExamineWin.java 15 Jan 2006 00:16:18 -0000 1.7 --- ExamineWin.java 1 Feb 2006 19:14:29 -0000 1.8 *************** *** 162,166 **** public void mouseEntered(MouseEvent evt) { - return; } public void mouseExited(MouseEvent evt) { --- 162,165 ---- Index: CFclient.java =================================================================== RCS file: /cvsroot/jcrossclient/jcrossclient/CFclient.java,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** CFclient.java 31 Jan 2006 00:28:49 -0000 1.30 --- CFclient.java 1 Feb 2006 19:14:29 -0000 1.31 *************** *** 278,294 **** case KeyEvent.VK_CONTROL: case KeyEvent.VK_SHIFT: ! if(run_on) { ! if(keycode==params.getRunKey()) { ! releasecmd="run_stop"; ! run_on=false; ! miscwin.setRunFlag(false); ! } } ! if(fire_on) { ! if(keycode==params.getFireKey()) { ! releasecmd="fire_stop"; ! fire_on=false; ! miscwin.setFireFlag(false); ! } } break; --- 278,290 ---- case KeyEvent.VK_CONTROL: case KeyEvent.VK_SHIFT: ! if(run_on && keycode==params.getRunKey()) { ! releasecmd="run_stop"; ! run_on=false; ! miscwin.setRunFlag(false); } ! if(fire_on && keycode==params.getFireKey()) { ! releasecmd="fire_stop"; ! fire_on=false; ! miscwin.setFireFlag(false); } break; *************** *** 783,787 **** name_pl=names[1]; thisobj.setname(name); ! thisobj.setname_pl(name); should_update = true; } --- 779,783 ---- name_pl=names[1]; thisobj.setname(name); ! thisobj.setname_pl(name_pl); should_update = true; } *************** *** 809,823 **** int strpos = 0; int tag = 0, len = itemdata.available(); - boolean examineflag = false, invflag = false; while ( strpos < len ) { - //tag=FourByteToInt(cmd, strpos); tag = itemdata.readInt(); ! strpos += 4; debug("DelItem " + tag); - CFObject oldobj = allobjects.getCFObject(tag); allobjects.delCFObject(tag); } - } --- 805,815 ---- int strpos = 0; int tag = 0, len = itemdata.available(); while ( strpos < len ) { tag = itemdata.readInt(); ! strpos += 4; debug("DelItem " + tag); allobjects.delCFObject(tag); } } *************** *** 1007,1011 **** File faceFile = new File(facePath); ImageIO.write(image, "png", faceFile); - FileOutputStream fos = new FileOutputStream(faceFile); mHTAskedPixMaps.remove(faceInt); --- 999,1002 ---- *************** *** 1076,1083 **** // interpret commands sent from server. ! void evalSrvCmd(String cmd, DataInputStream data) throws IOException ! { ! //debug("server cmd is " + cmd + " [" + cmd.length() + "]."); ! if(cmd.startsWith("image")) { if(lastcommand==0) { --- 1067,1071 ---- // interpret commands sent from server. ! void evalSrvCmd(String cmd, DataInputStream data) throws IOException { if(cmd.startsWith("image")) { if(lastcommand==0) { *************** *** 1104,1244 **** debug("Got server cmd \"" + cmd + "\""); } ! if(cmd.startsWith("delitem")) { DelItemCmd(data); ! return; ! } ! if(cmd.startsWith("face")) { FaceCmd(data); return; ! } ! if(cmd.startsWith("item2")) { ItemCmd(data, 2); ! return; ! } ! if(cmd.startsWith("item1")) { ItemCmd(data, 1); ! return; ! } ! if(cmd.startsWith("addspell")) { playerstats.addspell(data); spellwin.updateSpells(); ! return; ! } ! if(cmd.startsWith("updspell")) { playerstats.modifyspell(data); ! return; ! } ! if(cmd.startsWith("delspell")) { playerstats.removespell(data); spellwin.updateSpells(); ! return; ! } ! if(cmd.startsWith("map1")) { /* this includes map1a */ mapwin.map1aRead(data); ! return; ! } ! if(cmd.startsWith("newmap")) { if (mapwin !=null) mapwin.clearmap(); ! return; ! } ! if(cmd.startsWith("player")) { PlayerCmd(data); ! return; ! } ! if(cmd.startsWith("stats")) { ! // statwin.updateStats(datastr); playerstats.update(data); - statwin.updateStats(); miscwin.updateStats(); skillwin.update_skills(); ! ! return; ! } ! if (cmd.startsWith("comc")) { mConnection.command_completed(data); ! return; ! } ! if(cmd.startsWith("upditem")) { UpdItemCmd(data); ! return; ! } ! if (cmd.startsWith("replyinfo")) { parse_info_reply(data); ! return; ! } ! ! int size = data.available(); ! byte[] databa = new byte[size]; ! data.readFully(databa); ! String datastr = new String(databa); ! if (cmd.startsWith("map_scroll")) { ! MapScrollCmd(datastr); ! return; ! } ! if(cmd.startsWith("delinv")) { ! DelInvCmd(datastr); ! return; ! } ! if(cmd.startsWith("drawinfo")) { ! talkwin.addDisplayLine(datastr.substring(2) + "\n", (byte)datastr.charAt(0)); ! debug(" (drawinfo cmd)"); ! return; ! } ! if(cmd.startsWith("magicmap")) { ! magicmap.parse(datastr); ! return; ! } ! if(cmd.startsWith("anim")) { ! debug("IGNORING anim cmd"); ! return; ! } ! if(cmd.startsWith("version")) { ! // we are actually supposed to read two separate strings ! // here. oh well. ! String verstring = datastr; ! System.out.println("Vers : " + verstring); ! if(verstring.length() > 4) ! verstring=verstring.substring(0,4); ! server_version = Integer.parseInt(verstring); ! talkwin.addDisplayLine("server uses protocol version " ! +server_version+"\n"); ! debug(" (version cmd)"); ! if(server_version>protocol_version) ! { ! talkwin.addDisplayLine("WARNING: server version higher than we expect\n"); } - - writePVersion(); - return; - } - if(cmd.startsWith("addme_failed")) { - debug("Addme FAILED?!!"); - return; - } - if(cmd.startsWith("setup")) { - System.out.println("response to setup command: " + datastr); - return; - } - if(cmd.startsWith("addme_success")) { - debug("Successful addme"); - return; - } - if(cmd.startsWith("query")) { - debug("QUERY asked"); - in_query=true; - talkwin.query(datastr); - - // remember to call sendReply() - return; } - errmsg("UNRECOGNISED COMMAND FROM SERVER: "+cmd); - errmsg("\nEither corrupted datastream, or out-of-date client"); - errmsg(" QUITTING"); - System.exit(0); } --- 1092,1182 ---- debug("Got server cmd \"" + cmd + "\""); } ! if (cmd.startsWith("delitem")) { DelItemCmd(data); ! } else if (cmd.startsWith("face")) { FaceCmd(data); return; ! } else if (cmd.startsWith("item2")) { ItemCmd(data, 2); ! } else if (cmd.startsWith("item1")) { ItemCmd(data, 1); ! } else if (cmd.startsWith("addspell")) { playerstats.addspell(data); spellwin.updateSpells(); ! } else if (cmd.startsWith("updspell")) { playerstats.modifyspell(data); ! } else if (cmd.startsWith("delspell")) { playerstats.removespell(data); spellwin.updateSpells(); ! } else if (cmd.startsWith("map1")) { /* this includes map1a */ mapwin.map1aRead(data); ! } else if (cmd.startsWith("newmap")) { if (mapwin !=null) mapwin.clearmap(); ! } else if (cmd.startsWith("player")) { PlayerCmd(data); ! } else if (cmd.startsWith("stats")) { playerstats.update(data); statwin.updateStats(); miscwin.updateStats(); skillwin.update_skills(); ! } else if (cmd.startsWith("comc")) { mConnection.command_completed(data); ! } else if (cmd.startsWith("upditem")) { UpdItemCmd(data); ! } else if (cmd.startsWith("replyinfo")) { parse_info_reply(data); ! } else { ! int size = data.available(); ! byte[] databa = new byte[size]; ! data.readFully(databa); ! String datastr = new String(databa); ! if (cmd.startsWith("map_scroll")) { ! MapScrollCmd(datastr); ! } else if (cmd.startsWith("delinv")) { ! DelInvCmd(datastr); ! } else if (cmd.startsWith("drawinfo")) { ! talkwin.addDisplayLine(datastr.substring(2) + "\n", (byte)datastr.charAt(0)); ! debug(" (drawinfo cmd)"); ! } else if (cmd.startsWith("magicmap")) { ! magicmap.parse(datastr); ! } else if (cmd.startsWith("anim")) { ! debug("IGNORING anim cmd"); ! } else if (cmd.startsWith("version")) { ! // we are actually supposed to read two separate strings ! // here. oh well. ! String verstring = datastr; ! System.out.println("Vers : " + verstring); ! if(verstring.length() > 4) ! verstring=verstring.substring(0,4); ! server_version = Integer.parseInt(verstring); ! talkwin.addDisplayLine("server uses protocol version " ! +server_version+"\n"); ! debug(" (version cmd)"); ! if(server_version>protocol_version) { ! talkwin.addDisplayLine("WARNING: server version higher than we expect\n"); ! } ! writePVersion(); ! } else if (cmd.startsWith("addme_failed")) { ! debug("Addme FAILED?!!"); ! } else if (cmd.startsWith("setup")) { ! System.out.println("response to setup command: " + datastr); ! } else if (cmd.startsWith("addme_success")) { ! debug("Successful addme"); ! } else if (cmd.startsWith("query")) { ! debug("QUERY asked"); ! in_query=true; ! talkwin.query(datastr); ! // remember to call sendReply() ! } else { ! errmsg("UNRECOGNISED COMMAND FROM SERVER: "+cmd); ! errmsg("\nEither corrupted datastream, or out-of-date client"); ! errmsg(" QUITTING"); ! System.exit(0); } } } *************** *** 1495,1499 **** void writePVersion() { try { - String inmsg; mConnection.writeBytes("version "+protocol_version + " 1027 JCrossclient 1.0 alpha-3CVS"); /* make the server use the new map style commands */ --- 1433,1436 ---- *************** *** 1502,1507 **** mConnection.writeBytes("requestinfo spell_paths"); mConnection.writeBytes("addme"); - - }catch (java.io.IOException e) { debug("sigh. initial handshake from server failed"); --- 1439,1442 ---- |
From: <jcr...@li...> - 2006-01-31 00:37:14
|
Update of /cvsroot/jcrossclient/jcrossclient/com/sixlegs/png In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12950 Removed Files: Chunk_sPLT$SuggestedPaletteImpl.class TextChunkReader$TextChunkImpl.class Log Message: removed a couple of binary files that shouldn't have been here to start with --- Chunk_sPLT$SuggestedPaletteImpl.class DELETED --- --- TextChunkReader$TextChunkImpl.class DELETED --- |
From: <jcr...@li...> - 2006-01-31 00:28:57
|
Update of /cvsroot/jcrossclient/jcrossclient In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9915 Modified Files: CFObject.java CFclient.java Changelog InvWin.java Log Message: make item locking work correctly Index: CFObject.java =================================================================== RCS file: /cvsroot/jcrossclient/jcrossclient/CFObject.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** CFObject.java 27 Jan 2006 17:16:05 -0000 1.7 --- CFObject.java 31 Jan 2006 00:28:49 -0000 1.8 *************** *** 138,149 **** } - /* since we don't actually care about the current locked state of an - * item, only what it isn't, might as well return the opposite of the - * current state. */ - public byte getnotLocked() { - int locked = Flags & F_LOCKED; - return locked!=0?(byte)0:(byte)1; - } - /** Like getName() except that this only returns the name, not the * quantity, regardless of the number of objects */ --- 138,141 ---- *************** *** 164,166 **** --- 156,163 ---- public int getNumObjs(){ return NumObjs; }; public int getAnimId(){ return AnimId; }; + + /** returns the locked status of the object */ + public boolean isLocked() { + return ((Flags & F_LOCKED)>0)?true:false; + } } Index: CFclient.java =================================================================== RCS file: /cvsroot/jcrossclient/jcrossclient/CFclient.java,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** CFclient.java 27 Jan 2006 17:16:05 -0000 1.29 --- CFclient.java 31 Jan 2006 00:28:49 -0000 1.30 *************** *** 1725,1729 **** */ public void lockObj(int tag, byte state) { - System.out.println("I am trying to lock item " +tag); try { mConnection.writeBytes("lock ", state, tag); --- 1725,1728 ---- Index: InvWin.java =================================================================== RCS file: /cvsroot/jcrossclient/jcrossclient/InvWin.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** InvWin.java 15 Jan 2006 00:16:18 -0000 1.10 --- InvWin.java 31 Jan 2006 00:28:49 -0000 1.11 *************** *** 176,182 **** --- 176,190 ---- } else if (cmd.equals("Drop")) { + if (last_clicked_object.isLocked()) { + toplevel.talkwin.addDisplayLine("This object is locked.\n"); + return; + } toplevel.dropObj(last_clicked_object.getTag()); } else if (cmd.equals("Drop Some")) { + if (last_clicked_object.isLocked()) { + toplevel.talkwin.addDisplayLine("This object is locked.\n"); + return; + } dropsome=new Dropsome(toplevel, last_clicked_object); dropsome.pack(); *************** *** 187,192 **** } else if (cmd.equals("Lock")) { ! System.out.println("Lock item: I think I need to set the item state to " + last_clicked_object.getnotLocked()); ! toplevel.lockObj(last_clicked_object.getTag(), last_clicked_object.getnotLocked()); } else if (cmd.equals("Mark")) { --- 195,203 ---- } else if (cmd.equals("Lock")) { ! if (last_clicked_object.isLocked()) { ! toplevel.lockObj(last_clicked_object.getTag(), (byte)0); ! } else { ! toplevel.lockObj(last_clicked_object.getTag(), (byte)1); ! } } else if (cmd.equals("Mark")) { Index: Changelog =================================================================== RCS file: /cvsroot/jcrossclient/jcrossclient/Changelog,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** Changelog 27 Jan 2006 17:16:05 -0000 1.33 --- Changelog 31 Jan 2006 00:28:49 -0000 1.34 *************** *** 260,261 **** --- 260,268 ---- - add support for 'item2' command - merge item handling commands into one function. + + 31/01/2006 - CFclient - remove outdated debugging message + + CFObject - replace getnotLocked() with less hack-ish isLocked() + + InvWin - tidy up item locking, and make it actually work. + |
From: <jcr...@li...> - 2006-01-31 00:28:57
|
Update of /cvsroot/jcrossclient/jcrossclient/com/sixlegs/png In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9915/com/sixlegs/png Modified Files: Chunk_sPLT$SuggestedPaletteImpl.class TextChunkReader$TextChunkImpl.class Log Message: make item locking work correctly Index: Chunk_sPLT$SuggestedPaletteImpl.class =================================================================== RCS file: /cvsroot/jcrossclient/jcrossclient/com/sixlegs/png/Chunk_sPLT$SuggestedPaletteImpl.class,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 Binary files /tmp/cvssj9bU1 and /tmp/cvsk42JkN differ Index: TextChunkReader$TextChunkImpl.class =================================================================== RCS file: /cvsroot/jcrossclient/jcrossclient/com/sixlegs/png/TextChunkReader$TextChunkImpl.class,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 Binary files /tmp/cvs8JaUs1 and /tmp/cvsTv7lYM differ |
From: <jcr...@li...> - 2006-01-27 17:16:23
|
Update of /cvsroot/jcrossclient/jcrossclient In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13648 Modified Files: CFObject.java CFObjectStore.java CFclient.java Changelog Log Message: item2 support and inventory sorting Index: CFObject.java =================================================================== RCS file: /cvsroot/jcrossclient/jcrossclient/CFObject.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** CFObject.java 15 Jan 2006 00:16:18 -0000 1.6 --- CFObject.java 27 Jan 2006 17:16:05 -0000 1.7 *************** *** 28,34 **** import java.lang.String; ! ! public class CFObject ! { int Location; /* 0 for on ground, non-zero for object it is inside of*/ int Tag; /* unique identifier of object (?) */ --- 28,32 ---- import java.lang.String; ! public class CFObject { int Location; /* 0 for on ground, non-zero for object it is inside of*/ int Tag; /* unique identifier of object (?) */ *************** *** 37,41 **** int Face; /* aka graphics image identifier */ String Name, Name_pl; ! int NumObjs; int AnimId; --- 35,39 ---- int Face; /* aka graphics image identifier */ String Name, Name_pl; ! int type; int NumObjs; int AnimId; *************** *** 64,67 **** --- 62,68 ---- } + public void setType(int newtype) { + type=newtype; + } public void setNumObjs(int nof) { NumObjs=nof; *************** *** 133,136 **** --- 134,140 ---- return Tag; } + public int getType() { + return type; + } /* since we don't actually care about the current locked state of an Index: CFObjectStore.java =================================================================== RCS file: /cvsroot/jcrossclient/jcrossclient/CFObjectStore.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** CFObjectStore.java 27 Jan 2006 03:00:26 -0000 1.2 --- CFObjectStore.java 27 Jan 2006 17:16:05 -0000 1.3 *************** *** 22,25 **** --- 22,36 ---- import java.util.Enumeration; import java.lang.String; + import java.util.*; + + + /* small class to allow CFObjects to be sorted by type */ + class CFObjcompare implements java.util.Comparator { + public int compare(Object o1, Object o2) { + CFObject ob1 = (CFObject)o1; + CFObject ob2 = (CFObject)o2; + return ob1.getType() - ob2.getType(); + } + } /* *************** *** 137,140 **** --- 148,152 ---- if(oldindex != -1) { PlayerInv.setElementAt(newobj, oldindex); + Collections.sort(PlayerInv, new CFObjcompare()); } *************** *** 158,161 **** --- 170,174 ---- } else { PlayerInv.addElement(newobj); + Collections.sort(PlayerInv, new CFObjcompare()); } if(oldloc==0 || newloc ==0) Index: CFclient.java =================================================================== RCS file: /cvsroot/jcrossclient/jcrossclient/CFclient.java,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** CFclient.java 27 Jan 2006 00:01:39 -0000 1.28 --- CFclient.java 27 Jan 2006 17:16:05 -0000 1.29 *************** *** 647,701 **** // add possibly multiple objects, to a single "location" // "location" can be either the floor, the player, or some object. ! void ItemCmd(DataInputStream itemdata) throws IOException { ! CFObject newobj; ! int strpos = 0; ! int loc, tag, flags, weight,face; ! String name, name_pl; ! String[] names = new String[2]; ! int namelen, len = itemdata.available(); ! byte buf[]; ! ! loc = itemdata.readInt(); ! strpos += 4; ! ! while ( strpos < len ) { ! tag = itemdata.readInt(); ! strpos += 4; ! flags = itemdata.readInt(); ! strpos += 4; ! weight = itemdata.readInt(); ! strpos += 4; ! face = itemdata.readInt(); ! strpos += 4; ! ! namelen = itemdata.readUnsignedByte(); ! strpos += 1; ! buf = new byte[namelen]; ! itemdata.readFully(buf); ! name = new String(buf); ! strpos += namelen; ! /* this bit sends us the length of both the singular ! * and plural names, we want to seperate them.*/ ! names = name.split("\0", 2); ! name=names[0]; ! name_pl=names[1]; ! ! newobj = new CFObject(loc, tag, flags, weight, face, name, name_pl); ! allobjects.addCFObject(newobj); ! debug("added object "+tag+", location "+loc+", name "+name+" flags "+flags); ! ! // need to udpate, even if location is BAG that ! // player is holding. I suppose. sigh. ! // loc==0, means on floor ! } ! ! } ! ! // add possibly multiple objects, to a single "location" ! // "location" can be either the floor, the player, or some object. ! void Item1Cmd(DataInputStream itemdata) throws IOException { CFObject newobj; int strpos = 0; ! int len, loc, tag, flags, weight,face; String name, name_pl; String[] names = new String[2]; --- 647,654 ---- // add possibly multiple objects, to a single "location" // "location" can be either the floor, the player, or some object. ! void ItemCmd(DataInputStream itemdata, int version) throws IOException { CFObject newobj; int strpos = 0; ! int len, loc, tag, flags, weight, face, type; String name, name_pl; String[] names = new String[2]; *************** *** 746,753 **** newobj.setNumObjs(numitem); newobj.setAnimId(anim_id); allobjects.addCFObject(newobj); ! debug("Item1cmd: added object "+tag+", location "+loc+", name "+name+" flags "+flags); // need to update, even if location is BAG that --- 699,711 ---- newobj.setNumObjs(numitem); newobj.setAnimId(anim_id); + if (version == 2) { + type = itemdata.readShort(); + strpos += 2; + newobj.setType(type); + } allobjects.addCFObject(newobj); ! debug("ItemCmd: added object "+tag+", location "+loc+", name "+name+" flags "+flags); // need to update, even if location is BAG that *************** *** 1154,1163 **** return; } ! if(cmd.startsWith("item1")) { ! Item1Cmd(data); return; } ! if(cmd.startsWith("item")) { ! ItemCmd(data); return; } --- 1112,1121 ---- return; } ! if(cmd.startsWith("item2")) { ! ItemCmd(data, 2); return; } ! if(cmd.startsWith("item1")) { ! ItemCmd(data, 1); return; } *************** *** 1540,1544 **** mConnection.writeBytes("version "+protocol_version + " 1027 JCrossclient 1.0 alpha-3CVS"); /* make the server use the new map style commands */ ! mConnection.writeBytes("setup map1cmd 1 exp64 1 spellmon 1 newmapcmd 1 mapsize " + mapwin.XMAX + "x" + mapwin.YMAX); mConnection.writeBytes("requestinfo skill_info"); mConnection.writeBytes("requestinfo spell_paths"); --- 1498,1502 ---- mConnection.writeBytes("version "+protocol_version + " 1027 JCrossclient 1.0 alpha-3CVS"); /* make the server use the new map style commands */ ! mConnection.writeBytes("setup map1cmd 1 itemcmd 2 exp64 1 spellmon 1 newmapcmd 1 mapsize " + mapwin.XMAX + "x" + mapwin.YMAX); mConnection.writeBytes("requestinfo skill_info"); mConnection.writeBytes("requestinfo spell_paths"); Index: Changelog =================================================================== RCS file: /cvsroot/jcrossclient/jcrossclient/Changelog,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** Changelog 27 Jan 2006 00:01:39 -0000 1.32 --- Changelog 27 Jan 2006 17:16:05 -0000 1.33 *************** *** 250,251 **** --- 250,261 ---- - Show map again when a key or button is pressed. - Fix some colour definitions + + CFObject - add type, get type and set type + + CFObjectStore - add comparator class to sort items by type, + - resort inventory whenever new items are added to it + + CFclient - send itemcmd 2 in setup flags + - Remove support for 'item' command (horribly outdated) + - add support for 'item2' command + - merge item handling commands into one function. |
From: <jcr...@li...> - 2006-01-27 03:00:40
|
Update of /cvsroot/jcrossclient/jcrossclient In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5044 Modified Files: CFObjectStore.java Log Message: whitespace cleanups Index: CFObjectStore.java =================================================================== RCS file: /cvsroot/jcrossclient/jcrossclient/CFObjectStore.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** CFObjectStore.java 9 Nov 2005 03:12:07 -0000 1.1.1.1 --- CFObjectStore.java 27 Jan 2006 03:00:26 -0000 1.2 *************** *** 22,25 **** --- 22,26 ---- import java.util.Enumeration; import java.lang.String; + /* * This class holds information about all objects we know about *************** *** 37,42 **** // What IS the different between public and defaulted classes anyways? ! public class CFObjectStore ! { Vector objs_on_floor; // cache Vector PlayerInv; // cache --- 38,42 ---- // What IS the different between public and defaulted classes anyways? ! public class CFObjectStore { Vector objs_on_floor; // cache Vector PlayerInv; // cache *************** *** 48,53 **** // reinit things if we connect to a new server suddenly ! public void reinit() ! { AllObjects.clear(); objs_on_floor=new Vector(); --- 48,52 ---- // reinit things if we connect to a new server suddenly ! public void reinit() { AllObjects.clear(); objs_on_floor=new Vector(); *************** *** 56,70 **** } ! public void setPlayerTag(int ptag) ! { PlayerTag = ptag; } ! public int getPlayerTag() ! { return PlayerTag; } ! CFObject getPlayerObject() ! { return getCFObject(PlayerTag); } --- 55,66 ---- } ! public void setPlayerTag(int ptag) { PlayerTag = ptag; } ! public int getPlayerTag() { return PlayerTag; } ! CFObject getPlayerObject() { return getCFObject(PlayerTag); } *************** *** 72,82 **** // Maybe we should cache THIS, as well as the floor thing. // dunno. sigh. ! public Vector getPlayerInv() ! { return PlayerInv; } ! public CFObject getCFObject(int tag) ! { Integer locator=new Integer(tag); CFObject obj; --- 68,76 ---- // Maybe we should cache THIS, as well as the floor thing. // dunno. sigh. ! public Vector getPlayerInv() { return PlayerInv; } ! public CFObject getCFObject(int tag) { Integer locator=new Integer(tag); CFObject obj; *************** *** 85,105 **** } ! public void delCFObject(int tag) ! { Integer locator=new Integer(tag); CFObject oldobj = (CFObject)AllObjects.remove(locator); ! if(oldobj==null) ! { System.out.println("Error: trying to delete null object"); return; } ! if(oldobj.onFloor()) ! { deleteObjOnFloor(oldobj); toplevel.updateFloor(); } ! else ! { // probably should recurse or something? maybe not. deleteObjInInv(oldobj); --- 79,95 ---- } ! public void delCFObject(int tag) { Integer locator=new Integer(tag); CFObject oldobj = (CFObject)AllObjects.remove(locator); ! if(oldobj==null) { System.out.println("Error: trying to delete null object"); return; } ! if(oldobj.onFloor()) { deleteObjOnFloor(oldobj); toplevel.updateFloor(); } ! else { // probably should recurse or something? maybe not. deleteObjInInv(oldobj); *************** *** 111,123 **** * or just add a new object, as appropriate */ ! public void addCFObject(CFObject newobj) ! { int newtag = newobj.Tag; int newloc = newobj.getLocation(); Integer key=new Integer(newtag); ! if(AllObjects.size()==0) ! { ! if(newtag != PlayerTag) ! { debug("ERROR: trying to add object "+newtag+"before player object!"); return; --- 101,110 ---- * or just add a new object, as appropriate */ ! public void addCFObject(CFObject newobj) { int newtag = newobj.Tag; int newloc = newobj.getLocation(); Integer key=new Integer(newtag); ! if(AllObjects.size()==0) { ! if(newtag != PlayerTag) { debug("ERROR: trying to add object "+newtag+"before player object!"); return; *************** *** 129,135 **** if(oldobj!=null) oldloc = oldobj.getLocation(); - - AllObjects.put(key, newobj); --- 116,120 ---- *************** *** 140,157 **** */ ! if(oldloc == newloc) ! { /* existing object, AND same placed object */ int oldindex; oldindex=objs_on_floor.indexOf(oldobj); ! if(oldindex != -1) ! { objs_on_floor.setElementAt(newobj, oldindex); } oldindex=PlayerInv.indexOf(oldobj); ! if(oldindex != -1) ! { PlayerInv.setElementAt(newobj, oldindex); } --- 125,139 ---- */ ! if(oldloc == newloc) { /* existing object, AND same placed object */ int oldindex; oldindex=objs_on_floor.indexOf(oldobj); ! if(oldindex != -1) { objs_on_floor.setElementAt(newobj, oldindex); } oldindex=PlayerInv.indexOf(oldobj); ! if(oldindex != -1) { PlayerInv.setElementAt(newobj, oldindex); } *************** *** 161,190 **** else toplevel.updateInventory(); - - return; } - // else... ! if(oldloc==0) ! { deleteObjOnFloor(oldobj); } ! else ! { ! if(oldloc >0) ! { deleteObjInInv(oldobj); } } ! ! if(newloc==0) ! { objs_on_floor.addElement(newobj); ! } else ! { PlayerInv.addElement(newobj); } - if(oldloc==0 || newloc ==0) toplevel.updateFloor(); --- 143,162 ---- else toplevel.updateInventory(); return; } // else... ! if(oldloc==0) { deleteObjOnFloor(oldobj); } ! else { ! if(oldloc >0) { deleteObjInInv(oldobj); } } ! if(newloc==0) { objs_on_floor.addElement(newobj); ! } else { PlayerInv.addElement(newobj); } if(oldloc==0 || newloc ==0) toplevel.updateFloor(); *************** *** 193,198 **** } ! void debug(String msg) ! { if(toplevel.debugflag) System.out.println(msg); --- 165,169 ---- } ! void debug(String msg) { if(toplevel.debugflag) System.out.println(msg); *************** *** 202,207 **** // note: there is no order to the array. some slots may be // 0, at any slot ! public Vector getObjsOnFloor() ! { return objs_on_floor; } --- 173,177 ---- // note: there is no order to the array. some slots may be // 0, at any slot ! public Vector getObjsOnFloor() { return objs_on_floor; } *************** *** 210,224 **** // note: this means DIRECTLY carried. // It does not recurse into bags, for example ! public Vector getCarriedBy(int objtag) ! { Vector carried=new Vector(); Enumeration objs = AllObjects.elements(); CFObject tmpobj; ! while(objs.hasMoreElements()) ! { tmpobj= (CFObject)objs.nextElement(); ! if(tmpobj.getLocation() == objtag) ! { carried.addElement(tmpobj); } --- 180,191 ---- // note: this means DIRECTLY carried. // It does not recurse into bags, for example ! public Vector getCarriedBy(int objtag) { Vector carried=new Vector(); Enumeration objs = AllObjects.elements(); CFObject tmpobj; ! while(objs.hasMoreElements()) { tmpobj= (CFObject)objs.nextElement(); ! if(tmpobj.getLocation() == objtag) { carried.addElement(tmpobj); } *************** *** 231,245 **** // It's more important to lock on DELETE, than it is on add // Only object deletion makes big problems, in ExamineWin ! public void deleteObjInInv(CFObject obj) ! { ! synchronized (PlayerInv) ! { PlayerInv.removeElement(obj); } } ! public void deleteObjOnFloor(CFObject obj) ! { ! synchronized (objs_on_floor) ! { objs_on_floor.removeElement(obj); } --- 198,208 ---- // It's more important to lock on DELETE, than it is on add // Only object deletion makes big problems, in ExamineWin ! public void deleteObjInInv(CFObject obj) { ! synchronized (PlayerInv) { PlayerInv.removeElement(obj); } } ! public void deleteObjOnFloor(CFObject obj) { ! synchronized (objs_on_floor) { objs_on_floor.removeElement(obj); } *************** *** 248,259 **** // Note that we do NOT trigger a floor update, because // the floor never remains empty ! public void deleteAllOnFloor() ! { CFObject floorobj; int floorcount=objs_on_floor.size(); ! synchronized (objs_on_floor) ! { ! for(int oc=0; oc<floorcount; oc++) ! { floorobj = (CFObject)objs_on_floor.elementAt(oc); AllObjects.remove(new Integer(floorobj.getTag())); --- 211,219 ---- // Note that we do NOT trigger a floor update, because // the floor never remains empty ! public void deleteAllOnFloor() { CFObject floorobj; int floorcount=objs_on_floor.size(); ! synchronized (objs_on_floor) { ! for(int oc=0; oc<floorcount; oc++) { floorobj = (CFObject)objs_on_floor.elementAt(oc); AllObjects.remove(new Integer(floorobj.getTag())); *************** *** 261,269 **** objs_on_floor.removeAllElements(); } - //toplevel.updateFloor(); } ! public void deleteCarriedBy(int carrytag) ! { debug("deleteCarriedBy("+carrytag+")"); Enumeration objs = AllObjects.elements(); --- 221,227 ---- objs_on_floor.removeAllElements(); } } ! public void deleteCarriedBy(int carrytag) { debug("deleteCarriedBy("+carrytag+")"); Enumeration objs = AllObjects.elements(); *************** *** 271,276 **** CFObject oldobj; ! while(objs.hasMoreElements()) ! { oldobj= (CFObject)objs.nextElement(); location=oldobj.getLocation(); --- 229,233 ---- CFObject oldobj; ! while(objs.hasMoreElements()) { oldobj= (CFObject)objs.nextElement(); location=oldobj.getLocation(); *************** *** 278,283 **** tag=oldobj.getTag(); ! if(location != carrytag) ! { debug("delete: skipping obj "+tag); continue; --- 235,239 ---- tag=oldobj.getTag(); ! if(location != carrytag) { debug("delete: skipping obj "+tag); continue; *************** *** 285,294 **** debug("delete: trying to delete obj "+tag); ! if(location==0) ! { deleteObjOnFloor(oldobj); } ! else ! { deleteObjInInv(oldobj); } --- 241,248 ---- debug("delete: trying to delete obj "+tag); ! if(location==0) { deleteObjOnFloor(oldobj); } ! else { deleteObjInInv(oldobj); } *************** *** 296,305 **** } toplevel.updateInventory(); - } - ! public CFObjectStore(CFclient top) ! { // hopefully, '100' is larger than the default, // otherwise, we are hurting ourselves... --- 250,256 ---- } toplevel.updateInventory(); } ! public CFObjectStore(CFclient top) { // hopefully, '100' is larger than the default, // otherwise, we are hurting ourselves... *************** *** 309,314 **** toplevel = top; } - - } - --- 260,262 ---- |
From: <jcr...@li...> - 2006-01-27 00:01:47
|
Update of /cvsroot/jcrossclient/jcrossclient In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11032 Modified Files: CFclient.java Changelog MagicMap.java Log Message: make magicmap display automatically and fix some colour definitions Index: MagicMap.java =================================================================== RCS file: /cvsroot/jcrossclient/jcrossclient/MagicMap.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** MagicMap.java 26 Jan 2006 14:53:48 -0000 1.1 --- MagicMap.java 27 Jan 2006 00:01:39 -0000 1.2 *************** *** 40,44 **** } ! class MagicMap extends Canvas { magicmapsquare squares[][]; --- 40,44 ---- } ! class MagicMap extends Canvas implements KeyListener, MouseListener { magicmapsquare squares[][]; *************** *** 50,54 **** --- 50,59 ---- CFclient Parent; public MagicMap (CFclient parent) { + Parent = parent; word = new StringBuffer(); + gc=this.getGraphics(); + setBackground(Color.black); + addKeyListener(this); + addMouseListener(this); } *************** *** 76,79 **** --- 81,87 ---- } repaint(); + /* we'll display ourselves, and try and get focus (so we can disappear when a key is sent....) */ + Parent.showmap("magicmap"); + requestFocus(); } *************** *** 90,101 **** case 3: gc.setColor(Color.red); break; case 4: gc.setColor(Color.orange); break; ! case 5: gc.setColor(Color.cyan); break; ! case 6: gc.setColor(Color.magenta); break; case 7: gc.setColor(Color.green); break; ! case 8: gc.setColor(Color.green); break; ! case 9: gc.setColor(Color.gray); break; ! case 10: gc.setColor(Color.pink); break; case 11: gc.setColor(Color.yellow); break; ! case 12: gc.setColor(Color.pink); break; default: gc.setColor(Color.black); break; } --- 98,109 ---- case 3: gc.setColor(Color.red); break; case 4: gc.setColor(Color.orange); break; ! case 5: gc.setColor(new Color(192, 192, 255)); break; /*light blue*/ ! case 6: gc.setColor(new Color(192, 88, 0)); break; /* dark orange */ case 7: gc.setColor(Color.green); break; ! case 8: gc.setColor(new Color(192, 255, 192)); break; /* light green */ ! case 9: gc.setColor(Color.gray); break; /* grey */ ! case 10: gc.setColor(new Color(165, 42, 42)); break; /* brown */ case 11: gc.setColor(Color.yellow); break; ! case 12: gc.setColor(new Color(189, 183, 107)); break; default: gc.setColor(Color.black); break; } *************** *** 104,106 **** --- 112,129 ---- } } + + public void mouseExited(MouseEvent evt) {} + public void mouseEntered(MouseEvent evt) {} + public void mouseReleased(MouseEvent evt) {} + public void mousePressed(MouseEvent evt) {} + + public void mouseClicked(MouseEvent evt) { /* show the map again */ + Parent.showmap(); + } + public void keyReleased(KeyEvent evt) { + Parent.showmap(); + } + public void keyPressed(KeyEvent evt) {} + public void keyTyped(KeyEvent evt) {} + } \ No newline at end of file Index: CFclient.java =================================================================== RCS file: /cvsroot/jcrossclient/jcrossclient/CFclient.java,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** CFclient.java 26 Jan 2006 14:53:48 -0000 1.27 --- CFclient.java 27 Jan 2006 00:01:39 -0000 1.28 *************** *** 372,376 **** } ! /* Okay, this is somewhat ugly. We register ourselves as the --- 372,384 ---- } ! public void showmap() { ! CardLayout cl = (CardLayout)viewpane.getLayout(); ! cl.show(viewpane, "map"); ! mapwin.askForFocus(); ! } ! public void showmap(String panel) { ! CardLayout cl = (CardLayout)viewpane.getLayout(); ! cl.show(viewpane, panel); ! } /* Okay, this is somewhat ugly. We register ourselves as the *************** *** 623,630 **** } - void printChar(int ch) { - debug(" char is dec. "+ch); - } - /**********************************************************/ /* We now begin the "interpret a server command" section */ --- 631,634 ---- Index: Changelog =================================================================== RCS file: /cvsroot/jcrossclient/jcrossclient/Changelog,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** Changelog 26 Jan 2006 14:53:48 -0000 1.31 --- Changelog 27 Jan 2006 00:01:39 -0000 1.32 *************** *** 235,239 **** - display spell paths ! 26/01/2005 - CFClient - add a MagicMap to the class, make viewpane a global - add 'Toggle Map' entry to debug menu, to switch between viewpane cards - pass of magicmap packets to the magic map class --- 235,239 ---- - display spell paths ! 26/01/2006 - CFClient - add a MagicMap to the class, make viewpane a global - add 'Toggle Map' entry to debug menu, to switch between viewpane cards - pass of magicmap packets to the magic map class *************** *** 242,244 **** StatWin - Show HP, mana and grace on their own lines, along with the maximum values of each ! MagicMap - new file, handles magic map parsing and drawing \ No newline at end of file --- 242,251 ---- StatWin - Show HP, mana and grace on their own lines, along with the maximum values of each ! MagicMap - new file, handles magic map parsing and drawing ! ! 27/01/2006 - CFclient - Remove unused printchar function ! - showmap functions to switch between mappanes ! ! MagicMap - Show on magicmap packet being parsed ! - Show map again when a key or button is pressed. ! - Fix some colour definitions |
From: <jcr...@li...> - 2006-01-26 14:53:56
|
Update of /cvsroot/jcrossclient/jcrossclient In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6124 Modified Files: CFclient.java Changelog StatWin.java Added Files: MagicMap.java Log Message: magic map support --- NEW FILE: MagicMap.java --- /* * Copyright (c) 1997, Phil Brown, ph...@bo... * Copyright (c) 2005, Brendan Lally, bre...@gm... * * This file is part of jcrossclient. * * Jcrossclient is free software; you can redistribute it and/or modify it under * the terms of the GNU General Public License as published by the Free Software * Foundation; either version 2 of the License, or (at your option) any later version. * * Jcrossclient is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A * PARTICULAR PURPOSE. See the GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along with * Jcrossclient; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ //This class handles display of stat-bars. import java.awt.*; import java.awt.event.*; class magicmapsquare { static final int FACE_FLOOR = 0x80; static final int FACE_WALL = 0x40; byte colour; boolean is_floor; boolean is_wall; magicmapsquare(byte data) { if ((data & FACE_FLOOR) >0) is_floor = true; if ((data & FACE_WALL) >0) is_wall = true; /* a byte in data corresponds to one we should use in colour, * if it is set in data, and isn't one of the flags */ colour = (byte)(data & 0x0F); } } class MagicMap extends Canvas { magicmapsquare squares[][]; StringBuffer word; char nextchar; int width, height; Graphics gc=null; int playerwidth, playerheight; CFclient Parent; public MagicMap (CFclient parent) { word = new StringBuffer(); } public void parse(String mapdata) { int i,j; int space[] = new int[4]; space[0] = mapdata.indexOf(' '); space[1] = mapdata.indexOf(' ', space[0]+1); space[2] = mapdata.indexOf(' ', space[1]+1); space[3] = mapdata.indexOf(' ', space[2]+1); width = Integer.parseInt(mapdata.substring(0,space[0])); height = Integer.parseInt(mapdata.substring(space[0]+1, space[1])); playerwidth = Integer.parseInt(mapdata.substring(space[1]+1, space[2])); playerheight = Integer.parseInt(mapdata.substring(space[2]+1, space[3])); squares = new magicmapsquare[width][height]; for (i=0; i<height;i++) { for (j=0;j<width;j++) { /* the data starts on the byte after the fourth space, * and goes left to right, top to bottom */ squares[i][j]=new magicmapsquare((byte)mapdata.charAt(space[3]+1+(i*width)+j)); } } repaint(); } public void paint(Graphics gc) { int i,j; /* reset this to black in case it was changed before */ gc.setColor(Color.black); for (i=0; i<width;i++) { for (j=0;j<height;j++) { switch (squares[i][j].colour & 0x0F) { case 0: gc.setColor(Color.black); break; case 1: gc.setColor(Color.white); break; case 2: gc.setColor(Color.blue); break; case 3: gc.setColor(Color.red); break; case 4: gc.setColor(Color.orange); break; case 5: gc.setColor(Color.cyan); break; case 6: gc.setColor(Color.magenta); break; case 7: gc.setColor(Color.green); break; case 8: gc.setColor(Color.green); break; case 9: gc.setColor(Color.gray); break; case 10: gc.setColor(Color.pink); break; case 11: gc.setColor(Color.yellow); break; case 12: gc.setColor(Color.pink); break; default: gc.setColor(Color.black); break; } gc.fillRect(j*8, i*8, 8, 8); } } } } Index: CFclient.java =================================================================== RCS file: /cvsroot/jcrossclient/jcrossclient/CFclient.java,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** CFclient.java 25 Jan 2006 02:57:58 -0000 1.26 --- CFclient.java 26 Jan 2006 14:53:48 -0000 1.27 *************** *** 139,152 **** CFObjectStore allobjects; ! StatWin statwin; ! SkillWin skillwin; ! InvWin invwin; ! SpellWin spellwin; ! SettingsWin settingswin; ! MapWin mapwin; ! ExamineWin examinewin; ! TalkWin talkwin; ! StatbarWin miscwin; public ScrollPane iscrollp, escrollp, sscrollp, spscrollp; ServerDialog chooseserver; --- 139,154 ---- CFObjectStore allobjects; ! StatWin statwin; ! SkillWin skillwin; ! InvWin invwin; ! SpellWin spellwin; ! SettingsWin settingswin; ! MapWin mapwin; ! ExamineWin examinewin; ! TalkWin talkwin; ! StatbarWin miscwin; ! MagicMap magicmap; public ScrollPane iscrollp, escrollp, sscrollp, spscrollp; + Panel viewpane; ServerDialog chooseserver; *************** *** 523,526 **** --- 525,532 ---- } + if (cmd.equals("Toggle Map")) { + CardLayout cl = (CardLayout)viewpane.getLayout(); + cl.next(viewpane); + } if(cmd.equals("Debug on")) { debugflag=true; *************** *** 920,927 **** } } - - void MagicMapCmd(String cmd) { - debug("Ignoring MagicMapCmd\n"); - } void PlayerCmd(DataInputStream playerdata) throws IOException { --- 926,929 ---- *************** *** 1204,1208 **** return; } ! int size = data.available(); byte[] databa = new byte[size]; --- 1206,1210 ---- return; } ! int size = data.available(); byte[] databa = new byte[size]; *************** *** 1223,1226 **** --- 1225,1232 ---- return; } + if(cmd.startsWith("magicmap")) { + magicmap.parse(datastr); + return; + } if(cmd.startsWith("anim")) { debug("IGNORING anim cmd"); *************** *** 1249,1257 **** return; } - - if(cmd.startsWith("magicmap")) { - MagicMapCmd(datastr); - return; - } if(cmd.startsWith("addme_failed")) { debug("Addme FAILED?!!"); --- 1255,1258 ---- *************** *** 1355,1370 **** talkwin = new TalkWin(this); miscwin = new StatbarWin(this); ! TabPanel leftside = new TabPanel(); ! Panel topside = new VertPanel(); ! Panel rightside = new VertPanel(); ! Panel viewpane = new Panel(new CardLayout()); ! Panel items = new VertPanel(); ! iscrollp= new ScrollPane(ScrollPane.SCROLLBARS_ALWAYS); ! spscrollp= new ScrollPane(ScrollPane.SCROLLBARS_ALWAYS); ! // ALLWAYS, to not mess with speed of hide/show ! escrollp= new ScrollPane(ScrollPane.SCROLLBARS_ALWAYS); ! sscrollp = new ScrollPane(ScrollPane.SCROLLBARS_AS_NEEDED); iscrollp.setSize(290,210); --- 1356,1372 ---- talkwin = new TalkWin(this); miscwin = new StatbarWin(this); + magicmap = new MagicMap(this); ! TabPanel leftside = new TabPanel(); ! Panel topside = new VertPanel(); ! Panel rightside = new VertPanel(); ! /* we defined this in the main class, because other functions need it */ ! viewpane = new Panel(new CardLayout()); ! Panel items = new VertPanel(); ! iscrollp = new ScrollPane(ScrollPane.SCROLLBARS_ALWAYS); ! spscrollp = new ScrollPane(ScrollPane.SCROLLBARS_ALWAYS); ! escrollp = new ScrollPane(ScrollPane.SCROLLBARS_ALWAYS); ! sscrollp = new ScrollPane(ScrollPane.SCROLLBARS_AS_NEEDED); iscrollp.setSize(290,210); *************** *** 1379,1388 **** (escrollp.getVAdjustable()).setUnitIncrement(10); - spscrollp.setSize(290,210); spscrollp.add(spellwin); (spscrollp.getVAdjustable()).setUnitIncrement(10); - sscrollp.add(skillwin); items.add(iscrollp); --- 1381,1388 ---- *************** *** 1394,1404 **** leftside.add("settings", settingswin); viewpane.add("map", mapwin); topside.add(viewpane); topside.add(miscwin); rightside.add(talkwin); - placeWindow(parent, leftside, 0, 0, 1, 3); placeWindow(parent, topside, 1, 0, 1, 3); - placeWindow(parent, rightside, 2, 0, 1, 3); --- 1394,1404 ---- leftside.add("settings", settingswin); viewpane.add("map", mapwin); + viewpane.add("magicmap", magicmap); topside.add(viewpane); topside.add(miscwin); rightside.add(talkwin); + placeWindow(parent, leftside, 0, 0, 1, 3); placeWindow(parent, topside, 1, 0, 1, 3); placeWindow(parent, rightside, 2, 0, 1, 3); *************** *** 1431,1434 **** --- 1431,1435 ---- dmenu.add(newMenuItem("Local refresh")); dmenu.add(newMenuItem("Full redraw")); + dmenu.add(newMenuItem("Toggle Map")); help.add(newMenuItem("Help on jcrossclient")); *************** *** 1479,1485 **** void initWindows() { Frame topwin; - //topwin= new Frame(); - - // new test stuff, this line topwin = this; topwin.setLayout(new GridBagLayout()); --- 1480,1483 ---- Index: StatWin.java =================================================================== RCS file: /cvsroot/jcrossclient/jcrossclient/StatWin.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** StatWin.java 25 Jan 2006 02:57:58 -0000 1.4 --- StatWin.java 26 Jan 2006 14:53:48 -0000 1.5 *************** *** 34,38 **** newtext.append(playerstats.playerTitle+"\n"); newtext.append("Exp: "+playerstats.exp+" Level: "+playerstats.level+"\n"); ! newtext.append("Hp: "+playerstats.hp+" Mana: "+playerstats.mana+" Grace:"+playerstats.gr+"\n"); newtext.append("Str: "+playerstats.Str + "\n"); newtext.append("Dex: "+playerstats.Dex+ "\n"); --- 34,40 ---- newtext.append(playerstats.playerTitle+"\n"); newtext.append("Exp: "+playerstats.exp+" Level: "+playerstats.level+"\n"); ! newtext.append("Hp: "+playerstats.hp+"/"+playerstats.maxhp+"\n"); ! newtext.append("Mana: "+playerstats.mana+"/"+playerstats.maxmana+"\n"); ! newtext.append("Grace: "+playerstats.gr+"/"+playerstats.maxgr+"\n"); newtext.append("Str: "+playerstats.Str + "\n"); newtext.append("Dex: "+playerstats.Dex+ "\n"); Index: Changelog =================================================================== RCS file: /cvsroot/jcrossclient/jcrossclient/Changelog,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** Changelog 25 Jan 2006 02:57:58 -0000 1.30 --- Changelog 26 Jan 2006 14:53:48 -0000 1.31 *************** *** 235,236 **** --- 235,244 ---- - display spell paths + 26/01/2005 - CFClient - add a MagicMap to the class, make viewpane a global + - add 'Toggle Map' entry to debug menu, to switch between viewpane cards + - pass of magicmap packets to the magic map class + - remove MagicMapCmd + + StatWin - Show HP, mana and grace on their own lines, along with the maximum values of each + + MagicMap - new file, handles magic map parsing and drawing \ No newline at end of file |
From: <jcr...@li...> - 2006-01-25 02:58:06
|
Update of /cvsroot/jcrossclient/jcrossclient In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21640 Modified Files: CFclient.java Changelog PlayerStats.java StatWin.java Log Message: make statwin display spellpaths, and not armour Index: PlayerStats.java =================================================================== RCS file: /cvsroot/jcrossclient/jcrossclient/PlayerStats.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** PlayerStats.java 24 Jan 2006 18:56:31 -0000 1.6 --- PlayerStats.java 25 Jan 2006 02:57:58 -0000 1.7 *************** *** 87,91 **** int maxhp, maxmana, maxgr; int Str, Dex, Con, Int, Wis, Pow, Char; ! int Wc, Dam, Ac, Arm; int food, weightlimit; int attuned, repelled, denied; --- 87,91 ---- int maxhp, maxmana, maxgr; int Str, Dex, Con, Int, Wis, Pow, Char; ! int Wc, Dam, Ac; int food, weightlimit; int attuned, repelled, denied; *************** *** 112,116 **** Pow = 10 ; Char = 10; ! Wc=25; Dam = 0; Ac = 10; Arm = 0; skills_updated=true; --- 112,116 ---- Pow = 10 ; Char = 10; ! Wc=25; Dam = 0; Ac = 10; skills_updated=true; *************** *** 153,156 **** --- 153,171 ---- } + /** returns a string containing a newline seperated list of all spell + * paths to which the player has status type (as defined by + * get_path_status */ + public String attunements_display(int type) { + StringBuffer buf = new StringBuffer(); + int i; + spellpath path; + for (i = 0; i < spells.size(); i++) { + path = (spellpath)spellpaths.get(i); + if (get_path_status(path.number) == type) + buf.append(path.name + "\n"); + } + return buf.toString(); + } + static public void addSkill(int skillnumber, String skillname) { if (skillnumber < minskillnum) minskillnum = skillnumber; *************** *** 354,361 **** scan += 3; break; - case 16: /*armor*/ - Arm = statsdata.readShort(); - scan += 3; - break; case 17: /*speed*/ tmpint = statsdata.readInt(); --- 369,372 ---- Index: CFclient.java =================================================================== RCS file: /cvsroot/jcrossclient/jcrossclient/CFclient.java,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** CFclient.java 25 Jan 2006 01:35:40 -0000 1.25 --- CFclient.java 25 Jan 2006 02:57:58 -0000 1.26 *************** *** 1359,1363 **** Panel topside = new VertPanel(); Panel rightside = new VertPanel(); ! Panel items = new VertPanel(); --- 1359,1363 ---- Panel topside = new VertPanel(); Panel rightside = new VertPanel(); ! Panel viewpane = new Panel(new CardLayout()); Panel items = new VertPanel(); *************** *** 1393,1398 **** leftside.add("spells", spscrollp); leftside.add("settings", settingswin); ! topside.add (mapwin); ! topside.add (miscwin); rightside.add(talkwin); placeWindow(parent, leftside, 0, 0, 1, 3); --- 1393,1399 ---- leftside.add("spells", spscrollp); leftside.add("settings", settingswin); ! viewpane.add("map", mapwin); ! topside.add(viewpane); ! topside.add(miscwin); rightside.add(talkwin); placeWindow(parent, leftside, 0, 0, 1, 3); Index: StatWin.java =================================================================== RCS file: /cvsroot/jcrossclient/jcrossclient/StatWin.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** StatWin.java 23 Jan 2006 19:36:08 -0000 1.3 --- StatWin.java 25 Jan 2006 02:57:58 -0000 1.4 *************** *** 43,51 **** newtext.append("Cha: "+playerstats.Char+"\n"); newtext.append(playerstats.rangeattack+"\n"); ! newtext.append("Wc: "+playerstats.Wc+" Dam: "+playerstats.Dam+" Ac: "+playerstats.Ac+" Arm: "+playerstats.Arm+"\n"); newtext.append("Speed: "+playerstats.speed+" ("+playerstats.weapspeed+") Food: "+playerstats.food+"\n"); newtext.append("\n"); newtext.append("Resistances: \n"); newtext.append(playerstats.resistances_display()); setText(newtext.toString()); } --- 43,63 ---- newtext.append("Cha: "+playerstats.Char+"\n"); newtext.append(playerstats.rangeattack+"\n"); ! newtext.append("Wc: "+playerstats.Wc+" Dam: "+playerstats.Dam+" Ac: "+playerstats.Ac+"\n"); newtext.append("Speed: "+playerstats.speed+" ("+playerstats.weapspeed+") Food: "+playerstats.food+"\n"); newtext.append("\n"); newtext.append("Resistances: \n"); newtext.append(playerstats.resistances_display()); + if (playerstats.attuned >0) { + newtext.append("\nAttuned spellpaths:\n"); + newtext.append(playerstats.attunements_display(1)); + } + if (playerstats.repelled >0) { + newtext.append("\nRepelled spellpaths:\n"); + newtext.append(playerstats.attunements_display(-1)); + } + if (playerstats.denied >0) { + newtext.append("\nDenied spellpaths:\n"); + newtext.append(playerstats.attunements_display(-2)); + } setText(newtext.toString()); } Index: Changelog =================================================================== RCS file: /cvsroot/jcrossclient/jcrossclient/Changelog,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** Changelog 25 Jan 2006 01:35:40 -0000 1.29 --- Changelog 25 Jan 2006 02:57:58 -0000 1.30 *************** *** 227,229 **** --- 227,236 ---- CFclient - clarify some comments + - Add mapwin within a card layout panel + + PlayerStats - New function attunements_display() + - Stop parsing for obsolete armour stat + + Statwin - No longer display armour + - display spell paths |
From: <jcr...@li...> - 2006-01-25 01:35:50
|
Update of /cvsroot/jcrossclient/jcrossclient In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30798 Modified Files: CFclient.java Changelog MapWin.java Settings.java SettingsWin.java StatbarWin.java Log Message: better command line argument parsing and some display tweaks Index: Settings.java =================================================================== RCS file: /cvsroot/jcrossclient/jcrossclient/Settings.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Settings.java 24 Jan 2006 18:56:31 -0000 1.4 --- Settings.java 25 Jan 2006 01:35:40 -0000 1.5 *************** *** 312,354 **** } ! public void setLegalValue(String item, String newval) { ! if(newval.charAt(0) != '-') { ! // debug("setting "+item+" to "+newval); ! val.put(item,newval); ! } ! } ! ! void setValFromCmdLine(String args[]) { ! for(int ind = 0; ind < args.length; ind++ ) ! { ! String test = args[ind]; ! if(test.charAt(0) == '-') { ! try { ! // it would be cleaner to implement this as a switch, ! // how come java wont allow string switches?!? argh! ! if(test.equals("-host") || test.equals("-server")) { ! setLegalValue("server",args[++ind]); ! } else if(test.equals("-cache")) { ! setLegalValue("cache_images","true"); ! debug ("Image caching not enabled yet..."); ! } else if(test.equals("-debug")) { ! debug ("Running w/ debug mode"); ! setLegalValue("debug","true"); ! } else if(test.equals("-cmd")) { ! debug ("simple client 1-line command not installed yet..."); ! } else if(test.equals("-help")) { ! debug ("help not installed yet..."); ! } else { ! errmsg("unknown option:"+test); ! } ! } catch (ArrayIndexOutOfBoundsException err) { ! errmsg("No value given for:"+test); ! } ! } else { ! errmsg("unknown option:"+test); ! } ! } ! } } --- 312,351 ---- } ! public void setLegalValue(String item, String newval) { ! if(newval.charAt(0) != '-') { ! val.put(item,newval); ! } ! } ! void setValFromCmdLine(String args[]) { ! StringBuffer helptxt = new StringBuffer(); ! for(int ind = 0; ind < args.length; ind++ ) { ! String test = args[ind]; ! if(test.charAt(0) == '-') { ! try { ! if(test.equals("-host") || test.equals("-server")) { ! setLegalValue("server",args[++ind]); ! } else if(test.equals("-debug")) { ! debug ("Running w/ debug mode"); ! setLegalValue("debug","true"); ! } else if(test.equals("-help")) { ! helptxt.append("Jcrossclient:\n Options are:\n"); ! helptxt.append(" -server [hostname] Connect to server hostname\n"); ! helptxt.append(" -debug Run with extra debug messages\n"); ! helptxt.append(" -help This help text\n"); ! debug(helptxt.toString()); ! System.exit(0); ! } else { ! errmsg("unknown option:"+test + "\nrun with -help for options"); ! System.exit(0); ! } ! } catch (ArrayIndexOutOfBoundsException err) { ! errmsg("No value given for:"+test); ! } ! } else { ! errmsg("unknown option:"+test); ! } ! } ! } } Index: Changelog =================================================================== RCS file: /cvsroot/jcrossclient/jcrossclient/Changelog,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** Changelog 24 Jan 2006 18:56:31 -0000 1.28 --- Changelog 25 Jan 2006 01:35:40 -0000 1.29 *************** *** 203,206 **** --- 203,207 ---- - remove skill_name() function - remove listspells() function + - update for new naming Settings - reduce the default map and server delay by one-third *************** *** 208,211 **** --- 209,213 ---- Spell - remove irrelevant comment. - use skill.getName() instead of stats.skill_name() + - update for new naming SettingsWin - New file *************** *** 214,215 **** --- 216,229 ---- - added getName() function. + 25/01/2006 - StatbarWin - Set a preferred size + + SettingsWin - Improve layout + + Settings - Improve command line argument parsing + - Remove obsolete options + - provide a -help text + + MapWin - set minimum and maximum sizes + + CFclient - clarify some comments + Index: StatbarWin.java =================================================================== RCS file: /cvsroot/jcrossclient/jcrossclient/StatbarWin.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** StatbarWin.java 28 Nov 2005 19:04:32 -0000 1.2 --- StatbarWin.java 25 Jan 2006 01:35:40 -0000 1.3 *************** *** 38,44 **** boolean loading_pixmaps=false; ! public void componentResized(ComponentEvent evt) ! { Dimension newsize; int fontspace=25; // yeah, hardcoded. sigh. --- 38,47 ---- boolean loading_pixmaps=false; + public Dimension getPrefferedSize() { + /* magic numbers, 65 is the height that the last piece of text is printed at */ + return new Dimension(0, 65); + } ! public void componentResized(ComponentEvent evt) { Dimension newsize; int fontspace=25; // yeah, hardcoded. sigh. Index: CFclient.java =================================================================== RCS file: /cvsroot/jcrossclient/jcrossclient/CFclient.java,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** CFclient.java 24 Jan 2006 18:56:31 -0000 1.24 --- CFclient.java 25 Jan 2006 01:35:40 -0000 1.25 *************** *** 1327,1340 **** /****************************************************************\ * addWindows() adds and creates all the subwindows for user * ! * WIndow layout is roughly as follows: * * * - * inv stats spells * - * | skills | * - * | | * - * V map V * - * ground messages * - * | statbar | * - * | V * - * V * \****************************************************************/ --- 1327,1345 ---- /****************************************************************\ * addWindows() adds and creates all the subwindows for user * ! * Window layout is as follows: * ! * _________________________________________________ * ! * | | | | * ! * | | | | * ! * | | | | * ! * | | map | | * ! * | | | | * ! * | tabs | | messages | * ! * | | | | * ! * | |_______________| | * ! * | | | | * ! * | | stats | | * ! * | | | | * ! * |_______________|_______________|_______________| * * * \****************************************************************/ *************** *** 1363,1370 **** sscrollp = new ScrollPane(ScrollPane.SCROLLBARS_AS_NEEDED); - /* These next two lines only work with java 1.5+ until I find a - * better way to do this, they can stay commented out */ - /*miscwin.setMinimumSize(new Dimension(mapwin.pixwidth*mapwin.XMAX, 80)); - mapwin.setMinimumSize(new Dimension(mapwin.pixwidth*mapwin.XMAX, mapwin.pixheight*mapwin.YMAX));*/ iscrollp.setSize(290,210); iscrollp.add(invwin); --- 1368,1371 ---- Index: SettingsWin.java =================================================================== RCS file: /cvsroot/jcrossclient/jcrossclient/SettingsWin.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** SettingsWin.java 24 Jan 2006 18:56:31 -0000 1.1 --- SettingsWin.java 25 Jan 2006 01:35:40 -0000 1.2 *************** *** 31,35 **** public SettingsWin(CFclient parent) { ! super(); Parent = parent; /* set up the server delay */ --- 31,35 ---- public SettingsWin(CFclient parent) { ! super(new BorderLayout()); Parent = parent; /* set up the server delay */ *************** *** 48,52 **** server_panel.add(new Label("Server Delay(ms)")); server_panel.add(server_delay); ! add(server_panel); map_delay = new Choice(); map_delay.add("5"); --- 48,52 ---- server_panel.add(new Label("Server Delay(ms)")); server_panel.add(server_delay); ! add(server_panel, "North"); map_delay = new Choice(); map_delay.add("5"); *************** *** 63,67 **** map_panel.add(new Label("Map Delay(ms)")); map_panel.add(map_delay); ! add(map_panel); } --- 63,67 ---- map_panel.add(new Label("Map Delay(ms)")); map_panel.add(map_delay); ! add(map_panel, "Center"); } Index: MapWin.java =================================================================== RCS file: /cvsroot/jcrossclient/jcrossclient/MapWin.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** MapWin.java 15 Jan 2006 00:30:08 -0000 1.6 --- MapWin.java 25 Jan 2006 01:35:40 -0000 1.7 *************** *** 312,315 **** --- 312,323 ---- + /* ensure the entire map is always displayed when possible*/ + public Dimension getMinimumSize() { + return new Dimension(XMAX*pixwidth, YMAX*pixheight); + } + public Dimension getMaximumSize() { + return new Dimension(XMAX*pixwidth, YMAX*pixheight); + } + public void assignCells() { /* |