Merge branch 'master' into unicode
authorAdam Borowski <kilobyte@angband.pl>
Tue, 11 Jan 2011 12:03:13 +0000 (13:03 +0100)
committerAdam Borowski <kilobyte@angband.pl>
Tue, 11 Jan 2011 12:03:13 +0000 (13:03 +0100)
Conflicts galore...

38 files changed:
1  2 
crawl-ref/source/AppHdr.h
crawl-ref/source/chardump.cc
crawl-ref/source/clua.cc
crawl-ref/source/command.cc
crawl-ref/source/database.cc
crawl-ref/source/defines.h
crawl-ref/source/files.cc
crawl-ref/source/hints.cc
crawl-ref/source/initfile.cc
crawl-ref/source/libunix.cc
crawl-ref/source/libutil.cc
crawl-ref/source/macro.cc
crawl-ref/source/main.cc
crawl-ref/source/makefile
crawl-ref/source/makefile.obj
crawl-ref/source/maps.cc
crawl-ref/source/mon-enum.h
crawl-ref/source/monster.h
crawl-ref/source/options.h
crawl-ref/source/ouch.cc
crawl-ref/source/package.cc
crawl-ref/source/package.h
crawl-ref/source/player.h
crawl-ref/source/show.cc
crawl-ref/source/sqldbm.cc
crawl-ref/source/startup.cc
crawl-ref/source/stash.cc
crawl-ref/source/state.cc
crawl-ref/source/state.h
crawl-ref/source/stuff.cc
crawl-ref/source/syscalls.cc
crawl-ref/source/syscalls.h
crawl-ref/source/tags.cc
crawl-ref/source/tags.h
crawl-ref/source/tilefont.h
crawl-ref/source/view.cc
crawl-ref/source/viewgeom.h
crawl-ref/source/windowmanager-sdl.cc

Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
@@@ -27,9 -27,7 +27,9 @@@
      #endif
  #endif
  
 +typedef uint32_t ucs_t;
 +
- // length of a single zot defense cycle
+ // length of a single zot defence cycle
  #define CYCLE_LENGTH 200
  
  // Waiting time before monsters arrive
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
@@@ -678,21 -674,18 +674,21 @@@ void macro_save(
          return;
      }
  
 -    f << "# " CRAWL " " << Version::Long() << " macro file" << std::endl
 -      << "# WARNING: This file is entirely auto-generated." << std::endl
 -      << std::endl << "# Key Mappings:" << std::endl;
 +    fprintf(f, "# %s %s macro file\n"
 +               "# WARNING: This file is entirely auto-generated.\n"
 +               "\n"
 +               "# Key Mappings:\n",
 +            OUTS(CRAWL), // ok, localizing the game name is not likely
 +            OUTS(Version::Long())); // nor the version string
      for (int mc = KMC_DEFAULT; mc < KMC_CONTEXT_COUNT; ++mc)
      {
-         char keybuf[30] = "K:";
+         char buf[30] = "K:";
          if (mc)
-             snprintf(keybuf, sizeof keybuf, "K%d:", mc);
-         write_map(f, Keymaps[mc], keybuf);
+             snprintf(buf, sizeof buf, "K%d:", mc);
+         write_map(f, Keymaps[mc], buf);
      }
  
 -    f << "# Command Macros:" << std::endl;
 +    fprintf(f, "# Command Macros:\n");
      write_map(f, Macros, "M:");
  
      crawl_state.unsaved_macros = false;
Simple merge
Simple merge
@@@ -206,7 -207,7 +207,8 @@@ terrain.o 
  transform.o \
  traps.o \
  travel.o \
+ tutorial.o \
 +unicode.o \
  view.o \
  viewchar.o \
  viewgeom.o \
  #include "coord.h"
  #include "random.h"
  #include "state.h"
 +#include "syscalls.h"
  #include "tags.h"
  #include "terrain.h"
