Rewrite simple numeric casts from C style to static_cast<>
s/(\(int\|float\|fix\))\s*(/static_cast<\1>(/g
This commit is contained in:
parent
5d2b2891ad
commit
262094237f
|
@ -55,7 +55,7 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
|
|||
extern float FNTScaleX, FNTScaleY;
|
||||
|
||||
// add (scaled) spacing to given font coordinate
|
||||
#define LINE_SPACING ((float)(FNTScaleY*(grd_curcanv->cv_font->ft_h+(GAME_FONT->ft_h/5))))
|
||||
#define LINE_SPACING (static_cast<float>(FNTScaleY*(grd_curcanv->cv_font->ft_h+(GAME_FONT->ft_h/5))))
|
||||
|
||||
extern array<grs_font_ptr, MAX_FONTS> Gamefonts;
|
||||
|
||||
|
|
|
@ -888,7 +888,7 @@ int rotate_segment_new(const vms_angvec &pbh)
|
|||
int child_save;
|
||||
int current_group_save;
|
||||
|
||||
if (!IS_CHILD(Cursegp->children[(int) (Side_opposite[Curside])]))
|
||||
if (!IS_CHILD(Cursegp->children[static_cast<int>(Side_opposite[Curside])]))
|
||||
// -- I don't understand this, MK, 01/25/94: if (Cursegp->children[Curside] != group_seg-Segments)
|
||||
{
|
||||
editor_status("Error -- unable to rotate group, Cursegp:Side_opposite[Curside] cannot be free.");
|
||||
|
|
|
@ -231,7 +231,7 @@ static int segsize_common(int dimension, fix amount)
|
|||
int s;
|
||||
for (s=0; s<MAX_SIDES_PER_SEGMENT; s++)
|
||||
propagated[s]++;
|
||||
propagated[(int) (Side_opposite[i])]--;
|
||||
propagated[static_cast<int>(Side_opposite[i])]--;
|
||||
med_propagate_tmaps_to_segments(vsegptridx(c), Cursegp, 1);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -809,7 +809,7 @@ static int med_attach_segment_rotated(const vsegptridx_t destseg, const vsegptr_
|
|||
|
||||
// Set the vertex indices for the four vertices forming the front of the new side
|
||||
for (v=0; v<4; v++)
|
||||
nsp->verts[v] = destseg->verts[(int) (dvp[v])];
|
||||
nsp->verts[v] = destseg->verts[static_cast<int>(dvp[v])];
|
||||
|
||||
// The other 4 vertices must be created.
|
||||
// Their coordinates are determined by the 4 welded vertices and the vector from front
|
||||
|
@ -1228,11 +1228,11 @@ int med_form_joint(const vsegptridx_t seg1, int side1, const vsegptridx_t seg2,
|
|||
// Make a copy of the list of vertices in seg2 which will be deleted and set the
|
||||
// associated vertex number, so that all occurrences of the vertices can be replaced.
|
||||
for (v=0; v<4; v++)
|
||||
lost_vertices[v] = seg2->verts[(int) (vp2[v])];
|
||||
lost_vertices[v] = seg2->verts[static_cast<int>(vp2[v])];
|
||||
|
||||
// Now, for each vertex in lost_vertices, determine which vertex it maps to.
|
||||
for (v=0; v<4; v++)
|
||||
remap_vertices[3 - ((v + bfi) % 4)] = seg1->verts[(int) (vp1[v])];
|
||||
remap_vertices[3 - ((v + bfi) % 4)] = seg1->verts[static_cast<int>(vp1[v])];
|
||||
|
||||
// Now, in all segments, replace all occurrences of vertices in lost_vertices with remap_vertices
|
||||
|
||||
|
@ -1300,7 +1300,7 @@ int med_form_bridge_segment(const vsegptridx_t seg1, int side1, const vsegptridx
|
|||
{
|
||||
auto &sv = Side_to_verts[side2];
|
||||
for (v=0; v<4; v++)
|
||||
bs->verts[(3-v)+4] = seg2->verts[(int) (sv[v])];
|
||||
bs->verts[(3-v)+4] = seg2->verts[static_cast<int>(sv[v])];
|
||||
}
|
||||
|
||||
// Copy vertices from seg1 into first 4 vertices of bridge segment.
|
||||
|
@ -1309,7 +1309,7 @@ int med_form_bridge_segment(const vsegptridx_t seg1, int side1, const vsegptridx
|
|||
{
|
||||
auto &sv = Side_to_verts[side1];
|
||||
for (v=0; v<4; v++)
|
||||
bs->verts[(v + bfi) % 4] = seg1->verts[(int) (sv[v])];
|
||||
bs->verts[(v + bfi) % 4] = seg1->verts[static_cast<int>(sv[v])];
|
||||
}
|
||||
|
||||
// Form connections to children, first initialize all to unconnected.
|
||||
|
@ -1335,7 +1335,7 @@ int med_form_bridge_segment(const vsegptridx_t seg1, int side1, const vsegptridx
|
|||
seg1->children[side1] = segment_none;
|
||||
seg2->children[side2] = segment_none;
|
||||
bs->children[AttachSide] = segment_none;
|
||||
bs->children[(int) (Side_opposite[AttachSide])] = segment_none;
|
||||
bs->children[static_cast<int>(Side_opposite[AttachSide])] = segment_none;
|
||||
if (med_delete_segment(bs)) {
|
||||
Int3();
|
||||
}
|
||||
|
|
|
@ -637,7 +637,7 @@ static void get_side_ids(const vsegptr_t base_seg, const vsegptr_t con_seg, int
|
|||
if (side != base_side) {
|
||||
auto &base_vp = Side_to_verts[side];
|
||||
for (v0=0; v0<4; v0++)
|
||||
if (((base_seg->verts[(int) (base_vp[v0])] == abs_id1) && (base_seg->verts[(int) (base_vp[(v0+1) % 4])] == abs_id2)) || ((base_seg->verts[(int) (base_vp[v0])] == abs_id2) && (base_seg->verts[(int)(base_vp[ (v0+1) % 4])] == abs_id1))) {
|
||||
if (((base_seg->verts[static_cast<int>(base_vp[v0])] == abs_id1) && (base_seg->verts[static_cast<int>(base_vp[(v0+1) % 4])] == abs_id2)) || ((base_seg->verts[static_cast<int>(base_vp[v0])] == abs_id2) && (base_seg->verts[static_cast<int>(base_vp[ (v0+1) % 4])] == abs_id1))) {
|
||||
Assert(*base_common_side == -1); // This means two different sides shared the same edge with base_side == impossible!
|
||||
*base_common_side = side;
|
||||
}
|
||||
|
@ -652,7 +652,7 @@ static void get_side_ids(const vsegptr_t base_seg, const vsegptr_t con_seg, int
|
|||
if (side != con_side) {
|
||||
auto &con_vp = Side_to_verts[side];
|
||||
for (v0=0; v0<4; v0++)
|
||||
if (((con_seg->verts[(int) (con_vp[(v0 + 1) % 4])] == abs_id1) && (con_seg->verts[(int) (con_vp[v0])] == abs_id2)) || ((con_seg->verts[(int) (con_vp[(v0 + 1) % 4])] == abs_id2) && (con_seg->verts[(int) (con_vp[v0])] == abs_id1))) {
|
||||
if (((con_seg->verts[static_cast<int>(con_vp[(v0 + 1) % 4])] == abs_id1) && (con_seg->verts[static_cast<int>(con_vp[v0])] == abs_id2)) || ((con_seg->verts[static_cast<int>(con_vp[(v0 + 1) % 4])] == abs_id2) && (con_seg->verts[static_cast<int>(con_vp[v0])] == abs_id1))) {
|
||||
Assert(*con_common_side == -1); // This means two different sides shared the same edge with con_side == impossible!
|
||||
*con_common_side = side;
|
||||
}
|
||||
|
@ -825,8 +825,8 @@ static void propagate_tmaps_to_segment_sides(const vsegptridx_t base_seg, int ba
|
|||
|
||||
// Do for each edge on connecting face.
|
||||
for (v=0; v<4; v++) {
|
||||
abs_id1 = base_seg->verts[(int) (base_vp[v])];
|
||||
abs_id2 = base_seg->verts[(int) (base_vp[(v+1) % 4])];
|
||||
abs_id1 = base_seg->verts[static_cast<int>(base_vp[v])];
|
||||
abs_id2 = base_seg->verts[static_cast<int>(base_vp[(v+1) % 4])];
|
||||
propagate_tmaps_to_segment_side(base_seg, base_side, con_seg, con_side, abs_id1, abs_id2, uv_only_flag);
|
||||
}
|
||||
|
||||
|
|
|
@ -1163,8 +1163,8 @@ static int check_for_degenerate_side(const vcsegptr_t sp, int sidenum)
|
|||
//vm_vec_sub(&vec2, &Vertices[sp->verts[vp[2]]], &Vertices[sp->verts[vp[1]]]);
|
||||
//vm_vec_normalize(&vec1);
|
||||
//vm_vec_normalize(&vec2);
|
||||
vm_vec_normalized_dir(vec1, Vertices[sp->verts[(int) (vp[1])]], Vertices[sp->verts[(int) (vp[0])]]);
|
||||
vm_vec_normalized_dir(vec2, Vertices[sp->verts[(int) (vp[2])]], Vertices[sp->verts[(int) (vp[1])]]);
|
||||
vm_vec_normalized_dir(vec1, Vertices[sp->verts[static_cast<int>(vp[1])]], Vertices[sp->verts[static_cast<int>(vp[0])]]);
|
||||
vm_vec_normalized_dir(vec2, Vertices[sp->verts[static_cast<int>(vp[2])]], Vertices[sp->verts[static_cast<int>(vp[1])]]);
|
||||
const auto cross0 = vm_vec_cross(vec1, vec2);
|
||||
|
||||
dot = vm_vec_dot(vec_to_center, cross0);
|
||||
|
@ -1175,8 +1175,8 @@ static int check_for_degenerate_side(const vcsegptr_t sp, int sidenum)
|
|||
//vm_vec_sub(&vec2, &Vertices[sp->verts[vp[3]]], &Vertices[sp->verts[vp[2]]]);
|
||||
//vm_vec_normalize(&vec1);
|
||||
//vm_vec_normalize(&vec2);
|
||||
vm_vec_normalized_dir(vec1, Vertices[sp->verts[(int) (vp[2])]], Vertices[sp->verts[(int) (vp[1])]]);
|
||||
vm_vec_normalized_dir(vec2, Vertices[sp->verts[(int) (vp[3])]], Vertices[sp->verts[(int) (vp[2])]]);
|
||||
vm_vec_normalized_dir(vec1, Vertices[sp->verts[static_cast<int>(vp[2])]], Vertices[sp->verts[static_cast<int>(vp[1])]]);
|
||||
vm_vec_normalized_dir(vec2, Vertices[sp->verts[static_cast<int>(vp[3])]], Vertices[sp->verts[static_cast<int>(vp[2])]]);
|
||||
const auto cross1 = vm_vec_cross(vec1, vec2);
|
||||
|
||||
dot = vm_vec_dot(vec_to_center, cross1);
|
||||
|
|
|
@ -1709,8 +1709,8 @@ static void multi_do_message(const uint8_t *const cbuf)
|
|||
const auto color = get_player_or_team_color(buf[1]);
|
||||
char xrgb = BM_XRGB(player_rgb[color].r,player_rgb[color].g,player_rgb[color].b);
|
||||
digi_play_sample(SOUND_HUD_MESSAGE, F1_0);
|
||||
HUD_init_message(HM_MULTI, "%c%c%s:%c%c %s", CC_COLOR, xrgb, static_cast<const char *>(Players[(int)(buf[1])].callsign), CC_COLOR, BM_XRGB(0, 31, 0), msgstart);
|
||||
multi_sending_message[(int)(buf[1])] = msgsend_none;
|
||||
HUD_init_message(HM_MULTI, "%c%c%s:%c%c %s", CC_COLOR, xrgb, static_cast<const char *>(Players[static_cast<int>(buf[1])].callsign), CC_COLOR, BM_XRGB(0, 31, 0), msgstart);
|
||||
multi_sending_message[static_cast<int>(buf[1])] = msgsend_none;
|
||||
}
|
||||
|
||||
namespace dsx {
|
||||
|
@ -1942,17 +1942,17 @@ static void multi_do_escape(const ubyte *buf)
|
|||
|
||||
if (buf[2] == 0)
|
||||
{
|
||||
HUD_init_message(HM_MULTI, "%s %s", static_cast<const char *>(Players[(int)(buf[1])].callsign), TXT_HAS_ESCAPED);
|
||||
HUD_init_message(HM_MULTI, "%s %s", static_cast<const char *>(Players[static_cast<int>(buf[1])].callsign), TXT_HAS_ESCAPED);
|
||||
if (Game_mode & GM_NETWORK)
|
||||
Players[(int)(buf[1])].connected = CONNECT_ESCAPE_TUNNEL;
|
||||
Players[static_cast<int>(buf[1])].connected = CONNECT_ESCAPE_TUNNEL;
|
||||
if (!multi_goto_secret)
|
||||
multi_goto_secret = 2;
|
||||
}
|
||||
else if (buf[2] == 1)
|
||||
{
|
||||
HUD_init_message(HM_MULTI, "%s %s", static_cast<const char *>(Players[(int)(buf[1])].callsign), TXT_HAS_FOUND_SECRET);
|
||||
HUD_init_message(HM_MULTI, "%s %s", static_cast<const char *>(Players[static_cast<int>(buf[1])].callsign), TXT_HAS_FOUND_SECRET);
|
||||
if (Game_mode & GM_NETWORK)
|
||||
Players[(int)(buf[1])].connected = CONNECT_FOUND_SECRET;
|
||||
Players[static_cast<int>(buf[1])].connected = CONNECT_FOUND_SECRET;
|
||||
if (!multi_goto_secret)
|
||||
multi_goto_secret = 1;
|
||||
}
|
||||
|
@ -2085,7 +2085,7 @@ static multi_do_quit(const ubyte *buf)
|
|||
|
||||
if (!(Game_mode & GM_NETWORK))
|
||||
return;
|
||||
multi_disconnect_player((int)(buf[1]));
|
||||
multi_disconnect_player(static_cast<int>(buf[1]));
|
||||
}
|
||||
|
||||
namespace dsx {
|
||||
|
@ -4776,7 +4776,7 @@ void multi_restore_game(ubyte slot, uint id)
|
|||
|
||||
static void multi_do_msgsend_state(const ubyte *buf)
|
||||
{
|
||||
multi_sending_message[(int)(buf[1])] = (msgsend_state_t)buf[2];
|
||||
multi_sending_message[static_cast<int>(buf[1])] = (msgsend_state_t)buf[2];
|
||||
}
|
||||
|
||||
void multi_send_msgsend_state(msgsend_state_t state)
|
||||
|
|
|
@ -640,7 +640,7 @@ static void nd_read_object(const vobjptridx_t obj)
|
|||
if (obj->lifeleft == -1)
|
||||
obj->lifeleft = IMMORTAL_TIME;
|
||||
else
|
||||
obj->lifeleft = (fix)(static_cast<int>(obj->lifeleft) << 12);
|
||||
obj->lifeleft = static_cast<fix>(static_cast<int>(obj->lifeleft) << 12);
|
||||
}
|
||||
|
||||
if ((obj->type == OBJ_ROBOT) && !shareware) {
|
||||
|
|
Loading…
Reference in a new issue