Commit graph

1204 commits

Author SHA1 Message Date
Eric House
43b1e219f3 add a bit more logging to comms 2012-11-13 06:14:36 -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
f1ee77882b Send devid with RECONN as well as CONN so games present when device
upgrades can also use GCM.  Tested on relay but not device.
2012-11-09 06:54:12 -08:00
Eric House
9ad28908bb assert enum within range 2012-11-06 07:07:14 -08:00
Eric House
03108f311a Merge branch 'android_branch' into android_gcm 2012-11-05 06:14:21 -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
e66ddc3765 make stream_catString work with null ptr 2012-11-01 21:08:58 -07:00
Eric House
7135e30fe9 add missing ifdef 2012-11-01 07:58:36 -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
e7d5be06e9 fix crash when old client connects to new host by making host use the
right version test in deciding what to send.
2012-10-27 08:52:54 -07:00
Eric House
b097e0825e fix linux crash do to casting problem 2012-10-26 06:49:15 -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
13c74cfbd5 protect changeDict feature with compile-time flags (since it can't be
used on Android)
2012-10-24 06:46:54 -07:00
Eric House
c69dbda36f add new game_changeDict() and enough gtk code to test it. 2012-10-23 19:06:00 -07:00
Eric House
528c061156 report host-chosen dict name a bit later 2012-10-15 06:21:08 -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
3221fb237a Make state disallow hints when game over 2012-10-08 07:21:36 -07:00
Eric House
e64ecfb78d implement resign on top of existing endGame logic, adding "quitter" as
new param passed to remote and changing final score formatting and
menu items to match.  Still need to show old menu on android in case
where game has already ended.
2012-10-07 12:47:06 -07:00
Eric House
4e0c7923d9 fix bug with clean target introduced when BUILD_DIR was introduced 2012-10-07 12:14:47 -07:00
Eric House
968340f665 Fix release-build warnings that new compiler flags. 2012-10-07 11:43:50 -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
94103a4212 track time of most recent turn start, and include it in summary table. 2012-09-27 06:55:46 -07:00
Eric House
6ddd4a61c1 fix compile errors (mostly unused variables) found by gcc on latest
Ubuntu (12.04).
2012-09-25 07:28:02 -07:00
Eric House
140c982d41 merge from android_branch 2012-09-24 07:39:44 -07:00
Eric House
4fa5c61e14 add option to build in a separate directory, for e.g. case where source files
are on ro filesystem.
2012-09-17 06:48:53 -07:00
Eric House
ad67f31573 saveToken can be 0 when only gi is being saved 2012-09-15 15:19:23 -07:00
Eric House
4f18f01cb8 don't malloc(0) 2012-09-11 19:17:10 -07:00
Eric House
5c683f173a add mem_stream_make_sized, meant to make saving games more efficient 2012-09-11 19:06:27 -07:00
Eric House
0ccc2331b5 address bug where message was getting ACK'd by a device that failed to
save what it had ACK'd leaving the game permanently broken.  Do that
by adding a new method game_saveSucceeded() called after the client
claims to have committed bytes returned by game_writeToStream() to
disk.  In that method comms updates the value it'll use in subseqent
ACKs.
2012-09-10 07:31:45 -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
9a72f252ed Merge branch 'android_branch' into android_dictname 2012-09-08 13:20:59 -07:00
Eric House
7d51ee99d9 add dict_getMd5Sum 2012-09-08 10:09:31 -07:00
Eric House
5fa9b60846 add md5Sum field to dict struct, and on linux load it if present,
otherwise calculate it.  In DEBUG builds always calculate and assert
they match.
2012-09-07 20:34:06 -07:00
Eric House
07e6239699 transmit name of failing dict 2012-09-06 08:01:11 -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
2f8b6cceb5 pass additional param into callback -- unused so far. 2012-09-06 07:19:12 -07:00
Eric House
4325d4e709 Merge branch 'android_branch' into android_dictname 2012-09-05 19:30:50 -07:00
Eric House
1ec03e48bb plug leak: don't alloc stream when it won't be used 2012-09-05 19:09:01 -07:00
Eric House
71c1fc527a add counter to mpool tracking so easier to find source of leaks 2012-09-05 19:08:22 -07:00
Eric House
270a19f3aa Revert "first of a set of changes to communicate to clients dictionary being"
This reverts commit b7a0f1489b, which I didn't mean to check in on this branch.
2012-09-03 21:34:51 -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
b7a0f1489b 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:29:21 -07:00
Eric House
4cb848582e fix edge cases in prefix matching 2012-08-28 07:35:11 -07:00
Eric House
145317426d Fix prefix matching to accept letters constituting the first part of a
digraph tile when at the end of a prefix so that e.g. GORIL in Catalan
will list GORIL·LA (rather than nothing since GORIL, ending with the L
tile, is not a prefix.)
2012-08-27 21:50:09 -07:00
Eric House
fddd2c4ed5 fix bug in dict_tilesToString that occurred only when a language had
two tiles starting with the same letter: use recursive search to try
both paths in such cases.
2012-08-27 07:10:40 -07:00
Eric House
9d174601b9 add field, and getter, for new dict header description string, and
load it in linux client.
2012-08-26 20:58:28 -07:00
Eric House
67ddbf140b remove comment unintentionally committed 2012-08-23 06:38:45 -07:00
Eric House
c13971e3d8 convert a few more variable names from single- to double-letter 2012-08-23 06:38:29 -07:00
Eric House
32e1530d3f i => ii; no other change 2012-08-22 07:44:21 -07:00
Eric House
de87b32bb8 fix bug the right way this time: it's ok for a word not to be in the
current player's wordlist when the most recent move's being reported,
but not to ignore word legality altogether.
2012-08-15 18:11:16 -07:00
Eric House
de9a408b15 Revert "Fix bug where if word being scored for long-touch-on-scoreboard wasn't"
This reverts commit 07912bdcdb.
Problem is it breaks WARN-PHONIES
2012-08-15 18:01:36 -07:00
Eric House
25e65d3e6f cleanup: don't return from middle of function 2012-08-12 19:45:54 -07:00
Eric House
07912bdcdb Fix bug where if word being scored for long-touch-on-scoreboard wasn't
in current player's dictionary it'd show up empty: word, once played,
needn't be legal to be displayed.
2012-08-12 19:25:16 -07:00
Eric House
eb8401bb7a fix bug when turn lost for phonies in networked game: what's sent must
match what's expected.
2012-08-12 11:52:20 -07:00
Eric House
464696566d get rid of NODE_CAN_4. Not change to post-compiled code 2012-08-01 20:29:15 -07:00
Eric House
8f04bfadaf modify engine score ranking to include estimate of bonus to be earned
if all tiles are used (ending the game and triggering penalties for
other players.)  Changes are protected by compile-time flags currently
not turned on.
2012-07-29 08:35:08 -07:00
Eric House
9b0436d1ee Make rem string measure function return boolean to indicate rect will
be invisible rather than setting width and height to 0.  No real
change beyond simplifying/speeding platform code.
2012-07-15 09:30:27 -07:00
Eric House
b02855b00c sort tray after an undo adds tiles 2012-07-12 06:48:09 -07:00
Eric House
bfc68656cb move arrow to where removed tile was, and set its direction based on
whether removed tile and the next tile are in the same column or row.
2012-07-10 18:00:23 -07:00
Eric House
bd70a1dd7d improve text in remaining tiles dialog, and always show the tiles for
all trays rather than excluding those in current player's tray.
2012-07-09 21:44:29 -07:00
Eric House
09a81a2639 add some consts 2012-07-09 21:36:17 -07:00
Eric House
6da3f10855 cleanup -- no code change 2012-07-09 06:15:02 -07:00
Eric House
318cc52f5a we need the base64 stuff even when don't have SMS -- for serialization. 2012-07-07 11:05:45 -07:00
Eric House
c272491db6 add compile-time option to have tap on empty tray space return one
tile instead of all of them.
2012-06-29 06:50:46 -07:00
Eric House
c8cd2d500a fix to compile and save player score rect info for non-keyboard-nav case 2012-06-27 07:04:36 -07:00
Eric House
2fc2a60842 create alternate scoreboard draw flow, disabled by compile-time flag,
that does layout and draw in a single pass and with more information
so platform has more responsibilty for dealing with space constraints
and can, I hope, do a better job.  There's no change until the flag is
turned on.  Works for GTK with flag on, but is stubbed out for ncurses.
2012-06-26 07:20:09 -07:00
Eric House
d8e4b6481c make rectContainsRect public so can be used in assert 2012-06-26 07:15:26 -07:00
Eric House
405cb23023 fix bug where current player's scoreboard would disappear if other
players' names were too long by giving all a the same proportion of
what they request and passing in the percent given in case draw
implementation wants to use it as a cue to truncate.
2012-06-15 06:26:40 -07:00
Eric House
60a4f123a2 include trayVisState in GameStateInfo 2012-06-05 22:13:26 -07:00
Eric House
821add6df5 fix to compile when HASH_STREAM not defined 2012-05-29 07:19:19 -07:00
Eric House
adadc9c90c use new hash algorithm for new stream version, old for previous
versions.  Tested upgrade scenario from b44: works.
2012-05-28 11:07:59 -07:00
Eric House
0b1a9a67fe add param to server_handleUndo to prevent it from undoing all moves in
robot-vs-robot game, which is the wrong thing to do during a test
simulating play.
2012-05-24 22:25:30 -07:00
Eric House
0cb217496e cleanup 2012-05-24 22:22:00 -07:00
Eric House
9354e0e0cd fix off-by-one error in stream_copyBits that seems to have been
responsible for HASH_STREAM not working.
2012-05-24 22:16:22 -07:00
Eric House
60e1d50f43 add stream_copyBits, and use it to hash the move stack -- commented
out via conditional compile as it still doesn't work in all cases.
2012-05-22 19:24:54 -07:00
Eric House
2564a660ad remove logging 2012-05-18 21:23:12 -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
d846f96ec5 post-code-review cleanup: no significant change 2012-05-09 06:51:06 -07:00
Eric House
155df55b5c break hash finishing stuff out to be called only once 2012-05-07 20:48:00 -07:00
Eric House
08f03af2cc don't write gameID as 32 bits when it's bound for old-version client,
and assert based only on the lower 16 bits in case came from
old-version client.  Fixes crashes testing mid-game upgrade from beta
43.
2012-05-07 07:02:43 -07:00
Eric House
3b3439371f Merge branch 'android_branch' into android_bt 2012-05-05 17:33:21 -07:00
Eric House
5104ca6bc5 always sort tiles prior to including in hash -- as a fix for the case
where a game is opened that was created by an earlier version that
didn't save assigned tiles in sorted order.
2012-05-05 17:33:07 -07:00
Eric House
64199c4e64 Merge branch 'android_branch' into android_bt 2012-05-05 11:08:03 -07:00
Eric House
058cbc4e1b first attempt, commented out, to hash the stream directly rather than
its exploded contents.  Does't work once there's been some undo
activity as I don't have a way to get the length of the stack below
the undo/redo line.  Looks promising though.
2012-05-05 10:47:28 -07:00
Eric House
eb2f5ff6eb sort assigned tiles before putting them in the move stack. Fixes hash
comparison failure when devices are using sort-tiles option.
2012-05-05 09:47:57 -07:00
Eric House
d59b19514b Merge branch 'android_branch' into android_bt 2012-05-03 21:44:35 -07:00
Eric House
de3107271d changes to make hashing work -- make sure unused space in structs is 0
-- and to detect when an incoming move doesn't make sense.  These
latter changes may not be necessary now that hash code is checked
first thing, but can't hurt, and there will be devices without hash
codes for a while.
2012-05-03 19:02:42 -07:00
Eric House
47dde6cf3c init bitfield to 0 in case I want to hash stream directly 2012-05-03 19:00:43 -07:00
Eric House
652fe6dd64 fix test: unsigned can't drop below 0 2012-05-02 20:42:45 -07:00
Eric House
26913c5a37 get rid of excessive logging 2012-05-02 20:41:46 -07:00
Eric House
09f9038cff add option to have robot choose to trade tiles a configurable percent
of the time.  Meant to increase automated test coverage of trades.
2012-05-02 20:14:42 -07:00
Eric House
c52db8a8f0 toward better recovery from out-of-sync move and undo: include a hash
of the move stack with every turn (version permitting), and drop
incoming moves created against a move stack different from ours.
2012-05-01 07:58:11 -07:00
Eric House
0e07fab731 add stack_getHash() -- returning hash of current move stack (excluding
any pending redos)
2012-05-01 07:56:45 -07:00
Eric House
89ca45357a add pool_containsTiles() 2012-05-01 07:49:41 -07:00
Eric House
c15b56199c use marker enum to test for size. no code change 2012-04-22 17:55:53 -07:00
Eric House
033a69be8d to make it easier to tell games apart, print the number[s] of the
remote device[s] as part of summary view and in game config screen
(read-only).  Use same field in summaries table for remote phone
numbers and bt addresses.
2012-04-18 23:23:36 -07:00
Eric House
416a1054a7 Merge branch 'android_ack' into android_bt
Conflicts:
	xwords4/common/comms.c
	xwords4/common/comtypes.h
