Move some local structs into anonymous namespaces

This commit is contained in:
Kp 2015-01-24 19:16:34 +00:00
parent 40fd988a0f
commit 9794cfddc9
3 changed files with 19 additions and 3 deletions

View file

@ -92,7 +92,9 @@ static const sound_function_table_t digi_audio_table{
&digi_audio_set_digi_volume,
};
struct sound_function_pointers_t
namespace {
class sound_function_pointers_t
{
#ifdef USE_SDLMIXER
#ifdef DXX_COPY_SOUND_TABLE
@ -101,6 +103,8 @@ struct sound_function_pointers_t
const sound_function_table_t *table;
#endif
#endif
public:
__attribute_cold
void report_invalid_table() __noreturn;
inline const sound_function_table_t *operator->();
inline sound_function_pointers_t &operator=(const sound_function_table_t &t);
@ -152,6 +156,8 @@ sound_function_pointers_t &sound_function_pointers_t::operator=(const sound_func
}
#endif
}
static sound_function_pointers_t fptr;
void digi_select_system(int n) {

View file

@ -1041,7 +1041,9 @@ static void add_obj_to_seglist(render_state_t &rstate, objnum_t objnum, segnum_t
o.emplace_back(render_state_t::per_segment_state_t::distant_object{objnum});
}
struct render_compare_context_t
namespace {
class render_compare_context_t
{
struct element
{
@ -1052,6 +1054,7 @@ struct render_compare_context_t
};
typedef array<element, MAX_OBJECTS> array_t;
array_t a;
public:
array_t::reference operator[](std::size_t i) { return a[i]; }
array_t::const_reference operator[](std::size_t i) const { return a[i]; }
render_compare_context_t(const render_state_t::per_segment_state_t &segstate)
@ -1068,6 +1071,8 @@ struct render_compare_context_t
}
};
}
//compare function for object sort.
static bool compare_func(const render_compare_context_t &c, const render_state_t::per_segment_state_t::distant_object &a,const render_state_t::per_segment_state_t::distant_object &b)
{

View file

@ -138,14 +138,19 @@ static void draw_cell(int i,int j,g3s_point *p0,g3s_point *p1,g3s_point *p2,g3s_
}
struct terrain_y_cache
namespace {
class terrain_y_cache
{
static const std::size_t cache_size = 256;
std::bitset<cache_size> yc_flags;
array<vms_vector, cache_size> y_cache;
public:
vms_vector &operator()(uint_fast32_t h);
};
}
vms_vector &terrain_y_cache::operator()(uint_fast32_t h)
{
auto &dyp = y_cache[h];