- The server should apply the property set immediately, not wait until

the event trundles through the queue, especially since the 'test' was
  being done immediately.
- Simplified some stuff on the server.
- Fixed up the test, as EZgame arrays will auto-grow.
- Do not set the property immediately on the client! Dangerz! We will add
  a new function for that, so that set() behaves like testAndSet() without the
  test, and set() behaves like setImmediate() without the immediate.
  (And there's no such thing as test and set immediately.)


git-svn-id: svn+ssh://src.earth.threerings.net/vilya/trunk@196 c613c5cb-e716-0410-b11b-feb51c14d237
This commit is contained in:
Ray Greenwell
2007-02-19 21:12:43 +00:00
parent 83e02730cf
commit 38016c0ab0
5 changed files with 79 additions and 46 deletions
@@ -132,7 +132,10 @@ public class EZGameManager extends GameManager
throws InvocationException
{
validateUser(caller);
setProperty(propName, data, index, testAndSet, testValue);
if (testAndSet && !_gameObj.testProperty(propName, index, testValue)) {
return; // the test failed: do not set the property
}
setProperty(propName, data, index);
}
// from EZGameProvider
@@ -221,7 +224,7 @@ public class EZGameManager extends GameManager
}
if (playerId == 0) {
setProperty(msgOrPropName, result, -1, false, null);
setProperty(msgOrPropName, result, -1);
} else {
sendPrivateMessage(playerId, msgOrPropName, result);
@@ -402,15 +405,12 @@ public class EZGameManager extends GameManager
* Helper method to post a property set event.
*/
protected void setProperty (
String propName, Object value, int index,
boolean testAndSet, Object testValue)
String propName, Object value, int index)
{
if (_gameObj.testProperty (propName, index, testAndSet, testValue))
{
_gameObj.postEvent(
new PropertySetEvent(
_gameObj.getOid(), propName, value, index));
}
// apply the property set immediately
Object oldValue = _gameObj.applyPropertySet(propName, value, index);
_gameObj.postEvent(new PropertySetEvent(
_gameObj.getOid(), propName, value, index, oldValue));
}
/**