mirror of
https://github.com/Relintai/pandemonium_engine.git
synced 2025-01-11 21:31:10 +01:00
Ported: Fix warnings found by Emscripten 3.1.10
Fix `-Wunused-but-set-variable`, `-Wunqualified-std-cast-call`, and
`-Wliteral-range` warnings.
- akien-mga
5e693b6d84
This commit is contained in:
parent
b4ed478b6c
commit
24eccc4281
@ -271,7 +271,7 @@ static int _bsp_find_best_half_plane(const Face3 *p_faces, const Vector<int> &p_
|
|||||||
const Face3 &f = p_faces[indices[i]];
|
const Face3 &f = p_faces[indices[i]];
|
||||||
Plane p = f.get_plane();
|
Plane p = f.get_plane();
|
||||||
|
|
||||||
int num_over = 0, num_under = 0, num_spanning = 0;
|
int num_over = 0, num_under = 0; //, num_spanning = 0;
|
||||||
|
|
||||||
for (int j = 0; j < ic; j++) {
|
for (int j = 0; j < ic; j++) {
|
||||||
if (i == j) {
|
if (i == j) {
|
||||||
@ -293,9 +293,10 @@ static int _bsp_find_best_half_plane(const Face3 *p_faces, const Vector<int> &p_
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (over && under) {
|
//if (over && under) {
|
||||||
num_spanning++;
|
//num_spanning++;
|
||||||
} else if (over) {
|
//} else
|
||||||
|
if (over) {
|
||||||
num_over++;
|
num_over++;
|
||||||
} else {
|
} else {
|
||||||
num_under++;
|
num_under++;
|
||||||
|
@ -394,7 +394,6 @@ Error QuickHull::build(const Vector<Vector3> &p_points, Geometry::MeshData &r_me
|
|||||||
if (O->get().plane.is_equal_approx(f.plane)) {
|
if (O->get().plane.is_equal_approx(f.plane)) {
|
||||||
//merge and delete edge and contiguous face, while repointing edges (uuugh!)
|
//merge and delete edge and contiguous face, while repointing edges (uuugh!)
|
||||||
int ois = O->get().indices.size();
|
int ois = O->get().indices.size();
|
||||||
int merged = 0;
|
|
||||||
|
|
||||||
for (int j = 0; j < ois; j++) {
|
for (int j = 0; j < ois; j++) {
|
||||||
//search a
|
//search a
|
||||||
@ -409,7 +408,6 @@ Error QuickHull::build(const Vector<Vector3> &p_points, Geometry::MeshData &r_me
|
|||||||
if (idx != a) {
|
if (idx != a) {
|
||||||
f.indices.insert(i + 1, idx);
|
f.indices.insert(i + 1, idx);
|
||||||
i++;
|
i++;
|
||||||
merged++;
|
|
||||||
}
|
}
|
||||||
Edge e2(idx, idxn);
|
Edge e2(idx, idxn);
|
||||||
|
|
||||||
|
@ -1290,7 +1290,6 @@ int CScriptCompiler::_parse_expression(CodeGen &codegen, const CScriptParser::No
|
|||||||
|
|
||||||
Error CScriptCompiler::_parse_block(CodeGen &codegen, const CScriptParser::BlockNode *p_block, int p_stack_level, int p_break_addr, int p_continue_addr) {
|
Error CScriptCompiler::_parse_block(CodeGen &codegen, const CScriptParser::BlockNode *p_block, int p_stack_level, int p_break_addr, int p_continue_addr) {
|
||||||
codegen.push_stack_identifiers();
|
codegen.push_stack_identifiers();
|
||||||
int new_identifiers = 0;
|
|
||||||
codegen.current_line = p_block->line;
|
codegen.current_line = p_block->line;
|
||||||
|
|
||||||
for (int i = 0; i < p_block->statements.size(); i++) {
|
for (int i = 0; i < p_block->statements.size(); i++) {
|
||||||
@ -1321,7 +1320,6 @@ Error CScriptCompiler::_parse_block(CodeGen &codegen, const CScriptParser::Block
|
|||||||
// copied because there is no _parse_statement :(
|
// copied because there is no _parse_statement :(
|
||||||
codegen.add_stack_identifier(id->name, p_stack_level++);
|
codegen.add_stack_identifier(id->name, p_stack_level++);
|
||||||
codegen.alloc_stack(p_stack_level);
|
codegen.alloc_stack(p_stack_level);
|
||||||
new_identifiers++;
|
|
||||||
|
|
||||||
CScriptParser::OperatorNode *op = memnew(CScriptParser::OperatorNode);
|
CScriptParser::OperatorNode *op = memnew(CScriptParser::OperatorNode);
|
||||||
op->op = CScriptParser::OperatorNode::OP_ASSIGN;
|
op->op = CScriptParser::OperatorNode::OP_ASSIGN;
|
||||||
@ -1579,7 +1577,6 @@ Error CScriptCompiler::_parse_block(CodeGen &codegen, const CScriptParser::Block
|
|||||||
|
|
||||||
codegen.add_stack_identifier(lv->name, p_stack_level++);
|
codegen.add_stack_identifier(lv->name, p_stack_level++);
|
||||||
codegen.alloc_stack(p_stack_level);
|
codegen.alloc_stack(p_stack_level);
|
||||||
new_identifiers++;
|
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
default: {
|
default: {
|
||||||
|
@ -1316,7 +1316,6 @@ int GDScriptCompiler::_parse_expression(CodeGen &codegen, const GDScriptParser::
|
|||||||
|
|
||||||
Error GDScriptCompiler::_parse_block(CodeGen &codegen, const GDScriptParser::BlockNode *p_block, int p_stack_level, int p_break_addr, int p_continue_addr) {
|
Error GDScriptCompiler::_parse_block(CodeGen &codegen, const GDScriptParser::BlockNode *p_block, int p_stack_level, int p_break_addr, int p_continue_addr) {
|
||||||
codegen.push_stack_identifiers();
|
codegen.push_stack_identifiers();
|
||||||
int new_identifiers = 0;
|
|
||||||
codegen.current_line = p_block->line;
|
codegen.current_line = p_block->line;
|
||||||
|
|
||||||
for (int i = 0; i < p_block->statements.size(); i++) {
|
for (int i = 0; i < p_block->statements.size(); i++) {
|
||||||
@ -1347,7 +1346,6 @@ Error GDScriptCompiler::_parse_block(CodeGen &codegen, const GDScriptParser::Blo
|
|||||||
// copied because there is no _parse_statement :(
|
// copied because there is no _parse_statement :(
|
||||||
codegen.add_stack_identifier(id->name, p_stack_level++);
|
codegen.add_stack_identifier(id->name, p_stack_level++);
|
||||||
codegen.alloc_stack(p_stack_level);
|
codegen.alloc_stack(p_stack_level);
|
||||||
new_identifiers++;
|
|
||||||
|
|
||||||
GDScriptParser::OperatorNode *op = memnew(GDScriptParser::OperatorNode);
|
GDScriptParser::OperatorNode *op = memnew(GDScriptParser::OperatorNode);
|
||||||
op->op = GDScriptParser::OperatorNode::OP_ASSIGN;
|
op->op = GDScriptParser::OperatorNode::OP_ASSIGN;
|
||||||
@ -1605,7 +1603,6 @@ Error GDScriptCompiler::_parse_block(CodeGen &codegen, const GDScriptParser::Blo
|
|||||||
|
|
||||||
codegen.add_stack_identifier(lv->name, p_stack_level++);
|
codegen.add_stack_identifier(lv->name, p_stack_level++);
|
||||||
codegen.alloc_stack(p_stack_level);
|
codegen.alloc_stack(p_stack_level);
|
||||||
new_identifiers++;
|
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
default: {
|
default: {
|
||||||
|
@ -137,7 +137,7 @@ Vector<Vector2> PolygonPathFinder::find_path(const Vector2 &p_from, const Vector
|
|||||||
Edge ignore_to_edge(-1, -1);
|
Edge ignore_to_edge(-1, -1);
|
||||||
|
|
||||||
if (!_is_point_inside(from)) {
|
if (!_is_point_inside(from)) {
|
||||||
float closest_dist = 1e20;
|
float closest_dist = 1e20f;
|
||||||
Vector2 closest_point;
|
Vector2 closest_point;
|
||||||
|
|
||||||
for (Set<Edge>::Element *E = edges.front(); E; E = E->next()) {
|
for (Set<Edge>::Element *E = edges.front(); E; E = E->next()) {
|
||||||
@ -161,7 +161,7 @@ Vector<Vector2> PolygonPathFinder::find_path(const Vector2 &p_from, const Vector
|
|||||||
};
|
};
|
||||||
|
|
||||||
if (!_is_point_inside(to)) {
|
if (!_is_point_inside(to)) {
|
||||||
float closest_dist = 1e20;
|
float closest_dist = 1e20f;
|
||||||
Vector2 closest_point;
|
Vector2 closest_point;
|
||||||
|
|
||||||
for (Set<Edge>::Element *E = edges.front(); E; E = E->next()) {
|
for (Set<Edge>::Element *E = edges.front(); E; E = E->next()) {
|
||||||
@ -489,7 +489,7 @@ bool PolygonPathFinder::is_point_inside(const Vector2 &p_point) const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Vector2 PolygonPathFinder::get_closest_point(const Vector2 &p_point) const {
|
Vector2 PolygonPathFinder::get_closest_point(const Vector2 &p_point) const {
|
||||||
float closest_dist = 1e20;
|
float closest_dist = 1e20f;
|
||||||
Vector2 closest_point;
|
Vector2 closest_point;
|
||||||
|
|
||||||
for (Set<Edge>::Element *E = edges.front(); E; E = E->next()) {
|
for (Set<Edge>::Element *E = edges.front(); E; E = E->next()) {
|
||||||
@ -508,7 +508,7 @@ Vector2 PolygonPathFinder::get_closest_point(const Vector2 &p_point) const {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ERR_FAIL_COND_V(closest_dist == 1e20, Vector2());
|
ERR_FAIL_COND_V(Math::is_equal_approx(closest_dist, 1e20f), Vector2());
|
||||||
|
|
||||||
return closest_point;
|
return closest_point;
|
||||||
}
|
}
|
||||||
|
@ -526,7 +526,6 @@ int PortalRoomsBSP::evaluate_room_split_plane(int p_room_a_id, int p_room_b_id,
|
|||||||
int PortalRoomsBSP::evaluate_plane(const VSPortal *p_portal, const Plane &p_plane, const LocalVector<int32_t, int32_t> &p_room_ids, LocalVector<int32_t, int32_t> *r_room_ids_back, LocalVector<int32_t, int32_t> *r_room_ids_front) {
|
int PortalRoomsBSP::evaluate_plane(const VSPortal *p_portal, const Plane &p_plane, const LocalVector<int32_t, int32_t> &p_room_ids, LocalVector<int32_t, int32_t> *r_room_ids_back, LocalVector<int32_t, int32_t> *r_room_ids_front) {
|
||||||
int rooms_front = 0;
|
int rooms_front = 0;
|
||||||
int rooms_back = 0;
|
int rooms_back = 0;
|
||||||
int rooms_split = 0;
|
|
||||||
|
|
||||||
if (r_room_ids_back) {
|
if (r_room_ids_back) {
|
||||||
DEV_ASSERT(!r_room_ids_back->size());
|
DEV_ASSERT(!r_room_ids_back->size());
|
||||||
@ -536,13 +535,13 @@ int PortalRoomsBSP::evaluate_plane(const VSPortal *p_portal, const Plane &p_plan
|
|||||||
DEV_ASSERT(!r_room_ids_front->size());
|
DEV_ASSERT(!r_room_ids_front->size());
|
||||||
}
|
}
|
||||||
|
|
||||||
#define PANDEMONIUM_BSP_PUSH_FRONT \
|
#define PANDEMONIUM_BSP_PUSH_FRONT \
|
||||||
rooms_front++; \
|
rooms_front++; \
|
||||||
if (r_room_ids_front) { \
|
if (r_room_ids_front) { \
|
||||||
r_room_ids_front->push_back(rid); \
|
r_room_ids_front->push_back(rid); \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define PANDEMONIUM_BSP_PUSH_BACK \
|
#define PANDEMONIUM_BSP_PUSH_BACK \
|
||||||
rooms_back++; \
|
rooms_back++; \
|
||||||
if (r_room_ids_back) { \
|
if (r_room_ids_back) { \
|
||||||
r_room_ids_back->push_back(rid); \
|
r_room_ids_back->push_back(rid); \
|
||||||
@ -622,8 +621,6 @@ int PortalRoomsBSP::evaluate_plane(const VSPortal *p_portal, const Plane &p_plan
|
|||||||
if (r_room_ids_back) {
|
if (r_room_ids_back) {
|
||||||
r_room_ids_back->push_back(rid);
|
r_room_ids_back->push_back(rid);
|
||||||
}
|
}
|
||||||
|
|
||||||
rooms_split++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#undef PANDEMONIUM_BSP_PUSH_BACK
|
#undef PANDEMONIUM_BSP_PUSH_BACK
|
||||||
|
@ -98,8 +98,6 @@ void VisualServerViewport::_draw_viewport(Viewport *p_viewport) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!p_viewport->hide_canvas) {
|
if (!p_viewport->hide_canvas) {
|
||||||
int i = 0;
|
|
||||||
|
|
||||||
Map<Viewport::CanvasKey, Viewport::CanvasData *> canvas_map;
|
Map<Viewport::CanvasKey, Viewport::CanvasData *> canvas_map;
|
||||||
|
|
||||||
Rect2 clip_rect(0, 0, p_viewport->size.x, p_viewport->size.y);
|
Rect2 clip_rect(0, 0, p_viewport->size.x, p_viewport->size.y);
|
||||||
@ -108,8 +106,6 @@ void VisualServerViewport::_draw_viewport(Viewport *p_viewport) {
|
|||||||
RasterizerCanvas::Light *lights_with_mask = nullptr;
|
RasterizerCanvas::Light *lights_with_mask = nullptr;
|
||||||
Rect2 shadow_rect;
|
Rect2 shadow_rect;
|
||||||
|
|
||||||
int light_count = 0;
|
|
||||||
|
|
||||||
for (Map<RID, Viewport::CanvasData>::Element *E = p_viewport->canvas_map.front(); E; E = E->next()) {
|
for (Map<RID, Viewport::CanvasData>::Element *E = p_viewport->canvas_map.front(); E; E = E->next()) {
|
||||||
VisualServerCanvas::Canvas *canvas = static_cast<VisualServerCanvas::Canvas *>(E->get().canvas);
|
VisualServerCanvas::Canvas *canvas = static_cast<VisualServerCanvas::Canvas *>(E->get().canvas);
|
||||||
|
|
||||||
@ -155,8 +151,6 @@ void VisualServerViewport::_draw_viewport(Viewport *p_viewport) {
|
|||||||
cl->mask_next_ptr = lights_with_mask;
|
cl->mask_next_ptr = lights_with_mask;
|
||||||
lights_with_mask = cl;
|
lights_with_mask = cl;
|
||||||
}
|
}
|
||||||
|
|
||||||
light_count++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
VSG::canvas_render->light_internal_update(cl->light_internal, cl);
|
VSG::canvas_render->light_internal_update(cl->light_internal, cl);
|
||||||
@ -226,7 +220,6 @@ void VisualServerViewport::_draw_viewport(Viewport *p_viewport) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
VSG::canvas->render_canvas(canvas, xform, canvas_lights, lights_with_mask, clip_rect, canvas_layer_id);
|
VSG::canvas->render_canvas(canvas, xform, canvas_lights, lights_with_mask, clip_rect, canvas_layer_id);
|
||||||
i++;
|
|
||||||
|
|
||||||
if (scenario_draw_canvas_bg && E->key().get_layer() >= scenario_canvas_max_layer) {
|
if (scenario_draw_canvas_bg && E->key().get_layer() >= scenario_canvas_max_layer) {
|
||||||
if (!can_draw_3d) {
|
if (!can_draw_3d) {
|
||||||
|
Loading…
Reference in New Issue
Block a user