summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/package.cc
Commit message (Collapse)AuthorAgeFilesLines
* Formatting fixes (add braces).Neil Moore2014-05-121-0/+2
| | | | This fixes all the instances caught by unbrace.
* Don't allocate pointless iterators.Adam Borowski2013-11-151-3/+3
| | | | | map or set.count() can test the presence of a given key and return 0 or 1 outright.
* Add a couple of assertions in low-level save file handling.Adam Borowski2013-10-061-0/+6
| | | | | | | Over the years, there were only two unexplained corruptions, and I have a hunch there's a hardware/OS error too: something that zeroes a part of the file. Hard to tell without knowing more, so let's introduce these checks.
* Don't fsync in debug builds.Adam Borowski2013-08-271-6/+1
| | | | All it protects against is save corruption during power loss.
* Port to OpenSolaris (Dyson/Illumos).Adam Borowski2013-05-051-60/+60
| | | | | | This might be portability for portability sake (Solaris is so dead), but come on, we can't disappoint Igor Pashev by porting our stuff later than several hours after the first installable build of Dyson is released :)
* Don't fsync() --no-save saves.Adam Borowski2012-09-221-4/+4
| | | | | The temp file is still needed because the "game" might move through levels, but a pre-deleted file is quite unlikely to require durable storage.
* Android port.frogbotherer2012-09-081-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 2 files are added to the root of the repository: * AndroidAppSettings.cfg: settings file required for Android SDL port. Will change on each minor release to reset configuration. * AndroidBuild.sh: script called by the Android SDL port to commence building the game itself It might be nice to be able to move them elsewhere, but for now, their presence here is required. The build process is documented in docs/develop/android.txt There's a TOUCH_UI compiler flag which sets all the things specific to a touch screen interface. There has been a large amount of changes in the Makefile for redefining where the dat/, saves/, etc. directories go, because the "install" part of the make isn't the final destination for these files under Android - the environment we deploy to is a separate device from the build environment. There is also a number of changes to the tiles interface. Some are specific to the TOUCH_UI, but others are also changed in USE_TILE_LOCAL. Touch only: * 'a'bilities menu goes straight to menu without prompting first * tap menu header to toggle/submit * menu instead of prompt to select which corpse to butcher * same for eating food from the floor (those 2 could go in local tiles too) * show_more defaults to false and less --more-- messages * pickup mode defaults to menu * defaults for tile_layout_priority is different (commands are more important than inventory) * popup for yes/no prompts, level-up stat gain and swapping rings (should be used for all prompts, and probably local tiles too) * spell casting: force selection menu * map mode: left-click rather than right-click for mouse mode; autotravel on left-click removed * remove skills training and memorisation panels Also local tiles (some could also be integrated in webtiles): * commands below description are clickable * clickable shopping menu (uses PrecisionMenu) * split the command panel in 2 (common actions and system commands) * add a map command panel * tapping or left-clicking the player is smarter: * picks up the item if there's one on the tile, otherwise * shows pick-up menu if there's several items on the tile, otherwise * traverses stairs (or enters a portal or shop) if one is present, otherwise * prays if an altar is present, otherwise * waits one turn * right-clicking the map enters map mode and brings the map commands tab to the front; map mode stays until exited rather than upon release of mouse Some more details can be found in android_patch_notes.txt on #5677 (although some TODOs are already obsolete). Signed-off-by: Raphael Langella <raphael.langella@gmail.com>
* Use std namespace.Raphael Langella2012-08-261-21/+21
| | | | | | | | | | | | | I had to rename distance() (in coord.h) to distance2() because it conflicts with the STL function to compare 2 iterators. Not a bad change given how it returns the square of the distance anyway. I also had to rename the message global variable (in message.cc) to buffer. I tried to fix and improve the coding style has much as I could, but I probably missed a few given how huge and tedious it is. I also didn't touch crawl-gdb.py, and the stuff in prebuilt, rltiles/tool and util/levcomp.*, because I have no clue about those.
* Massive style fix (braces, indentation, etc.)Neil Moore2012-08-011-0/+2
|
* Check if some code tries to read from a save into (void*)0Adam Borowski2012-07-121-0/+2
| | | | This way, we can tell save corruption from reader corruption.
* An undocumented command-line option, --no-save.Adam Borowski2012-07-101-0/+23
| | | | | | | | It uses a temporary file for the save file. This fixes canned tests breaking if a run has been aborted (and thus a save by that name exists), and also allows concurrently running multiple instances of the same test. Implies wizmode.
* Fix save files leaking space.Adam Borowski2012-06-161-0/+2
| | | | | While X[] did not leak, it's not the case for regular walking between levels. This means, stair dancing can result in enormous saves.
* Allow deleting/overwriting save chunks while they're being read.Adam Borowski2012-06-121-19/+23
| | | | | | | | | | | Crawl itself doesn't ever read and write at the same time (I doubt it ever does more than one operation at once, too), but it just feels wrong to have a known data-loss bug in code that's separable from the rest of Crawl. By reusing already instantiated STL templates, this actually reduces binary size somewhat. This reverts commit ed9508da27c3ef0803bfd1e600465a5eb6566441.
* Add a comment how to allow readers to linger past commits.Adam Borowski2012-06-111-0/+2
| | | | | | I'm not putting that in, as Crawl currently doesn't need this and every use of std::map for a new pair of types enlarges the executable by 30KB stripped, 1.1MB unstripped.
* Do the whole of X[] save handling as one transaction.Adam Borowski2012-06-111-11/+21
| | | | | | | | | Actually, not even one as it won't be committed until the next time you go to a new level. Subsequent writes of a given level in a transaction overwrite the old uncommitted version. This sadly can double the size of saves, if someone views all existing levels in a game.
* Assert out when committing a save when there are readers or writers.Adam Borowski2012-06-111-2/+7
| | | | | | Crawl never needs that, but if that ever changes (or someone reuses the transactional filesystem-in-a-file elsewhere), there are potential problems that, while easy to fix, would require that effort.
* Offer to delete corrupted saves.Adam Borowski2012-03-241-17/+17
|
* Consistently use a space after flow control statements.Adam Borowski2011-12-021-15/+15
|
* Partial fix for broken MSVC build (still need to fix prebuild)Alexander Vostres2011-07-171-1/+2
| | | | | The MSVC2010/ dir is omitted, since it doesn't work for me yet, and adding a whole yet useless dir just before branching would be counterproductive. -- 1KB
* Fix zlib compression done in chunks of only 4 bytes.Adam Borowski2011-07-051-1/+1
| | | | This worked correctly, but inefficiently.
* cppcheck: use ++p not p++ for complex types (like iterators).Adam Borowski2011-07-051-9/+9
| | | | | | | | | | | Pre-increment looks worse than post-increment, but on a C++ object the latter forces an allocation plus copy that is completely unnecessary but the compiler doesn't know that yet. Note that I did change some of our iterators to return void rather than the old or new value for exactly this performance reason before, breaking the expected behaviour. If that's an issue, tell me, we can use preincrements instead which have very little penalty.
* Fix a warning on certain architectures.Adam Borowski2011-06-091-1/+1
|
* Try to fight fragmentation by choosing the best-fitting block.Adam Borowski2011-06-081-20/+31
| | | | | | Unlike my attempt a year ago, this version actually tries a block that fits, rather than one that's just below what we need, so a tiny new fragment is created in most cases, making things worse :p
* Show some internal info about saves.Adam Borowski2011-06-081-11/+61
|
* Merge branch 'unicode'.Adam Borowski2011-04-011-3/+3
|\ | | | | | | | | There are some issues left, like incorrect wrapping in some cases, but we can fix them later.
| * Merge branch 'master' into unicodeAdam Borowski2011-01-111-44/+60
| |\ | | | | | | | | | Conflicts galore...
| * \ Merge branch 'master' into unicodeAdam Borowski2010-12-121-1/+5
| |\ \
| * \ \ Merge branch 'master' into unicodeAdam Borowski2010-10-151-40/+80
| |\ \ \
| * | | | Handle filenames with non-ascii characters.Adam Borowski2010-09-171-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | Only iostreams functions are left; on Windows they don't support Unicode so a workaround will be needed.
* | | | | Make file headers doxygen-friendly, drop useless fields.Adam Borowski2011-03-281-5/+4
| |_|_|/ |/| | | | | | | | | | | | | | | | | | | | | | | "File:" is shown in your editor's status bar. "Written by:" was used only for the first person who changed a file. We got git for that now, and pre-DCSS history is so woefully inaccurate it doesn't really matter.
* | | | Convert ASSERT(!"foo") to die("foo").Adam Borowski2011-01-111-1/+1
| | | |
* | | | Adjust the max chunk name in --edit-save as well.Adam Borowski2011-01-081-1/+2
| | | |
* | | | Change the max name length of save file chunks from 4 to 255.Adam Borowski2011-01-081-36/+52
| | | | | | | | | | | | | | | | | | | | The on-disk format has been changed; the saves will be upgraded just fine but old Crawls will be unable to read them.
* | | | Fix an irrelevant memory leak on write errors.Adam Borowski2011-01-071-0/+1
| | | | | | | | | | | | | | | | | | | | They are currently fatal and I doubt we'll ever bother to handle them (out of disk being the most likely thing we could possibly do).
* | | | Fix a memory leak and potential crash on browsing corrupted saves.Adam Borowski2011-01-071-4/+2
| | | |
* | | | Allow handling old save package formats.Adam Borowski2011-01-071-5/+5
| |_|/ |/| |
* | | Except for public servers, ensure robustness against filesystem crashes.Adam Borowski2010-12-031-1/+5
| |/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | On a busy disk, this can cause a pause of several seconds -- or a spin-up on a laptop. Still, people do lose games to crashes from time to time. This commit sacrifices performance for a full guarantee against system or power crashes, as long as the underlying fsync() implementation isn't broken (many network filesystems and certain ATA disks). Neither CAO nor CDO ever had a system crash, so we give a guarantee against Crawl's crashes only. As long as writes are not maliciously reordered, this should be enough. With the loads they experience during the Tourney, fsync()s would be murder. (What about emergency saves? They can write possibly tainted data during a crash, claiming it's kosher.)
* | Remove an obsolete comment.Adam Borowski2010-10-071-2/+0
| |
* | Fix a memory leak on failed writes.Adam Borowski2010-10-071-0/+6
| | | | | | | | | | | | | | | | | | Actually, I can't think of a case where such error won't be fatal, but then, it leaves Crawl in a consistent state so we might in theory merely return to menu (restart_after_game). I'm fixing it mostly in case someone reuses the transactional packager for some purpose other than Crawl.
* | Don't leak file descriptors when trying to open a save file fails.Adam Borowski2010-10-071-34/+52
| | | | | | | | | | | | The save browser is likely to open many, especially if you have a lot of old saves after a compat break. Actually running out of descriptors would require a bizarre case, but a bug is a bug...
* | Move unlinking save files to the save code itself.Adam Borowski2010-10-071-3/+13
| | | | | | | | | | | | This fixes --edit-save foo repack on Windows, and is safer in case the player's name ever changes (might be possible if we add that "read morgue" functionality).
* | Fix saves on big-endian systems.Adam Borowski2010-09-181-1/+1
| |
* | Document the limitation of save chunk name length of 4 characters.Adam Borowski2010-09-171-0/+8
|/
* Give a nicer message for an empty save -- it's not really corrupted.Adam Borowski2010-09-131-0/+5
|
* Skip an assertion when crashing down.Adam Borowski2010-09-111-1/+5
|
* Fix the save browser on non-Windows.Adam Borowski2010-09-061-1/+4
|
* Use file locking on the save file to prevent corruption from running Crawl ↵Adam Borowski2010-09-061-0/+4
| | | | | | | | | | twice. This fixes Mantis 2061. I did not reuse the existing lk_open() because it's non-portable, waits for the lock to become available and works using FILE* not a descriptor (bad for random access).
* Disable COSTLY_ASSERTS.Adam Borowski2010-09-051-1/+1
| | | | | | | | They apply only to the core internal format whose code is pretty solid (stress-tested on hundreds of millions of random operations), and the file gets fscked on rw opens anyway. It's code outside of package.cc which could use better checks.
* Store the "lua" subfile as a chunk.Adam Borowski2010-09-041-0/+14
|
* Allow reads of 0 bytes, they do happen.Adam Borowski2010-09-041-1/+2
|