aboutsummaryrefslogtreecommitdiff
path: root/netslide.c (follow)
Commit message (Collapse)AuthorAge
...
* Infrastructure change which I've been thinking about for a while:Simon Tatham2005-06-17
| | | | | | | the back end function solve_game() now takes the _current_ game_state in addition to the initial one. [originally from svn r5969]
* Overzealous last-move tracking during shuffle was causing lockups onSimon Tatham2005-06-10
| | | | | | 2x2 grid generation. [originally from svn r5939]
* All the games in this collection have always defined their graphicsSimon Tatham2005-06-07
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | in terms of a constant TILE_SIZE (or equivalent). Here's a surprisingly small patch which switches this constant into a run-time variable. The only observable behaviour change should be on Windows, which physically does not permit the creation of windows larger than the screen; if you try to create a puzzle (Net makes this plausible) large enough to encounter this restriction, the Windows front end should automatically re-adjust the puzzle's tile size so that it does fit within the available space. On GTK, I haven't done this, on the grounds that X _does_ permit windows larger than the screen, and many X window managers already provide the means to navigate around such a window. Gareth said he'd rather navigate around a huge Net window than have it shrunk to fit on one screen. I'm uncertain that this makes sense for all puzzles - Pattern in particular strikes me as something that might be better off shrunk to fit - so I may have to change policy later or make it configurable. On OS X, I also haven't done automatic shrinkage to fit on one screen, largely because I didn't have the courage to address the question of multiple monitors and what that means for the entire concept :-) [originally from svn r5913]
* Introduce a new game backend function (there seem to have been a lotSimon Tatham2005-06-06
| | | | | | | | | | | | | | | | | | | of these recently) whose job is to update a game_ui to be consistent with a new game_state. This is called by midend.c in every situation where the current game_state changes _other_ than as a result of make_move (Undo, Redo, Restart, Solve). The introduction of this function allows a game_ui to contain information about selections or highlights within a game_state which simply wouldn't make sense when transferred to another game_state. In particular, I've used it to fix a subtle bug in Solo whereby, although you couldn't right-click to pencil-mode highlight a filled square, you could _get_ a pencil-mode highlight in a filled square if you used Undo and Redo. (Undo to before the square was filled, right-click to highlight it, then Redo. Alternatively, left-click and clear the square, right-click to highlight it, then Undo.) [originally from svn r5912]
* James Harvey requested that puzzles not use DEBUG as a preprocessorSimon Tatham2005-06-04
| | | | | | | | | symbol for enabling diagnostics, presumably because in his Palm port it means something else as well. He sent this patch to switch Net and Netslide over to using GENERATION_DIAGNOSTICS, in the fashion of the newer games. [originally from svn r5908]
* Fix various departures from C found by `gcc -ansi -pedantic'. ISimon Tatham2005-06-02
| | | | | | | haven't checked in Makefile changes to enable this, but I'll at least fix the specific problems it found when enabled as a one-off. [originally from svn r5902]
* Miscellaneous fixes from James Harvey's PalmOS porting work:Simon Tatham2005-06-01
| | | | | | | | | | | | | | | | | | | | - fixed numerous memory leaks (not Palm-specific) - corrected a couple of 32-bit-int assumptions (vital for Palm but generally a good thing anyway) - lifted a few function pointer types into explicit typedefs (neutral for me but convenient for the source-munging Perl scripts he uses to deal with Palm code segment rules) - lifted a few function-level static arrays into global static arrays (neutral for me but apparently works round a Palm tools bug) - a couple more presets in Rectangles (so that Palm, or any other slow platform which can't handle the larger sizes easily, can still have some variety available) - in Solo, arranged a means of sharing scratch space between calls to nsolve to prevent a lot of redundant malloc/frees (gives a 10% speed increase even on existing platforms) [originally from svn r5897]
* Better mouse button handling in Mines:Simon Tatham2005-05-31
| | | | | | | | | | | | | - middle button now also triggers the clear-around-square action - a special-case handler in midend_process_key() arranges that the left button always trumps the right button if both are pressed together, meaning that Windows Minesweeper players used to pressing L+R to clear around a square should still be able to do so without any strange behaviour. (The latter touches all game backends, yet again, to add a field to the game structure which is zero in everything except Mines.) [originally from svn r5888]
* Move definition of PI into puzzles.h. If nothing else, the definition in cube.cJacob Nevins2005-05-31
| | | | | | had a typo :) [originally from svn r5878]
* Mouse-based interface for Cube: you left-click anywhere on the gridSimon Tatham2005-05-31
| | | | | | | | | | | | | | | and it moves the polyhedron in the general direction of the mouse pointer. (I had this in my initial throwaway Python implementation of this game, but never reimplemented it in this version. It's harder with triangles, but not too much harder.) Since the logical-to-physical coordinate mapping in Cube is dynamically computed, this has involved an interface change which touches all puzzles: make_move() is now passed a pointer to the game_drawstate, which it may of course completely ignore if it wishes. [originally from svn r5877]
* Added an `interactive' flag to new_game_desc(), which toggles MinesSimon Tatham2005-05-30
| | | | | | | | | between on the one hand generating indeterminate game descriptions awaiting the initial click, and on the other hand generating concrete ones which have had their initial click. This makes `mines --generate' do something useful. [originally from svn r5869]
* First cut at a game timer. Yet another backend function whichSimon Tatham2005-05-30
| | | | | | | | | | | | | | | indicates whether a particular game state should have the timer going (for Mines the initial indeterminate state does not have this property, and neither does a dead or won state); a midend function that optionally (on request from the game) prepends a timer to the front of the status bar text; some complicated midend timing code. It's not great. It's ugly; it's probably slightly inaccurate; it's got no provision for anyone but the game author decreeing whether a game is timed or not. But Mines can't be taken seriously without a timer, so it's a start. [originally from svn r5866]
* Mines now follows the conventional approach of offering a completelySimon Tatham2005-05-30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | blank grid until you make the first click; to ensure solubility, it does not generate the mine layout until that click, and then ensures it is solvable starting from that position. This has involved three infrastructure changes: - random.c now offers functions to encode and decode an entire random_state as a string - each puzzle's new_game() is now passed a pointer to the midend itself, which most of them ignore - there's a function in the midend which a game can call back to _rewrite_ its current game description. So Mines now has two entirely separate forms of game ID. One contains the generation-time parameters (n and unique) plus an encoding of a random_state; the other actually encodes the grid once it's been generated, and also contains the initial click position. When called with the latter, new_game() does plausibly normal stuff. When called with the former, it notes down all the details and waits until the first square is opened, and _then_ does the grid generation and updates the game description in the midend. So if, _after_ your first click, you decide you want to share this particular puzzle with someone else, you can do that fine. Also in this checkin, the mine layout is no longer _copied_ between all the game_states on the undo chain. Instead, it's in a separate structure and all game_states share a pointer to it - and the structure is reference-counted to ensure deallocation. [originally from svn r5862]
* Infrastructure change: game_anim_length and game_flash_length nowSimon Tatham2005-05-30
| | | | | | | | | both get passed a pointer to the game_ui. This means that if they need to note down information for the redraw function about what _type_ of flash or animation is required, they now have somewhere to do so. [originally from svn r5858]
* Add a limited-shuffle mode like that added to Sixteen and Twiddle in r5769,Jacob Nevins2005-05-28
| | | | | | | for completeness. [originally from svn r5854] [r5769 == 8f1c713735316422cfe041400ccc49999d563d8b]
* Add origin-shifting (Shift+cursors) and source-shifting (Ctrl+cursors) to Net.Jacob Nevins2005-05-26
| | | | | | | | | | | | (Adding modifier+cursors handling has had minor knock-on effects on the other puzzles, so that they can continue to ignore modifiers.) (An unfortunate side effect of this is some artifacts in exterior barrier drawing; notably, a disconnected corner can now appear at the corner of the grid under some circumstances. I haven't found a satisfactory way round this yet.) [originally from svn r5844]
* Null-terminate generated Net/Netslide descriptive game IDs.Jacob Nevins2005-05-17
| | | | [originally from svn r5794]
* The game IDs for Net (and Netslide) have always been random seedsSimon Tatham2005-05-16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | rather than literal grid descriptions, which has always faintly annoyed me because it makes it impossible to type in a grid from another source. However, Gareth pointed out that short random-seed game descriptions are useful, because you can read one out to someone else without having to master the technology of cross- machine cut and paste, or you can have two people enter the same random seed simultaneously in order to race against each other to complete the same puzzle. So both types of game ID seem to have their uses. Therefore, here's a reorganisation of the whole game ID concept. There are now two types of game ID: one has a parameter string then a hash then a piece of arbitrary random seed text, and the other has a parameter string then a colon then a literal game description. For most games, the latter is identical to the game IDs that were previously valid; for Net and Netslide, old game IDs must be translated into new ones by turning the colon into a hash, and there's a new descriptive game ID format. Random seed IDs are not guaranteed to be portable between software versions (this is a major reason why I added version reporting yesterday). Descriptive game IDs have a longer lifespan. As an added bonus, I've removed the sections of documentation dealing with game parameter encodings not shown in the game ID (Rectangles expansion factor, Solo symmetry and difficulty settings etc), because _all_ parameters must be specified in a random seed ID and therefore users can easily find out the appropriate parameter string for any settings they have configured. [originally from svn r5788]
* solve_game() is passed the _initial_ game state, not the most recentSimon Tatham2005-05-07
| | | | | | | | | | | | | | one; so we can't just set `ret->completed = ret->movecount' and hope it's been set to something other than zero. Instead, we set both move counts to 1, which is entirely arbitrary but works. This fixes a subtle bug with the Solve feature: if you pressed Solve, then disturbed the grid, then brought it back to the solved state by making more forward moves (rather than using Undo), then the first time you did this the `Moves since auto-solve' status line would reset to zero. [originally from svn r5759]
* Added an automatic `Solve' feature to most games. This is useful forSimon Tatham2005-05-02
| | | | | | | | | | | | | | | | various things: - if you haven't fully understood what a game is about, it gives you an immediate example of a puzzle plus its solution so you can understand it - in some games it's useful to compare your solution with the real one and see where you made a mistake - in the rearrangement games (Fifteen, Sixteen, Twiddle) it's handy to be able to get your hands on a pristine grid quickly so you can practise or experiment with manoeuvres on it - it provides a good way of debugging the games if you think you've encountered an unsolvable grid! [originally from svn r5731]
* Introduce the concept of a `game_aux_info' structure. This isSimon Tatham2005-05-02
| | | | | | | | | | constructed at the same time as an internally generated game seed, so that it can preserve any interesting information known by the program at generation time but not physically contained within the text of the game seed itself. (Such as, for example, the solution.) Currently not used for anything yet, but it will be. [originally from svn r5729]
* Introduced a new function in every game which formats a game_stateSimon Tatham2005-05-01
| | | | | | | | as text. This is used by front ends to implement copy-to-clipboard. Currently the function does nothing (and is disabled) in every game except Solo, but it's a start. [originally from svn r5724]
* I can never remember what that `TRUE' means in the game structureSimon Tatham2005-05-01
| | | | | | | | | definitions, so let's move it so that it's just next to the functions it relates to. This also opens the way for me to add more booleans next to other functions without getting confused as to which is which. [originally from svn r5723]
* Rather than each game backend file exporting a whole load ofSimon Tatham2005-01-17
| | | | | | | | | | functions and a couple of variables, now each one exports a single structure containing a load of function pointers and said variables. This should make it easy to support platforms on which it's sensible to compile all the puzzles into a single monolithic application. The two existing platforms are still one-binary-per-game. [originally from svn r5126]
* After discussion with Simon, the game redraw functions are now passed a newJacob Nevins2004-08-16
| | | | | | | | | argument `dir' which tells them whether this redraw is due to an undo, rather than have them second-guess it from game state. Note that none of the actual games yet take advantage of this; so it hasn't been tested in anger (although it has been inspected by debugging). [originally from svn r4469]
* Added a help file, mostly thanks to Jacob.Simon Tatham2004-08-16
| | | | [originally from svn r4460]
* Richard B's utterly evil `netslide': cross between Net and Sixteen.Simon Tatham2004-05-26
[originally from svn r4257]