summaryrefslogtreecommitdiff
path: root/apps/plugins/puzzles/src
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins/puzzles/src')
-rw-r--r--apps/plugins/puzzles/src/Buildscr15
-rw-r--r--apps/plugins/puzzles/src/Makefile.doc14
-rw-r--r--apps/plugins/puzzles/src/README4
-rw-r--r--apps/plugins/puzzles/src/icons/tracks.sav2
-rw-r--r--apps/plugins/puzzles/src/loopy.c19
-rw-r--r--apps/plugins/puzzles/src/map.c2
-rw-r--r--apps/plugins/puzzles/src/midend.c2
-rw-r--r--apps/plugins/puzzles/src/misc.c17
-rw-r--r--apps/plugins/puzzles/src/net.c4
-rw-r--r--apps/plugins/puzzles/src/netslide.c4
-rw-r--r--apps/plugins/puzzles/src/puzzles.but10
-rw-r--r--apps/plugins/puzzles/src/puzzles.h4
-rw-r--r--apps/plugins/puzzles/src/range.c3
-rw-r--r--apps/plugins/puzzles/src/rect.c4
-rw-r--r--apps/plugins/puzzles/src/tracks.c2
-rw-r--r--apps/plugins/puzzles/src/untangle.c21
-rw-r--r--apps/plugins/puzzles/src/website.url2
-rwxr-xr-xapps/plugins/puzzles/src/winiss.pl2
18 files changed, 83 insertions, 48 deletions
diff --git a/apps/plugins/puzzles/src/Buildscr b/apps/plugins/puzzles/src/Buildscr
index 910981f079..c72084477b 100644
--- a/apps/plugins/puzzles/src/Buildscr
+++ b/apps/plugins/puzzles/src/Buildscr
@@ -51,14 +51,10 @@ enddelegate
51 51
52# Build the Windows binaries and installer, and the CHM file. 52# Build the Windows binaries and installer, and the CHM file.
53in puzzles do make -f Makefile.doc clean 53in puzzles do make -f Makefile.doc clean
54in puzzles do make -f Makefile.doc chm 54in puzzles do make -f Makefile.doc # build help files for installer
55in puzzles do make -f Makefile.doc # build help file for installer
56in puzzles do mason.pl --args '{"version":"$(Version)","descfile":"gamedesc.txt"}' winwix.mc > puzzles.wxs 55in puzzles do mason.pl --args '{"version":"$(Version)","descfile":"gamedesc.txt"}' winwix.mc > puzzles.wxs
57in puzzles do perl winiss.pl $(Version) gamedesc.txt > puzzles.iss 56in puzzles do perl winiss.pl $(Version) gamedesc.txt > puzzles.iss
58delegate windows 57delegate windows
59 # Ignore the poorly controlled return value from HHC, and instead
60 # just test that the output file was generated.
61 in puzzles with htmlhelp do/win hhc puzzles.hhp & type puzzles.chm >nul
62 # FIXME: Cygwin alternative? 58 # FIXME: Cygwin alternative?
63 in puzzles with visualstudio do/win nmake -f Makefile.vc clean 59 in puzzles with visualstudio do/win nmake -f Makefile.vc clean
64 in puzzles with visualstudio do/win nmake -f Makefile.vc VER=-DVER=$(Version) 60 in puzzles with visualstudio do/win nmake -f Makefile.vc VER=-DVER=$(Version)
@@ -67,12 +63,11 @@ delegate windows
67 # provide a 'more info' URL, and an optional -n option to provide a 63 # provide a 'more info' URL, and an optional -n option to provide a
68 # program name, and that it can take multiple .exe filename 64 # program name, and that it can take multiple .exe filename
69 # arguments and sign them all in place. 65 # arguments and sign them all in place.
70 ifneq "$(winsigncode)" "" in puzzles do $(winsigncode) -i http://www.chiark.greenend.org.uk/~sgtatham/puzzles/ *.exe 66 ifneq "$(winsigncode)" "" in puzzles do $(winsigncode) -i https://www.chiark.greenend.org.uk/~sgtatham/puzzles/ *.exe
71 # Build installers. 67 # Build installers.
72 in puzzles with wix do/win candle puzzles.wxs && light -ext WixUIExtension -sval puzzles.wixobj 68 in puzzles with wix do/win candle puzzles.wxs && light -ext WixUIExtension -sval puzzles.wixobj
73 in puzzles with innosetup do/win iscc puzzles.iss 69 in puzzles with innosetup do/win iscc puzzles.iss
74 ifneq "$(winsigncode)" "" in puzzles do $(winsigncode) -i http://www.chiark.greenend.org.uk/~sgtatham/puzzles/ -n "Simon Tatham's Portable Puzzle Collection Installer" puzzles.msi Output/installer.exe 70 ifneq "$(winsigncode)" "" in puzzles do $(winsigncode) -i https://www.chiark.greenend.org.uk/~sgtatham/puzzles/ -n "Simon Tatham's Portable Puzzle Collection Installer" puzzles.msi Output/installer.exe
75 return puzzles/puzzles.chm
76 return puzzles/*.exe 71 return puzzles/*.exe
77 return puzzles/Output/installer.exe 72 return puzzles/Output/installer.exe
78 return puzzles/puzzles.msi 73 return puzzles/puzzles.msi
@@ -114,9 +109,7 @@ in puzzles do chmod +x *.exe
114# return puzzles/puzzles.armv4.cab 109# return puzzles/puzzles.armv4.cab
115#enddelegate 110#enddelegate
116 111
117# Build the help file and the HTML docs. 112# Build the HTML docs.
118in puzzles do make -f Makefile.doc clean # remove CHM-target HTML
119in puzzles do make -f Makefile.doc # and rebuild help file...
120in puzzles do mkdir doc 113in puzzles do mkdir doc
121in puzzles do mkdir devel 114in puzzles do mkdir devel
122in puzzles/doc do halibut --html -Chtml-contents-filename:index.html -Chtml-index-filename:indexpage.html -Chtml-template-filename:%k.html -Chtml-template-fragment:%k ../puzzles.but 115in puzzles/doc do halibut --html -Chtml-contents-filename:index.html -Chtml-index-filename:indexpage.html -Chtml-template-filename:%k.html -Chtml-template-fragment:%k ../puzzles.but
diff --git a/apps/plugins/puzzles/src/Makefile.doc b/apps/plugins/puzzles/src/Makefile.doc
index c7d6946cf1..0fd28db5ed 100644
--- a/apps/plugins/puzzles/src/Makefile.doc
+++ b/apps/plugins/puzzles/src/Makefile.doc
@@ -1,17 +1,17 @@
1all: puzzles.hlp puzzles.txt HACKING 1all: puzzles.chm puzzles.hlp puzzles.txt HACKING
2 2
3preprocessed.but: puzzles.but 3preprocessed.but: puzzles.but
4 sed 's/PREFIX-/$(BINPREFIX)/g' puzzles.but > preprocessed.but 4 sed 's/PREFIX-/$(BINPREFIX)/g' puzzles.but > preprocessed.but
5 5
6puzzles.hlp puzzles.txt: preprocessed.but 6puzzles.chm: preprocessed.but
7 halibut --winhelp=puzzles.hlp --text=puzzles.txt preprocessed.but 7 halibut --chm=puzzles.chm preprocessed.but
8puzzles.hlp: preprocessed.but
9 halibut --winhelp=puzzles.hlp preprocessed.but
10puzzles.txt: preprocessed.but
11 halibut --text=puzzles.txt preprocessed.but
8 12
9HACKING: devel.but 13HACKING: devel.but
10 halibut --text=HACKING devel.but 14 halibut --text=HACKING devel.but
11 15
12chm: puzzles.hhp
13puzzles.hhp: puzzles.but chm.but
14 halibut --html puzzles.but chm.but
15
16clean: 16clean:
17 rm -f puzzles.hlp puzzles.txt preprocessed.but HACKING *.html *.hh[pck] 17 rm -f puzzles.hlp puzzles.txt preprocessed.but HACKING *.html *.hh[pck]
diff --git a/apps/plugins/puzzles/src/README b/apps/plugins/puzzles/src/README
index 890db56771..00830126e8 100644
--- a/apps/plugins/puzzles/src/README
+++ b/apps/plugins/puzzles/src/README
@@ -1,6 +1,6 @@
1This is the README accompanying the source code to Simon Tatham's 1This is the README accompanying the source code to Simon Tatham's
2puzzle collection. The collection's web site is at 2puzzle collection. The collection's web site is at
3<http://www.chiark.greenend.org.uk/~sgtatham/puzzles/>. 3<https://www.chiark.greenend.org.uk/~sgtatham/puzzles/>.
4 4
5If you've obtained the source code by downloading a .tar.gz archive 5If you've obtained the source code by downloading a .tar.gz archive
6from the Puzzles web site, you should find several Makefiles in the 6from the Puzzles web site, you should find several Makefiles in the
@@ -51,4 +51,4 @@ application and for the web site. It is generated from a Halibut
51source file (puzzles.but), which is the preferred form for 51source file (puzzles.but), which is the preferred form for
52modification. To generate the manual in other formats, rebuild it, 52modification. To generate the manual in other formats, rebuild it,
53or learn about Halibut, visit the Halibut website at 53or learn about Halibut, visit the Halibut website at
54<http://www.chiark.greenend.org.uk/~sgtatham/halibut/>. 54<https://www.chiark.greenend.org.uk/~sgtatham/halibut/>.
diff --git a/apps/plugins/puzzles/src/icons/tracks.sav b/apps/plugins/puzzles/src/icons/tracks.sav
index ca30644506..d13ef95f06 100644
--- a/apps/plugins/puzzles/src/icons/tracks.sav
+++ b/apps/plugins/puzzles/src/icons/tracks.sav
@@ -1,6 +1,6 @@
1SAVEFILE:41:Simon Tatham's Portable Puzzle Collection 1SAVEFILE:41:Simon Tatham's Portable Puzzle Collection
2VERSION :1:1 2VERSION :1:1
3GAME :12:Train Tracks 3GAME :12:Tracks
4PARAMS :5:6x6dt 4PARAMS :5:6x6dt
5CPARAMS :5:6x6dt 5CPARAMS :5:6x6dt
6SEED :15:145870397370785 6SEED :15:145870397370785
diff --git a/apps/plugins/puzzles/src/loopy.c b/apps/plugins/puzzles/src/loopy.c
index 652b9ecc09..7d3436aacb 100644
--- a/apps/plugins/puzzles/src/loopy.c
+++ b/apps/plugins/puzzles/src/loopy.c
@@ -3054,6 +3054,24 @@ static char *interpret_move(const game_state *state, game_ui *ui,
3054 state->lines[e_next - g->edges] != state->lines[i]) 3054 state->lines[e_next - g->edges] != state->lines[i])
3055 break; 3055 break;
3056 3056
3057 if (e_next == e) {
3058 /*
3059 * Special case: we might have come all the
3060 * way round a loop and found our way back to
3061 * the same edge we started from. In that
3062 * situation, we must terminate not only this
3063 * while loop, but the 'for' outside it that
3064 * was tracing in both directions from the
3065 * starting edge, because if we let it trace
3066 * in the second direction then we'll only
3067 * find ourself traversing the same loop in
3068 * the other order and generate an encoded
3069 * move string that mentions the same set of
3070 * edges twice.
3071 */
3072 goto autofollow_done;
3073 }
3074
3057 dot = (e_next->dot1 != dot ? e_next->dot1 : e_next->dot2); 3075 dot = (e_next->dot1 != dot ? e_next->dot1 : e_next->dot2);
3058 if (movelen > movesize - 40) { 3076 if (movelen > movesize - 40) {
3059 movesize = movesize * 5 / 4 + 128; 3077 movesize = movesize * 5 / 4 + 128;
@@ -3064,6 +3082,7 @@ static char *interpret_move(const game_state *state, game_ui *ui,
3064 (int)(e_this - g->edges), button_char); 3082 (int)(e_this - g->edges), button_char);
3065 } 3083 }
3066 } 3084 }
3085 autofollow_done:;
3067 } 3086 }
3068 } 3087 }
3069 3088
diff --git a/apps/plugins/puzzles/src/map.c b/apps/plugins/puzzles/src/map.c
index f1af38ba5e..54073bad0d 100644
--- a/apps/plugins/puzzles/src/map.c
+++ b/apps/plugins/puzzles/src/map.c
@@ -2779,7 +2779,7 @@ static void draw_square(drawing *dr, game_drawstate *ds,
2779 2779
2780 draw_circle(dr, COORD(x) + (xo+1)*TILESIZE/5, 2780 draw_circle(dr, COORD(x) + (xo+1)*TILESIZE/5,
2781 COORD(y) + (yo+1)*TILESIZE/5, 2781 COORD(y) + (yo+1)*TILESIZE/5,
2782 TILESIZE/7, COL_0 + c, COL_0 + c); 2782 TILESIZE/4, COL_0 + c, COL_0 + c);
2783 } 2783 }
2784 2784
2785 /* 2785 /*
diff --git a/apps/plugins/puzzles/src/midend.c b/apps/plugins/puzzles/src/midend.c
index 6dbdd33905..f80a7fa19f 100644
--- a/apps/plugins/puzzles/src/midend.c
+++ b/apps/plugins/puzzles/src/midend.c
@@ -1701,7 +1701,7 @@ void midend_serialise(midend *me,
1701 */ 1701 */
1702 if (me->ourgame->is_timed) { 1702 if (me->ourgame->is_timed) {
1703 char buf[80]; 1703 char buf[80];
1704 ftoa(buf, 80, me->elapsed); 1704 ftoa(buf, me->elapsed);
1705 wr("TIME", buf); 1705 wr("TIME", buf);
1706 } 1706 }
1707 1707
diff --git a/apps/plugins/puzzles/src/misc.c b/apps/plugins/puzzles/src/misc.c
index 9904aee75e..2bf35d391b 100644
--- a/apps/plugins/puzzles/src/misc.c
+++ b/apps/plugins/puzzles/src/misc.c
@@ -361,16 +361,21 @@ void draw_text_outline(drawing *dr, int x, int y, int fonttype,
361 361
362} 362}
363 363
364/* kludge for non-compliant sprintf() */ 364/* kludge for sprintf() in Rockbox not supporting "%-8.8s" */
365void copy_left_justified(char *buf, size_t sz, const char *str) 365void copy_left_justified(char *buf, size_t sz, const char *str)
366{ 366{
367 size_t len = strlen(str);
368 assert(sz > 0);
367 memset(buf, ' ', sz - 1); 369 memset(buf, ' ', sz - 1);
368 int len = strlen(str); 370 assert(len <= sz - 1);
369 if(len <= sz - 1) 371 memcpy(buf, str, len);
370 memcpy(buf, str, len);
371 else
372 fatal("overrun");
373 buf[sz - 1] = 0; 372 buf[sz - 1] = 0;
374} 373}
375 374
375/* another kludge for platforms without %g support in *printf() */
376int ftoa(char *buf, float f)
377{
378 return sprintf(buf, "%d.%06d", (int)f, (int)((f - (int)f)*1e6));
379}
380
376/* vim: set shiftwidth=4 tabstop=8: */ 381/* vim: set shiftwidth=4 tabstop=8: */
diff --git a/apps/plugins/puzzles/src/net.c b/apps/plugins/puzzles/src/net.c
index 9289afb682..f479f03bb7 100644
--- a/apps/plugins/puzzles/src/net.c
+++ b/apps/plugins/puzzles/src/net.c
@@ -259,7 +259,7 @@ static char *encode_params(const game_params *params, int full)
259 if (full && params->barrier_probability) 259 if (full && params->barrier_probability)
260 { 260 {
261 len += sprintf(ret+len, "b"); 261 len += sprintf(ret+len, "b");
262 len += ftoa(ret + len, 400, params->barrier_probability); 262 len += ftoa(ret + len, params->barrier_probability);
263 } 263 }
264 if (full && !params->unique) 264 if (full && !params->unique)
265 ret[len++] = 'a'; 265 ret[len++] = 'a';
@@ -295,7 +295,7 @@ static config_item *game_configure(const game_params *params)
295 295
296 ret[3].name = "Barrier probability"; 296 ret[3].name = "Barrier probability";
297 ret[3].type = C_STRING; 297 ret[3].type = C_STRING;
298 ftoa(buf, 80, params->barrier_probability); 298 ftoa(buf, params->barrier_probability);
299 ret[3].sval = dupstr(buf); 299 ret[3].sval = dupstr(buf);
300 ret[3].ival = 0; 300 ret[3].ival = 0;
301 301
diff --git a/apps/plugins/puzzles/src/netslide.c b/apps/plugins/puzzles/src/netslide.c
index 96ac8e7eea..bb9b0999ea 100644
--- a/apps/plugins/puzzles/src/netslide.c
+++ b/apps/plugins/puzzles/src/netslide.c
@@ -243,7 +243,7 @@ static char *encode_params(const game_params *params, int full)
243 if (full && params->barrier_probability) 243 if (full && params->barrier_probability)
244 { 244 {
245 len += sprintf(ret+len, "b"); 245 len += sprintf(ret+len, "b");
246 len += ftoa(ret + len, 400, params->barrier_probability); 246 len += ftoa(ret + len, params->barrier_probability);
247 } 247 }
248 /* Shuffle limit is part of the limited parameters, because we have to 248 /* Shuffle limit is part of the limited parameters, because we have to
249 * provide the target move count. */ 249 * provide the target move count. */
@@ -281,7 +281,7 @@ static config_item *game_configure(const game_params *params)
281 281
282 ret[3].name = "Barrier probability"; 282 ret[3].name = "Barrier probability";
283 ret[3].type = C_STRING; 283 ret[3].type = C_STRING;
284 ftoa(buf, 80, params->barrier_probability); 284 ftoa(buf, params->barrier_probability);
285 ret[3].sval = dupstr(buf); 285 ret[3].sval = dupstr(buf);
286 ret[3].ival = 0; 286 ret[3].ival = 0;
287 287
diff --git a/apps/plugins/puzzles/src/puzzles.but b/apps/plugins/puzzles/src/puzzles.but
index 2508fe3337..2c448b8030 100644
--- a/apps/plugins/puzzles/src/puzzles.but
+++ b/apps/plugins/puzzles/src/puzzles.but
@@ -13,6 +13,12 @@
13\cfg{html-contents-depth-1}{2} 13\cfg{html-contents-depth-1}{2}
14\cfg{html-leaf-contains-contents}{true} 14\cfg{html-leaf-contains-contents}{true}
15 15
16\cfg{chm-filename}{puzzles.chm}
17\cfg{chm-contents-filename}{index.html}
18\cfg{chm-template-filename}{%k.html}
19\cfg{chm-head-end}{<link rel="stylesheet" type="text/css" href="chm.css">}
20\cfg{chm-extra-file}{chm.css}
21
16\cfg{info-filename}{puzzles.info} 22\cfg{info-filename}{puzzles.info}
17 23
18\cfg{ps-filename}{puzzles.ps} 24\cfg{ps-filename}{puzzles.ps}
@@ -65,13 +71,13 @@ with the game binaries or the code, except pretending you wrote them
65yourself, or suing me if anything goes wrong. 71yourself, or suing me if anything goes wrong.
66 72
67The most recent versions, and \i{source code}, can be found at 73The most recent versions, and \i{source code}, can be found at
68\I{website}\W{http://www.chiark.greenend.org.uk/~sgtatham/puzzles/}\cw{http://www.chiark.greenend.org.uk/~sgtatham/puzzles/}. 74\I{website}\W{https://www.chiark.greenend.org.uk/~sgtatham/puzzles/}\cw{https://www.chiark.greenend.org.uk/~sgtatham/puzzles/}.
69 75
70Please report \I{feedback}\i{bugs} to 76Please report \I{feedback}\i{bugs} to
71\W{mailto:anakin@pobox.com}\cw{anakin@pobox.com}. 77\W{mailto:anakin@pobox.com}\cw{anakin@pobox.com}.
72You might find it helpful to read this article before reporting a bug: 78You might find it helpful to read this article before reporting a bug:
73 79
74\W{http://www.chiark.greenend.org.uk/~sgtatham/bugs.html}\cw{http://www.chiark.greenend.org.uk/~sgtatham/bugs.html} 80\W{https://www.chiark.greenend.org.uk/~sgtatham/bugs.html}\cw{https://www.chiark.greenend.org.uk/~sgtatham/bugs.html}
75 81
76\ii{Patches} are welcome. Especially if they provide a new front end 82\ii{Patches} are welcome. Especially if they provide a new front end
77(to make all these games run on another platform), or a new game. 83(to make all these games run on another platform), or a new game.
diff --git a/apps/plugins/puzzles/src/puzzles.h b/apps/plugins/puzzles/src/puzzles.h
index 03af2ca186..fbfcfce4f8 100644
--- a/apps/plugins/puzzles/src/puzzles.h
+++ b/apps/plugins/puzzles/src/puzzles.h
@@ -381,6 +381,10 @@ void draw_text_outline(drawing *dr, int x, int y, int fonttype,
381 * less than buffer size. */ 381 * less than buffer size. */
382void copy_left_justified(char *buf, size_t sz, const char *str); 382void copy_left_justified(char *buf, size_t sz, const char *str);
383 383
384/* An ugly, but working float-to-string implementation for platforms
385 * that don't have one */
386int ftoa(char *buf, float f);
387
384/* 388/*
385 * dsf.c 389 * dsf.c
386 */ 390 */
diff --git a/apps/plugins/puzzles/src/range.c b/apps/plugins/puzzles/src/range.c
index 588178c003..4dd39b97cd 100644
--- a/apps/plugins/puzzles/src/range.c
+++ b/apps/plugins/puzzles/src/range.c
@@ -1159,7 +1159,8 @@ static int game_can_format_as_text_now(const game_params *params)
1159 1159
1160static char *game_text_format(const game_state *state) 1160static char *game_text_format(const game_state *state)
1161{ 1161{
1162 int cellsize, r, c, i, w_string, h_string, n_string; 1162 int r, c, i, w_string, h_string, n_string;
1163 char cellsize;
1163 char *ret, *buf, *gridline; 1164 char *ret, *buf, *gridline;
1164 1165
1165 int const w = state->params.w, h = state->params.h; 1166 int const w = state->params.w, h = state->params.h;
diff --git a/apps/plugins/puzzles/src/rect.c b/apps/plugins/puzzles/src/rect.c
index 0c06c74945..247138cedb 100644
--- a/apps/plugins/puzzles/src/rect.c
+++ b/apps/plugins/puzzles/src/rect.c
@@ -165,7 +165,7 @@ static char *encode_params(const game_params *params, int full)
165 if (full && params->expandfactor) 165 if (full && params->expandfactor)
166 { 166 {
167 sprintf(data + strlen(data), "e"); 167 sprintf(data + strlen(data), "e");
168 ftoa(data + strlen(data), 256, params->expandfactor); 168 ftoa(data + strlen(data), params->expandfactor);
169 } 169 }
170 if (full && !params->unique) 170 if (full && !params->unique)
171 strcat(data, "a"); 171 strcat(data, "a");
@@ -194,7 +194,7 @@ static config_item *game_configure(const game_params *params)
194 194
195 ret[2].name = "Expansion factor"; 195 ret[2].name = "Expansion factor";
196 ret[2].type = C_STRING; 196 ret[2].type = C_STRING;
197 ftoa(buf, 80, params->expandfactor); 197 ftoa(buf, params->expandfactor);
198 ret[2].sval = dupstr(buf); 198 ret[2].sval = dupstr(buf);
199 ret[2].ival = 0; 199 ret[2].ival = 0;
200 200
diff --git a/apps/plugins/puzzles/src/tracks.c b/apps/plugins/puzzles/src/tracks.c
index 43428a19e9..0c06c59ae9 100644
--- a/apps/plugins/puzzles/src/tracks.c
+++ b/apps/plugins/puzzles/src/tracks.c
@@ -2620,7 +2620,7 @@ static void game_print(drawing *dr, const game_state *state, int tilesize)
2620#endif 2620#endif
2621 2621
2622const struct game thegame = { 2622const struct game thegame = {
2623 "Train Tracks", "games.tracks", "tracks", 2623 "Tracks", "games.tracks", "tracks",
2624 default_params, 2624 default_params,
2625 game_fetch_preset, NULL, 2625 game_fetch_preset, NULL,
2626 decode_params, 2626 decode_params,
diff --git a/apps/plugins/puzzles/src/untangle.c b/apps/plugins/puzzles/src/untangle.c
index 47e839e875..441c8658ce 100644
--- a/apps/plugins/puzzles/src/untangle.c
+++ b/apps/plugins/puzzles/src/untangle.c
@@ -1122,6 +1122,7 @@ static char *interpret_move(const game_state *state, game_ui *ui,
1122 1122
1123 if (bestd <= DRAG_THRESHOLD * DRAG_THRESHOLD) { 1123 if (bestd <= DRAG_THRESHOLD * DRAG_THRESHOLD) {
1124 ui->dragpoint = best; 1124 ui->dragpoint = best;
1125 ui->cursorpoint = -1;
1125 ui->newpoint.x = x; 1126 ui->newpoint.x = x;
1126 ui->newpoint.y = y; 1127 ui->newpoint.y = y;
1127 ui->newpoint.d = ds->tilesize; 1128 ui->newpoint.d = ds->tilesize;
@@ -1183,25 +1184,28 @@ static char *interpret_move(const game_state *state, game_ui *ui,
1183 bestd = 0; 1184 bestd = 0;
1184 1185
1185 for (i = 0; i < n; i++) { 1186 for (i = 0; i < n; i++) {
1187 long px, py, dx, dy, d;
1188 float angle;
1189 int right_direction;
1186 if(i == ui->cursorpoint) 1190 if(i == ui->cursorpoint)
1187 continue; 1191 continue;
1188 1192
1189 long px = state->pts[i].x * ds->tilesize / state->pts[i].d; 1193 px = state->pts[i].x * ds->tilesize / state->pts[i].d;
1190 long py = state->pts[i].y * ds->tilesize / state->pts[i].d; 1194 py = state->pts[i].y * ds->tilesize / state->pts[i].d;
1191 long dx = px - state->pts[ui->cursorpoint].x * ds->tilesize / state->pts[ui->cursorpoint].d; 1195 dx = px - state->pts[ui->cursorpoint].x * ds->tilesize / state->pts[ui->cursorpoint].d;
1192 long dy = py - state->pts[ui->cursorpoint].y * ds->tilesize / state->pts[ui->cursorpoint].d; 1196 dy = py - state->pts[ui->cursorpoint].y * ds->tilesize / state->pts[ui->cursorpoint].d;
1193 long d = dx*dx + dy*dy; 1197 d = dx*dx + dy*dy;
1194 1198
1195 /* Figure out if this point falls into a 90 degree 1199 /* Figure out if this point falls into a 90 degree
1196 * range extending from the current point */ 1200 * range extending from the current point */
1197 1201
1198 float angle = atan2(-dy, dx); /* negate y to adjust for raster coordinates */ 1202 angle = atan2(-dy, dx); /* negate y to adjust for raster coordinates */
1199 1203
1200 /* offset to [0..2*PI] */ 1204 /* offset to [0..2*PI] */
1201 if(angle < 0) 1205 if(angle < 0)
1202 angle += 2*PI; 1206 angle += 2*PI;
1203 1207
1204 int right_direction = FALSE; 1208 right_direction = FALSE;
1205 1209
1206 if((button == CURSOR_UP && (1*PI/4 <= angle && angle <= 3*PI/4)) || 1210 if((button == CURSOR_UP && (1*PI/4 <= angle && angle <= 3*PI/4)) ||
1207 (button == CURSOR_LEFT && (3*PI/4 <= angle && angle <= 5*PI/4)) || 1211 (button == CURSOR_LEFT && (3*PI/4 <= angle && angle <= 5*PI/4)) ||
@@ -1284,7 +1288,10 @@ static char *interpret_move(const game_state *state, game_ui *ui,
1284 return dupstr(buf); 1288 return dupstr(buf);
1285 } 1289 }
1286 else if(ui->cursorpoint < 0) 1290 else if(ui->cursorpoint < 0)
1291 {
1287 ui->cursorpoint = 0; 1292 ui->cursorpoint = 0;
1293 return "";
1294 }
1288 } 1295 }
1289 1296
1290 return NULL; 1297 return NULL;
diff --git a/apps/plugins/puzzles/src/website.url b/apps/plugins/puzzles/src/website.url
index 2ab37f6faf..2913e622c6 100644
--- a/apps/plugins/puzzles/src/website.url
+++ b/apps/plugins/puzzles/src/website.url
@@ -1,2 +1,2 @@
1[InternetShortcut] 1[InternetShortcut]
2URL=http://www.chiark.greenend.org.uk/~sgtatham/puzzles/ 2URL=https://www.chiark.greenend.org.uk/~sgtatham/puzzles/
diff --git a/apps/plugins/puzzles/src/winiss.pl b/apps/plugins/puzzles/src/winiss.pl
index eca02d3b15..3200337138 100755
--- a/apps/plugins/puzzles/src/winiss.pl
+++ b/apps/plugins/puzzles/src/winiss.pl
@@ -48,7 +48,7 @@ print 'VersionInfoTextVersion=Version '.$ver."\n";
48print 'AppVersion=r'.$ver."\n"; 48print 'AppVersion=r'.$ver."\n";
49print 'VersionInfoVersion=0.0.'.$integer_date.'.0'."\n"; 49print 'VersionInfoVersion=0.0.'.$integer_date.'.0'."\n";
50print 'AppPublisher=Simon Tatham'."\n"; 50print 'AppPublisher=Simon Tatham'."\n";
51print 'AppPublisherURL=http://www.chiark.greenend.org.uk/~sgtatham/puzzles/'."\n"; 51print 'AppPublisherURL=https://www.chiark.greenend.org.uk/~sgtatham/puzzles/'."\n";
52print 'DefaultDirName={pf}\Simon Tatham\'s Portable Puzzle Collection'."\n"; 52print 'DefaultDirName={pf}\Simon Tatham\'s Portable Puzzle Collection'."\n";
53print 'DefaultGroupName=Simon Tatham\'s Puzzles'."\n"; 53print 'DefaultGroupName=Simon Tatham\'s Puzzles'."\n";
54# print 'SetupIconFile=fixmethinkoneup.ico'."\n"; 54# print 'SetupIconFile=fixmethinkoneup.ico'."\n";