Commit graph

78 commits

Author SHA1 Message Date
Eric House
4701fe2b90 pass in number of devices already connected so forceChannel can be set
more correctly; put up alert when device rejects an invitation as a
duplicate.
2015-01-03 09:50:07 -08:00
Eric House
878a16b3bc snapshot: android compiles, and works well enough to exchange moves
via relay!  Lots of changes, mostly around treating connTypes as a Set
inside the java world.  Jni to translate to that is a pain.
2014-10-16 06:45:24 -07:00
Eric House
a522266ce4 add message checksumming for android too by making it part of util
(compiled out by default)
2013-07-10 08:05:47 -07:00
Eric House
78670e9650 fix bug: include wordlist name in bad word info passed into util function 2012-12-29 07:48:31 -08:00
Eric House
1316ae4b67 Fix relay devid protocol to deal with case where client submits a
ID_TYPE_RELAY id that's not in the devices table (as has happened when
a device switches relay URLs during testing, but might also happen if
I have to delete an entry from the devices table.)  In that case,
return ID_TYPE_NONE to the client, which will be its clue to delete
its ID_TYPE_RELAY id and submit the platform-specific id again.

Note: android won't compile this revision thanks to util.h change
2012-11-10 15:05:44 -08:00
Eric House
59937b8514 modify how devids are handled on the relay and the protocol through
which they're communicated to the device.  Device is expected to have
a platform-specific notion of ID which the relay stores in a new
devices table and indexes with a 32-bit number which is returned to
the device -- which is encouraged but not required to use it in lieu
of the longer ID in future communications.  Modify linux client and
test script to use the relay-supplied id.  Some of this is commented
out for now.
2012-11-03 10:58:01 -07:00
Eric House
3469975d2a add, still disabled by compile-time flags, code to transmit device ID
(e.g. ID Android devices get via GCM) to relay and to associate it
there with messages that need to be delivered.
2012-10-30 07:01:47 -07:00
Eric House
aec03fc572 When a game's consumated and guest discovers it isn't using the same
dict, give chance to switch, and to download if required.  Because of
the way the JNI thread works, and JNI's requirement in general that
env instances match up (e.g. dicts must be destroyed in the same
thread that creates them), substituting into a live game is too hard.
So the game's saved with its new dict and then reloaded.
2012-10-24 07:17:21 -07:00
Eric House
e90c5ee94f pass index of resigning player into util_notifyGameOver. Not yet
passed into java.
2012-10-09 05:31:12 -07:00
Eric House
fd9b9f85e2 make util_hiliteCell conditional, and remove from android where it
wasn't used anyway.
2012-10-05 18:51:32 -07:00
Eric House
2c89f13383 add turn as param to util_turnChanged, and call from server rather
than board.
2012-09-27 07:04:57 -07:00
Eric House
95a7b14a3a transmit dict's md5sum along with name in initial message from host to
guest.  On guest, pass that sum into client code along with names so
the appropriate tests can be done and corrections taken.
2012-09-08 20:23:48 -07:00
Eric House
509c832f2f more progress: copy dict name into badwordinfo and free it successfully 2012-09-06 07:49:05 -07:00
Eric House
ea4d805d5f first of a set of changes to communicate to clients dictionary being
used by server.  Clients need to care if e.g. the server's disallowing
phonies based on its dict.  Can only be sent if client is of latest
version.  In that case, common code calls into new util function.  In
future changes, BoardActivity's implemention of the callback will need
to check if the server's choice of dict is available, and if not offer
to download it.  Once it's available, will want to install it.
2012-09-03 21:33:46 -07:00
Eric House
3a54aa0ebc add util_informUndo() that gets called, and puts up a dialog, after
remote device has performed an undo on a committed turn.
2012-05-14 07:01:02 -07:00
Eric House
fe614e9efc delegate phone number comparison to platform code which in Android
case has a method for it.  strcmp is not enough.
2012-03-19 07:36:18 -07:00
Eric House
0755a9e781 add new util function that gets called when a game is opened to inform
it if any players are missing.  Idea's to allow for non-relay devices
the invitation opportunity that comes when a game connects to the
relay and learns that no other games have joined its room.
2012-02-09 05:19:03 -08:00
Andy2
210c59ef9b move bonus square values into model: add API to set an array, and API
to query model for values.  Now everybody else queries new model API
rather than client via util_getSquareBonus(), model uses its internal
values if present otherwise falls back to util_getSquareBonus(), and
internalizes the array as part of the game.  Now it should be easier
to have different bonus patterns and to have them exchanged as part of
network game init.
2011-11-16 19:01:11 -08:00
Andy2
8d228ae190 turn on face-up tile picking for Android (though there's no prefs UI
to enable it for a game yet).  In common code, break pick tile utils
method in two, one for blank and the other for tray tiles.  In java,
implement dialog for picking the tiles.  Works, though is a bit clumsy
to have the dialog come and go after every pick.  Better would be a
dialog that stays up and accumulates picks -- but it'd have to know to
reduce the set of tile choices as letters are chosen.  This'll do for
now.
2011-10-28 22:15:56 -07:00
Andy2
4eee7f8aa7 Pass selected tiles into new util function, and from there into java
world, so confirming query can include them.
2011-10-19 18:34:26 -07:00
Andy2
0e6b4d749f When pen held on committed tile on board, cons up list of all words
played that include that tile and pass to new util_cellSquareHeld()
method.  In java implementation of that method, use existing lookup
activity code to display list of words.  Enabled on the C side by a
compile-time flag in case it has problems.  Right now the time spent
saving a game before launching the lookup activity, and reloading it
after, is pretty apparent, but that's in emulator which is slow.
2011-10-13 19:14:08 -07:00
Andy2
dc20b04a4c remove unused param (on the C/jni side) 2011-10-04 18:54:53 -07:00
Andy2
77b9fa11a5 improving lookup words experience: replace
util_userQuery(QUERY_ROBOT_MOVE) with new util_informMove(), into
which the number of words formed and the words themselves are passed.
The process of consing up the score explanation was already passing
over the model, so storing the words is very little effort, and will
save a call back into the model where the user actually wants to do
the lookup.
2011-10-02 16:21:09 -07:00
Andy2
2d2f3e23fd change signature of util_playerScoreHeld(): pass player num rather
than formatted text. Client code can use new
model_getPlayersLastScore() or whatever else it wants to build text to
show the user.
2011-09-02 18:36:03 -07:00
Andy2
e94524958f get rid of util_setInTrade(); fix passing of selBits when trading
(broken with prev checkin.)
2011-09-01 19:51:26 -07:00
Eric House
c01981bc8f Make miniwindow stuff compile-time optional. The goal's to use native
features where they look better or are easier to manage, e.g. Toasts
and dialogs on Android.
2011-08-29 20:36:01 -07:00
Andy2
828bd9aa4c fire user error rather than committing turn when trade attempted
without any tiles selected.
2011-03-07 06:28:43 -08:00
Andy2
4a12f7a96f Revert "in attempt to work around non-random rand() in jni world, call back"
This reverts commit 99c92e779d.

