[Jcrossclient-cvs] jcrossclient CFObject.java,1.7,1.8 CFclient.java,1.29,1.30 Changelog,1.33,1.34 In
Status: Alpha
Brought to you by:
cavesomething
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. + |