Explicitly delete vvalptridx(valptridx&&)

This commit is contained in:
Kp 2014-08-16 23:13:17 +00:00
parent 83c6b60123
commit 56557a0443
3 changed files with 23 additions and 7 deletions

View file

@ -28,6 +28,9 @@
template <typename T>
void get_global_array(T *);
template <typename T, typename I, template <I> class magic_constant>
class vvalptridx_t;
/*
* A data type for passing both a pointer and its offset in an
* agreed-upon array. Useful for Segments, Objects.
@ -70,6 +73,7 @@ public:
template <typename U>
typename tt::enable_if<!tt::is_base_of<this_type, U>::value, bool>::type operator==(U) const = delete;
valptridx_t() = delete;
valptridx_t(vvalptridx_t<typename tt::remove_const<T>::type, I, magic_constant> &&) = delete;
valptridx_t(const valptridx_t<typename tt::remove_const<T>::type, I, magic_constant> &t) :
p(t.p), i(t.i)
{
@ -88,6 +92,11 @@ public:
p(check_null_pointer(t)), i(check_index_match(get_array(), t, check_index_range(get_array(), t-get_array())))
{
}
template <typename A>
valptridx_t(A &a, index_type s) :
p(s != ~static_cast<index_type>(0) ? &a[s] : NULL), i(s != ~static_cast<index_type>(0) ? check_index_range(a, s) : s)
{
}
valptridx_t(index_type s) :
p(s != ~static_cast<index_type>(0) ? &get_array()[s] : NULL), i(s != ~static_cast<index_type>(0) ? check_index_range(get_array(), s) : s)
{
@ -162,6 +171,7 @@ public:
base_t(p)
{
}
vvalptridx_t(base_t &&) = delete;
vvalptridx_t(const base_t &t) :
base_t(get_array(), t, t)
{
@ -201,6 +211,8 @@ public:
DXX_INHERIT_CONSTRUCTORS(v##name, vvalptridx_t<P Pconst, I, P##_magic_constant_t>); \
}; \
\
static inline name N(name) = delete; \
static inline v##name N(v##name) = delete; \
static inline v##name N(name::pointer_type o, name::index_type i) { \
return {A, o, i}; \
} \
@ -216,7 +228,11 @@ public:
_DEFINE_VALPTRIDX_SUBTYPE_USERTYPE(N,P,I,A,N##_t,); \
_DEFINE_VALPTRIDX_SUBTYPE_USERTYPE(N,P,I,A,c##N##_t,const); \
\
static inline v##N##_t N(N##_t::index_type i) { \
static inline N##_t N(N##_t::index_type i) { \
return {A, i}; \
} \
\
static inline v##N##_t v##N(N##_t::index_type i) { \
return {A, i}; \
} \

View file

@ -1023,7 +1023,7 @@ static int load_game_data(PHYSFS_file *LoadFile)
}
else {
Objects[i].segnum = segment_none; //avoid Assert()
obj_link(objptridx(i),objsegnum);
obj_link(vobjptridx(i),objsegnum);
}
}
}

View file

@ -988,7 +988,7 @@ void multi_do_boss_teleport(unsigned pnum, const ubyte *buf)
Int3(); // See Rob
return;
}
vobjptridx_t boss_obj = objptridx(b.objnum);
vobjptridx_t boss_obj = vobjptridx(b.objnum);
if ((boss_obj->type != OBJ_ROBOT) || !(Robot_info[get_robot_id(boss_obj)].boss_flag))
{
Int3(); // Got boss actions for a robot who's not a boss?
@ -1032,7 +1032,7 @@ void multi_do_boss_cloak(unsigned pnum, const ubyte *buf)
Int3(); // See Rob
return;
}
vobjptridx_t boss_obj = objptridx(b.objnum);
vobjptridx_t boss_obj = vobjptridx(b.objnum);
if ((boss_obj->type != OBJ_ROBOT) || !(Robot_info[get_robot_id(boss_obj)].boss_flag))
{
Int3(); // Got boss actions for a robot who's not a boss?
@ -1057,7 +1057,7 @@ void multi_do_boss_start_gate(unsigned pnum, const ubyte *buf)
Int3(); // See Rob
return;
}
vobjptridx_t boss_obj = objptridx(b.objnum);
vobjptridx_t boss_obj = vobjptridx(b.objnum);
if ((boss_obj->type != OBJ_ROBOT) || !(Robot_info[get_robot_id(boss_obj)].boss_flag))
{
Int3(); // Got boss actions for a robot who's not a boss?
@ -1075,7 +1075,7 @@ void multi_do_boss_stop_gate(unsigned pnum, const ubyte *buf)
Int3(); // See Rob
return;
}
vobjptridx_t boss_obj = objptridx(b.objnum);
vobjptridx_t boss_obj = vobjptridx(b.objnum);
if ((boss_obj->type != OBJ_ROBOT) || !(Robot_info[get_robot_id(boss_obj)].boss_flag))
{
Int3(); // Got boss actions for a robot who's not a boss?
@ -1093,7 +1093,7 @@ void multi_do_boss_create_robot(unsigned pnum, const ubyte *buf)
Int3(); // See Rob
return;
}
vobjptridx_t boss_obj = objptridx(b.objnum);
vobjptridx_t boss_obj = vobjptridx(b.objnum);
if ((boss_obj->type != OBJ_ROBOT) || !(Robot_info[get_robot_id(boss_obj)].boss_flag))
{
Int3(); // Got boss actions for a robot who's not a boss?