Commit graph

565 commits

Author SHA1 Message Date
ehouse
38a23ba74f Begin changes for utf8 support (mostly from unicode_branch). Dict now
provides tiles as null-terminated const strings ptrs to which can be
passed and stored.  They're utf8 strings.  Old dicts still work,
platform must convert to utf8 on load.
2009-04-05 19:02:21 +00:00
ehouse
926f5963a3 rename only: stream_putString to stream_catString. 2009-03-29 18:26:59 +00:00
ehouse
d7eaa8e574 Add functions names to log statements. 2009-03-08 19:54:50 +00:00
ehouse
4e1155583f Add support for a config button as a cleaner alternative to launching
comms config dialogs on changes to host type (which often involved
platform-specific hackery to trigger the dialog when user doesn't want
to change role)
2009-03-08 19:54:14 +00:00
ehouse
4909ae0137 Close down relay connection when comms going away. Fixes crashes when
new game is standalone and prev used relay.  Add logging code in comms.
2009-03-06 13:43:03 +00:00
ehouse
213c66b391 Reset all relay-related variable on new game. Fixes bug where devices
couldn't switch roles or join a new game.
2009-02-28 19:27:45 +00:00
ehouse
61c07ba1a3 Make all of a non-server's players local. 2009-02-28 19:25:46 +00:00
ehouse
acb37fda4f fix checkServerRole which was incorrectly counting players in client
case.
2009-02-28 19:25:08 +00:00
ehouse
21d4203fe2 Empty out queue and use existing code to re-add elems we want to keep.
Candidate for 4.2.
2009-02-28 16:11:09 +00:00
ehouse
9abb637330 assert queue ok after deleting. Candidate for moving to 4.2 branch if
to be used for Palm.
2009-02-28 15:06:12 +00:00
ehouse
233bf5ffde Fix crasher: removing ACK'd messages left list in inconsistent state.
Candidate for moving to 4.2 branch if to be used for Palm.
2009-02-28 14:40:50 +00:00
ehouse
8d1289d3b7 Create type to hold array rather than passing array whose lenght is assumed. 2009-02-23 04:01:15 +00:00
ehouse
fb3d4cf2ba Draw arrow only if inval bit set and cell is otherwise unoccupied.
Fixes wince bug where tile dragged onto arrow disappears.  Should be
merged to 4.2 branch.
2009-02-14 16:23:18 +00:00
ehouse
b2acdbae91 Add simple helper for keeping a queue of buffers in a single array. 2009-02-09 02:44:58 +00:00
ehouse
43982e1a07 validate initial message correctly when comms heartbeat not being
used; improve logging.
2009-02-07 18:14:28 +00:00
ehouse
42b314966b If platform doesn't provide a game id, use current seconds. 2009-02-07 18:12:46 +00:00
ehouse
46f72de960 new files into svn:ignore 2009-02-01 16:03:31 +00:00
ehouse
c672fcfafd Make it possible to run same binary against relay with relay heartbeat
and direct with comms heartbeat.  This mostly means changing ifdefs.
2009-02-01 15:50:58 +00:00
ehouse
3a643c51a4 cleanup; set locale based on ENV 2009-01-25 20:31:13 +00:00
ehouse
ac1a88f603 Add __func__ to what's tracked for allocation in debug builds 2009-01-18 16:37:44 +00:00
ehouse
c754726b0f Don't pass valid bitmaps ptr when drawing blank tile. 2009-01-17 18:24:18 +00:00
ehouse
21f5f329a0 Get rid of bogus assert 2009-01-14 13:02:38 +00:00
ehouse
5505c435a2 Don't pass new bitmaps struct to draw code uninitialized 2009-01-14 12:51:55 +00:00
ehouse
6d7a81fce6 change draw api so all available bitmaps (only 2 in current format)
can be passed for tile and cell drawing
2009-01-13 12:57:56 +00:00
ehouse
abeb5376c0 Implement, with help from glib base64 source, routines to turn binary
into SMS-compatible strings and back.  This should ensure that the
format is cross-platform.
2009-01-05 02:08:55 +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
c731e0d231 Remove newlines from debug statements. 2009-01-05 01:59:04 +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
cefd69d8b3 Since there's now a flag indicating whether to show the value of a
tile, make value unsigned.  Adjust/fix platforms.  Add cmdline flag to
linux apps for hiding values.
2008-12-29 03:09:35 +00:00
ehouse
1755267d55 Add support to gtk app for tranport over "sms", with files containing
base64-encoded data as the messages.  Make necessary changes to comms.
This is the foundation for doing real SMS transport on handhelds.
Currently a full robot game works for two gtk clients provided the
server is launched first.
2008-12-29 01:35:29 +00:00
ehouse
7e2f2fd38e invalCellsUnderRect didn't work for rects not intersecting board; fix. 2008-12-16 05:30:25 +00:00
ehouse
13001301ec Indicate tiles whose values should be hidden with a new bit rather
than a negative value.
2008-12-13 07:32:53 +00:00
ehouse
37518415ea fix occasional crash: null-out ptrs after deleting what they point to. 2008-12-11 13:42:21 +00:00
ehouse
af1ca9af84 Quash some compile-time warnings. snprintf instead of sprintf. 2008-12-06 15:59:30 +00:00
ehouse
d3d3dd561f Pass string for tile even when it has a bitmap. Let platform decide which to use. 2008-12-04 06:13:59 +00:00
ehouse
7ae7b91e40 When hideTileValues changes, inval all tray tiles. 2008-12-03 13:38:54 +00:00
ehouse
f8870da48f Don't draw hint rect, or start drag to change it, if hints are disallowed. 2008-12-01 13:06:37 +00:00
ehouse
438be9dd2a When tray overlaps board yet is hidden, should not be on top except
when focussed.  Remember state before gained focus, and restore it
when loses.
2008-12-01 13:04:14 +00:00
ehouse
b78a46e110 When tray overlaps board yet is hidden, should not be on top except
when focussed.  Remember state before gained focus, and restore it
when loses.
2008-12-01 13:03:42 +00:00
ehouse
ce2420840d a bit of cleanup 2008-11-22 19:43:47 +00:00
ehouse
6e9f5791d6 Fix bug: when using hint limits to restrict first move on empty board
limits were ignored for the vertical search.  Fix is to make
special-case treatment of first move more integrated so special limits
code isn't needed.
2008-11-22 19:32:42 +00:00
ehouse
542e441b69 hide focus when pen used, but remember where it was (don't set to
OBJ_NONE) so can replace it when focus keys used again.
2008-11-22 16:37:29 +00:00
ehouse
46b574b4e7 fix inval of focussed tile to take divider into account. 2008-11-20 05:12:48 +00:00
ehouse
d4bc42b0a1 add getters 2008-11-10 16:01:46 +00:00
ehouse
30df2166ab Don't assert when unknown key seen; just ignore. 2008-11-08 16:19:04 +00:00
ehouse
5cb97bf636 New Ubuntu has a stricter compiler... 2008-11-06 03:16:09 +00:00
ehouse
93e615b44c Don't skip over occupied tiles when moving cursor unless alt key is
down.  Smartphone doesn't have an alt key, and this
simplier-to-understand behavior should be the default.
2008-11-02 03:43:33 +00:00
ehouse
4ff04dac84 When tray's not revealed, cursor should travel over all tiles to be
consistent with display of 7 tiles even if some are really on board.
2008-10-31 04:30:58 +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
944789b14c use three bits for scoreboard cursor in anticipate of making Rem selectable. 2008-10-21 03:19:54 +00:00
ehouse
c48f836fe7 back out 2245: having scrollbar be focusable is a better way of allowing scrolling than overloading cursor movement; scroll cursor onscreen when diving and it is off 2008-10-20 02:23:17 +00:00
ehouse
ac5bbced8f mark debug-only formals and wrap in #defines to fix compile-time
warnings of clean wince build.
2008-10-11 17:58:43 +00:00
ehouse
a26f6ad658 flag unusued param to fix compile error; move code used only in
multi-device games inside ifdefs.
2008-10-11 17:30:35 +00:00
ehouse
bbe8cceb6e debug changes: change defines to remove gremlin-only code; add missing constants. 2008-10-11 16:46:08 +00:00
ehouse
018be047ad fix bug: need to reset engine when divider moved via keys as well as
when dragged.
2008-10-10 08:38:23 +00:00
ehouse
d7f17ecbe0 add function for logging location reached when debugging 2008-10-09 12:04:57 +00:00
ehouse
d1603aa543 Fix crash when switching to game with same-language dict: inform draw
even if tile sets the same since old is about to be destroyed.
2008-09-28 16:43:24 +00:00
ehouse
79ec57be8d Bug: tap on hidden tray doesn't reveal it (likely new). Fix by always
reversing hidden tray on giving it focus and by finding tray to be
location of pen even when hidden (but only the part not under the
board.)
2008-09-27 16:59:04 +00:00
ehouse
63422f9c1d When moving cursor within board, scroll board if it's possible to do
so, and only if it is not move the cursor (or if needed to keep it
visible after scroll.)  This makes it easier for users to scroll --
but may not be needed if focussing scrolbar works.
2008-09-27 15:07:48 +00:00
ehouse
eb1f083a19 Require two key events to reveal tray and act on a tile; don't treat
divider as wider (to make it easier to tap on) when keyboard being
used to select.
2008-09-18 03:53:53 +00:00
ehouse
d2cb36029b Had to comment out BLANKS_FIRST to compile new wince font code, so
assert that blank test catches only one tile per dict.
2008-09-09 12:20:09 +00:00
ehouse
61a3602dc5 Don't save dict as part of model. It's redundant as the platform code
already saves the name and passes the dict in.
2008-09-09 12:18:32 +00:00
ehouse
a1f3e3d174 call draw_dictChanged on load so draw can calc fonts immediately 2008-09-09 12:16:06 +00:00
ehouse
36627fb051 Add listeners to model so board can be notified whenever dictionary
changes.  Pass dict into draw via new API, removing it from the
draw_begin calls.
2008-09-05 12:11:37 +00:00
ehouse
bd2eff236c catch up with API changes. GTK to use this still needs to be fixed! 2008-08-30 13:54:47 +00:00
ehouse
5e6ba430fe fix newg_attrChanged to exit quickly when there's no change 2008-08-27 12:09:30 +00:00
ehouse
07e7032c16 give serverRole a default value. 2008-08-27 12:08:07 +00:00
ehouse
454788ad04 better leak debugging 2008-07-28 05:05:39 +00:00
ehouse
6c5e3b7149 draw divider focussed when all of tray has focus 2008-07-28 05:04:34 +00:00
ehouse
0c751cc4d1 Add feature lost when five-way drag of divider became possible: don't
allow focus rect to stop on any empty tray slot but the leftmost.
2008-07-24 12:39:46 +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
fd805791e4 Quiet over-enthusiastic logging of state transitions. 2008-07-18 09:06:09 +00:00
ehouse
47088c8030 Return true on preflight for cursor move so will get called again.
Fixes tray nav on Palm.
2008-07-18 09:05:04 +00:00
ehouse
ab89d78ac8 selInfo can't be left null when board created, as selPlayer is 0.
Point at pti[0] to fix crasher.
2008-07-18 09:03:54 +00:00
ehouse
c20e85eccd combine all per-player arrays in board into a single array of structs.
access can then be via a ptr, more effecient and faster.  The change
seems to save 1K of generated code.  No changes to algorithms, only to
field access.
2008-07-18 07:49:00 +00:00
ehouse
5422b82fd3 Implement new model for focus/tray interaction aimed at smartphones
with five-ways and no obvious alt key.  Focus once dived into tray
moves over tiles *and* divider.  Tap of center key toggles
selectedness of object under focus.  Movement of focus when object is
selected drags the object (tile or divider) unless in trade mode.
This is easier to discover and behaves more like drag-and-drop -- and
lets you move the divider.  Works for linux and win32.  Key nav in
tray is broken on palm.
2008-07-17 05:16:09 +00:00
ehouse
0d44c26373 break board.c up so isn't too large for 68K on palm when compiled for
debugging.
2008-07-17 05:06:08 +00:00
ehouse
bc05761c4a change API for drawing divider so it can be focussed as well as
selected.  Being using that information in palm and wince.  For GTK,
use color rather than ugly black rects to indicate focus.
2008-07-17 05:03:01 +00:00
ehouse
2ed08ac7da Fix cosmetic problems when changing focus and board overlaps tray.
The goal is to have the tray drawn on top, even if it's otherwise
hidden, when the whole thing's focussed.  Fix is to inval and
recalculate rects more often as focus changes or tray is hidden.
2008-06-07 23:14:26 +00:00
ehouse
2905af749e Fix crasher: don't start a board-scroll operation and attempt to end
by dropping a tile.  (This part is to detect that no drag actuall happened.)
2008-06-07 23:07:31 +00:00
ehouse
183d5514ca Fix crasher: don't start a board-scroll operation and attempt to end
by dropping a tile.
2008-06-07 23:05:54 +00:00
ehouse
f749fdd560 Remove all tabs. No code changes. 2008-05-31 03:26:16 +00:00
ehouse
bd6aed4b5a Fix so curses-only builds and curses build doesn't segfault. 2008-05-26 00:27:48 +00:00
ehouse
8fa530303a fix bug: don't advance arrow if unable to move tile to board (introduced with recent tile index changes) 2008-05-24 16:21:03 +00:00
ehouse
6280129788 Fix bug that number key tries to move tile to board even during trade.
Generalize use of number to select tile in tray so that during trade
keys will toggle selected tiles.  Letters too.
2008-05-19 01:18:43 +00:00
ehouse
5502c3ef8b Trying to give smartphone users way to use keypad to move tiles to
board.  Enabling key-to-text works, but constants to turn it off
aren't in cegcc.  So for b2 add a quick hack where 1 means first tile
in tray, 7 means last (rightmost).  Enable and test on gtk.
2008-05-11 20:29:43 +00:00
ehouse
290f505a98 While tap on draggable tile should not return it to tray, return-key on same tile should.
That's the only way to return a single tile on smartphone.
2008-05-11 16:20:37 +00:00
ehouse
1a2ce36bb0 A bit of cleanup; no code change. 2008-05-11 15:23:22 +00:00
ehouse
ebad668227 add some consts. 2008-05-06 12:49:37 +00:00
ehouse
6c81a63fce redraw tray (if dirty) even if hidden. On wince at least this
prevents the bottoms of the tiles from peeking out from under a
partially obscuring board, giving away information.  In cases where
the board completely hides the tray this is unnecessary, but making
that optimiztion can come later.  This is a bug.
2008-04-14 01:31:53 +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
97b8d81d40 remove excessive logging 2008-04-02 03:50:55 +00:00
ehouse
1e7bc3839b Implement scrolling during drag via timer rather than by counting on
getting notified when pen is dragged off the board.  The latter won't
happen if the board is up against the edge of the screen.
2008-03-29 20:23:27 +00:00
ehouse
1172502b04 If search limits in use, try vertical as well as horizontal initial moves. 2008-03-29 19:40:03 +00:00
ehouse
ed2452cbc2 add assertions that formatted string returned fit within the provided space. 2008-03-23 19:14:20 +00:00
ehouse
1de7ca6697 When scrolling in response to a drag, invalidate under the tile both
before and after the scroll.  Otherwise on platforms where scrolling
is via a bitmove the old position gets scrolled away and never redrawn
leaving ghost tile parts lying around.
2008-03-15 14:00:05 +00:00
ehouse
d3ce87b057 Indicate empty cell with CELL_ISEMPTY rather than an empty string; fix
palm to not draw star on top of placed tile.
2008-03-14 09:36:42 +00:00
ehouse
123923fd4b rewrite invalCellsUnderRect to be less stupid: start from rect passed
in rather than whole board.
2008-03-14 09:20:26 +00:00
ehouse
cb22f01d2b Remove commented-out field. (Forgot to save before checking in....) 2008-03-13 12:43:33 +00:00