Commit graph

1521 commits

Author SHA1 Message Date
Eric House
9f1f1aeee7 only harvest when closing game 2020-10-01 13:39:02 -07:00
Eric House
21483cf861 add missing file 2020-09-30 20:38:44 -07:00
Eric House
f90d76329b use semaphore to protect known players data
Requires adding a common method called by platform code on creating a
new dutil ctxt.
2020-09-30 17:21:18 -07:00
Eric House
dbde9c87ae list known player in invite info where known
(for mqtt only)
2020-09-30 10:10:43 -07:00
Eric House
2b56b1f8b2 cleanup 2020-09-29 16:06:59 -07:00
Eric House
eb728e4368 fix crash: don't go beyond last edge
An obscure pattern from a user caught this one, but the test should have
been there all along.
2020-09-28 19:18:09 -07:00
Eric House
e9ec30206d add debug-only field tracking place in iterator 2020-09-28 19:18:04 -07:00
Eric House
7b097ea67d Don't allow duplicates when renaming 2020-09-28 11:17:51 -07:00
Eric House
8406d9e551 implement Known Player renaming
Used existing GameNamer which now needs to be made more general.
2020-09-28 08:59:39 -07:00
Eric House
aff75053ac implement deleting known players 2020-09-27 20:52:56 -07:00
Eric House
9e78e47954 fix so non-drag movement stops timer to show words
The last change meant the test whether to show the words under the
pen-down cell would pass when it shouldn't because a drag to an occupied
location didn't register as movement. Change so movement counts to stop
the timer even if it wouldn't change the drag-target's location.
2020-09-27 17:32:23 -07:00
Eric House
80160d740f null-terminate words buffer 2020-09-27 14:23:39 -07:00
Eric House
7fe249ad8d Don't allow drag of tile to place it can't be
Rather than have a tile revert to its original location if it's dropped
where it can't be (on an occupied tile or outside the board), put it in
the last place it could have been. Do that by only updating cur when
it's to a legal location, and then relocating to cur when drag ends.
2020-09-27 13:44:21 -07:00
Eric House
b0c1c5ac1b don't deref ptr after free(); cleanup 2020-09-26 11:00:11 -07:00
Eric House
fad252d8c0 use created stamp to decide between conflicting addresses
Not at all tested, but now the game's timestamp is kept and passed in to
where it can be used to determine, e.g., which of two Bluetooth device
names to keep for a given opponent.
2020-09-26 09:48:35 -07:00
Eric House
c4b55385a3 add creation timestamp to game struct
Address resolution will want to know which address is older. Game
creation is a good enough proxy for that, so add it in a cross-platform
way.
2020-09-26 09:48:35 -07:00
Eric House
f0f2a598e0 make up new name rather than drop new player 2020-09-26 09:48:35 -07:00
Eric House
49909c84d6 make known-player stuff conditional
and ifdefs to C and BuildConfig flag to java so the feature can be
hidden in release builds until it's ready.
2020-09-26 09:48:35 -07:00
Eric House
fc05612b74 rough implementation of creating and inviting a known player
Followed the way rematch works. Which is gross. Eventually the two
paths (invitee and rematch) should be unified with rematch getting a lot
simpler.)
2020-09-26 09:48:35 -07:00
Eric House
11266ece5b gtk known-player invitation works 2020-09-26 09:48:35 -07:00
Eric House
736c9f3503 harvest players on open; save and make available
Got as far as having gtk client display list of previously harvested
known players to be invited. Their addresses, or at least mqtt ids are
saved. Next is to actually invite one.
2020-09-26 09:48:35 -07:00
Eric House
43c1e13563 remove dead code 2020-09-23 12:01:17 -07:00
Eric House
8072a0c629 write 0 where flags will be
unused for now.
2020-09-22 10:56:06 -07:00
Eric House
e4594f36e0 generate new mqtt devid when server reports dupe
Thanks to my use of unseeded() rand() early on to generate mqtt device
IDs, a handful of devices are using the same devIDs. The server notices
this and passes a new response which triggers generating a new id that
should be unique (rand() being seeded earlier now.) Testing says the
games that are left behind with the old devid will limp along thanks to
their relay connection while newer games will be better.
2020-09-13 15:06:08 -07:00
Eric House
36cc6cc9d6 fix two bits never being set 2020-09-12 21:23:02 -07:00
Eric House
e26fd23df1 add addrType to comms' main addr when added to channel
I'm fixing android client not showing stats for or allowing to disable
mqtt after it's added automatically to a game that connects
otherwise. Problem was that only the channel got the mqtt address
flag. So now add the flag for any type that's added.
2020-09-10 15:11:22 -07:00
Eric House
79324032b9 remove dead code 2020-09-07 17:59:53 -07:00
Eric House
93a98820e1 cleanup 2020-09-06 14:06:51 -07:00
Eric House
8c3c1b59f6 cleanup 2020-09-05 17:52:00 -07:00
Eric House
1c6d28633f don't let keys change with every upgrade (use newest)
Supid bug generating keys from __FILE__ meant each release
build (usually done in /tmp/$$, or on a travis server) had a new key and
generated a new MQTT devID (and other stuff less frequently used.)
Replace the keys with something that won't change, and as a temporary
fix so the upgrade including this fix doesn't generate new keys use the
most recent stored key matching the suffix the old keys will have had in
common.
2020-09-04 20:51:44 -07:00
Eric House
5998132d4b fix standalone hang introduced by 15f95b52a 2020-08-27 19:47:10 -07:00
Eric House
15f95b52a9 hack to recover from stalled by-room-name games 2020-08-26 13:04:02 -07:00
Eric House
5c150d2f58 don't save isServer in comms
Pass it in so don't have to keep two state locations in sync
2020-08-25 22:27:43 -07:00
Eric House
b0f7176b6c fix relay game failure to change roles
If a configured-as-host game joined an existing game the relay would
make it a guest. The android util_ callback for that change was only
implemented in BoardDelegate and so the change was dropped unless the
game was open/visible. Because comms recorded the change, though, the
callback would never be called again and so the game never learned to
behave as a guest and never registered: permanent failure to join game!
Implemented with a new server state so initClientConnection can be
called from server_do() instead of inside comms while processing an
incoming packet.
2020-08-25 14:53:33 -07:00
Eric House
15fde8044f make server_initClientConnection() make its own stream 2020-08-25 14:53:28 -07:00
Eric House
d10d2597d4 add logging; cleanup
I'm chasing a relay problem that's hard to repro and need more info when
it's happened. (These won't show up in shipping builds.)
2020-08-24 17:02:49 -07:00
Eric House
a7acc37395 adding logging 2020-08-24 12:10:25 -07:00
Eric House
99d47fd067 log number of channels 2020-08-23 20:09:21 -07:00
Eric House
55c50ca8b6 don't try to send via mqtt when to dest address 2020-08-23 19:08:29 -07:00
Eric House
587735f607 make gameID's random
using current clock might lead to conflicts
2020-08-23 09:08:40 -07:00
Eric House
0f61a6d9f4 pass and use mqttid in game-connection code
To avoid inviteless relay games not having an mqtt channel (and so
yielding a crappy experience) pass the mqtt devid when device registers
and when server replies with all-here.
2020-08-23 08:34:12 -07:00
Eric House
bd53824d95 replace assert fail with message rejection
Some relay bug (I think) misroutes or duplicates packets. Don't assert
as that means test scripts fail to finish. Instead drop the
message. Scripts seem to recover ok with this change and I've never seen
the assert on a device so suspect it's test-world only
2020-08-23 08:22:21 -07:00
Eric House
55cb36d091 cleanup 2020-08-16 19:29:42 -07:00
Eric House
8511c633ee Merge android_translate branch 2020-08-12 16:50:34 -07:00
Eric House
7a43e95aa8 fix crashes when filter strings are too long 2020-08-11 14:13:11 -07:00
Eric House
0f9bcd9898 let user choose between tile-spellings 2020-08-06 11:37:05 -07:00
Eric House
b8f359c3e5 add filtering to wordlist browser
Add a basic regular expression engine to the dictiter, and to the UI add
the ability to filter for "starts with", "contains" and "ends with",
which translate into ANDed RE_*, _*RE_* and _*RE, respectively (with
_ standing for blank/wildcard). The engine's tightly integrated with the
next/prevWord() functions for greatest possible speed, but unless
there's no pattern does slow things down a bit (especially when "ENDS
WITH" is used.) The full engine is not exposed (users can't provide raw
REs), and while the parser will accept nesting (e.g. ([AB]_*[CD]){2,5}
to mean words from 2-5 tiles long starting with A or B and ending with C
or D) the engine can't handle it. Which is why filtering for word length
is handled separately from REs (but also tightly integrated.)

Users can enter strings that don't map to tiles. They now get an
error. It made sense for the error alert to have a "Show tiles"
button, so there's now a dialog listing all the tiles in a wordlist,
something the browser has needed all along.
2020-08-05 09:47:44 -07:00
Eric House
fe7e85c93d fix to store mqtt id using properly-named key
And throw in temporary code so those of us testing the stuff don't have
all our existing games stop working.
2020-07-25 13:58:29 -07:00
Eric House
436d3c2ad0 fix crashes rematching from linux a games started on android
Didn't handle the case where a game included NFC or BT. I should
probably be stripping those on receipt as I think the android side does
when the devices doesn't support 'em. And that in turn should be common/
code. So just fix it for now so testing can continue.
2020-06-04 11:37:07 -07:00
Eric House
5f31fedf70 handle new mqtt fcm message
Not sure yet how to restart, but this is a try
2020-06-03 18:53:10 -07:00