Skip to content

Commit

Permalink
Address various warnings raised by clang's -Weverything
Browse files Browse the repository at this point in the history
They were mostly extra breaks/extra semicolons
  • Loading branch information
edo9300 committed Jan 5, 2024
1 parent 7982ca1 commit 9790b55
Show file tree
Hide file tree
Showing 13 changed files with 19 additions and 32 deletions.
7 changes: 2 additions & 5 deletions card.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2716,7 +2716,7 @@ int32_t card::check_summon_procedure(effect* peffect, uint8_t playerid, uint8_t
if(new_min_tribute < min_tribute)
new_min_tribute = min_tribute;
if (peffect->is_flag(EFFECT_FLAG_SPSUM_PARAM) && peffect->o_range)
new_zone = (new_zone >> 16) | (new_zone & 0xffff << 16);
new_zone = (new_zone >> 16) | (new_zone & 0xffffu << 16);
new_zone &= zone;
if(is_summonable(peffect, new_min_tribute, new_zone, releasable, peffect))
return TRUE;
Expand Down Expand Up @@ -2808,7 +2808,7 @@ int32_t card::check_set_procedure(effect* peffect, uint8_t playerid, uint8_t ign
releasable = static_cast<uint32_t>(retval[2]);
}
if (peffect->is_flag(EFFECT_FLAG_SPSUM_PARAM) && peffect->o_range)
new_zone = (new_zone >> 16) | (new_zone & 0xffff << 16);
new_zone = (new_zone >> 16) | (new_zone & 0xffffu << 16);
if(new_min_tribute < (int32_t)min_tribute)
new_min_tribute = min_tribute;
new_zone &= zone;
Expand Down Expand Up @@ -3570,7 +3570,6 @@ int32_t card::is_destructable_by_effect(effect* peffect, uint8_t playerid) {
pduel->lua->add_param<LuaParam::INT>(playerid);
if(peff->check_value_condition(3)) {
return FALSE;
break;
}
}
eset.clear();
Expand All @@ -3584,7 +3583,6 @@ int32_t card::is_destructable_by_effect(effect* peffect, uint8_t playerid) {
pduel->lua->add_param<LuaParam::INT>(playerid);
if(peff->check_value_condition(3)) {
return FALSE;
break;
}
} else {
pduel->lua->add_param<LuaParam::EFFECT>(peffect);
Expand All @@ -3595,7 +3593,6 @@ int32_t card::is_destructable_by_effect(effect* peffect, uint8_t playerid) {
auto it = indestructable_effects.emplace(peff->id, 0);
if(it.first->second + 1 <= ct) {
return FALSE;
break;
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion duel.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ struct card_data {
uint32_t rscale{};
uint32_t link_marker{};
card_data(const OCG_CardData& data);
card_data() {};
card_data() = default;
};

class duel {
Expand Down
5 changes: 0 additions & 5 deletions effect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -548,11 +548,9 @@ int32_t effect::reset(uint32_t reset_level, uint32_t reset_type) {
if(reset_level & 0xffff0000 & reset_flag)
return TRUE;
return FALSE;
break;
}
case RESET_CARD: {
return owner && (owner->data.code == reset_level);
break;
}
case RESET_PHASE: {
if(!(reset_flag & RESET_PHASE))
Expand All @@ -565,15 +563,12 @@ int32_t effect::reset(uint32_t reset_level, uint32_t reset_type) {
if(reset_count == 0)
return TRUE;
return FALSE;
break;
}
case RESET_CODE: {
return (code == reset_level) && (type & EFFECT_TYPE_SINGLE) && !(type & EFFECT_TYPE_ACTIONS);
break;
}
case RESET_COPY: {
return copy_id == reset_level;
break;
}
}
return FALSE;
Expand Down
3 changes: 1 addition & 2 deletions effect.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,7 @@ class effect : public lua_obj_helper<LuaParam::EFFECT> {
uint64_t description{};
std::vector<lua_Integer> label;

explicit effect(duel* pd) : lua_obj_helper(pd) {};
~effect() = default;
explicit effect(duel* pd) : lua_obj_helper(pd) {}

int32_t is_disable_related();
int32_t is_self_destroy_related();
Expand Down
4 changes: 2 additions & 2 deletions field.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1215,9 +1215,9 @@ bool field::has_separate_pzone(uint8_t p) const {
uint32_t field::get_pzone_zones_flag() const {
uint32_t flag = 0;
if(!has_separate_pzone(0))
flag |= 0xC000;
flag |= 0xC000u;
if(!has_separate_pzone(1))
flag |= 0xC000 << 16;
flag |= 0xC000u << 16;
return flag;
}
uint8_t field::get_pzone_index(uint8_t seq, uint8_t p) const {
Expand Down
2 changes: 1 addition & 1 deletion field.h
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ class return_card_generic {
public:
bool canceled;
std::vector<T> list;
return_card_generic():canceled(false) {};
return_card_generic():canceled(false) {}
void clear() {
canceled = false;
list.clear();
Expand Down
1 change: 0 additions & 1 deletion interpreter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,6 @@ void interpreter::push_param(lua_State* L, bool is_coroutine) {
}
case LuaParam::DELETED:
unreachable();
break;
}
++pushed;
}
Expand Down
5 changes: 2 additions & 3 deletions libduel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3487,7 +3487,7 @@ LUA_STATIC_FUNCTION(TossCoin) {
return yieldk({
const auto& coin_results = pduel->game_field->core.coin_results;
luaL_checkstack(L, static_cast<int>(coin_results.size()), nullptr);
for(const auto& result : coin_results)
for(const auto result : coin_results)
lua_pushinteger(L, static_cast<int8_t>(result));
return static_cast<int32_t>(coin_results.size());
});
Expand Down Expand Up @@ -3520,7 +3520,7 @@ LUA_STATIC_FUNCTION(RockPaperScissors) {
LUA_STATIC_FUNCTION(GetCoinResult) {
const auto& coin_results = pduel->game_field->core.coin_results;
luaL_checkstack(L, static_cast<int>(coin_results.size()), nullptr);
for(const auto& coin : coin_results)
for(const auto coin : coin_results)
lua_pushinteger(L, static_cast<int>(coin));
return static_cast<int32_t>(coin_results.size());
}
Expand Down Expand Up @@ -3960,7 +3960,6 @@ LUA_STATIC_FUNCTION(GetActivityCount) {
break;
default:
lua_error(L, "Passed invalid ACTIVITY flag.");
break;
}
return 1;
});
Expand Down
4 changes: 2 additions & 2 deletions lua_obj.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class lua_obj {
int32_t ref_handle;
duel* pduel{ nullptr };
protected:
lua_obj(LuaParam _lua_type, duel* _pduel) :lua_type(_lua_type), pduel(_pduel) {};
lua_obj(LuaParam _lua_type, duel* _pduel) :lua_type(_lua_type), pduel(_pduel) {}
};

template<LuaParam _Type>
Expand All @@ -37,7 +37,7 @@ class lua_obj_helper : public lua_obj {
_Type == LuaParam::EFFECT || _Type == LuaParam::DELETED,
"Invalid parameter type");
public:
lua_obj_helper(duel* pduel) : lua_obj(_Type, pduel) {};
lua_obj_helper(duel* pduel_) : lua_obj(_Type, pduel_) {}
};

#endif /* LUA_OBJ_H_ */
14 changes: 7 additions & 7 deletions operations.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1783,8 +1783,8 @@ int32_t field::summon(uint16_t step, uint8_t sumplayer, card* target, effect* pr
if(target->current.location == LOCATION_MZONE) {
core.units.begin()->step = 4;
if(!ignore_count && !core.extra_summon[sumplayer]) {
for(const auto& peff : eset) {
core.units.begin()->ptr1 = peff;
if(!eset.empty()) {
core.units.begin()->ptr1 = eset.front();
return FALSE;
}
}
Expand Down Expand Up @@ -1815,7 +1815,7 @@ int32_t field::summon(uint16_t step, uint8_t sumplayer, card* target, effect* pr
releasable = static_cast<uint32_t>(retval[2]);
}
if (proc && proc->is_flag(EFFECT_FLAG_SPSUM_PARAM) && proc->o_range)
new_zone = (new_zone >> 16) | (new_zone & 0xffff << 16);
new_zone = (new_zone >> 16) | (new_zone & 0xffffu << 16);
new_zone &= zone;
if(proc) {
if(new_min_tribute < min_tribute)
Expand Down Expand Up @@ -1865,7 +1865,7 @@ int32_t field::summon(uint16_t step, uint8_t sumplayer, card* target, effect* pr
if(min_tribute < new_min_tribute)
min_tribute = new_min_tribute;
if (proc && proc->is_flag(EFFECT_FLAG_SPSUM_PARAM) && proc->o_range)
new_zone = (new_zone >> 16) | (new_zone & 0xffff << 16);
new_zone = (new_zone >> 16) | (new_zone & 0xffffu << 16);
zone &= new_zone;
core.units.begin()->arg1 = sumplayer + (ignore_count << 8) + (min_tribute << 16) + (zone << 24);
}
Expand Down Expand Up @@ -2449,7 +2449,7 @@ int32_t field::mset(uint16_t step, uint8_t setplayer, card* target, effect* proc
releasable = static_cast<uint32_t>(retval[2]);
}
if(proc && proc->is_flag(EFFECT_FLAG_SPSUM_PARAM) && proc->o_range)
new_zone = (new_zone >> 16) | (new_zone & 0xffff << 16);
new_zone = (new_zone >> 16) | (new_zone & 0xffffu << 16);
new_zone &= zone;
if(proc) {
if(new_min_tribute < (int32_t)min_tribute)
Expand Down Expand Up @@ -2499,7 +2499,7 @@ int32_t field::mset(uint16_t step, uint8_t setplayer, card* target, effect* proc
if(min_tribute < new_min_tribute)
min_tribute = new_min_tribute;
if(proc && proc->is_flag(EFFECT_FLAG_SPSUM_PARAM) && proc->o_range)
new_zone = (new_zone >> 16) | (new_zone & 0xffff << 16);
new_zone = (new_zone >> 16) | (new_zone & 0xffffu << 16);
zone &= new_zone;
core.units.begin()->arg1 = setplayer + (ignore_count << 8) + (min_tribute << 16) + (zone << 24);
}
Expand Down Expand Up @@ -2845,7 +2845,7 @@ int32_t field::sset_g(uint16_t step, uint8_t setplayer, uint8_t toplayer, group*
card_set* set_cards = &core.set_group_pre_set;
card* target = *set_cards->begin();
target->enable_field_effect(false);
uint32_t zone;
uint32_t zone{};
if(target->data.type & TYPE_FIELD) {
zone = 1 << 5;
} else {
Expand Down
2 changes: 1 addition & 1 deletion processor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3325,8 +3325,8 @@ int32_t field::process_battle_command(uint16_t step) {
return TRUE;
}
core.units.begin()->step = 32;
[[fallthrough]];
}
// fall through
case 32: {
auto message = pduel->new_message(MSG_HINT);
message->write<uint8_t>(HINT_EVENT);
Expand Down
1 change: 0 additions & 1 deletion progressivebuffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
class ProgressiveBuffer {
public:
std::vector<uint8_t> data;
ProgressiveBuffer() {};
void clear() {
data.clear();
}
Expand Down
1 change: 0 additions & 1 deletion scriptlib.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ bool check_param(lua_State* L, LuaParam param_type, int32_t index, bool retfalse
break;
default:
unreachable();
break;
}
if(retfalse)
return false;
Expand Down

0 comments on commit 9790b55

Please sign in to comment.