Skip to content

Commit 8e25801

Browse files
committed
Adding [[fallthrough]] attribute
1 parent 9b51b8b commit 8e25801

File tree

6 files changed

+18
-18
lines changed

6 files changed

+18
-18
lines changed

actors.cc

+2-2
Original file line numberDiff line numberDiff line change
@@ -3066,13 +3066,13 @@ int Actor::get_effective_prop(
30663066
if (get_flag(Obj_flags::paralyzed) || get_flag(Obj_flags::asleep) ||
30673067
is_knocked_out())
30683068
return prop == Actor::dexterity ? 0 : 1;
3069-
// FALL THROUGH
3069+
[[fallthrough]];
30703070
case Actor::intelligence:
30713071
if (is_dead())
30723072
return prop == Actor::dexterity ? 0 : 1;
30733073
else if (get_flag(Obj_flags::charmed) || get_flag(Obj_flags::asleep))
30743074
val--;
3075-
// FALL THROUGH
3075+
[[fallthrough]];
30763076
case Actor::strength:
30773077
if (get_flag(Obj_flags::might))
30783078
val += (val < 15 ? val : 15); // Add up to 15.

audio/midi_drivers/FMOplMidiDriver.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ void FMOplMidiDriver::send(uint32 b)
298298
case 0x80: /*note off */
299299
// Quick hack, but we should never use it. since note offs will never be sent
300300
b &= 0xFFFF;
301-
// FALL THROUGH
301+
[[fallthrough]];
302302
case 0x90:{ /*note on */
303303
auto note = static_cast<unsigned char>((b >> 8) & 0x7F);
304304
auto vel = static_cast<unsigned char>((b >> 16) & 0x7F);

gamemgr/bggame.cc

+2-2
Original file line numberDiff line numberDiff line change
@@ -1196,7 +1196,7 @@ bool Hand_Handler::draw_frame() {
11961196
if (currBackground != eSHOW_STATIC) {
11971197
break;
11981198
}
1199-
// FALL THROUGH
1199+
[[fallthrough]];
12001200
case eSHOW_STATIC:
12011201
case eNOP:
12021202
if (currOp == eSHOW_STATIC) {
@@ -1224,7 +1224,7 @@ bool Hand_Handler::draw_frame() {
12241224
currBackground = currOp;
12251225
break;
12261226
}
1227-
// FALL THROUGH
1227+
[[fallthrough]];
12281228
case eBLACK_SCREEN:
12291229
win->fill8(0, screenShape->get_width(), screenShape->get_height(),
12301230
centerx + 12 - screenShape->get_width()/2,

gamemgr/modmgr.cc

+2-2
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,7 @@ ModManager::ModManager(const string &name, const string &menu, bool needtitle,
408408
break;
409409
default:
410410
unknown_crc("Black Gate");
411-
// FALLTHROUGH
411+
[[fallthrough]];
412412
case 0xafc35523:
413413
// English BG
414414
language = ENGLISH;
@@ -450,7 +450,7 @@ ModManager::ModManager(const string &name, const string &menu, bool needtitle,
450450
break;
451451
default:
452452
unknown_crc("Serpent Isle");
453-
// FALLTHROUGH
453+
[[fallthrough]];
454454
case 0xf98f5f3e:
455455
// English SI
456456
language = ENGLISH;

objs/egg.cc

+2-2
Original file line numberDiff line numberDiff line change
@@ -764,7 +764,7 @@ bool Egg_object::is_active(
764764
#ifdef DEBUG
765765
print_debug();
766766
#endif
767-
// fall through
767+
[[fallthrough]];
768768
case party_near: // Avatar or party member.
769769
if (!obj->get_flag(Obj_flags::in_party))
770770
return false;
@@ -1268,7 +1268,7 @@ bool Field_object::field_effect(
12681268
// Campfire (Fire in SI) doesn't hurt when burnt out
12691269
if (frame == 0)
12701270
return false;
1271-
// FALLTHROUGH
1271+
[[fallthrough]];
12721272
case fire_field:
12731273
actor->reduce_health(2 + rand() % 3, Weapon_data::fire_damage);
12741274
// But no sleeping here.

schedule.cc

+9-9
Original file line numberDiff line numberDiff line change
@@ -1027,8 +1027,8 @@ void Patrol_schedule::now_what(
10271027
Game_object_vector nearby;
10281028
npc->find_nearby(nearby, PATH_SHAPE, 25, 0x10, c_any_qual, c_any_framenum);
10291029
gotpath = !nearby.empty();
1030+
[[fallthrough]];
10301031
}
1031-
// FALLTHROUGH
10321032
case 0: { // Find next path.
10331033
if (!gotpath) {
10341034
// SI seems to try switching to preprogrammed schedules
@@ -1122,7 +1122,7 @@ void Patrol_schedule::now_what(
11221122
case 25: // 50% wrap to 0.
11231123
if (rand() % 2)
11241124
break;
1125-
// FALLTHROUGH
1125+
[[fallthrough]];
11261126
case 1: // Wrap to 0.
11271127
pathnum = -1;
11281128
dir = 1;
@@ -1134,7 +1134,7 @@ void Patrol_schedule::now_what(
11341134
case 24: // Read
11351135
// Find the book which will be read.
11361136
book = weak_from_obj(npc->find_closest(642, 4));
1137-
// FALLTHROUGH
1137+
[[fallthrough]];
11381138
case 3: // Sit.
11391139
if (Sit_schedule::set_action(npc)) {
11401140
scr->start(); // Start next tick.
@@ -1840,7 +1840,7 @@ void Farmer_schedule::now_what(
18401840
switch (state) {
18411841
case start:
18421842
state = find_crop;
1843-
/* FALL THROUGH */
1843+
[[fallthrough]];
18441844
case find_crop: {
18451845
Game_object_vector crops;
18461846
crop = Game_object_weak();
@@ -2724,7 +2724,7 @@ void Desk_schedule::now_what(
27242724
}
27252725
state = sit_at_desk;
27262726
}
2727-
/* FALL THROUGH */
2727+
[[fallthrough]];
27282728
case sit_at_desk: {
27292729
const int frnum = npc->get_framenum();
27302730
// Not sitting?
@@ -3577,7 +3577,7 @@ void Waiter_schedule::now_what(
35773577
find_tables(964, 24);
35783578
find_prep_tables();
35793579
state = get_customer;
3580-
/* FALL THROUGH */
3580+
[[fallthrough]];
35813581
case get_customer:
35823582
if (!find_customer()) {
35833583
walk_to_prep();
@@ -3602,8 +3602,8 @@ void Waiter_schedule::now_what(
36023602
customers_ordered.push_back(customer);
36033603
}
36043604
state = took_order;
3605+
[[fallthrough]];
36053606
}
3606-
/* FALL THROUGH */
36073607
case took_order:
36083608
// Get up to 4 orders before serving them.
36093609
if (customers_ordered.size() >= 4 || customers.empty()) {
@@ -3659,8 +3659,8 @@ void Waiter_schedule::now_what(
36593659
Ready_food(npc);
36603660
cooking = false;
36613661
state = bring_food;
3662+
[[fallthrough]];
36623663
}
3663-
/* FALL THROUGH. */
36643664
case bring_food:
36653665
if (customers_ordered.empty()) { // All done serving them?
36663666
if (rand() % 3 == 0)
@@ -3712,8 +3712,8 @@ void Waiter_schedule::now_what(
37123712
++items_in_hand;
37133713
break;
37143714
}
3715+
[[fallthrough]];
37153716
}
3716-
/* FALL THROUGH */
37173717
case picked_up_item:
37183718
set_current_item(nullptr);
37193719
if (cooking) {

0 commit comments

Comments
 (0)