diff options
-rw-r--r-- | crawl-ref/source/AppHdr.h | 7 | ||||
-rw-r--r-- | crawl-ref/source/dgnevent.cc | 2 | ||||
-rw-r--r-- | crawl-ref/source/dgnevent.h | 2 | ||||
-rw-r--r-- | crawl-ref/source/dungeon.cc | 2 | ||||
-rw-r--r-- | crawl-ref/source/env.h | 2 | ||||
-rw-r--r-- | crawl-ref/source/fontwrapper-ft.cc | 2 | ||||
-rw-r--r-- | crawl-ref/source/godconduct.cc | 2 | ||||
-rw-r--r-- | crawl-ref/source/godconduct.h | 2 | ||||
-rw-r--r-- | crawl-ref/source/hiscores.cc | 4 | ||||
-rw-r--r-- | crawl-ref/source/hiscores.h | 2 | ||||
-rw-r--r-- | crawl-ref/source/l_dgn.cc | 2 | ||||
-rw-r--r-- | crawl-ref/source/mapdef.cc | 12 | ||||
-rw-r--r-- | crawl-ref/source/mapdef.h | 12 | ||||
-rw-r--r-- | crawl-ref/source/mapmark.h | 2 | ||||
-rw-r--r-- | crawl-ref/source/mon-info.h | 2 | ||||
-rw-r--r-- | crawl-ref/source/monster.cc | 2 | ||||
-rw-r--r-- | crawl-ref/source/monster.h | 2 | ||||
-rw-r--r-- | crawl-ref/source/sqldbm.cc | 12 | ||||
-rw-r--r-- | crawl-ref/source/sqldbm.h | 4 | ||||
-rw-r--r-- | crawl-ref/source/store.cc | 2 | ||||
-rw-r--r-- | crawl-ref/source/terrain.cc | 2 | ||||
-rw-r--r-- | crawl-ref/source/travel.cc | 6 | ||||
-rw-r--r-- | crawl-ref/source/view.cc | 6 |
23 files changed, 50 insertions, 43 deletions
diff --git a/crawl-ref/source/AppHdr.h b/crawl-ref/source/AppHdr.h index be23bdeda2..4945a81eb4 100644 --- a/crawl-ref/source/AppHdr.h +++ b/crawl-ref/source/AppHdr.h @@ -24,6 +24,13 @@ namespace std {}; using namespace std; +#if defined(__cplusplus) && __cplusplus < 201103 +# define unique_ptr auto_ptr +template<typename T> +static inline T move(T x) { return x; } // good enough for our purposes +# define nullptr NULL +#endif + #ifdef TARGET_COMPILER_VC /* Disable warning about: 4290: the way VC handles the throw() specifier diff --git a/crawl-ref/source/dgnevent.cc b/crawl-ref/source/dgnevent.cc index f93d247da7..ed5f9f5082 100644 --- a/crawl-ref/source/dgnevent.cc +++ b/crawl-ref/source/dgnevent.cc @@ -30,7 +30,7 @@ void dgn_event_dispatcher::move_listeners( const coord_def &from, const coord_def &to) { // Any existing listeners at to will be discarded. YHBW. - grid_triggers[to.x][to.y] = grid_triggers[from.x][from.y]; + grid_triggers[to.x][to.y] = move(grid_triggers[from.x][from.y]); } bool dgn_event_dispatcher::has_listeners_at(const coord_def &pos) const diff --git a/crawl-ref/source/dgnevent.h b/crawl-ref/source/dgnevent.h index 98e351bf17..1071d6742a 100644 --- a/crawl-ref/source/dgnevent.h +++ b/crawl-ref/source/dgnevent.h @@ -129,7 +129,7 @@ private: private: unsigned global_event_mask; - auto_ptr<dgn_square_alarm> grid_triggers[GXM][GYM]; + unique_ptr<dgn_square_alarm> grid_triggers[GXM][GYM]; list<dgn_listener_def> listeners; }; diff --git a/crawl-ref/source/dungeon.cc b/crawl-ref/source/dungeon.cc index 0b0ea22496..0b0ec24466 100644 --- a/crawl-ref/source/dungeon.cc +++ b/crawl-ref/source/dungeon.cc @@ -239,7 +239,7 @@ struct dgn_colour_override_manager }; typedef FixedArray< coloured_feature, GXM, GYM > dungeon_colour_grid; -static auto_ptr<dungeon_colour_grid> dgn_colour_grid; +static unique_ptr<dungeon_colour_grid> dgn_colour_grid; static string branch_epilogues[NUM_BRANCHES]; diff --git a/crawl-ref/source/env.h b/crawl-ref/source/env.h index e3db207113..4624153173 100644 --- a/crawl-ref/source/env.h +++ b/crawl-ref/source/env.h @@ -42,7 +42,7 @@ struct crawl_environment vault_placement_refv level_vaults; - auto_ptr<grid_heightmap> heightmap; + unique_ptr<grid_heightmap> heightmap; // Player-remembered terrain and LOS FixedArray< map_cell, GXM, GYM > map_knowledge; diff --git a/crawl-ref/source/fontwrapper-ft.cc b/crawl-ref/source/fontwrapper-ft.cc index 7de49cadc7..6f868534e3 100644 --- a/crawl-ref/source/fontwrapper-ft.cc +++ b/crawl-ref/source/fontwrapper-ft.cc @@ -470,7 +470,7 @@ static void _draw_box(int x_pos, int y_pos, float width, float height, float box_width, unsigned char box_colour, unsigned char box_alpha) { - auto_ptr<GLShapeBuffer> buf(GLShapeBuffer::create(false, true)); + unique_ptr<GLShapeBuffer> buf(GLShapeBuffer::create(false, true)); GLWPrim rect(x_pos - box_width, y_pos - box_width, x_pos + width + box_width, y_pos + height + box_width); diff --git a/crawl-ref/source/godconduct.cc b/crawl-ref/source/godconduct.cc index b46c87aaab..f09b7c4f45 100644 --- a/crawl-ref/source/godconduct.cc +++ b/crawl-ref/source/godconduct.cc @@ -17,7 +17,7 @@ god_conduct_trigger::god_conduct_trigger( conduct_type c, int pg, bool kn, const monster* vict) - : conduct(c), pgain(pg), known(kn), enabled(true), victim(NULL) + : conduct(c), pgain(pg), known(kn), enabled(true), victim(nullptr) { if (vict) { diff --git a/crawl-ref/source/godconduct.h b/crawl-ref/source/godconduct.h index d12153c62e..8baa7d0a1c 100644 --- a/crawl-ref/source/godconduct.h +++ b/crawl-ref/source/godconduct.h @@ -13,7 +13,7 @@ struct god_conduct_trigger int pgain; bool known; bool enabled; - auto_ptr<monster> victim; + unique_ptr<monster> victim; god_conduct_trigger(conduct_type c = NUM_CONDUCTS, int pg = 0, diff --git a/crawl-ref/source/hiscores.cc b/crawl-ref/source/hiscores.cc index f529bc85c4..677505c1ed 100644 --- a/crawl-ref/source/hiscores.cc +++ b/crawl-ref/source/hiscores.cc @@ -70,7 +70,7 @@ #define SCORE_VERSION "0.1" // enough memory allocated to snarf in the scorefile entries -static auto_ptr<scorefile_entry> hs_list[SCORE_FILE_ENTRIES]; +static unique_ptr<scorefile_entry> hs_list[SCORE_FILE_ENTRIES]; // hackish: scorefile position of newest entry. Will be highlit during // highscore printing (always -1 when run from command line). @@ -138,7 +138,7 @@ void hiscores_new_entry(const scorefile_entry &ne) // Fixed a nasty overflow bug here -- Sharp if (i+1 < SCORE_FILE_ENTRIES) { - hs_list[i + 1] = hs_list[i]; + hs_list[i + 1] = move(hs_list[i]); hs_list[i].reset(new scorefile_entry(ne)); i++; } diff --git a/crawl-ref/source/hiscores.h b/crawl-ref/source/hiscores.h index 61ce9b05b9..537ca57300 100644 --- a/crawl-ref/source/hiscores.h +++ b/crawl-ref/source/hiscores.h @@ -113,7 +113,7 @@ private: int zigs; // Ziggurats completed. int zigmax; // Max level reached in a ziggurat. - mutable auto_ptr<xlog_fields> fields; + mutable unique_ptr<xlog_fields> fields; public: scorefile_entry(); diff --git a/crawl-ref/source/l_dgn.cc b/crawl-ref/source/l_dgn.cc index 44ad3ecc12..22fbb207eb 100644 --- a/crawl-ref/source/l_dgn.cc +++ b/crawl-ref/source/l_dgn.cc @@ -1434,7 +1434,7 @@ static int dgn_register_lua_marker(lua_State *ls) return 0; } -static auto_ptr<lua_datum> _dgn_map_safe_bounds_fn; +static unique_ptr<lua_datum> _dgn_map_safe_bounds_fn; static bool _lua_map_place_valid(const map_def &map, const coord_def &c, diff --git a/crawl-ref/source/mapdef.cc b/crawl-ref/source/mapdef.cc index e3b2b2ae6a..d551ad5b8d 100644 --- a/crawl-ref/source/mapdef.cc +++ b/crawl-ref/source/mapdef.cc @@ -994,14 +994,14 @@ void map_lines::extend(int min_width, int min_height, char fill) // Extend overlay matrix as well. if (overlay.get()) { - auto_ptr<overlay_matrix> new_overlay( + unique_ptr<overlay_matrix> new_overlay( new overlay_matrix(width(), height())); for (int y = 0; y < old_height; ++y) for (int x = 0; x < old_width; ++x) (*new_overlay)(x, y) = (*overlay)(x, y); - overlay = new_overlay; + overlay = move(new_overlay); } } @@ -1495,12 +1495,12 @@ void map_lines::rotate(bool clockwise) if (overlay.get()) { - auto_ptr<overlay_matrix> new_overlay( + unique_ptr<overlay_matrix> new_overlay( new overlay_matrix(lines.size(), map_width)); for (int i = xs, y = 0; i != xe; i += xi, ++y) for (int j = ys, x = 0; j != ye; j += yi, ++x) (*new_overlay)(x, y) = (*overlay)(i, j); - overlay = new_overlay; + overlay = move(new_overlay); } map_width = lines.size(); @@ -5466,7 +5466,7 @@ void keyed_mapspec::parse_features(const string &s) * @param s The string to be parsed. * @param weight The weight of this string. * @returns A feature_spec with the contained, parsed trap_spec stored via - * auto_ptr as feature_spec->trap. + * unique_ptr as feature_spec->trap. **/ feature_spec keyed_mapspec::parse_trap(string s, int weight) { @@ -5494,7 +5494,7 @@ feature_spec keyed_mapspec::parse_trap(string s, int weight) * @param s The string to be parsed. * @param weight The weight of this string. * @returns A feature_spec with the contained, parsed shop_spec stored via - * auto_ptr as feature_spec->shop. + * unique_ptr as feature_spec->shop. **/ feature_spec keyed_mapspec::parse_shop(string s, int weight) { diff --git a/crawl-ref/source/mapdef.h b/crawl-ref/source/mapdef.h index 0f002223e1..f1415bc616 100644 --- a/crawl-ref/source/mapdef.h +++ b/crawl-ref/source/mapdef.h @@ -263,7 +263,7 @@ public: string marker; // Special handling for Lua markers: - auto_ptr<lua_datum> lua_fn; + unique_ptr<lua_datum> lua_fn; map_marker_spec(string _key, const string &mark) : key(_key), marker(mark), lua_fn() { } @@ -500,7 +500,7 @@ private: int keyspec_idx; }; typedef Matrix<overlay_def> overlay_matrix; - auto_ptr<overlay_matrix> overlay; + unique_ptr<overlay_matrix> overlay; typedef map<int, keyed_mapspec> keyed_specs; keyed_specs keyspecs; @@ -801,14 +801,14 @@ struct trap_spec * * This specification struct is used firstly when a feature is specified in * vault code (any feature), and secondly, if that feature is either a trap or a - * shop, as a container for a auto_ptr to that shop_spec or trap_spec. + * shop, as a container for a unique_ptr to that shop_spec or trap_spec. **/ struct feature_spec { int genweight; /**> The weight of this specific feature. */ int feat; /**> The specific feature being placed. */ - auto_ptr<shop_spec> shop; /**> A pointer to a shop_spec. */ - auto_ptr<trap_spec> trap; /**> A pointer to a trap_spec. */ + unique_ptr<shop_spec> shop; /**> A pointer to a shop_spec. */ + unique_ptr<trap_spec> trap; /**> A pointer to a trap_spec. */ int glyph; /**> What glyph to use instead. */ int mimic; /**> 1 chance in x to be a feature mimic. */ bool no_mimic; /**> Prevents random feature mimic here. */ @@ -896,7 +896,7 @@ public: dlua_set_map(map_def *map); ~dlua_set_map(); private: - auto_ptr<lua_datum> old_map; + unique_ptr<lua_datum> old_map; }; dungeon_feature_type map_feature_at(map_def *map, diff --git a/crawl-ref/source/mapmark.h b/crawl-ref/source/mapmark.h index 5dc3ecee56..c4263abb76 100644 --- a/crawl-ref/source/mapmark.h +++ b/crawl-ref/source/mapmark.h @@ -192,7 +192,7 @@ public: string debug_to_string() const; private: bool initialised; - auto_ptr<lua_datum> marker_table; + unique_ptr<lua_datum> marker_table; private: void check_register_table(); diff --git a/crawl-ref/source/mon-info.h b/crawl-ref/source/mon-info.h index 9ccdcd901e..1cae6cfb1c 100644 --- a/crawl-ref/source/mon-info.h +++ b/crawl-ref/source/mon-info.h @@ -159,7 +159,7 @@ struct monster_info : public monster_info_base void to_string(int count, string& desc, int& desc_colour, bool fullname = true) const; /* only real equipment is visible, miscellany is for mimic items */ - auto_ptr<item_def> inv[MSLOT_LAST_VISIBLE_SLOT + 1]; + unique_ptr<item_def> inv[MSLOT_LAST_VISIBLE_SLOT + 1]; union { diff --git a/crawl-ref/source/monster.cc b/crawl-ref/source/monster.cc index 72fc1b70d3..493e591b7a 100644 --- a/crawl-ref/source/monster.cc +++ b/crawl-ref/source/monster.cc @@ -80,7 +80,7 @@ monster::monster() clear_constricted(); }; -// Empty destructor to keep auto_ptr happy with incomplete ghost_demon type. +// Empty destructor to keep unique_ptr happy with incomplete ghost_demon type. monster::~monster() { } diff --git a/crawl-ref/source/monster.h b/crawl-ref/source/monster.h index 63b2a2d41b..2f6609dfd5 100644 --- a/crawl-ref/source/monster.h +++ b/crawl-ref/source/monster.h @@ -64,7 +64,7 @@ public: god_type god; // What god the monster worships, if // any. - auto_ptr<ghost_demon> ghost; // Ghost information. + unique_ptr<ghost_demon> ghost; // Ghost information. seen_context_type seen_context; // Non-standard context for // AI_SEE_MONSTER diff --git a/crawl-ref/source/sqldbm.cc b/crawl-ref/source/sqldbm.cc index d70bd27a34..03999a0e8a 100644 --- a/crawl-ref/source/sqldbm.cc +++ b/crawl-ref/source/sqldbm.cc @@ -253,20 +253,20 @@ string SQL_DBM::query(const string &key) return result; } -auto_ptr<string> SQL_DBM::firstkey() +unique_ptr<string> SQL_DBM::firstkey() { if (init_iterator() != SQLITE_OK) { - auto_ptr<string> result; + unique_ptr<string> result; return result; } return nextkey(); } -auto_ptr<string> SQL_DBM::nextkey() +unique_ptr<string> SQL_DBM::nextkey() { - auto_ptr<string> result; + unique_ptr<string> result; if (s_iterator) { if (ec(sqlite3_step(s_iterator)) == SQLITE_ROW) @@ -412,9 +412,9 @@ sql_datum dbm_fetch(SQL_DBM *db, const sql_datum &key) return sql_datum(ans); } -static sql_datum dbm_key(SQL_DBM *db, auto_ptr<string> (SQL_DBM::*key)()) +static sql_datum dbm_key(SQL_DBM *db, unique_ptr<string> (SQL_DBM::*key)()) { - auto_ptr<string> res = (db->*key)(); + unique_ptr<string> res = (db->*key)(); if (res.get()) return sql_datum(*res.get()); else diff --git a/crawl-ref/source/sqldbm.h b/crawl-ref/source/sqldbm.h index ccdb465355..1f8eb1a5f0 100644 --- a/crawl-ref/source/sqldbm.h +++ b/crawl-ref/source/sqldbm.h @@ -56,8 +56,8 @@ public: int open(const string &db = ""); void close(); - auto_ptr<string> firstkey(); - auto_ptr<string> nextkey(); + unique_ptr<string> firstkey(); + unique_ptr<string> nextkey(); string query(const string &key); int insert(const string &key, const string &value); diff --git a/crawl-ref/source/store.cc b/crawl-ref/source/store.cc index 2d929d1f96..b6f49ba71d 100644 --- a/crawl-ref/source/store.cc +++ b/crawl-ref/source/store.cc @@ -1253,7 +1253,7 @@ CrawlHashTable::CrawlHashTable(const CrawlHashTable& other) CrawlHashTable::~CrawlHashTable() { - // NOTE: Not using auto_ptr because making hash_map an auto_ptr + // NOTE: Not using unique_ptr because making hash_map an unique_ptr // causes compile weirdness in externs.h if (hash_map == NULL) return; diff --git a/crawl-ref/source/terrain.cc b/crawl-ref/source/terrain.cc index f272998f46..6bc2fa9a12 100644 --- a/crawl-ref/source/terrain.cc +++ b/crawl-ref/source/terrain.cc @@ -612,7 +612,7 @@ coord_def get_random_stair() } -static auto_ptr<map_mask_boolean> _slime_wall_precomputed_neighbour_mask; +static unique_ptr<map_mask_boolean> _slime_wall_precomputed_neighbour_mask; static void _precompute_slime_wall_neighbours() { diff --git a/crawl-ref/source/travel.cc b/crawl-ref/source/travel.cc index 7455a3d3a2..6032620e8c 100644 --- a/crawl-ref/source/travel.cc +++ b/crawl-ref/source/travel.cc @@ -346,7 +346,7 @@ struct cell_travel_safety }; typedef FixedArray<cell_travel_safety, GXM, GYM> travel_safe_grid; -static auto_ptr<travel_safe_grid> _travel_safe_grid; +static unique_ptr<travel_safe_grid> _travel_safe_grid; class precompute_travel_safety_grid { @@ -359,7 +359,7 @@ public: if (!_travel_safe_grid.get()) { did_compute = true; - auto_ptr<travel_safe_grid> tsgrid(new travel_safe_grid); + unique_ptr<travel_safe_grid> tsgrid(new travel_safe_grid); travel_safe_grid &safegrid(*tsgrid); for (rectangle_iterator ri(1); ri; ++ri) { @@ -369,7 +369,7 @@ public: ts.safe_if_ignoring_hostile_terrain = _is_travelsafe_square(p, true); } - _travel_safe_grid = tsgrid; + _travel_safe_grid = move(tsgrid); } } ~precompute_travel_safety_grid() diff --git a/crawl-ref/source/view.cc b/crawl-ref/source/view.cc index 13f69c62e8..b9cfb8f4e3 100644 --- a/crawl-ref/source/view.cc +++ b/crawl-ref/source/view.cc @@ -403,9 +403,9 @@ static const FixedArray<uint8_t, GXM, GYM>& _tile_difficulties(bool random) return cache; } -static auto_ptr<FixedArray<bool, GXM, GYM> > _tile_detectability() +static unique_ptr<FixedArray<bool, GXM, GYM> > _tile_detectability() { - auto_ptr<FixedArray<bool, GXM, GYM> > map(new FixedArray<bool, GXM, GYM>); + unique_ptr<FixedArray<bool, GXM, GYM> > map(new FixedArray<bool, GXM, GYM>); vector<coord_def> flood_from; @@ -482,7 +482,7 @@ bool magic_mapping(int map_radius, int proportion, bool suppress_msg, const FixedArray<uint8_t, GXM, GYM>& difficulty = _tile_difficulties(!deterministic); - auto_ptr<FixedArray<bool, GXM, GYM> > detectable; + unique_ptr<FixedArray<bool, GXM, GYM> > detectable; if (!deterministic) detectable = _tile_detectability(); |