Conflicts:

	xwords4/android/XWords4/jni/utilwrapper.c
2010-12-07 18:43:53 -08:00
Andy2
99c92e779d in attempt to work around non-random rand() in jni world, call back
into the java world by making it a util_ctxt function.  Do same on
linux to test.  We'll see how it is -- and can back this commit out if
there's no improvement.
2010-12-02 19:02:36 -08:00
Eric House
61b228f189 implement simple chat on top of current server-level protocol --
meaning it'll work on any tranport but relay doesn't know about it.
(If relay knew about it I could send a "shutting down for a minute"
message to every connected device, which would be cool.  But this is
easier.)  Written, BTW, enroute from Seattle with help from beer from
Chris in first class. :-)
2010-10-03 18:11:51 -07:00
Andy2
20312144dd tons of changes, still rough, snapshoted here: a gtk device vs device
game works to completion with both signing up as guests (no -s) with
one local and one remote player (identical commandlines.)  Not yet
tested: if any signs up as a host, reconnecting rather than
connecting, etc.  This is just a snapshot.
2010-09-10 01:30:40 -07:00
eehouse
774d3f8a13 copyright change 2010-04-08 04:14:34 +00:00
eehouse
d263b47a56 lots of changes, still rough, to allow zooming in and out on board.
Includes ability to scroll horizontally by dragging.  Board init API
changes to specify board width and max height instead of cell
dimensions, so now board owns task of picking cell size.  If the
number of cells does not evenly divide into a board dimension then the
extra pixels are distributed among some columns/rows in a way that
still allows bitblit-based scroll implementations (though horizontal
scrolling at this point always does an invalAll()).  Not yet tested
with overlapping tray.  And still need to allow rows to be taller than
cols are wide if platform code has given the space.  Stream format
changes with this checkin.
2010-04-08 04:14:14 +00:00
eehouse
eb3d0308e0 add const 2010-02-24 04:34:22 +00:00
ehouse
a13e1d6488 add util_clearTimer, implement on all platforms, and call when closing
comms to fix crash on Wince when timer fired after comms had been
deleted.  The closure stored and passed in was no longer a valid ptr.
2009-09-21 12:49:08 +00:00
ehouse
669e423ca8 Use new dict API to get rid of XP_UCHAR4 type, replacing with const XP_UCHAR*. 2009-04-07 04:23:56 +00:00
ehouse
e570d692b5 cleanup. SMS, not BT, is the default conType for other than Palm. 2009-01-05 02:07:30 +00:00
ehouse
e32e231dd5 New stream version makes standalone and multi-device build formats the
same so new Wince can open files saved by current version.  Tweaks to
build with relay and heartbeat turned on.
2009-01-03 23:54:25 +00:00
ehouse
77d14163b1 track focus on Rem: region of scoreboard in addition to players' score
areas, pass into draw whether to show it highlighted, and fire a util
method when it's clicked on.  Intent is that platforms show the
remaining tiles dialog.
2008-10-24 08:56:20 +00:00
ehouse
ac0a9f4ac5 Put up dialog when user asks for hint and the feature's disabled. 2008-07-24 12:37:05 +00:00
ehouse
f749fdd560 Remove all tabs. No code changes. 2008-05-31 03:26:16 +00:00
ehouse
ebad668227 add some consts. 2008-05-06 12:49:37 +00:00
ehouse
c2fbb06438 force miniwindow entirely onto board even if natural position is on
tray; fix overdrawing onto miniwindow by making timer proc return a
boolean and only redrawing (on wince) when it's true.
2008-04-12 15:36:31 +00:00
ehouse
ff254fcef4 add ability to scroll the board by dragging it. add new method
util_altKeyDown to allow user to choose between scrolling board and
dragging the hint rect when both are possible.  add adjustYOffset;
make it and board_setYOffset more tolerant of out-of-bounds inputs and
use that to simplify calling code.
2008-04-08 03:55:53 +00:00
ehouse
4c730be669 make new turnChanged notification compile-time conditional 2008-02-27 05:43:27 +00:00
ehouse
b397c30178 add and call util_turnChanged 2008-02-26 13:46:33 +00:00
ehouse
ff7a3bfe63 Error code used with method to check consistency of BT address. 2008-01-07 01:11:29 +00:00
ehouse
08da013d4d Warn user, and refuse to continue, when new game is as host and has no remote players. API
changes, so other platforms won't compile until changed.
2008-01-04 14:47:52 +00:00
ehouse
d5d29adc0c Change util function to use signed type; other cleanup to compile with various features. 2007-12-05 06:28:51 +00:00
ehouse
4c8cf98d24 Add and set a compile-time option so comms will set a periodic timer
and use it to send and check for heartbeats over any transport.
Caller must supply a reset proc which is called when heartbeat hasn't
been received in too long.  No changes required to comms protocol, but
that means the heartbeat interval is fixed at compile time: can't be
negotiated, and the two ends had better agree.  Currently tested with
linux host and PalmOS guest, where only the first heartbeat failure is
recovered from.  So there's some debugging to be done still.
2007-11-18 23:43:27 +00:00