Commit graph

1196 commits

Author SHA1 Message Date
Eric House
0b132661ca change struct name from r to rr for easier searching; no code change 2014-02-07 21:12:45 -08:00
Eric House
ca8a901bbb add assertion aimed at confirming theory about race-condition based Android crash 2014-02-07 07:41:50 -08:00
Eric House
e34cc9007d fix problems with opening and using wordlists on 64-bit linux by
making XP_U32 32 rather than 64 bits. Duh. Do same on Android jni just
in case.
2014-01-07 06:58:20 -08:00
Eric House
b43855a313 fix curses build for 64bit compile and to use common layout (meaning
tray is now under the board unstead of to the right).  Works on 64-bit
system at least for non-networked games.
2014-01-05 13:04:59 -08:00
Eric House
3f67afaefb replace tabs with spaces; no code change 2014-01-05 12:57:46 -08:00
Eric House
f46f8ed560 cleanup 2013-12-30 07:08:42 -08:00
Eric House
b2b4c2a1f5 fix android compile errors 2013-12-27 19:32:56 -08:00
Eric House
762945857e fix to work for standalone games too 2013-12-19 07:59:00 -08:00
Eric House
2a47c91a91 add gi_setNPlayers() 2013-12-17 21:54:02 -08:00
Eric House
de41802f54 rename variable so I don't trip up again 2013-12-17 21:08:27 -08:00
Eric House
f1f13c65a2 don't overwrite gameID 2013-12-16 08:05:56 -08:00
Eric House
4420049bd0 remove duplicate lines (added by merge?) 2013-12-16 08:05:35 -08:00
Eric House
b5d6c513a6 add canUndo to GameStateInfo and use to hide the undo menu 2013-12-03 07:06:48 -08:00
Eric House
94216a5fb9 add canTrade to GameStateInfo, pass through to java world, and use to
determine whether to show trade menuitem
2013-12-01 21:53:41 -08:00
Eric House
9fa9ba643f fix linux crash when timers enabled: clear timer while taking down board 2013-12-01 18:50:18 -08:00
Eric House
fc6d6ec707 use local variable 2013-12-01 18:37:21 -08:00
Eric House
6875eaa10a don't draw timer if it has an empty rect 2013-12-01 18:32:51 -08:00
Eric House
9f22386bf6 another assert 2013-11-29 10:15:22 -08:00
Eric House
0cc45ad865 add new field canHideRack to GameStateInfo and use it to disable menu. 2013-11-17 13:54:21 -08:00
Eric House
14c7b7370a fix layout bug where board overlapped tray 2013-11-16 18:31:14 -08:00
Eric House
088dd1bd75 center board when it must be narrower than screen 2013-11-15 20:46:22 -08:00
Eric House
7d1a1228f0 fix bug where scrolling used when shrinking would suffice 2013-11-14 06:56:11 -08:00
Eric House
c9ba7b2fe1 When timer fires for pen held on board, don't do anything if we're in
trade mode.
2013-11-10 07:08:49 -08:00
Eric House
dfdbd9a8a2 pass scoreWidth separately into formatting code so space can be left
for network status icon.
2013-11-09 05:34:23 -08:00
Eric House
38613a85d3 make active rect for empty board 3x3 for a bit more context 2013-11-08 06:34:41 -08:00
Eric House
a26dced506 drawing tray tiles can fail, e.g. when font info not yet available, so
only clear bits when successful. Fixes problem where tray didn't get
drawn until tiles were somehow invalidated.
2013-11-07 07:29:54 -08:00
Eric House
bb80cdfb08 Merge branch 'android_branch' into android_thumbnail
Conflicts:
	xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardCanvas.java
	xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/XwJNI.java
2013-11-07 05:25:51 -08:00
Eric House
499e07d84b follow convention: width usually comes before height 2013-11-05 06:38:48 -08:00
Eric House
9c9a04025a Merge branch 'android_branch' into android_thumbnail
Conflicts:
	xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/XwJNI.java
2013-11-04 06:20:53 -08:00
Eric House
9f1b0c5121 Specify relative height of scoreboard and tray in board_figureLayout,
and allow those to be 0.
2013-11-04 06:19:33 -08:00
Eric House
5a65bca12a add board functions to figure layout (position and size of board,
tray, etc.), removing need for each client to do it itself.
2013-11-03 12:12:25 -08:00
Eric House
b9d0469cfe fix OFFSET_OF ptr size to quiet compiler 2013-11-01 19:09:05 -07:00
Eric House
d7a1f53157 Merge branch 'android_branch' into android_thumbnail
Conflicts:
	xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardView.java
