Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 24 additions & 18 deletions code/ai/aicode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1399,7 +1399,7 @@ void ai_turn_towards_vector(const vec3d* dest, object* objp, const vec3d* slide_
}

// Don't allow a ship to turn if it's prevented from turning.
if ( objp->flags[Object::Object_Flags::Dont_change_orientation, Object::Object_Flags::Immobile] ) {
if (objp->flags.any_of(Object::Object_Flags::Dont_change_orientation,Object::Object_Flags::Immobile)) {
return;
}

Expand Down Expand Up @@ -2146,7 +2146,8 @@ float get_wing_lowest_av_ab_speed(object *objp)
ai_info *oaip = &Ai_info[oshipp->ai_index];
ship_info *osip = &Ship_info[oshipp->ship_info_index];

if ((oaip->mode == AIM_WAYPOINTS) && (oshipp->wingnum == wingnum) && (oaip->ai_flags[AI::AI_Flags::Formation_object, AI::AI_Flags::Formation_wing])) {
if ((oaip->mode == AIM_WAYPOINTS) && (oshipp->wingnum == wingnum) &&
(oaip->ai_flags.any_of(AI::AI_Flags::Formation_object,AI::AI_Flags::Formation_wing))) {

float cur_max;
if ((oshipp->flags[Ship::Ship_Flags::Afterburner_locked]) || !(osip->flags[Ship::Info_Flags::Afterburner]) || (o->phys_info.afterburner_max_vel.xyz.z <= o->phys_info.max_vel.xyz.z) || !(oaip->ai_flags[AI::AI_Flags::Free_afterburner_use] || oaip->ai_profile_flags[AI::Profile_Flags::Free_afterburner_use])) {
Expand Down Expand Up @@ -6650,7 +6651,8 @@ void ai_maybe_announce_shockwave_weapon(object *firing_objp, int weapon_index)
ai_info *aip = &Ai_info[Ships[A->instance].ai_index];

// AL 1-5-98: only avoid shockwave if not docked or repairing
if ( !object_is_docked(A) && !(aip->ai_flags[AI::AI_Flags::Repairing, AI::AI_Flags::Being_repaired]) ) {
if (!object_is_docked(A) &&
aip->ai_flags.none_of(AI::AI_Flags::Repairing,AI::AI_Flags::Being_repaired)) {
aip->ai_flags.set(AI::AI_Flags::Avoid_shockwave_weapon);
}
}
Expand Down Expand Up @@ -12318,7 +12320,8 @@ void ai_process_subobjects(int objnum)
// (previously in ship_evaluate_ai (previously in ship_process_post))
// Cyborg -- Unfortunately Ai info is not reliable and should just not be accessed here.
// It will have no real effect on gameplay, since the server decides when turrets fire
if (!MULTIPLAYER_CLIENT && (aip->ai_flags[AI::AI_Flags::Being_repaired, AI::AI_Flags::Awaiting_repair]))
if (!MULTIPLAYER_CLIENT &&
(aip->ai_flags.any_of(AI::AI_Flags::Being_repaired,AI::AI_Flags::Awaiting_repair)))
{
if (aip->support_ship_objnum >= 0)
{
Expand Down Expand Up @@ -13167,7 +13170,7 @@ void ai_do_repair_frame(object *objp, ai_info *aip, float frametime)
static bool rearm_eta_found=false;


if (aip->ai_flags[AI::AI_Flags::Being_repaired, AI::AI_Flags::Awaiting_repair]) {
if (aip->ai_flags.any_of(AI::AI_Flags::Being_repaired,AI::AI_Flags::Awaiting_repair)) {
if (Ships[objp->instance].team == Iff_traitor) {
ai_abort_rearm_request(objp);
return;
Expand Down Expand Up @@ -13534,7 +13537,7 @@ void ai_maybe_evade_locked_missile(object *objp, ai_info *aip)
return;
}

if (aip->ai_flags[AI::AI_Flags::No_dynamic, AI::AI_Flags::Kamikaze]) { // If not allowed to pursue dynamic objectives, don't evade. Dumb? Maybe change. -- MK, 3/15/98
if (aip->ai_flags.any_of(AI::AI_Flags::No_dynamic,AI::AI_Flags::Kamikaze)) { // If not allowed to pursue dynamic objectives, don't evade. Dumb? //Maybe change. -- MK, 3/15/98
return;
}

Expand Down Expand Up @@ -13589,7 +13592,7 @@ void ai_maybe_evade_locked_missile(object *objp, ai_info *aip)
}
break;
case AIM_DOCK: // Ships in dock mode can evade iif they are not currently repairing or docked.
if (object_is_docked(objp) || (aip->ai_flags[AI::AI_Flags::Repairing, AI::AI_Flags::Being_repaired]))
if (object_is_docked(objp) || (aip->ai_flags.any_of(AI::AI_Flags::Repairing,AI::AI_Flags::Being_repaired)))
break;
FALLTHROUGH;
case AIM_GUARD:
Expand Down Expand Up @@ -13739,7 +13742,8 @@ void maybe_evade_dumbfire_weapon(ai_info *aip)
case AIM_WAYPOINTS:
case AIM_FLY_TO_SHIP:
case AIM_SAFETY:
if (!(aip->ai_flags[AI::AI_Flags::No_dynamic, AI::AI_Flags::Kamikaze]) && Ship_info[Ships[aip->shipnum].ship_info_index].is_small_ship()) {
if (aip->ai_flags.none_of(AI::AI_Flags::No_dynamic,AI::AI_Flags::Kamikaze) &&
Ship_info[Ships[aip->shipnum].ship_info_index].is_small_ship()) {
aip->active_goal = AI_ACTIVE_GOAL_DYNAMIC;
aip->previous_mode = aip->mode;
aip->previous_submode = aip->submode;
Expand Down Expand Up @@ -14417,7 +14421,7 @@ int num_allies_rearming(object *objp)
continue;

if (Ships[A->instance].team == team) {
if (Ai_info[Ships[A->instance].ai_index].ai_flags[AI::AI_Flags::Repairing, AI::AI_Flags::Awaiting_repair]) {
if (Ai_info[Ships[A->instance].ai_index].ai_flags.any_of(AI::AI_Flags::Repairing,AI::AI_Flags::Awaiting_repair)) {
count++;
}
}
Expand Down Expand Up @@ -14449,7 +14453,7 @@ int maybe_request_support(object *objp)
return 0;

// A ship that is currently awaiting does not need support!
if (aip->ai_flags[AI::AI_Flags::Being_repaired, AI::AI_Flags::Awaiting_repair])
if (aip->ai_flags.any_of(AI::AI_Flags::Being_repaired,AI::AI_Flags::Awaiting_repair))
return 0;

if (!timestamp_elapsed(aip->next_rearm_request_timestamp))
Expand Down Expand Up @@ -14773,7 +14777,8 @@ void ai_announce_ship_dying(object *dying_objp)
ai_info *aip = &Ai_info[Ships[A->instance].ai_index];

// AL 1-5-98: only avoid shockwave if not docked or repairing
if ( !object_is_docked(A) && !(aip->ai_flags[AI::AI_Flags::Repairing, AI::AI_Flags::Being_repaired]) ) {
if (!object_is_docked(A) &&
aip->ai_flags.none_of(AI::AI_Flags::Repairing,AI::AI_Flags::Being_repaired)) {
aip->ai_flags.set(AI::AI_Flags::Avoid_shockwave_ship);
}
}
Expand Down Expand Up @@ -15104,7 +15109,7 @@ int ai_avoid_shockwave(object *objp, ai_info *aip)
// Return true if this ship is close to being repaired, else return false.
int ai_await_repair_frame(object *objp, ai_info *aip)
{
if (!(aip->ai_flags[AI::AI_Flags::Being_repaired, AI::AI_Flags::Awaiting_repair]))
if (aip->ai_flags.none_of(AI::AI_Flags::Being_repaired,AI::AI_Flags::Awaiting_repair))
return 0;

if (aip->support_ship_objnum == -1)
Expand Down Expand Up @@ -15364,11 +15369,12 @@ void ai_frame(int objnum)
ai_process_mission_orders( objnum, aip );

// Avoid a shockwave, if necessary. If a shockwave and rearming, stop rearming.
if (aip->mode != AIM_PLAY_DEAD && aip->ai_flags[AI::AI_Flags::Avoid_shockwave_ship, AI::AI_Flags::Avoid_shockwave_weapon]) {
if (aip->mode != AIM_PLAY_DEAD &&
aip->ai_flags.any_of(AI::AI_Flags::Avoid_shockwave_ship,AI::AI_Flags::Avoid_shockwave_weapon)) {
if (ai_avoid_shockwave(Pl_objp, aip)) {
aip->ai_flags.remove(AI::AI_Flags::Big_ship_collide_recover_1);
aip->ai_flags.remove(AI::AI_Flags::Big_ship_collide_recover_2);
if (aip->ai_flags[AI::AI_Flags::Being_repaired, AI::AI_Flags::Awaiting_repair])
if (aip->ai_flags.any_of(AI::AI_Flags::Being_repaired,AI::AI_Flags::Awaiting_repair))
ai_abort_rearm_request(Pl_objp);
return;
}
Expand Down Expand Up @@ -15553,7 +15559,7 @@ void ai_frame(int objnum)
aip->target_time += flFrametime;

int in_formation = 0;
if (aip->ai_flags[AI::AI_Flags::Formation_object, AI::AI_Flags::Formation_wing]) {
if (aip->ai_flags.any_of(AI::AI_Flags::Formation_object,AI::AI_Flags::Formation_wing)) {
in_formation = !ai_formation();
}

Expand Down Expand Up @@ -16497,11 +16503,11 @@ void ai_ship_hit(object *objp_ship, object *hit_objp, const vec3d *hit_normal)

aip->last_hit_time = Missiontime;

if (aip->ai_flags[AI::AI_Flags::No_dynamic, AI::AI_Flags::Kamikaze]) // If not allowed to pursue dynamic objectives, don't evade. Dumb? Maybe change. -- MK, 3/15/98
if (aip->ai_flags.any_of(AI::AI_Flags::No_dynamic,AI::AI_Flags::Kamikaze)) // If not allowed to pursue dynamic objectives, don't evade. Dumb? //Maybe change. -- MK, 3/15/98
return;

// If this ship is awaiting repair, abort!
if (aip->ai_flags[AI::AI_Flags::Being_repaired, AI::AI_Flags::Awaiting_repair]) {
if (aip->ai_flags.any_of(AI::AI_Flags::Being_repaired,AI::AI_Flags::Awaiting_repair)) {
if (get_hull_pct(objp_ship) < 0.3f) {
// Note, only abort if hull below a certain level.
aip->next_rearm_request_timestamp = timestamp(NEXT_REARM_TIMESTAMP/2); // Might request again after 15 seconds.
Expand Down Expand Up @@ -16794,7 +16800,7 @@ int ai_abort_rearm_request(object *requester_objp)
}
requester_aip = &Ai_info[requester_shipp->ai_index];

if (requester_aip->ai_flags[AI::AI_Flags::Being_repaired, AI::AI_Flags::Awaiting_repair]){
if (requester_aip->ai_flags.any_of(AI::AI_Flags::Being_repaired,AI::AI_Flags::Awaiting_repair)){

// support objnum is always valid once a rearm repair has been requested. It points to the
// ship that is coming to repair me.
Expand Down
3 changes: 2 additions & 1 deletion code/cutscene/cutscenes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -537,7 +537,8 @@ void cutscenes_screen_init()
int u = 0;
for (auto cut = Cutscenes.begin(); cut != Cutscenes.end(); ++cut, ++u)
{
if (cut->flags[Cutscene::Cutscene_Flags::Viewable, Cutscene::Cutscene_Flags::Always_viewable] && !cut->flags[Cutscene::Cutscene_Flags::Never_viewable])
if ((cut->flags.any_of(Cutscene::Cutscene_Flags::Viewable,Cutscene::Cutscene_Flags::Always_viewable)) &&
!cut->flags[Cutscene::Cutscene_Flags::Never_viewable])
{
Cutscene_list.push_back(u);
}
Expand Down
14 changes: 14 additions & 0 deletions code/globalincs/flagset.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,21 @@ class flagset {
set(val);
}
}
// Returns true if any of the given flags are set.
template <typename... Ts>
bool any_of(T first, Ts... rest) const
{
static_assert((std::is_same<Ts, T>::value && ...),
"All arguments to any_of() must be flags of the same enum type");
return (*this)[first] || ((*this)[rest] || ...);
}

// Returns true if none of the given flags are set.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

none_of has a comment but any_of doesn't

template <typename... Ts>
bool none_of(T first, Ts... rest) const
{
return !any_of(first, rest...);
}
bool operator[](const T idx) const { return values[(static_cast < size_t >(idx))]; };

template<size_t COMB_SIZE>
Expand Down
4 changes: 2 additions & 2 deletions code/hud/hudsquadmsg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ bool hud_squadmsg_wing_valid(wing *wingp)

// a couple of special cases to account for before adding to count (or to menu). Don't count
// wings that are leaving or left.
if ( wingp->flags[Ship::Wing_Flags::Gone, Ship::Wing_Flags::Departing] )
if ( wingp->flags.any_of(Ship::Wing_Flags::Gone,Ship::Wing_Flags::Departing) )
return false;

// Goober5000 - instead of checking wing leader, let's check all ships in wing;
Expand Down Expand Up @@ -1842,7 +1842,7 @@ void hud_squadmsg_type_select( )

// check to see if the player is awaiting repair or being repaired. Active the abort and inactive the repair items
// check to see if the player is scheduled to be repaired by incoming ship
if ( Ai_info[Ships[Player_obj->instance].ai_index].ai_flags[AI::AI_Flags::Being_repaired, AI::AI_Flags::Awaiting_repair] ) {
if (Ai_info[Ships[Player_obj->instance].ai_index].ai_flags.any_of(AI::AI_Flags::Being_repaired,AI::AI_Flags::Awaiting_repair)) {
MsgItems[TYPE_REPAIR_REARM_ITEM].active = 0;
MsgItems[TYPE_REPAIR_REARM_ABORT_ITEM].active = 1;
}
Expand Down
2 changes: 1 addition & 1 deletion code/missionui/missionbrief.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2098,7 +2098,7 @@ int brief_only_allow_briefing()
return 1;
}

if ( The_mission.flags[Mission::Mission_Flags::Scramble, Mission::Mission_Flags::Red_alert] ) {
if (The_mission.flags.any_of(Mission::Mission_Flags::Scramble,Mission::Mission_Flags::Red_alert)) {
return 1;
}

Expand Down
3 changes: 2 additions & 1 deletion code/missionui/missionshipchoice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1976,7 +1976,8 @@ commit_pressed_status commit_pressed(bool API_Access)
// Any incomplete loadouts that make it through the loadout screen will be condensed so that gaps are moved to the bottom. This check adds that responsibility to the player.
// Note: don't check for training, scramble, or red-alert missions
// Note2: don't check missions without briefings either
if (check_for_gaps_in_weapon_slots() && !(The_mission.game_type & MISSION_TYPE_TRAINING) && !The_mission.flags[Mission::Mission_Flags::Scramble, Mission::Mission_Flags::Red_alert, Mission::Mission_Flags::No_briefing])
if (check_for_gaps_in_weapon_slots() && !(The_mission.game_type & MISSION_TYPE_TRAINING) &&
The_mission.flags.none_of(Mission::Mission_Flags::Scramble,Mission::Mission_Flags::Red_alert,Mission::Mission_Flags::No_briefing))
{
popup(PF_USE_AFFIRMATIVE_ICON,
1,
Expand Down
5 changes: 3 additions & 2 deletions code/model/animation/modelanimation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,8 @@ namespace animation {
if (m_flags[Animation_Flags::Random_starting_phase]) {
instanceData.time = util::Random::next() * util::Random::INV_F_MAX_VALUE * instanceData.duration;
//Check if we might be on the way backwards
if (m_flags[Animation_Flags::Loop, Animation_Flags::Auto_Reverse] && !m_flags[Animation_Flags::Reset_at_completion] && util::Random::flip_coin()) {
if (m_flags.any_of(Animation_Flags::Loop,Animation_Flags::Auto_Reverse) &&
!m_flags[Animation_Flags::Reset_at_completion] && util::Random::flip_coin()) {
prevTime = instanceData.duration;
instanceData.canonicalDirection = ModelAnimationDirection::RWD;
}
Expand Down Expand Up @@ -1378,7 +1379,7 @@ namespace animation {
if (Animation_types.find(type)->second.second) {
//This is a type where the code does not reset the animation. The animation is expected to auto-reset in one way or another.
//If it doesn't, nothing will crash, but the result is most likely unintended.
if (!animation->m_flags[Animation_Flags::Auto_Reverse, Animation_Flags::Reset_at_completion]) {
if (animation->m_flags.none_of(Animation_Flags::Auto_Reverse,Animation_Flags::Reset_at_completion)) {
error_display(0, "Animation trigger type %s expects an auto-reset flag to be set.", atype);
}

Expand Down
7 changes: 5 additions & 2 deletions code/model/modelread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2093,7 +2093,8 @@ modelread_status read_model_file_no_subsys(polymodel * pm, const char* filename,

// Genghis: if we have a thruster and none of the collision
// properties were provided, then set "nocollide_this_only".
if (sm->flags[Model::Submodel_flags::Is_thruster] && !(sm->flags[Model::Submodel_flags::No_collisions, Model::Submodel_flags::Nocollide_this_only, Model::Submodel_flags::Collide_invisible]) )
if (sm->flags[Model::Submodel_flags::Is_thruster] &&
sm->flags.none_of(Model::Submodel_flags::No_collisions,Model::Submodel_flags::Nocollide_this_only,Model::Submodel_flags::Collide_invisible))
{
sm->flags.set(Model::Submodel_flags::Nocollide_this_only);
}
Expand Down Expand Up @@ -3445,7 +3446,9 @@ int model_load(const char* filename, ship_info* sip, ErrorType error_type, bool
dl2 = SCP_tolower(sm2->name[first_diff]) - 'a';

// Handle LODs named "detail0/1/2/etc" too (as opposed to "detaila/b/c/etc")
if (sm1->parent == -1 && sm2->parent == -1 && !sm1->flags[Model::Submodel_flags::Is_damaged, Model::Submodel_flags::Is_live_debris] && !sm2->flags[Model::Submodel_flags::Is_damaged, Model::Submodel_flags::Is_live_debris]) {
if (sm1->parent == -1 && sm2->parent == -1 &&
sm1->flags.none_of(Model::Submodel_flags::Is_damaged, Model::Submodel_flags::Is_live_debris) &&
sm2->flags.none_of(Model::Submodel_flags::Is_damaged, Model::Submodel_flags::Is_live_debris)) {
dl2 = dl2 - dl1;
dl1 = 0;
}
Expand Down
2 changes: 1 addition & 1 deletion code/network/multimsgs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7612,7 +7612,7 @@ void process_homing_weapon_info( ubyte *data, header *hinfo )
if ( homing_object->type == OBJ_WEAPON ) {
auto flags_check = Weapon_info[Weapons[homing_object->instance].weapon_info_index].wi_flags;

if ( !((flags_check[Weapon::Info_Flags::Bomb, Weapon::Info_Flags::Cmeasure])) ) {
if (flags_check.none_of(Weapon::Info_Flags::Bomb, Weapon::Info_Flags::Cmeasure)) {
nprintf(("Network", "Homing object is invalid for homing update\n"));
return;
}
Expand Down
7 changes: 3 additions & 4 deletions code/object/collideshipship.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -803,7 +803,7 @@ void calculate_ship_ship_collision_physics(collision_info_struct *ship_ship_hit_
// We will try not to worry about the left over time in the frame
// heavy's position unchanged by collision
// light's position is heavy's position plus relative position from heavy
if (should_collide && !lighter->flags[Object::Object_Flags::Dont_change_position, Object::Object_Flags::Immobile]){
if (should_collide && lighter->flags.none_of(Object::Object_Flags::Dont_change_position, Object::Object_Flags::Immobile)) {
vm_vec_add(&lighter->pos, &heavy->pos, &ship_ship_hit_info->light_collision_cm_pos);
}

Expand All @@ -821,7 +821,7 @@ void calculate_ship_ship_collision_physics(collision_info_struct *ship_ship_hit_
}

if (should_collide){
if (!heavy->flags[Object::Object_Flags::Dont_change_position, Object::Object_Flags::Immobile]) {
if (heavy->flags.none_of(Object::Object_Flags::Dont_change_position, Object::Object_Flags::Immobile)) {
Assert(!vm_is_vec_nan(&direction_light));
vm_vec_scale_add2(&heavy->pos, &direction_light, 0.2f * (1.0f - heavy_light_mass_ratio));
vm_vec_scale_add2(&heavy->pos, &ship_ship_hit_info->collision_normal, -0.1f * (1.0f - heavy_light_mass_ratio));
Expand All @@ -840,8 +840,7 @@ void calculate_ship_ship_collision_physics(collision_info_struct *ship_ship_hit_
//For landings, we want minimal movement on the light ship (just enough to keep the collision detection honest)
if (ship_ship_hit_info->is_landing) {
vm_vec_scale_add2(&lighter->pos, &ship_ship_hit_info->collision_normal, LANDING_POS_OFFSET);
}
else if (!lighter->flags[Object::Object_Flags::Dont_change_position, Object::Object_Flags::Immobile]) {
} else if (lighter->flags.none_of(Object::Object_Flags::Dont_change_position, Object::Object_Flags::Immobile)) {
vm_vec_scale_add2(&lighter->pos, &direction_light, -0.2f * heavy_light_mass_ratio);
vm_vec_scale_add2(&lighter->pos, &ship_ship_hit_info->collision_normal, 0.1f * heavy_light_mass_ratio);
}
Expand Down
8 changes: 6 additions & 2 deletions code/object/object.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1641,8 +1641,12 @@ void obj_move_all(float frametime)
}

// Goober5000 - accommodate objects that aren't supposed to move in some way (at least until they're destroyed)
bool dont_change_position = objp->flags[Object::Object_Flags::Dont_change_position, Object::Object_Flags::Immobile] && objp->hull_strength > 0.0f;
bool dont_change_orientation = objp->flags[Object::Object_Flags::Dont_change_orientation, Object::Object_Flags::Immobile] && objp->hull_strength > 0.0f;
bool dont_change_position =
objp->flags.any_of(Object::Object_Flags::Dont_change_position, Object::Object_Flags::Immobile) &&
objp->hull_strength > 0.0f;
bool dont_change_orientation =
objp->flags.any_of(Object::Object_Flags::Dont_change_orientation, Object::Object_Flags::Immobile) &&
objp->hull_strength > 0.0f;

// skip the physics if we're totally immobile
if (!dont_change_position || !dont_change_orientation) {
Expand Down
2 changes: 1 addition & 1 deletion code/parse/sexp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4298,7 +4298,7 @@ int check_sexp_potential_issues(int node, int *bad_node, SCP_string &issue_msg)
for (const auto so : list_range(&Ship_obj_list))
{
const auto &obj = Objects[so->objnum];
if (obj.flags[Object::Object_Flags::Immobile, Object::Object_Flags::Dont_change_position, Object::Object_Flags::Dont_change_orientation])
if (obj.flags.any_of(Object::Object_Flags::Immobile,Object::Object_Flags::Dont_change_position,Object::Object_Flags::Dont_change_orientation))
{
issue_msg = "At least one ship (";
issue_msg += Ships[obj.instance].ship_name;
Expand Down
2 changes: 1 addition & 1 deletion code/particle/volumes/ModelSurfaceVolume.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ vec3d ModelSurfaceVolume::sampleRandomPoint(const matrix &orientation, decltype(
if (submodel < 0) {
SCP_vector<int> eligible_submodels;
for (int i = 0; i < pm->n_models; ++i) {
if (!pm->submodel[i].flags[Model::Submodel_flags::Is_lod, Model::Submodel_flags::Is_damaged, Model::Submodel_flags::Is_live_debris])
Comment thread
Goober5000 marked this conversation as resolved.
if (pm->submodel[i].flags.none_of(Model::Submodel_flags::Is_lod,Model::Submodel_flags::Is_damaged,Model::Submodel_flags::Is_live_debris))
eligible_submodels.emplace_back(i);
}

Expand Down
2 changes: 1 addition & 1 deletion code/scripting/api/objs/ship.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1654,7 +1654,7 @@ ADE_FUNC(callSupport,
return ADE_RETURN_FALSE;
}

if (aip->ai_flags[AI::AI_Flags::Being_repaired, AI::AI_Flags::Awaiting_repair]) {
if (aip->ai_flags.any_of(AI::AI_Flags::Being_repaired,AI::AI_Flags::Awaiting_repair)) {
return ADE_RETURN_FALSE;
}

Expand Down
3 changes: 2 additions & 1 deletion code/scripting/api/objs/techroom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,8 @@ ADE_VIRTVAR(isVisible,
current.getScene()->flags.set(Cutscene::Cutscene_Flags::Viewable, visible);
Pilot.save_savefile();
}
if (current.getScene()->flags[Cutscene::Cutscene_Flags::Viewable, Cutscene::Cutscene_Flags::Always_viewable] &&
if (current.getScene()->flags.any_of(Cutscene::Cutscene_Flags::Viewable,
Cutscene::Cutscene_Flags::Always_viewable) &&
!current.getScene()->flags[Cutscene::Cutscene_Flags::Never_viewable])
{
return ade_set_args(L, "b", true);
Expand Down
Loading
Loading