From 73caeb4198e8321a6de37934b1120779469cae89 Mon Sep 17 00:00:00 2001 From: Steven Noonan Date: Mon, 12 Oct 2009 06:26:57 -0700 Subject: project-wide: fix msvc compile breakage MSVC is like a chimp with Down's syndrome. Signed-off-by: Steven Noonan --- crawl-ref/source/AppHdr.cc | 3 +++ crawl-ref/source/effects.cc | 2 +- crawl-ref/source/files.cc | 2 +- crawl-ref/source/initfile.cc | 20 ++++++++++---------- crawl-ref/source/luadgn.cc | 12 ++++++------ crawl-ref/source/tilebuf.cc | 4 ++++ crawl-ref/source/tilefont.cc | 4 ++++ crawl-ref/source/tilemcache.cc | 4 ++++ crawl-ref/source/tilereg.cc | 4 ++++ crawl-ref/source/tilesdl.cc | 4 ++++ crawl-ref/source/tiletex.cc | 3 +++ 11 files changed, 44 insertions(+), 18 deletions(-) create mode 100644 crawl-ref/source/AppHdr.cc diff --git a/crawl-ref/source/AppHdr.cc b/crawl-ref/source/AppHdr.cc new file mode 100644 index 0000000000..91e3e9f392 --- /dev/null +++ b/crawl-ref/source/AppHdr.cc @@ -0,0 +1,3 @@ + +/* This file is for MSVC to generate a precompiled header */ +#include "AppHdr.h" \ No newline at end of file diff --git a/crawl-ref/source/effects.cc b/crawl-ref/source/effects.cc index 6c4dc207bc..975cd9b593 100644 --- a/crawl-ref/source/effects.cc +++ b/crawl-ref/source/effects.cc @@ -4196,7 +4196,7 @@ struct greater_second // out which arc the input point pos falls on. static int _arc_decomposition(const coord_def & pos, int n_arcs) { - float theta = atan2(pos.y, pos.x); + float theta = atan2((float)pos.y, (float)pos.x); if (pos.x == 0 && pos.y != 0) theta = pos.y > 0 ? PI / 2 : -PI / 2; diff --git a/crawl-ref/source/files.cc b/crawl-ref/source/files.cc index 2e627db619..303ea417d6 100644 --- a/crawl-ref/source/files.cc +++ b/crawl-ref/source/files.cc @@ -482,7 +482,7 @@ bool is_read_safe_path(const std::string &path) { assert_read_safe_path(path); } - catch (const std::string &err) + catch (const std::string &) { return (false); } diff --git a/crawl-ref/source/initfile.cc b/crawl-ref/source/initfile.cc index cf175bc4db..2a796af899 100644 --- a/crawl-ref/source/initfile.cc +++ b/crawl-ref/source/initfile.cc @@ -9,16 +9,6 @@ REVISION("$Rev$"); #include "initfile.h" -// For finding the executable's path -#if defined ( WIN32CONSOLE ) || defined ( WIN32TILES ) -#define WIN32_LEAN_AND_MEAN -#include -#elif defined ( __linux__ ) -#include -#elif defined ( __MACH__ ) -extern char **NXArgv; -#endif - #include #include #include @@ -52,6 +42,16 @@ extern char **NXArgv; #include "items.h" #include "view.h" +// For finding the executable's path +#if defined ( WIN32CONSOLE ) || defined ( WIN32TILES ) +#define WIN32_LEAN_AND_MEAN +#include +#elif defined ( __linux__ ) +#include +#elif defined ( __MACH__ ) +extern char **NXArgv; +#endif + const std::string game_options::interrupt_prefix = "interrupt_"; game_options Options; diff --git a/crawl-ref/source/luadgn.cc b/crawl-ref/source/luadgn.cc index f377397337..deb089d3f0 100644 --- a/crawl-ref/source/luadgn.cc +++ b/crawl-ref/source/luadgn.cc @@ -669,8 +669,8 @@ static int dgn_set_random_mon_list(lua_State *ls) } else if (nargs == 2) { - map_def **_map( - clua_get_userdata(ls, MAP_METATABLE, 1)); + map_def **_map = + clua_get_userdata(ls, MAP_METATABLE, 1); map = *_map; } @@ -3466,8 +3466,8 @@ static mons_list _lua_get_mlist(lua_State *ls, int ndx) } else { - mons_list **mlist( - clua_get_userdata(ls, MONSLIST_METATABLE, ndx)); + mons_list **mlist = + clua_get_userdata(ls, MONSLIST_METATABLE, ndx); if (mlist) return (**mlist); @@ -3491,8 +3491,8 @@ static item_list _lua_get_ilist(lua_State *ls, int ndx) } else { - item_list **ilist( - clua_get_userdata(ls, ITEMLIST_METATABLE, ndx)); + item_list **ilist = + clua_get_userdata(ls, ITEMLIST_METATABLE, ndx); if (ilist) return (**ilist); diff --git a/crawl-ref/source/tilebuf.cc b/crawl-ref/source/tilebuf.cc index 470e8fa549..2699502717 100644 --- a/crawl-ref/source/tilebuf.cc +++ b/crawl-ref/source/tilebuf.cc @@ -8,6 +8,8 @@ #include "AppHdr.h" REVISION("$Rev$"); +#ifdef USE_TILE + #include "tilebuf.h" #include "tilefont.h" #include "tilesdl.h" @@ -323,3 +325,5 @@ void LineBuffer::add_square(float sx, float sy, float ex, float ey, add(ex, ey, sx, ey, col); add(sx, ey, sx, sy, col); } + +#endif diff --git a/crawl-ref/source/tilefont.cc b/crawl-ref/source/tilefont.cc index b92a499aa9..6c2c9e2d5a 100644 --- a/crawl-ref/source/tilefont.cc +++ b/crawl-ref/source/tilefont.cc @@ -6,6 +6,8 @@ #include "AppHdr.h" REVISION("$Rev$"); +#ifdef USE_TILE + #include "tilebuf.h" #include "tilefont.h" #include "defines.h" @@ -759,3 +761,5 @@ void FTFont::store(FontBuffer &buf, float &x, float &y, x += m_glyphs[c].advance; } + +#endif diff --git a/crawl-ref/source/tilemcache.cc b/crawl-ref/source/tilemcache.cc index 5811bdb94c..9e1c403456 100644 --- a/crawl-ref/source/tilemcache.cc +++ b/crawl-ref/source/tilemcache.cc @@ -1,6 +1,8 @@ #include "AppHdr.h" REVISION("$Rev$"); +#ifdef USE_TILE + #include "tilemcache.h" #include "tags.h" #include "ghost.h" @@ -865,3 +867,5 @@ void mcache_demon::construct(writer &th) marshallDemon(th, m_demon); } + +#endif diff --git a/crawl-ref/source/tilereg.cc b/crawl-ref/source/tilereg.cc index 3a7650eac5..447c7af8e2 100644 --- a/crawl-ref/source/tilereg.cc +++ b/crawl-ref/source/tilereg.cc @@ -8,6 +8,8 @@ #include "AppHdr.h" REVISION("$Rev$"); +#ifdef USE_TILE + #include "cio.h" #include "debug.h" #include "describe.h" @@ -4167,3 +4169,5 @@ void ImageManager::unload_textures() for (int i = 0; i < TEX_MAX; i++) m_textures[i].unload_texture(); } + +#endif diff --git a/crawl-ref/source/tilesdl.cc b/crawl-ref/source/tilesdl.cc index 953c5ba563..7945b80124 100644 --- a/crawl-ref/source/tilesdl.cc +++ b/crawl-ref/source/tilesdl.cc @@ -1,6 +1,8 @@ #include "AppHdr.h" REVISION("$Rev$"); +#ifdef USE_TILE + #include "artefact.h" #include "cio.h" #include "itemname.h" @@ -1758,3 +1760,5 @@ bool TilesFramework::need_redraw() const { return m_need_redraw; } + +#endif diff --git a/crawl-ref/source/tiletex.cc b/crawl-ref/source/tiletex.cc index 39993ca9e0..83c76c50b2 100644 --- a/crawl-ref/source/tiletex.cc +++ b/crawl-ref/source/tiletex.cc @@ -1,6 +1,8 @@ #include "AppHdr.h" REVISION("$Rev$"); +#ifdef USE_TILE + #include "files.h" #include "tiletex.h" @@ -270,3 +272,4 @@ void TilesTexture::set_info(int tile_max, tile_info_func *info_func) m_info_func = info_func; } +#endif -- cgit v1.2.3-54-g00ecf