2013-10-31 08:13:39 -07:00
Eric House
182ea7f862 make it possible to set DrawCtxt after opening/creating game 2013-10-31 08:06:44 -07:00
Eric House
88af10552e don't try to draw with null dctx 2013-10-31 06:35:00 -07:00
Eric House
26f5a0b269 add two out params giving number of cols and rows 2013-10-29 07:50:12 -07:00
Eric House
88b380503e add function, not compiled by default, to return bounding rect of all
non-empty tiles. As a test, add menu that uses it to grey out that
region.
2013-10-27 21:51:30 -07:00
Eric House
53e6db5683 remove return from middle of function 2013-10-27 21:47:49 -07:00
Eric House
8fa5e3e4bd drop duplicate packet rather than asserting 2013-09-11 07:30:12 -07:00
Eric House
a25d664eb5 Merge branch 'from_android_beta_65' into android_branch
Conflicts:
	xwords4/android/XWords4/res/raw/changes
	xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardActivity.java
2013-09-09 08:01:28 -07:00
Eric House
94b2eddda6 fix crash by adding byte protocol expects 2013-09-09 07:42:00 -07:00
Eric House
da3f62729b Merge tag 'android_beta_64' into android_branch
beta 64
2013-08-07 06:18:15 -07:00
Eric House
a38fd0e96c fix too-short tray on 10" tablet by making height a 16-bit value, not 8-. 2013-08-06 21:56:10 -07:00
Eric House
1f877c7567 remove logging 2013-07-29 07:29:01 -07:00
Eric House
a191c6fc2a don't add chats to queue at len 64 rather than 128 2013-07-22 06:12:06 -07:00
Eric House
573a87993e Don't propogate chat when queue too full. This *should* only impact
tests since users won't keep chatting at a non-responsive friend.
2013-07-20 08:01:56 -07:00
Eric House
27d9f3de45 Don't enable chat when more than 128 messages are in queue to prevent
an extremely unlikely cause of stalls -- and make tests trip over full
queues less often.
2013-07-18 07:37:45 -07:00
Eric House
62dacb83d8 fix to compile when DEBUG not defined 2013-07-16 08:17:46 -07:00
Eric House
ab1ae7c9ad remove logging 2013-07-12 08:19:53 -07:00
Eric House
9e358ad413 don't insert a new message in queue if it's identical to the one
currently at the end.  This mostly happens when devices are making
several initial client connection attempts before succeeding.
2013-07-12 07:34:12 -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
5462a05692 Merge branch 'gtk_multigame' into android_branch 2013-07-09 19:35:26 -07:00
Eric House
bf1cdf225c print queue less frequently 2013-07-09 19:32:49 -07:00
Eric House
79f07e8751 cleanup 2013-07-09 07:19:20 -07:00
Eric House
d50c808f96 Merge branch 'android_branch' into gtk_multigame
Conflicts:
	xwords4/android/XWords4/src/org/eehouse/android/xw4/DlgDelegate.java
	xwords4/common/comms.c
	xwords4/linux/cursesmain.c
	xwords4/linux/cursesmain.h
	xwords4/linux/gtkmain.c
	xwords4/linux/gtkmain.h
	xwords4/linux/linuxmain.c
	xwords4/linux/main.h
	xwords4/linux/scripts/discon_ok2.sh
	xwords4/relay/xwrelay.cpp

(Note: The curses app crashes on exit with mempool assertions, but that's a problem before the merge.)
2013-07-09 07:18:00 -07:00
Eric House
a3de759d9e fix to compile on Android when DEBUG set 2013-07-07 19:40:07 -07:00
Eric House
923d41e0ee fix to compile when DEBUG not set 2013-07-07 13:17:26 -07:00
Eric House
bbac923f68 assert queueLen at the point where it'll be easier track why it's overgrowing 2013-07-05 21:32:41 -07:00
Eric House
e6248210a5 when formatting final scores, print all players with top score as
Winner (fixing bug that occurred in case of a tie)
2013-07-04 12:37:10 -07:00
Eric House
7229535be7 insist on non-0 channel ID *net of mask*; don't send acks when we
don't have a connID yet, as this confuses the server.  This fixes
assertions in testing that were pretty common when chat was enabled;
it may also fix the reported problem on Android that games get hosed
when people are using chat, as the server's response (without the
assert) was to add a new channel.
2013-07-03 07:39:05 -07:00
Eric House
3364dcbf46 remove unused enum 2013-07-03 07:26:23 -07:00
Eric House
858d00332a when an initial message from a client arrives with channel already
set, drop it (after asserting in debug code.)  I'm not yet sure why
this happens, but giving it a new channel is not the right move.
2013-07-02 18:49:48 -07:00
Eric House
1f63745e34 add more logging in search of channelNo bug 2013-07-01 07:54:38 -07:00
Eric House
c77021231c print checksums of sent and received messages 2013-06-30 08:33:29 -07:00
Eric House
b31858ee5e log rather than assert when hostid changes -- though I'm not seeing
this now that the relay doesn't send packets to the wrong device
2013-06-26 00:42:55 -07:00
Eric House
6d22c3ab86 tweak logging 2013-06-22 05:51:29 -07:00
Eric House
d41c1a4ca8 add new param so pending text can be drawn differently when it's not
the player's turn.
2013-05-30 07:17:13 -07:00
Eric House
8e8b4755b3 bring in changes from gtk_multigame to remove assertion fail when
connname gets changed by relay due to failure to ack it (which happens
when a large number of games is being run in a test.)
2013-05-30 06:48:29 -07:00
Eric House
31c443e4b1 Merge branch 'android_branch' into gtk_multigame
Conflicts:
	xwords4/android/XWords4/src/org/eehouse/android/xw4/GCMIntentService.java
	xwords4/android/XWords4/src/org/eehouse/android/xw4/RelayService.java