+ #include "tutorial.h"
  
  static map_section_type write_vault(map_def &mdef,
                                      vault_placement &,
@@@ -1141,10 -1123,10 +1124,10 @@@ static bool load_map_index(const std::s
  {
      // If there's a global prelude, load that first.
      {
 -        FILE *fp = fopen((base + ".lux").c_str(), "rb");
 +        FILE *fp = fopen_u((base + ".lux").c_str(), "rb");
          if (fp)
          {
-             reader inf(fp);
+             reader inf(fp, TAG_MINOR_VERSION);
              lc_global_prelude.read(inf);
              fclose(fp);
  
          }
      }
  
 -    FILE* fp = fopen((base + ".idx").c_str(), "rb");
 +    FILE* fp = fopen_u((base + ".idx").c_str(), "rb");
      if (!fp)
          end(1, true, "Unable to read %s", (base + ".idx").c_str());
-     reader inf(fp);
  
+     reader inf(fp, TAG_MINOR_VERSION);
      // Discard version (it's been checked by verify_map_index).
      (void) unmarshallInt(inf);
      const int nmaps = unmarshallShort(inf);
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
@@@ -80,47 -80,36 +80,47 @@@ int SQL_DBM::open(const std::string &s
      if (!s.empty())
          dbfile = s;
  
-     if (!dbfile.empty())
+     if (dbfile.empty())
      {
-         if (dbfile.find(".db") != dbfile.length() - 3)
-             dbfile += ".db";
+         error = "No filename!";
+         return SQLITE_ERROR; // "... or missing database"
+     }
+     if (dbfile.find(".db") != dbfile.length() - 3)
+         dbfile += ".db";
  
 +/*
 +From SQLite's documentation:
 +
 +# Note to Windows users: The encoding used for the filename argument of
 +# sqlite3_open() and sqlite3_open_v2() must be UTF-8, not whatever codepage
 +# is currently defined.  Filenames containing international characters must
 +# be converted to UTF-8 prior to passing them into sqlite3_open() or
 +# sqlite3_open_v2().
 +
 +... which saves us a lot of trouble.
 +*/
  #ifdef ANCIENT_SQLITE
-         if (ec(sqlite3_open(
-                     dbfile.c_str(), &db
+     if (ec(sqlite3_open(
+                 dbfile.c_str(), &db
  #else
-         if (ec(sqlite3_open_v2(
-                     dbfile.c_str(), &db,
-                     readonly? SQLITE_OPEN_READONLY :
-                     (SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE),
-                     NULL
+     if (ec(sqlite3_open_v2(
+                 dbfile.c_str(), &db,
+                 readonly? SQLITE_OPEN_READONLY :
+                 (SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE),
+                 NULL
  #endif
-                   )) != SQLITE_OK)
-         {
-             const std::string saveerr = error;
-             const int serrc = errc;
-             close();
-             error = saveerr;
-             errc  = serrc;
-             return (errc);
-         }
-         init_schema();
+               )) != SQLITE_OK)
+     {
+         const std::string saveerr = error;
+         const int serrc = errc;
+         close();
+         error = saveerr;
+         errc  = serrc;
+         return (errc);
      }
-     else
-         error = "No filename!";
  
+     init_schema();
      return (errc);
  }
  
Simple merge
Simple merge
@@@ -29,8 -29,9 +29,8 @@@ game_state::game_state(
        terminal_resized(false), io_inited(false), need_save(false),
        saving_game(false), updating_scores(false), seen_hups(0),
        map_stat_gen(false), type(GAME_TYPE_NORMAL), arena_suspended(false),
-       test(false), script(false), build_db(false), tests_selected(),
-       show_more_prompt(true),
+       dump_maps(false), test(false), script(false), build_db(false),
 -      tests_selected(), unicode_ok(false), show_more_prompt(true),
 -      glyph2strfn(NULL), multibyte_strlen(NULL),
++      tests_selected(), show_more_prompt(true),
        terminal_resize_handler(NULL), terminal_resize_check(NULL),
        doing_prev_cmd_again(false), prev_cmd(CMD_NO_CMD),
        repeat_cmd(CMD_NO_CMD),cmd_repeat_started_unsafe(false),
Simple merge
Simple merge
@@@ -5,15 -5,17 +5,16 @@@
   */
  
  #include "AppHdr.h"
 -#include "syscalls.h"
 +#include <dirent.h>
  
  #ifdef TARGET_OS_WINDOWS
 -
 -// FIXME!  This file doesn't yet use rename() (but we'll redefine it anyway once
 -// charset handling comes).
 -#undef rename
 -
 -#include <windows.h>
 -#include <wincrypt.h>
 -#include <io.h>
 +# ifdef TARGET_COMPILER_VC
 +#  include <direct.h>
 +# endif
 +# define WIN32_LEAN_AND_MEAN
 +# include <windows.h>
++# include <wincrypt.h>
 +# include <io.h>
  #else
  #include <unistd.h>
  #include <fcntl.h>
Simple merge
  #include "state.h"
  #include "stuff.h"
  #include "env.h"
 +#include "syscalls.h"
  #include "tags.h"
  #ifdef USE_TILE
+  #include "options.h"
+  #include "tiledef-dngn.h"
+  #include "tiledef-player.h"
   #include "tilemcache.h"
   #include "tilepick.h"
   #include "tileview.h"
@@@ -76,14 -78,11 +79,11 @@@ extern std::map<level_id, std::string> 
  
  level_id_set Generated_Levels;
  
- // The minor version for the tag currently being read.
- static int _tag_minor_version = -1;
- reader::reader(const std::string &filename, int minorVersion)
-     : _chunk(0), _pbuf(NULL), _read_offset(0),
+ reader::reader(const std::string &_read_filename, int minorVersion)
+     : _filename(_read_filename), _chunk(0), _pbuf(NULL), _read_offset(0),
        _minorVersion(minorVersion), seen_enums()
  {
-     _file       = fopen_u(filename.c_str(), "rb");
 -    _file       = fopen(_filename.c_str(), "rb");
++    _file       = fopen_u(_filename.c_str(), "rb");
      opened_file = !!_file;
  }
  
Simple merge
Simple merge
Simple merge
@@@ -1,14 -1,15 +1,15 @@@
  #ifndef VIEWGEOM_H
  #define VIEWGEOM_H
  
+ #include "tiledgnbuf.h"
  struct screen_cell_t
  {
 -    screen_buffer_t glyph;
 -    screen_buffer_t colour;
 -    screen_buffer_t flash_colour;
 +    wchar_t glyph;
 +    unsigned short colour; // TODO: check if this is real colour (8 bit)
 +    unsigned short flash_colour;
  #ifdef USE_TILE
-     tileidx_t tile_fg;
-     tileidx_t tile_bg;
+     packed_cell tile;
  #endif
  };
  
Simple merge