Skip to content

Commit

Permalink
Add [[fallthrough]];.
Browse files Browse the repository at this point in the history
  • Loading branch information
Jarod42 committed Mar 24, 2024
1 parent a891bb3 commit 6ac60c6
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
4 changes: 2 additions & 2 deletions src/action/action_unload.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ void COrder_Unload::Execute(CUnit &unit) /* override */
}
this->Retries = 0;
this->State = MOVE_TO_DROPZONE_STATE;
// fall through and move immediately
[[fallthrough]]; // fallthrough and move immediately
case MOVE_TO_DROPZONE_STATE:
switch (DoActionMove(unit)) {
case PF_UNREACHABLE:
Expand All @@ -424,7 +424,7 @@ void COrder_Unload::Execute(CUnit &unit) /* override */
// still moving or waiting to move
return;
}
// fall through
[[fallthrough]];
case UNLOAD_STATE:
// Leave the transporter
// FIXME: show still animations ?
Expand Down
2 changes: 1 addition & 1 deletion src/map/fow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ void CFogOfWar::Update(bool doAtOnce /*= false*/)

case States::cGenerateFog:
GenerateFog();
/// pass through
[[fallthrough]];
default:
this->State++;
break;
Expand Down
22 changes: 11 additions & 11 deletions src/network/netconnect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1277,13 +1277,13 @@ int CServer::Parse_Hello(int h, const CInitMessage_Hello &msg, const CHost &host
void CServer::Parse_Resync(const int h)
{
switch (networkStates[h].State) {
case ccs_mapinfo:
// a delayed ack - fall through..
case ccs_mapinfo: // a delayed ack..
[[fallthrough]];
case ccs_async:
// client has recvd welcome and is waiting for info
networkStates[h].State = ccs_synced;
networkStates[h].MsgCnt = 0;
/* Fall through */
[[fallthrough]];
case ccs_synced: {
// this code path happens until client falls back to ICMWaiting
// (indicating Resync has completed)
Expand Down Expand Up @@ -1314,11 +1314,11 @@ void CServer::Parse_Waiting(const int h)
case ccs_connecting:
networkStates[h].State = ccs_connected;
networkStates[h].MsgCnt = 0;
/* Fall through */
[[fallthrough]];
case ccs_needmap: // client has finished receiving the map and wants the info again
networkStates[h].State = ccs_connected;
networkStates[h].MsgCnt = 0;
/* Fall through */
[[fallthrough]];
case ccs_connected: {
// this code path happens until client acknowledges the map
Send_Map(Hosts[h]);
Expand All @@ -1338,7 +1338,7 @@ void CServer::Parse_Waiting(const int h)
networkStates[i].State = ccs_async;
}
}
/* Fall through */
[[fallthrough]];
case ccs_synced:
// the wanted state - do nothing.. until start...
networkStates[h].MsgCnt = 0;
Expand Down Expand Up @@ -1377,7 +1377,7 @@ void CServer::Parse_Map(const int h)
case ccs_connected:
networkStates[h].State = ccs_mapinfo;
networkStates[h].MsgCnt = 0;
/* Fall through */
[[fallthrough]];
case ccs_mapinfo: {
// this code path happens until client acknowledges the state info
// by falling back to ICMWaiting with prev. State synced
Expand All @@ -1403,7 +1403,7 @@ void CServer::Parse_MapFragment(const int h, uint32_t fragmentIdx)
networkStates[h].State = ccs_needmap;
networkStates[h].MsgCnt = 0;
Assert(fragmentIdx == 0); // client keep asking for this fragment initially
/* Fall through */
[[fallthrough]];
case ccs_needmap: {
Send_MapFragment(Hosts[h], fragmentIdx);
networkStates[h].MsgCnt++;
Expand All @@ -1429,7 +1429,7 @@ void CServer::Parse_State(const int h, const CInitMessage_State &msg)
switch (networkStates[h].State) {
case ccs_mapinfo:
// User State Change right after connect - should not happen, but..
/* Fall through */
[[fallthrough]];
case ccs_synced:
// Default case: Client is in sync with us, but notes a local change
// networkStates[h].State = ccs_async;
Expand All @@ -1445,7 +1445,7 @@ void CServer::Parse_State(const int h, const CInitMessage_State &msg)
networkStates[i].State = ccs_async;
}
}
/* Fall through */
[[fallthrough]];
case ccs_async: {
// this code path happens until client acknowledges the state change reply
// by sending ICMResync
Expand Down Expand Up @@ -1475,7 +1475,7 @@ void CServer::Parse_GoodBye(const int h)
// We can enter here from _ANY_ state!
networkStates[h].MsgCnt = 0;
networkStates[h].State = ccs_detaching;
/* Fall through */
[[fallthrough]];
case ccs_detaching: {
// this code path happens until client acknoledges the GoodBye
// by sending ICMSeeYou;
Expand Down

0 comments on commit 6ac60c6

Please sign in to comment.