fix odr violations

not sure why these only started to be reported on this branch
This commit is contained in:
Eric Wasylishen 2024-03-17 18:32:07 -06:00
parent 28190f5065
commit 9985d6c8fd
5 changed files with 16 additions and 4 deletions

View File

@ -4,6 +4,8 @@
#include <common/imglib.hh>
#include <utility>
namespace mapfile {
/*static*/ bool brush_side_t::is_valid_texture_projection(const qvec3f &faceNormal, const qvec3f &s_vec, const qvec3f &t_vec)
{
// TODO: This doesn't match how light does it (TexSpaceToWorld)
@ -1200,3 +1202,5 @@ void map_file_t::convert_to(texcoord_style_t style, const gamedef_t *game, const
}
}
}
} // namespace mapfile

View File

@ -29,6 +29,10 @@ See file, 'COPYING', for details.
#include <variant>
#include <optional>
// this file declares some names that clash with names elsewhere in the project and lead to ODR violations
// (e.g. texdef_valve_t). For now just wrap everything in a namespace to avoid issues.
namespace mapfile {
// main brush style; technically these can be mixed
enum class texcoord_style_t
{
@ -204,3 +208,5 @@ struct map_file_t
void convert_to(texcoord_style_t style, const gamedef_t *game, const settings::common_settings &options);
};
} // namespace mapfile

View File

@ -37,6 +37,8 @@ extern "C"
}
#endif
using namespace mapfile;
// global map file state
map_file_t map_file;
const gamedef_t *current_game = nullptr;

View File

@ -2005,9 +2005,9 @@ static std::optional<mapface_t> ParseBrushFace(
// to save on texinfo, reset all invisible sides to default texvecs
if (tx.flags.is_nodraw || tx.flags.is_hintskip || tx.flags.is_hint) {
brush_side_t temp;
mapfile::brush_side_t temp;
temp.plane = face.get_plane();
temp.set_texinfo(texdef_quake_ed_t{ { 0, 0 }, 0, { 1, 1 }});
temp.set_texinfo(mapfile::texdef_quake_ed_t{ { 0, 0 }, 0, { 1, 1 }});
tx.vecs = temp.vecs;
} else {
// ericw -- round texture vector values that are within ZERO_EPSILON of integers,

View File

@ -833,9 +833,9 @@ static void ExportBrushList_r(const mapentity_t &entity, node_t *node, brush_lis
// optimize BSP by using existing world-aligned texinfo
// if they exist
maptexinfo_t copy = texinfo;
brush_side_t temp;
mapfile::brush_side_t temp;
temp.plane = side.get_plane();
temp.set_texinfo(texdef_quake_ed_t{ { 0, 0 }, 0, { 1, 1 }});
temp.set_texinfo(mapfile::texdef_quake_ed_t{ { 0, 0 }, 0, { 1, 1 }});
copy.vecs = temp.vecs;
texinfo_id = FindTexinfo(copy, temp.plane, false);