2013-05-22 07:01:08 -07:00
Eric House
b58fe30ecc add synonyms to tile counts/values summary 2013-05-14 22:00:22 -07:00
Eric House
7d8cddb31f Merge branch 'android_branch' into gtk_multigame
Conflicts:
	xwords4/linux/gtkmain.c
	xwords4/linux/linuxmain.c
	xwords4/relay/xwrelay.cpp
2013-05-08 07:37:55 -07:00
Eric House
5a026ffda3 merge android_wordlists (local branch) 2013-05-01 06:39:31 -07:00
Eric House
541fc546ab remove that bit from flags -- since we already do the right thing for it. 2013-04-20 19:46:35 -07:00
Eric House
07cfdad699 fix to support synonyms within specials too -- for linux only so far.
Seems to work, though the dawg2dict.pl script is broken.
2013-04-09 07:43:04 -07:00
Eric House
3a628f4375 load new-format dict into linux client, display default faces
correctly, and search using alternate as well as default faces.  Next:
support for alternate specials.
2013-04-06 11:43:57 -07:00
Eric House
567cd2913a Merge remote-tracking branch 'origin/android_branch' into android_branch 2013-04-06 05:32:10 -07:00
Eric House
bd1a909321 assert, in debug-only code, that saved moves alternate between players
and are ordered.  I've seen games in the wild with three moves in a
row by the same player and want to catch this in testing.
2013-03-01 07:49:26 -08:00
Eric House
2bfda1b56d function to print StackMoveType 2013-02-22 21:34:53 -08:00
Eric House
d78a4979da HACK: if gi's notion of gameID is out of sync, force it in (logging
the fact).  I'm not sure why but this is required sometimes on
Android.
2013-01-28 07:01:49 -08:00
Eric House
3e723c72c5 call comms_stop() before closing (removing from memory) a game. 2013-01-28 06:52:32 -08:00
Eric House
3be45a67f7 fix erroneous asserts: it's uncommon but ok for a device to get
assigne a second connname.  (Cause: failure of relay to receive the
device's ACK.)
2013-01-26 18:56:53 -08:00
Eric House
c839db4a25 disconnect from relay no matter what the state 2013-01-22 06:12:55 -08:00
Eric House
f6e7ece578 add comms_stop() and an assert to make sure it's called. Explicit
stop and a message to the relay when using a UDP socket makes up for
there being no notification of connection closing.
2013-01-16 06:31:09 -08:00
Eric House
565b742971 snapshot -- connects to relay but doesn't play yet. 2013-01-07 08:00:47 -08:00
Eric House
e0dc83ed70 rest of what I just meant to commit. 2013-01-05 16:08:47 -08:00
Eric House
4af30c534c snapshot. New game button works and game gets saved in DB. Next: display and open from DB. 2013-01-05 16:08:19 -08: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
83b1d4c364 fix compiler warnings 2012-12-08 06:40:21 -08:00
Eric House
5463535265 don't increase backoff if there wasn't actually anything to send. 2012-11-14 05:42:47 -08:00
Eric House
c4df31892e Fix occasional infinite loop of devices sending and receiving the same
message over and over when getting updated by GCM.  The problem
occurred when one device had an un-ACKable initial message still in
its queue.  I call resendAll a lot, which caused that message to get
resent to the other game which then replied without being able to ACK
it so it remained to be sent again.  This would continue until users
moved forward in the game.  The fix is to add a backoff timer to
resendAll() so that it can't loop.  The timer is reset when an ackable
and new message is received, meaning there's been a change in what's
available to resend.  And since users calling resendAll manually
expect it to do something, add a force param that ignores the backoff.
seems to fix the problem (but needs a lot of testing.)
2012-11-13 21:25:03 -08:00
Eric House
cf8d30ce5d tweak logging; fix uninitialized debug-only variable 2012-11-13 21:18:52 -08:00
Eric House
57ea768aaf refuse to send 0-length messages. That may happen only when the stupid
curses client calls server_initClientConnection over and over, but
reduces unnecessary messaging in that case at least.
2012-11-13 07:22:48 -08:00
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