2012-04-13 20:57:35 -07:00
Eric House
f22d9530b1 track what's been ack'd, and add method to ack what hasn't been. 2012-04-13 20:21:59 -07:00
Eric House
404265565b tighten definition of connected BT or SMS game 2012-04-12 22:14:13 -07:00
Eric House
ac06d730f8 fix so chat works on SMS (and BT, though untested) 2012-03-24 12:04:07 -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
9caeff4a5e recover a bit better from messages not meant for me, as is happening
when a devices sends to self via SMS and client winds up getting a
registration message it just sent.  Not perfect yet (and may require a
change in the comms protocol -- that's not versioned :-(.
2012-03-19 07:35:20 -07:00
Eric House
cd8889f90e Merge branch 'android_branch' into android_bt
Conflicts:
	xwords4/android/XWords4/src/org/eehouse/android/xw4/DlgDelegate.java
	xwords4/linux/Makefile
2012-03-12 07:04:06 -07:00
Eric House
3b5dcdc2e0 add const param decls; remove redundant method call 2012-03-12 06:59:08 -07:00
Eric House
f51c0b39e6 use const where possible for game_writeToStream and others it calls.
No other code changes.
2012-03-11 18:28:14 -07:00
Eric House
07fba2c71b Fix problem with writing server to stream changing its internal state
so that snapshotting made score strings disappear.  Also rename
stream_copyFromStream to stream_getFromStream to make it clearer that
the src is modified.  And swap params in stream_setPos().
2012-03-11 14:57:28 -07:00
Eric House
5c11f1b284 add XP_LOGSTREAM 2012-03-11 14:46:03 -07:00
Eric House
a2493ffa97 Merge branch 'android_branch' into android_bt 2012-03-06 07:47:05 -08:00
Eric House
24ac205917 cleanup -- no behavior change 2012-03-06 06:23:04 -08:00
Eric House
eec1cb00a1 wrap UUID in #ifdef XWFEATURE_BLUETOOTH 2012-02-27 20:30:48 -08:00
Eric House
9a2b488183 Merge branch 'android_branch' into android_bt 2012-02-14 16:56:20 -08:00
Eric House
914fa857be return COMMS_CONN_NONE as address type of null comms rather than asserting. 2012-02-14 16:54:19 -08:00
Eric House
1ed1bce7d1 call informMissing after loading game -- before that it'll never be 0. 2012-02-12 22:27:58 -08: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
Eric House
7214b7e12a turn off the palmos-era bt wrapper stuff I was trying to use to know
when to reset the stack.  It breaks Android when I turn on
XWFEATURE_BLUETOOTH and adds no value I can see.
2012-02-07 17:38:24 -08:00
Eric House
47c3bd3090 track a BT game's set (singleton for two-device game) of remote
devices in summary DB so, e.g., we can quickly determine what games
care when a devices becomes available via BT.  First use of this is
notifying when a remote game's deleted -- least that's the plan.  This
commit just adds to the DB and scans the DB to build a map of
device->gameIDs array.
2012-02-06 19:02:19 -08:00
Eric House
606e733b19 add _ to typedef to reduce number of etags hits on name. No code change. 2012-02-06 06:27:53 -08:00
Eric House
6326e45892 make btAddr a string rather than array of bytes. 2012-01-31 18:43:26 -08:00
Eric House
6bfd6e74e6 Merge branch 'android_branch' into android_bt 2012-01-26 06:24:18 -08:00
Eric House
866aeb2387 change relay connect message format to include client version (meaning
of which is TBD).  When a new-version client connects, store the value
it's passed. At first this will let me track how quickly people
upgrade.  Later I can use it to let different clients have different
formats to their messages e.g. to proxy.
2012-01-26 05:43:54 -08:00
Eric House
0934f83106 add gameID to params passed to comms' sendproc, including passing
through to java layer.
2012-01-25 18:27:37 -08:00
Eric House
a34921155f make gameID consistently 32 bits in C code. It's been stored as 16,
so stream version must change.  Plan's to use it to address incoming
BT packets so a game needn't be open to receive.
2012-01-19 18:47:53 -08:00
Eric House
5f77ef6e13 get uuid from C code so can ensure linux version has same. 2012-01-19 18:28:27 -08:00
Eric House
814e4dd088 cut some logging 2012-01-03 18:53:58 -08:00
Andy2
2a34cd1e05 remove second param from server_do() -- it doesn't work anyway. 2011-12-21 18:45:05 -08:00
Eric House
b04604595f change assertion to log -- fails very infrequently which is probably to be expected. 2011-12-15 18:37:20 -08:00
Andy2
17edc79aaf Merge branch 'android_branch' into send_in_background
Conflicts:
	xwords4/android/XWords4/src/org/eehouse/android/xw4/XWApp.java
2011-12-06 19:56:10 -08:00
Andy2
b0470d5276 add new preference that when set prevents calculation and drawing of
crosshairs.
2011-12-06 18:17:55 -08:00
eehouse@eehouse.org
e1e8516e1b Merge branch 'android_branch' into send_in_background 2011-12-02 19:04:12 -08:00
Andy2
52d02f04dd pass tile value into drawCell(). Java code doesn't use it yet, but I
want to play with drawing cells tray-tile-style when they're big
enough.
2011-12-02 18:58:52 -08:00
Andy2
08063d9444 Merge branch 'android_branch' into send_in_background
Conflicts:
	xwords4/android/XWords4/src/org/eehouse/android/xw4/NetUtils.java
	xwords4/android/XWords4/src/org/eehouse/android/xw4/XWApp.java
2011-12-01 21:18:37 -08:00
Andy2
3e21b7845a comment 2011-12-01 21:04:31 -08:00
Eric House
cbd455148d comment only. I tracked down the most recent network proto change
from before which devices probably can't upgrade mid-game once the
MAX_COLS=32 change is enabled and wanted to record it.
2011-12-01 20:23:58 -08:00
Eric House
4a32942e57 two fixes that seem to allow old- and new-proto devices to play games
with 15x15 and 17x17 (and presumably larger) with the old games being
upgraded mid-game: when server's new and wants to use a larger board
but not all clients are capable, shrink the board; and, when new
server is opening state saved by pre-upgrade code, assume a non-0
proto version for clients that registered earlier (as old code didn't
save the client's proto version.)
2011-12-01 20:22:16 -08:00
Eric House
1e48a8d615 Merge remote branch 'origin/android_branch' into android_branch
Conflicts:
	xwords4/common/model.c
2011-12-01 20:12:27 -08:00
Eric House
c1e420f726 Merge branch 'android_branch' into send_in_background
Conflicts:
	xwords4/relay/rq.c
2011-11-29 06:45:32 -08:00
Eric House
adb9b3853d fix bugs around new variable-length tiles array changes, and otherwise
improve storage of col/row data so that test runs succeed with
MAX_COLS of 16 or 32.  Still to do: test mid-game upgrade.
2011-11-28 18:46:08 -08:00
Eric House
42d1d2f7bd define variable before it's first used. 2011-11-28 18:21:46 -08:00
Eric House
2bfe120014 do away with need to accept out-of-bounds values in getTileRaw(). 2011-11-23 18:25:12 -08:00
eehouse@eehouse.org
93a7d15a5e Merge remote branch 'origin/send_in_background' into send_in_background 2011-11-23 17:57:54 -08:00
Andy2
d37424ad7f Merge branch 'android_branch' into send_in_background
Conflicts:
	xwords4/linux/linuxutl.h
2011-11-21 22:18:52 -08:00
Andy2
d856b9a8ce Don't behave badly in presence of empty dict: word count should be 0
and sanity test should pass.
2011-11-21 18:06:46 -08:00
Eric House
eec83fe5b6 don't fail when RELAY_ALLHERE comes without a connection, as that will
happen when messages come in background.  I'm not sure what the test
I'm removing was there to catch so need to test thoroughly.
2011-11-21 17:38:50 -08:00
Andy2
872ebe68f4 make array one large to hold word whose len is == max 2011-11-18 21:14:24 -08:00
Andy2
21330af568 make tiles array variable sizes. 32*32*2 is too many bytes to use
when the typical board at 15*15 requires less than 1/4 of that.
2011-11-18 18:59:59 -08:00
Andy2
cc0105e14c add param to dict_countWords in which it accumulates counts per word
length.  Shouldn't hurt speed too much if null passed.
2011-11-18 08:15:21 -08:00
Andy2
598be8b404 MAX_COLS -> MAX_COLS_DICT for dict-related stuff (since dicts are
staying with fewer words for now.)
2011-11-18 07:56:02 -08:00
Andy2
2eac8e70e0 adding missing ifdef 2011-11-18 07:43:37 -08:00
Andy2
37e81fd062 use number of bits based on stream version not current build --
required in case new code is talking with old in networked game.
2011-11-18 07:43:10 -08:00
Andy2
f9c3a95603 move stream version definitions 2011-11-18 07:41:57 -08:00
Andy2
4760ceda5a Merge branch 'android_branch' into android_browsedict
Conflicts:
	xwords4/android/XWords4/jni/anddict.c
2011-11-17 20:55:02 -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
fab39a5f87 Trying to deal with old- and new-proto devices interacting. Fix
clients to append their stream version to their inital connect
message.  (The format can't change, so detecting additional length was
the only option.  comm.c on existing clients won't allow more than one
connect message per channel, so adding a new to be used in addition
didn't work.)  New servers detect this; old will ignore.  Track the
version (implicit or not) of all clients, and use the lowest any
supports, so that new server and all new clients will use newer proto.
2011-11-16 06:47:55 -08:00
Andy2
bdb8e6f03c fix several crashers that prevented network games from working when
MAX_COLS was larger than 16.  In order that old-style messages on
relay be readable by new-style code on device, modified server.c's
protocol to include stream version.  But: unless I come up with a
better way of doing this all devices will have to be upgraded at the
same time: old won't be able to read the new format as it's done here.
2011-11-15 06:13:25 -08:00
Andy2
86d5778ec3 remove 16x16 limitation on board size, replacing with 32x32. Change
is enabled by a compile-time flag so Android needn't follow yet.
2011-11-14 18:21:41 -08:00
Andy2
2492e7cfc5 Merge branch 'android_branch' into send_in_background
Conflicts:
	xwords4/linux/cursesmain.c
2011-11-13 17:10:46 -08:00
Andy2
dddec50f1d Merge branch 'android_branch' into android_browsedict
Conflicts:
	xwords4/android/XWords4/jni/Android.mk
	xwords4/linux/Makefile
	xwords4/linux/linuxmain.c
2011-11-10 19:22:57 -08:00
Eric House
619c25ee49 add a bit of logging to help deciphering test app problems. 2011-11-10 18:28:11 -08:00
Eric House
cee738942e back out earlier change using redo: it was broken. Add assert to
catch problem with passing ptr to tiles as src of tiles.
2011-11-10 18:26:32 -08:00
Eric House
6d98631640 sanity check: make sure tiles are within range. 2011-11-10 18:24:45 -08:00
eehouse@eehouse.org
9f22b11f81 Merge remote branch 'origin/android_branch' into android_branch 2011-11-10 06:54:42 -08:00
Andy2
43a79a0b47 use undo/redo rather than copying stack to figure past move score.
This may have been contributing to crashes, but the new code's more
effecient anyway.
2011-11-10 06:52:33 -08:00
Andy2
645695e358 improve logging, and fix mistyped variable found by inspection rather
because of a problem.
2011-11-10 06:41:07 -08:00
Andy2
b9a7574925 fix emacs header comments; no code change 2011-11-10 06:39:36 -08:00
Andy2
af5c8a096f don't pass a pointer to a tray inside the model to model code that
will modify that tray!  Fixes nasty random crash/assertion failure.
2011-11-10 06:35:05 -08:00
Eric House
268f018140 add dict sanity check that will, I hope, catch corrupt dicts. 2011-11-09 06:51:12 -08:00
Andy2
3707e7aaca tweak to get performance to same level as before length-filtering was
added, mostly by using local variables instead of ptr-accessed in
struct and macro magic to support that.  Passes every test I can think
of on Linux but fast-scrolling broken on Android.
2011-11-05 06:14:35 -07:00
Andy2
da02e994b7 protext min,max with compile-time flag 2011-11-04 06:16:44 -07:00
Eric House
a2319a8073 experimental additions, mostly compile-time disable-able, so prune
dict by wordlen.
2011-11-03 21:25:51 -07:00
Andy2
627410250f reuse existing code in dict_countWords() 2011-11-03 06:18:53 -07:00
Andy2
5c995af38c stop changing formats between internal and external structs
(iterators); use internal format all the time for speed.  Update linux
test code for new API.
2011-11-02 18:32:00 -07:00
Andy2
38867b2875 fix bug in debug free following debug realloc to smaller size 2011-11-02 04:38:39 -07:00
Andy2
eb2b139e48 add some consts and better test for null index data 2011-11-01 18:47:20 -07:00
Andy2
fc4a5c31f4 silence picky compiler 2011-10-31 21:11:52 -07:00
Andy2
0d4404d43b add dict_getStartsWith(), and code to test it. Lots of cleanup and
bugfixing of dictiter code as well.
2011-10-31 21:05:34 -07:00
Andy2
88f556356c dict_tileForString -> dict_tilesForString 2011-10-31 20:56:48 -07:00
Andy2
69b1b4da27 break dict iteration stuff out into new files. No code change
otherwise.
2011-10-31 18:30:55 -07:00
Andy2
1d34c26ebc remove unneeded parama 2011-10-31 06:37:53 -07:00
Andy2
dc58d123d5 combine params into single struct 2011-10-31 06:34:21 -07: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
Eric House
f6ff3e85c6 Merge remote branch 'origin/android_branch' into android_branch
Conflicts:
	xwords4/common/dictnry.c
	xwords4/common/dictnry.h
	xwords4/linux/linuxmain.c
2011-10-28 20:54:55 -07:00
Eric House
71450b02b3 use indexing (and add binary search) to double speed of getNthWord 2011-10-28 20:27:16 -07:00
Eric House
42d1a48a1d don't include indices for prefixes that don't exist. 2011-10-26 22:25:21 -07:00
Eric House
412a58f6b9 make dict_makeIndex work for depth > 1. 2011-10-26 22:20:21 -07:00
Eric House
f2c4e39cd4 add dict_makeIndex(). Works, but only for depth==1 so far (A, not AA or AAA). 2011-10-26 07:10:50 -07:00
Andy2
fc973079dc add first cut at dict_getNthWord. Works. Is slow. 2011-10-25 06:48:16 -07:00
Andy2
ac214236c4 add code to walk dict backwards as well, and test code that
succesfully walks huge dicts in both directions turning out the same
list of words either way.  Still compile-time disabled.
2011-10-24 18:27:16 -07:00
Andy2
7c7cd82e0a add code to iterate over words in a dict. Works on Linux (iterating
forward only) but disabled at compile time.  Idea's to have a dict
browser.  There was some simple refactoring in common code Android
uses, and that tests fine.
2011-10-21 18:51:33 -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
f41d3c27e6 Merge branch 'android_branch' into send_in_background
Conflicts:
	xwords4/common/server.c
2011-10-19 06:23:16 -07:00
Andy2
c2a7a5c347 fix crash: don't destroy stream if for some reason it's null. Not
sure how that happens, but it does.
2011-10-18 21:29:40 -07:00
Andy2
652b7e703a Remove difference between debug- and non-debug stream format. 2011-10-18 21:27:28 -07:00
Andy2
b31e829414 Remove file-format differences between debug and non-debug versions.
Fix curses to compile non-debug.
2011-10-18 18:52:37 -07:00
eehouse@eehouse.org
b8adbd94c1 Merge branch 'android_branch' into send_in_background 2011-10-18 06:47:38 -07:00
Andy2
235259ef45 a bit more tuning of model_listWordsThrough()... 2011-10-17 18:26:04 -07:00
Andy2
3b7532aba8 improve stack_redo() to return the redone move, and use that to avoid
making a copy of the move stack in model_listWordsThrough()
2011-10-17 18:16:19 -07:00
Andy2
9109396ae9 in model_listWordsThrough, only undo as much as needed to find the
move tile that places a tile on the cell we're interested in.
2011-10-17 06:48:59 -07:00
Andy2
8062a027e7 cleanup: NULL's a legal value now. 2011-10-17 06:48:13 -07:00
eehouse@eehouse.org
5afb0ae145 Merge branch 'android_branch' into send_in_background 2011-10-14 22:34:29 -07:00
Andy2
6793742f0f remove option to list all words played in a single lookup dialog, and
supporting code in the jni/common C.
2011-10-14 22:32:30 -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
7449923328 log tiles left in pool -- makes progress of automated/test games
easier to follow.
2011-10-13 19:10:13 -07:00
Eric House
861a24dfeb Merge branch 'android_branch' into send_in_background 2011-10-10 22:42:28 -07:00
Eric House
f86b0dfcc5 fix to compile on x86 (with newer compiler that doesn't like unused variables) 2011-10-10 22:42:02 -07:00
Eric House
eb60bfade7 fix to compile on x86 (with newer compiler that doesn't like unused variables) 2011-10-10 22:40:05 -07:00
Andy2
4bb61401bd fix crash: src and dest stream params were reversed. 2011-10-10 22:24:44 -07:00
eehouse@eehouse.org
99707e4029 Merge branch 'android_branch' into send_in_background 2011-10-10 18:31:30 -07:00
Andy2
d5ca5bbd0d remove misplaced assert: in network games illegal words may well
arrive.
2011-10-10 06:48:07 -07:00
eehouse@eehouse.org
471a9d988d Merge branch 'android_branch' into send_in_background 2011-10-05 07:10:52 -07:00
Andy2
90f11abc37 add to game state passed into java world whether it's the cur selected
player's turn, and use that to enable/disable Pass/Turn done button.
2011-10-05 06:36:01 -07:00
Andy2
dc20b04a4c remove unused param (on the C/jni side) 2011-10-04 18:54:53 -07:00
Andy2
3ec97d5c07 Turn "Turn done" into "Pass" when the pending score is 0. To do that
I had to pass the score into draw_trayBegin since
draw_drawPendingScore() isn't called until the first tile's placed.
Note: as long as I'm messinng with this menuitem it should be disabled
when it's not the player's turn.
2011-10-04 18:48:33 -07:00
eehouse@eehouse.org
82615f409b Merge branch 'android_branch' into send_in_background 2011-10-04 06:49:19 -07:00
Andy2
c04f981442 fix new word-list reporting to work for networked games too: create
and save a second stream parallel to the existing one reporting the
move scoring.  Requires bump in stream version.
2011-10-04 06:44:29 -07:00
Andy2
3cf1d07df3 optimization: set up word-tracking invariants on init rather than each
time used
2011-10-04 06:21:02 -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
8650c997e0 nuke noisy logging -- that stuff works now. 2011-09-30 18:34:31 -07:00
eehouse@eehouse.org
554e497593 Merge branch 'send_in_background' of ssh://xwords.git.sourceforge.net/gitroot/xwords/xwords into send_in_background 2011-09-30 06:39:23 -07:00
Andy2
c952ebd8e6 cleanup 2011-09-30 06:29:14 -07:00
Andy2
8e0e8d911e fix compile errors 2011-09-26 18:12:16 -07:00
Eric House
26ba812aff cleanup 2011-09-22 17:31:57 -07:00
Eric House
f0c3e2c5f0 Merge branch 'android_branch' into send_in_background 2011-09-22 17:22:01 -07:00
Andy2
35a0a3a291 passing pool into word-listing code a mistake as it put tiles back
when undoing and so the pool grew each time.  Fix, and remove server
API as it's unneeded.
2011-09-22 06:41:48 -07:00
Andy2
d000c430b9 thought there was an internal problem with pool and wrote debug-only
code to check.  There wasn't, and it's unused, but no point writing it
again.
2011-09-22 06:40:44 -07:00
Andy2
92614370ce Merge branch 'android_branch' into send_in_background
Conflicts:
	xwords4/common/comms.c
2011-09-20 06:21:54 -07:00
Andy2
43e8bd7879 formatting only 2011-09-18 19:05:29 -07:00
Andy2
26ce5a119a in model_getWordsPlayed, make '\n' a separator rather than a
terminator.  Makes it easier to split in the Java world without
getting an extra empty word.
2011-09-18 19:05:00 -07:00
Andy2
9eacdb3856 add server_listWordsPlayed, and implement via function in model.c that
uses existing stack and undo features to run a WordNotifierInfo over
some number of scoring passes to gather the words seen.  Seems to work
as tested from gtk version.  Now need to try from android....
2011-09-18 17:20:01 -07:00
Andy2
63893b8a0d add stream_getPtr() and use to remove a couple of allocs, including
one per message sent.
2011-09-18 16:54:36 -07:00
eehouse@eehouse.org
98c2617613 Merge branch 'android_branch' into send_in_background 2011-09-14 06:47:12 -07:00
Andy2
f8f06a7768 raise same error when try to commit exchange out-of-turn is raised for
out-of-turn move attempt -- and don't exit exchange mode.
2011-09-12 18:33:33 -07:00
Andy2
e709ea730c only exit exchange mode if user confirms trade 2011-09-09 21:30:40 -07:00
Andy2
c9c498786e add to game state whether any tiles selected. Use that to disable
'commit exchange' button when there's nothing to commit, and get rid
of error message used when committing nothing since it's now
impossible (on Android).
2011-09-09 19:04:25 -07:00
Andy2
66fb5f87fb don't exit trade mode if no tiles selected; fix warning string to match. 2011-09-09 18:40:19 -07:00
Andy2
201db9415c sort tiles after trade too 2011-09-09 18:32:04 -07:00
Eric House
84931f34ff Merge branch 'android_branch' into send_in_background 2011-09-07 21:44:36 -07:00
Andy2
e4b952222a unify two ways of saving words encountered during scoring, removing
one and changing the site that used it to use the other.  Not visible
outside of common, but should make it easier to harvest a list of all
words for one move or the entire game.
2011-09-02 19:11:04 -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
b6a4621617 trivial optimization 2011-09-02 18:34:07 -07:00
Andy2
99679357a8 Exit trade mode on "commit" even if no tiles selected (in keeping with
error message on Android); don't block trade if pending tiles are on
board; instead undo them. There's redo now so there's no need to
confirm, no data loss.
2011-09-02 06:48:06 -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
Andy2
8e45dcd720 exit trade mode only in the case where we're asking user to confirm,
and do it before server can call callback that changes selPlayer so
it'll actually work.
2011-09-01 18:50:09 -07:00
eehouse@eehouse.org
b6e5327b1a Merge branch 'android_branch' into send_in_background 2011-08-31 06:46:42 -07:00
Andy2
9c60a5c05b make sure util_setInTrade() gets called every time internal state
changes, including on creation/load from stream.
2011-08-31 06:33:36 -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
eehouse@eehouse.org
3cdd4c1c9b Merge branch 'android_branch' into send_in_background 2011-08-21 15:04:25 -07:00
Andy2
9612b28b1f use goto to avoid having multiple returns. No behavior change. 2011-08-21 14:20:59 -07:00
Andy2
eb00984563 Merge branch 'android_branch' into send_in_background
Conflicts:
	xwords4/android/XWords4/src/org/eehouse/android/xw4/GameUtils.java
2011-08-20 12:44:17 -07:00
Andy2
7a1346e530 add assert to catch bad dict earlier 2011-08-18 07:49:40 -07:00