summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/3rdparty/squirrel/squirrel/sqvm.cpp9
-rw-r--r--src/ai/ai_scanner.cpp2
-rw-r--r--src/company_cmd.cpp2
-rw-r--r--src/company_gui.cpp10
-rw-r--r--src/console.cpp2
-rw-r--r--src/depot_gui.cpp3
-rw-r--r--src/economy.cpp2
-rw-r--r--src/engine_gui.cpp2
-rw-r--r--src/fileio.cpp4
-rw-r--r--src/fios.cpp3
-rw-r--r--src/fios_gui.cpp3
-rw-r--r--src/fontcache.cpp2
-rw-r--r--src/game/game_scanner.cpp2
-rw-r--r--src/industry_gui.cpp2
-rw-r--r--src/misc_gui.cpp9
-rw-r--r--src/music/extmidi.cpp2
-rw-r--r--src/music/qtmidi.cpp8
-rw-r--r--src/network/core/udp.cpp9
-rw-r--r--src/network/network_chat_gui.cpp11
-rw-r--r--src/network/network_client.cpp3
-rw-r--r--src/network/network_content_gui.cpp3
-rw-r--r--src/network/network_gui.cpp5
-rw-r--r--src/network/network_server.cpp5
-rw-r--r--src/newgrf.cpp8
-rw-r--r--src/newgrf_gui.cpp12
-rw-r--r--src/newgrf_industries.cpp2
-rw-r--r--src/newgrf_industries.h6
-rw-r--r--src/newgrf_object.cpp2
-rw-r--r--src/newgrf_object.h5
-rw-r--r--src/newgrf_station.h2
-rw-r--r--src/order_cmd.cpp9
-rw-r--r--src/order_gui.cpp2
-rw-r--r--src/pathfinder/yapf/yapf_destrail.hpp3
-rw-r--r--src/rail_cmd.cpp59
-rw-r--r--src/saveload/afterload.cpp2
-rw-r--r--src/saveload/company_sl.cpp2
-rw-r--r--src/saveload/vehicle_sl.cpp2
-rw-r--r--src/script/api/script_error.cpp3
-rw-r--r--src/settings.cpp3
-rw-r--r--src/signal.cpp6
-rw-r--r--src/signs_gui.cpp2
-rw-r--r--src/smallmap_gui.cpp10
-rw-r--r--src/spritecache.cpp2
-rw-r--r--src/station_cmd.cpp3
-rw-r--r--src/stdafx.h19
-rw-r--r--src/terraform_gui.cpp6
-rw-r--r--src/timetable_gui.cpp3
-rw-r--r--src/town_cmd.cpp6
-rw-r--r--src/town_gui.cpp3
-rw-r--r--src/train_cmd.cpp3
-rw-r--r--src/tree_cmd.cpp5
-rw-r--r--src/vehicle.cpp2
-rw-r--r--src/vehicle_gui.cpp11
-rw-r--r--src/vehiclelist.cpp2
-rw-r--r--src/video/cocoa/event.mm2
-rw-r--r--src/video/win32_v.cpp2
-rw-r--r--src/viewport.cpp8
-rw-r--r--src/water_cmd.cpp6
-rw-r--r--src/widget.cpp2
-rw-r--r--src/window.cpp14
60 files changed, 221 insertions, 121 deletions
diff --git a/src/3rdparty/squirrel/squirrel/sqvm.cpp b/src/3rdparty/squirrel/squirrel/sqvm.cpp
index 973002b49..a738244ba 100644
--- a/src/3rdparty/squirrel/squirrel/sqvm.cpp
+++ b/src/3rdparty/squirrel/squirrel/sqvm.cpp
@@ -215,7 +215,7 @@ bool SQVM::ObjCmp(const SQObjectPtr &o1,const SQObjectPtr &o2,SQInteger &result)
_RET_SUCCEED(_integer(res))
}
}
- //continues through (no break needed)
+ FALLTHROUGH;
default:
_RET_SUCCEED( _userpointer(o1) < _userpointer(o2)?-1:1 );
}
@@ -287,6 +287,7 @@ void SQVM::ToString(const SQObjectPtr &o,SQObjectPtr &res)
//else keeps going to the default
}
}
+ FALLTHROUGH;
default:
seprintf(buf, lastof(buf),"(%s : 0x%p)",GetTypeName(o),(void*)_rawval(o));
}
@@ -539,7 +540,7 @@ bool SQVM::FOREACH_OP(SQObjectPtr &o1,SQObjectPtr &o2,SQObjectPtr
_generator(o1)->Resume(this, arg_2+1);
_FINISH(0);
}
- /* FALL THROUGH */
+ FALLTHROUGH;
default:
Raise_Error("cannot iterate %s", GetTypeName(o1));
}
@@ -769,7 +770,7 @@ exception_restore:
ct_stackbase = _stackbase;
goto common_call;
}
- /* FALL THROUGH */
+ FALLTHROUGH;
case _OP_CALL: {
ct_tailcall = false;
ct_target = arg0;
@@ -1330,7 +1331,7 @@ bool SQVM::Set(const SQObjectPtr &self,const SQObjectPtr &key,const SQObjectPtr
return true;
}
}
- //keeps going
+ FALLTHROUGH;
case OT_USERDATA:
if(_delegable(self)->_delegate) {
SQObjectPtr t;
diff --git a/src/ai/ai_scanner.cpp b/src/ai/ai_scanner.cpp
index 4eb207147..5f16de3f9 100644
--- a/src/ai/ai_scanner.cpp
+++ b/src/ai/ai_scanner.cpp
@@ -114,7 +114,7 @@ AIInfo *AIScannerInfo::FindInfo(const char *nameParam, int versionParam, bool fo
*e = '\0';
e++;
versionParam = atoi(e);
- /* FALL THROUGH, like we were calling this function with a version. */
+ /* Continue, like we were calling this function with a version. */
}
if (force_exact_match) {
diff --git a/src/company_cmd.cpp b/src/company_cmd.cpp
index 577ea884d..ee2ed1335 100644
--- a/src/company_cmd.cpp
+++ b/src/company_cmd.cpp
@@ -162,7 +162,7 @@ static bool IsValidCompanyManagerFace(CompanyManagerFace cmf)
for (CompanyManagerFaceVariable cmfv = CMFV_CHEEKS; cmfv < CMFV_END; cmfv++) {
switch (cmfv) {
case CMFV_MOUSTACHE: if (!has_moustache) continue; break;
- case CMFV_LIPS: // FALL THROUGH
+ case CMFV_LIPS:
case CMFV_NOSE: if (has_moustache) continue; break;
case CMFV_TIE_EARRING: if (!has_tie_earring) continue; break;
case CMFV_GLASSES: if (!has_glasses) continue; break;
diff --git a/src/company_gui.cpp b/src/company_gui.cpp
index 4d394203d..31d4fdd1f 100644
--- a/src/company_gui.cpp
+++ b/src/company_gui.cpp
@@ -318,7 +318,8 @@ struct CompanyFinancesWindow : Window {
case WID_CF_EXPS_PRICE2:
case WID_CF_EXPS_PRICE3:
size->height = _expenses_list_types[type].GetHeight();
- /* FALL THROUGH */
+ FALLTHROUGH;
+
case WID_CF_BALANCE_VALUE:
case WID_CF_LOAN_VALUE:
case WID_CF_TOTAL_VALUE:
@@ -636,7 +637,8 @@ public:
size->width = 0;
break;
}
- /* FALL THROUGH */
+ FALLTHROUGH;
+
case WID_SCL_PRI_COL_DROPDOWN: {
int padding = this->square.width + NWidgetScrollbar::GetVerticalDimension().width + 10;
for (const StringID *id = _colour_dropdown; id != endof(_colour_dropdown); id++) {
@@ -892,7 +894,7 @@ void DrawCompanyManagerFace(CompanyManagerFace cmf, int colour, int x, int y)
for (CompanyManagerFaceVariable cmfv = CMFV_CHEEKS; cmfv < CMFV_END; cmfv++) {
switch (cmfv) {
case CMFV_MOUSTACHE: if (!has_moustache) continue; break;
- case CMFV_LIPS: // FALL THROUGH
+ case CMFV_LIPS:
case CMFV_NOSE: if (has_moustache) continue; break;
case CMFV_TIE_EARRING: if (!has_tie_earring) continue; break;
case CMFV_GLASSES: if (!has_glasses) continue; break;
@@ -1365,7 +1367,7 @@ public:
/* OK button */
case WID_SCMF_ACCEPT:
DoCommandP(0, 0, this->face, CMD_SET_COMPANY_MANAGER_FACE);
- /* FALL THROUGH */
+ FALLTHROUGH;
/* Cancel button */
case WID_SCMF_CANCEL:
diff --git a/src/console.cpp b/src/console.cpp
index ece859916..6e9b46f6b 100644
--- a/src/console.cpp
+++ b/src/console.cpp
@@ -468,7 +468,7 @@ void IConsoleCmdExec(const char *cmdstr)
tokenstream[tstream_i++] = *++cmdptr;
break;
}
- /* FALL THROUGH */
+ FALLTHROUGH;
default: // Normal character
tokenstream[tstream_i++] = *cmdptr;
diff --git a/src/depot_gui.cpp b/src/depot_gui.cpp
index 47eefc65e..a99f2e4dd 100644
--- a/src/depot_gui.cpp
+++ b/src/depot_gui.cpp
@@ -445,7 +445,8 @@ struct DepotWindow : Window {
switch (this->type) {
case VEH_TRAIN:
if (wagon) return MODE_ERROR;
- /* FALL THROUGH */
+ FALLTHROUGH;
+
case VEH_ROAD:
if (xm <= this->flag_width) return MODE_START_STOP;
break;
diff --git a/src/economy.cpp b/src/economy.cpp
index 7461d34b7..0106e87e1 100644
--- a/src/economy.cpp
+++ b/src/economy.cpp
@@ -1726,7 +1726,7 @@ static void LoadUnloadVehicle(Vehicle *front)
/* update stats */
int t;
switch (front->type) {
- case VEH_TRAIN: /* FALL THROUGH */
+ case VEH_TRAIN:
case VEH_SHIP:
t = front->vcache.cached_max_speed;
break;
diff --git a/src/engine_gui.cpp b/src/engine_gui.cpp
index d1ccd3bf4..5e9e8cef7 100644
--- a/src/engine_gui.cpp
+++ b/src/engine_gui.cpp
@@ -126,7 +126,7 @@ struct EnginePreviewWindow : Window {
switch (widget) {
case WID_EP_YES:
DoCommandP(0, this->window_number, 0, CMD_WANT_ENGINE_PREVIEW);
- /* FALL THROUGH */
+ FALLTHROUGH;
case WID_EP_NO:
if (!_shift_pressed) delete this;
break;
diff --git a/src/fileio.cpp b/src/fileio.cpp
index 085c2c66d..526f5b184 100644
--- a/src/fileio.cpp
+++ b/src/fileio.cpp
@@ -522,7 +522,7 @@ FILE *FioFOpenFile(const char *filename, const char *mode, Subdirectory subdir,
case BASESET_DIR:
f = FioFOpenFile(filename, mode, OLD_GM_DIR, filesize);
if (f != NULL) break;
- /* FALL THROUGH */
+ FALLTHROUGH;
case NEWGRF_DIR:
f = FioFOpenFile(filename, mode, OLD_DATA_DIR, filesize);
break;
@@ -1477,7 +1477,7 @@ uint FileScanner::Scan(const char *extension, Subdirectory sd, bool tars, bool r
switch (sd) {
case BASESET_DIR:
num += this->Scan(extension, OLD_GM_DIR, tars, recursive);
- /* FALL THROUGH */
+ FALLTHROUGH;
case NEWGRF_DIR:
num += this->Scan(extension, OLD_DATA_DIR, tars, recursive);
break;
diff --git a/src/fios.cpp b/src/fios.cpp
index 8ed01152f..0d30e0965 100644
--- a/src/fios.cpp
+++ b/src/fios.cpp
@@ -158,7 +158,8 @@ const char *FiosBrowseTo(const FiosItem *item)
#elif defined(WIN32) || defined(__OS2__)
seprintf(_fios_path, _fios_path_last, "%c:" PATHSEP, item->title[0]);
#endif
- /* FALL THROUGH */
+ break;
+
case FIOS_TYPE_INVALID:
break;
diff --git a/src/fios_gui.cpp b/src/fios_gui.cpp
index e6cd9625c..f20cfd792 100644
--- a/src/fios_gui.cpp
+++ b/src/fios_gui.cpp
@@ -702,7 +702,8 @@ public:
this->vscroll->SetCount(this->fios_items.Length());
this->selected = NULL;
_load_check_data.Clear();
- /* FALL THROUGH */
+ FALLTHROUGH;
+
case 1:
/* Selection changes */
if (!gui_scope) break;
diff --git a/src/fontcache.cpp b/src/fontcache.cpp
index 85e5a92cc..72e42ccbb 100644
--- a/src/fontcache.cpp
+++ b/src/fontcache.cpp
@@ -126,7 +126,7 @@ void SpriteFontCache::InitializeUnicodeGlyphMap()
SpriteID base;
switch (this->fs) {
default: NOT_REACHED();
- case FS_MONO: // Use normal as default for mono spaced font, i.e. FALL THROUGH
+ case FS_MONO: // Use normal as default for mono spaced font
case FS_NORMAL: base = SPR_ASCII_SPACE; break;
case FS_SMALL: base = SPR_ASCII_SPACE_SMALL; break;
case FS_LARGE: base = SPR_ASCII_SPACE_BIG; break;
diff --git a/src/game/game_scanner.cpp b/src/game/game_scanner.cpp
index bc02f6afd..38afdd135 100644
--- a/src/game/game_scanner.cpp
+++ b/src/game/game_scanner.cpp
@@ -55,7 +55,7 @@ GameInfo *GameScannerInfo::FindInfo(const char *nameParam, int versionParam, boo
*e = '\0';
e++;
versionParam = atoi(e);
- /* FALL THROUGH, like we were calling this function with a version. */
+ /* Continue like we were calling this function with a version. */
}
if (force_exact_match) {
diff --git a/src/industry_gui.cpp b/src/industry_gui.cpp
index b9077b9d7..41b3c573f 100644
--- a/src/industry_gui.cpp
+++ b/src/industry_gui.cpp
@@ -785,7 +785,7 @@ public:
DrawString(left_side, right - WD_FRAMERECT_RIGHT, y, STR_INDUSTRY_VIEW_ACCEPT_CARGO_AMOUNT);
break;
}
- /* FALL THROUGH */
+ FALLTHROUGH;
case CSD_CARGO:
SetDParam(0, CargoSpec::Get(i->accepts_cargo[j])->name);
diff --git a/src/misc_gui.cpp b/src/misc_gui.cpp
index 2d3871ffb..03500c2a2 100644
--- a/src/misc_gui.cpp
+++ b/src/misc_gui.cpp
@@ -1007,10 +1007,12 @@ struct QueryStringWindow : public Window
switch (widget) {
case WID_QS_DEFAULT:
this->editbox.text.DeleteAll();
- /* FALL THROUGH */
+ FALLTHROUGH;
+
case WID_QS_OK:
this->OnOk();
- /* FALL THROUGH */
+ FALLTHROUGH;
+
case WID_QS_CANCEL:
delete this;
break;
@@ -1160,7 +1162,8 @@ struct QueryWindow : public Window {
this->proc(this->parent, true);
this->proc = NULL;
}
- /* FALL THROUGH */
+ FALLTHROUGH;
+
case WKC_ESC:
delete this;
return ES_HANDLED;
diff --git a/src/music/extmidi.cpp b/src/music/extmidi.cpp
index 12b3689e2..d39a050f6 100644
--- a/src/music/extmidi.cpp
+++ b/src/music/extmidi.cpp
@@ -124,7 +124,7 @@ void MusicDriver_ExtMidi::DoPlay()
case -1:
DEBUG(driver, 0, "extmidi: couldn't fork: %s", strerror(errno));
- /* FALL THROUGH */
+ FALLTHROUGH;
default:
this->song[0] = '\0';
diff --git a/src/music/qtmidi.cpp b/src/music/qtmidi.cpp
index dfd6f16eb..9bc6a6174 100644
--- a/src/music/qtmidi.cpp
+++ b/src/music/qtmidi.cpp
@@ -242,7 +242,7 @@ void MusicDriver_QtMidi::Stop()
case QT_STATE_PLAY:
StopSong();
- /* FALL THROUGH */
+ FALLTHROUGH;
case QT_STATE_STOP:
DisposeMovie(_quicktime_movie);
@@ -267,13 +267,13 @@ void MusicDriver_QtMidi::PlaySong(const char *filename)
case QT_STATE_PLAY:
StopSong();
DEBUG(driver, 3, "qtmidi: previous tune stopped");
- /* FALL THROUGH */
+ FALLTHROUGH;
case QT_STATE_STOP:
DisposeMovie(_quicktime_movie);
DEBUG(driver, 3, "qtmidi: previous tune disposed");
_quicktime_state = QT_STATE_IDLE;
- /* FALL THROUGH */
+ FALLTHROUGH;
case QT_STATE_IDLE:
LoadMovieForMIDIFile(filename, &_quicktime_movie);
@@ -294,7 +294,7 @@ void MusicDriver_QtMidi::StopSong()
switch (_quicktime_state) {
case QT_STATE_IDLE:
- /* FALL THROUGH */
+ FALLTHROUGH;
case QT_STATE_STOP:
DEBUG(driver, 3, "qtmidi: stop requested, but already idle");
diff --git a/src/network/core/udp.cpp b/src/network/core/udp.cpp
index ce5f06b1f..20b1ce119 100644
--- a/src/network/core/udp.cpp
+++ b/src/network/core/udp.cpp
@@ -252,17 +252,20 @@ void NetworkUDPSocketHandler::ReceiveNetworkGameInfo(Packet *p, NetworkGameInfo
*dst = c;
dst = &c->next;
}
- /* FALL THROUGH */
}
+ FALLTHROUGH;
+
case 3:
info->game_date = Clamp(p->Recv_uint32(), 0, MAX_DATE);
info->start_date = Clamp(p->Recv_uint32(), 0, MAX_DATE);
- /* FALL THROUGH */
+ FALLTHROUGH;
+
case 2:
info->companies_max = p->Recv_uint8 ();
info->companies_on = p->Recv_uint8 ();
info->spectators_max = p->Recv_uint8 ();
- /* FALL THROUGH */
+ FALLTHROUGH;
+
case 1:
p->Recv_string(info->server_name, sizeof(info->server_name));
p->Recv_string(info->server_revision, sizeof(info->server_revision));
diff --git a/src/network/network_chat_gui.cpp b/src/network/network_chat_gui.cpp
index f1e54f38d..68e148987 100644
--- a/src/network/network_chat_gui.cpp
+++ b/src/network/network_chat_gui.cpp
@@ -492,10 +492,13 @@ struct NetworkChatWindow : public Window {
virtual void OnClick(Point pt, int widget, int click_count)
{
switch (widget) {
- /* Send */
- case WID_NC_SENDBUTTON: SendChat(this->message_editbox.text.buf, this->dtype, this->dest);
- /* FALL THROUGH */
- case WID_NC_CLOSE: /* Cancel */ delete this; break;
+ case WID_NC_SENDBUTTON: /* Send */
+ SendChat(this->message_editbox.text.buf, this->dtype, this->dest);
+ FALLTHROUGH;
+
+ case WID_NC_CLOSE: /* Cancel */
+ delete this;
+ break;
}
}
diff --git a/src/network/network_client.cpp b/src/network/network_client.cpp
index edfe4587f..e3bcbb2d8 100644
--- a/src/network/network_client.cpp
+++ b/src/network/network_client.cpp
@@ -965,7 +965,8 @@ NetworkRecvStatus ClientNetworkGameSocketHandler::Receive_SERVER_CHAT(Packet *p)
/* For speaking to company or giving money, we need the company-name */
case NETWORK_ACTION_GIVE_MONEY:
if (!Company::IsValidID(ci_to->client_playas)) return NETWORK_RECV_STATUS_OKAY;
- /* FALL THROUGH */
+ FALLTHROUGH;
+
case NETWORK_ACTION_CHAT_COMPANY: {
StringID str = Company::IsValidID(ci_to->client_playas) ? STR_COMPANY_NAME : STR_NETWORK_SPECTATORS;
SetDParam(0, ci_to->client_playas);
diff --git a/src/network/network_content_gui.cpp b/src/network/network_content_gui.cpp
index 1227d43db..4b1332c58 100644
--- a/src/network/network_content_gui.cpp
+++ b/src/network/network_content_gui.cpp
@@ -908,7 +908,8 @@ public:
}
return ES_HANDLED;
}
- /* FALL THROUGH, space is pressed and filter is focused. */
+ /* space is pressed and filter is focused. */
+ FALLTHROUGH;
default:
return ES_NOT_HANDLED;
diff --git a/src/network/network_gui.cpp b/src/network/network_gui.cpp
index 520c4f60a..3e4a4b050 100644
--- a/src/network/network_gui.cpp
+++ b/src/network/network_gui.cpp
@@ -2053,7 +2053,8 @@ struct NetworkJoinStatusWindow : Window {
progress = 15; // We don't have the final size yet; the server is still compressing!
break;
}
- /* FALL THROUGH */
+ FALLTHROUGH;
+
default: // Waiting is 15%, so the resting receivement of map is maximum 70%
progress = 15 + _network_join_bytes * (100 - 15) / _network_join_bytes_total;
}
@@ -2182,7 +2183,7 @@ struct NetworkCompanyPasswordWindow : public Window {
switch (widget) {
case WID_NCP_OK:
this->OnOk();
- /* FALL THROUGH */
+ FALLTHROUGH;
case WID_NCP_CANCEL:
delete this;
diff --git a/src/network/network_server.cpp b/src/network/network_server.cpp
index 6a33c73d8..bcee40852 100644
--- a/src/network/network_server.cpp
+++ b/src/network/network_server.cpp
@@ -1361,7 +1361,8 @@ void NetworkServerSendChat(NetworkAction action, DestType desttype, int dest, co
}
default:
DEBUG(net, 0, "[server] received unknown chat destination type %d. Doing broadcast instead", desttype);
- /* FALL THROUGH */
+ FALLTHROUGH;
+
case DESTTYPE_BROADCAST:
FOR_ALL_CLIENT_SOCKETS(cs) {
cs->SendChat(action, from_id, false, msg, data);
@@ -1396,7 +1397,7 @@ NetworkRecvStatus ServerNetworkGameSocketHandler::Receive_CLIENT_CHAT(Packet *p)
switch (action) {
case NETWORK_ACTION_GIVE_MONEY:
if (!Company::IsValidID(ci->client_playas)) break;
- /* FALL THROUGH */
+ FALLTHROUGH;
case NETWORK_ACTION_CHAT:
case NETWORK_ACTION_CHAT_CLIENT:
case NETWORK_ACTION_CHAT_COMPANY:
diff --git a/src/newgrf.cpp b/src/newgrf.cpp
index 9c7188ec7..24b0238b3 100644
--- a/src/newgrf.cpp
+++ b/src/newgrf.cpp
@@ -2969,7 +2969,7 @@ static ChangeInfoResult CargoChangeInfo(uint cid, int numinfo, int prop, ByteRea
case 0x0B: cs->town_effect = TE_FOOD; break;
default:
grfmsg(1, "CargoChangeInfo: Unknown town growth substitute value %d, setting to none.", substitute_type);
- /* FALL THROUGH */
+ FALLTHROUGH;
case 0xFF: cs->town_effect = TE_NONE; break;
}
break;
@@ -4094,7 +4094,7 @@ static ChangeInfoResult RailTypeChangeInfo(uint id, int numinfo, int prop, ByteR
RailType rt = GetRailTypeByLabel(BSWAP32(label), false);
if (rt != INVALID_RAILTYPE) {
switch (prop) {
- case 0x0F: SetBit(rti->powered_railtypes, rt); // Powered implies compatible.
+ case 0x0F: SetBit(rti->powered_railtypes, rt); FALLTHROUGH; // Powered implies compatible.
case 0x0E: SetBit(rti->compatible_railtypes, rt); break;
case 0x18: SetBit(rti->introduction_required_railtypes, rt); break;
case 0x19: SetBit(rti->introduces_railtypes, rt); break;
@@ -4211,7 +4211,7 @@ static ChangeInfoResult RailTypeReserveInfo(uint id, int numinfo, int prop, Byte
break;
}
grfmsg(1, "RailTypeReserveInfo: Ignoring property 1D for rail type %u because no label was set", id + i);
- /* FALL THROUGH */
+ FALLTHROUGH;
case 0x0E: // Compatible railtype list
case 0x0F: // Powered railtype list
@@ -4350,7 +4350,7 @@ static bool HandleChangeInfoResult(const char *caller, ChangeInfoResult cir, uin
case CIR_UNKNOWN:
grfmsg(0, "%s: Unknown property 0x%02X of feature 0x%02X, disabling", caller, property, feature);
- /* FALL THROUGH */
+ FALLTHROUGH;
case CIR_INVALID_ID: {
/* No debug message for an invalid ID, as it has already been output */
diff --git a/src/newgrf_gui.cpp b/src/newgrf_gui.cpp
index c3007ac42..c0aa160c2 100644
--- a/src/newgrf_gui.cpp
+++ b/src/newgrf_gui.cpp
@@ -1032,8 +1032,9 @@ struct NewGRFWindow : public Window, NewGRFScanCallback {
if (this->editable && this->active_sel != NULL) SetObjectToPlaceWnd(SPR_CURSOR_MOUSE, PAL_NONE, HT_DRAG, this);
break;
}
- /* FALL THROUGH, with double click. */
+ /* With double click, continue */
}
+ FALLTHROUGH;
case WID_NS_REMOVE: { // Remove GRF
if (this->active_sel == NULL || !this->editable) break;
@@ -1087,8 +1088,9 @@ struct NewGRFWindow : public Window, NewGRFScanCallback {
if (this->editable && this->avail_sel != NULL && !HasBit(this->avail_sel->flags, GCF_INVALID)) SetObjectToPlaceWnd(SPR_CURSOR_MOUSE, PAL_NONE, HT_DRAG, this);
break;
}
- /* FALL THROUGH, with double click. */
+ /* With double click, continue */
}
+ FALLTHROUGH;
case WID_NS_ADD:
if (this->avail_sel == NULL || !this->editable || HasBit(this->avail_sel->flags, GCF_INVALID)) break;
@@ -1225,10 +1227,12 @@ struct NewGRFWindow : public Window, NewGRFScanCallback {
}
this->avails.ForceRebuild();
- /* FALL THROUGH */
+ FALLTHROUGH;
+
case GOID_NEWGRF_LIST_EDITED:
this->preset = -1;
- /* FALL THROUGH */
+ FALLTHROUGH;
+
case GOID_NEWGRF_PRESET_LOADED: {
/* Update scrollbars */
int i = 0;
diff --git a/src/newgrf_industries.cpp b/src/newgrf_industries.cpp
index ef8e9fa9b..e8486e760 100644
--- a/src/newgrf_industries.cpp
+++ b/src/newgrf_industries.cpp
@@ -128,7 +128,7 @@ static uint32 GetCountAndDistanceOfClosestInstance(byte param_setID, byte layout
case 0xFFFFFFFF: // current grf
GrfID = GetIndustrySpec(current->type)->grf_prop.grffile->grfid;
- /* FALL THROUGH */
+ FALLTHROUGH;
default: // use the grfid specified in register 100h
SetBit(param_setID, 7); // bit 7 means it is not an old type
diff --git a/src/newgrf_industries.h b/src/newgrf_industries.h
index 57e44e8c0..94a502166 100644
--- a/src/newgrf_industries.h
+++ b/src/newgrf_industries.h
@@ -48,9 +48,11 @@ struct IndustriesResolverObject : public ResolverObject {
case VSG_SCOPE_PARENT: {
TownScopeResolver *tsr = this->GetTown();
if (tsr != NULL) return tsr;
- /* FALL-THROUGH */
}
- default: return ResolverObject::GetScope(scope, relative);
+ FALLTHROUGH;
+
+ default:
+ return ResolverObject::GetScope(scope, relative);
}
}
};
diff --git a/src/newgrf_object.cpp b/src/newgrf_object.cpp
index 3f48a819f..058d5e0c0 100644
--- a/src/newgrf_object.cpp
+++ b/src/newgrf_object.cpp
@@ -232,7 +232,7 @@ static uint32 GetCountAndDistanceOfClosestInstance(byte local_id, uint32 grfid,
case 0xFFFFFFFF: // current grf
grf_id = grfid;
- /* FALL THROUGH */
+ FALLTHROUGH;
default: // use the grfid specified in register 100h
idx = _object_mngr.GetID(local_id, grf_id);
diff --git a/src/newgrf_object.h b/src/newgrf_object.h
index 4a3b770d2..cbd06b6f6 100644
--- a/src/newgrf_object.h
+++ b/src/newgrf_object.h
@@ -128,10 +128,11 @@ struct ObjectResolverObject : public ResolverObject {
case VSG_SCOPE_PARENT: {
TownScopeResolver *tsr = this->GetTown();
if (tsr != NULL) return tsr;
- /* FALL-THROUGH */
}
+ FALLTHROUGH;
- default: return ResolverObject::GetScope(scope, relative);
+ default:
+ return ResolverObject::GetScope(scope, relative);
}
}
diff --git a/src/newgrf_station.h b/src/newgrf_station.h
index ffb827cb3..b9333c105 100644
--- a/src/newgrf_station.h
+++ b/src/newgrf_station.h
@@ -59,8 +59,8 @@ struct StationResolverObject : public ResolverObject {
case VSG_SCOPE_PARENT: {
TownScopeResolver *tsr = this->GetTown();
if (tsr != NULL) return tsr;
- /* FALL-THROUGH */
}
+ FALLTHROUGH;
default:
return ResolverObject::GetScope(scope, relative);
diff --git a/src/order_cmd.cpp b/src/order_cmd.cpp
index 57b29f3f5..db812f6c5 100644
--- a/src/order_cmd.cpp
+++ b/src/order_cmd.cpp
@@ -772,7 +772,8 @@ CommandCost CmdInsertOrder(TileIndex tile, DoCommandFlag flags, uint32 p1, uint3
case OSL_PLATFORM_NEAR_END:
case OSL_PLATFORM_MIDDLE:
if (v->type != VEH_TRAIN) return CMD_ERROR;
- /* FALL THROUGH */
+ FALLTHROUGH;
+
case OSL_PLATFORM_FAR_END:
break;
@@ -880,7 +881,8 @@ CommandCost CmdInsertOrder(TileIndex tile, DoCommandFlag flags, uint32 p1, uint3
case OCV_LOAD_PERCENTAGE:
case OCV_RELIABILITY:
if (new_order.GetConditionValue() > 100) return CMD_ERROR;
- /* FALL THROUGH */
+ FALLTHROUGH;
+
default:
if (occ == OCC_IS_TRUE || occ == OCC_IS_FALSE) return CMD_ERROR;
break;
@@ -1466,7 +1468,8 @@ CommandCost CmdModifyOrder(TileIndex tile, DoCommandFlag flags, uint32 p1, uint3
case OCV_LOAD_PERCENTAGE:
case OCV_RELIABILITY:
if (order->GetConditionValue() > 100) order->SetConditionValue(100);
- /* FALL THROUGH */
+ FALLTHROUGH;
+
default:
if (occ == OCC_IS_TRUE || occ == OCC_IS_FALSE) order->SetConditionComparator(OCC_EQUALS);
break;
diff --git a/src/order_gui.cpp b/src/order_gui.cpp
index 3ca29e087..9045fac6b 100644
--- a/src/order_gui.cpp
+++ b/src/order_gui.cpp
@@ -841,7 +841,7 @@ public:
case VIWD_AUTOREPLACE:
/* Autoreplace replaced the vehicle */
this->vehicle = Vehicle::Get(this->window_number);
- /* FALL THROUGH */
+ FALLTHROUGH;
case VIWD_CONSIST_CHANGED:
/* Vehicle composition was changed. */
diff --git a/src/pathfinder/yapf/yapf_destrail.hpp b/src/pathfinder/yapf/yapf_destrail.hpp
index 681034a2f..03519b059 100644
--- a/src/pathfinder/yapf/yapf_destrail.hpp
+++ b/src/pathfinder/yapf/yapf_destrail.hpp
@@ -140,7 +140,8 @@ public:
* waypoint. */
Yapf().DisableCache(true);
}
- /* FALL THROUGH */
+ FALLTHROUGH;
+
case OT_GOTO_STATION:
m_destTile = CalcClosestStationTile(v->current_order.GetDestination(), v->tile, v->current_order.IsType(OT_GOTO_STATION) ? STATION_RAIL : STATION_WAYPOINT);
m_dest_station_id = v->current_order.GetDestination();
diff --git a/src/rail_cmd.cpp b/src/rail_cmd.cpp
index 5582666b1..9f284fc30 100644
--- a/src/rail_cmd.cpp
+++ b/src/rail_cmd.cpp
@@ -554,8 +554,8 @@ CommandCost CmdBuildSingleRail(TileIndex tile, DoCommandFlag flags, uint32 p1, u
if (IsLevelCrossing(tile) && GetCrossingRailBits(tile) == trackbit) {
return_cmd_error(STR_ERROR_ALREADY_BUILT);
}
- /* FALL THROUGH */
}
+ FALLTHROUGH;
default: {
/* Will there be flat water on the lower halftile? */
@@ -2444,33 +2444,60 @@ static void DrawTile_Track(TileInfo *ti)
SpriteID ground = GetCustomRailSprite(rti, ti->tile, RTSG_GROUND);
switch (GetRailDepotDirection(ti->tile)) {
- case DIAGDIR_NE: if (!IsInvisibilitySet(TO_BUILDINGS)) break; // else FALL THROUGH
- case DIAGDIR_SW: DrawGroundSprite(ground + RTO_X, PAL_NONE); break;
- case DIAGDIR_NW: if (!IsInvisibilitySet(TO_BUILDINGS)) break; // else FALL THROUGH
- case DIAGDIR_SE: DrawGroundSprite(ground + RTO_Y, PAL_NONE); break;
- default: break;
+ case DIAGDIR_NE:
+ if (!IsInvisibilitySet(TO_BUILDINGS)) break;
+ FALLTHROUGH;
+ case DIAGDIR_SW:
+ DrawGroundSprite(ground + RTO_X, PAL_NONE);
+ break;
+ case DIAGDIR_NW:
+ if (!IsInvisibilitySet(TO_BUILDINGS)) break;
+ FALLTHROUGH;
+ case DIAGDIR_SE:
+ DrawGroundSprite(ground + RTO_Y, PAL_NONE);
+ break;
+ default:
+ break;
}
if (_settings_client.gui.show_track_reservation && HasDepotReservation(ti->tile)) {
SpriteID overlay = GetCustomRailSprite(rti, ti->tile, RTSG_OVERLAY);
switch (GetRailDepotDirection(ti->tile)) {
- case DIAGDIR_NE: if (!IsInvisibilitySet(TO_BUILDINGS)) break; // else FALL THROUGH
- case DIAGDIR_SW: DrawGroundSprite(overlay + RTO_X, PALETTE_CRASH); break;
- case DIAGDIR_NW: if (!IsInvisibilitySet(TO_BUILDINGS)) break; // else FALL THROUGH
- case DIAGDIR_SE: DrawGroundSprite(overlay + RTO_Y, PALETTE_CRASH); break;
- default: break;
+ case DIAGDIR_NE:
+ if (!IsInvisibilitySet(TO_BUILDINGS)) break;
+ FALLTHROUGH;
+ case DIAGDIR_SW:
+ DrawGroundSprite(overlay + RTO_X, PALETTE_CRASH);
+ break;
+ case DIAGDIR_NW:
+ if (!IsInvisibilitySet(TO_BUILDINGS)) break;
+ FALLTHROUGH;
+ case DIAGDIR_SE:
+ DrawGroundSprite(overlay + RTO_Y, PALETTE_CRASH);
+ break;
+ default:
+ break;
}
}
} else {
/* PBS debugging, draw reserved tracks darker */
if (_game_mode != GM_MENU && _settings_client.gui.show_track_reservation && HasDepotReservation(ti->tile)) {
switch (GetRailDepotDirection(ti->tile)) {
- case DIAGDIR_NE: if (!IsInvisibilitySet(TO_BUILDINGS)) break; // else FALL THROUGH
- case DIAGDIR_SW: DrawGroundSprite(rti->base_sprites.single_x, PALETTE_CRASH); break;
- case DIAGDIR_NW: if (!IsInvisibilitySet(TO_BUILDINGS)) break; // else FALL THROUGH
- case DIAGDIR_SE: DrawGroundSprite(rti->base_sprites.single_y, PALETTE_CRASH); break;
- default: break;
+ case DIAGDIR_NE:
+ if (!IsInvisibilitySet(TO_BUILDINGS)) break;
+ FALLTHROUGH;
+ case DIAGDIR_SW:
+ DrawGroundSprite(rti->base_sprites.single_x, PALETTE_CRASH);
+ break;
+ case DIAGDIR_NW:
+ if (!IsInvisibilitySet(TO_BUILDINGS)) break;
+ FALLTHROUGH;
+ case DIAGDIR_SE:
+ DrawGroundSprite(rti->base_sprites.single_y, PALETTE_CRASH);
+ break;
+ default:
+ break;
}
}
}
diff --git a/src/saveload/afterload.cpp b/src/saveload/afterload.cpp
index 8b5967175..d5d9bc3a4 100644
--- a/src/saveload/afterload.cpp
+++ b/src/saveload/afterload.cpp
@@ -154,7 +154,7 @@ static void ConvertTownOwner()
if (GB(_m[tile].m5, 4, 2) == ROAD_TILE_CROSSING && HasBit(_m[tile].m3, 7)) {
_m[tile].m3 = OWNER_TOWN;
}
- /* FALL THROUGH */
+ FALLTHROUGH;
case MP_TUNNELBRIDGE:
if (_m[tile].m1 & 0x80) SetTileOwner(tile, OWNER_TOWN);
diff --git a/src/saveload/company_sl.cpp b/src/saveload/company_sl.cpp
index 733bc0eaf..d7c313027 100644
--- a/src/saveload/company_sl.cpp
+++ b/src/saveload/company_sl.cpp
@@ -185,7 +185,7 @@ void AfterLoadCompanyStats()
}
}
}
- /* FALL THROUGH */
+ FALLTHROUGH;
case MP_OBJECT:
if (GetWaterClass(tile) == WATER_CLASS_CANAL) {
diff --git a/src/saveload/vehicle_sl.cpp b/src/saveload/vehicle_sl.cpp
index d7c701189..2234659ab 100644
--- a/src/saveload/vehicle_sl.cpp
+++ b/src/saveload/vehicle_sl.cpp
@@ -433,8 +433,8 @@ void AfterLoadVehicles(bool part_of_load)
RoadVehicle *rv = RoadVehicle::From(v);
rv->roadtype = HasBit(EngInfo(v->First()->engine_type)->misc_flags, EF_ROAD_TRAM) ? ROADTYPE_TRAM : ROADTYPE_ROAD;
rv->compatible_roadtypes = RoadTypeToRoadTypes(rv->roadtype);
- /* FALL THROUGH */
}
+ FALLTHROUGH;
case VEH_TRAIN:
case VEH_SHIP:
diff --git a/src/script/api/script_error.cpp b/src/script/api/script_error.cpp
index 24c491995..87d2906c5 100644
--- a/src/script/api/script_error.cpp
+++ b/src/script/api/script_error.cpp
@@ -40,7 +40,8 @@ ScriptError::ScriptErrorMapString ScriptError::error_map_string = ScriptError::S
case TEXT_TAB_SPECIAL:
if (index < 0xE4) break; // Player name
- /* FALL THROUGH */
+ FALLTHROUGH;
+
case TEXT_TAB_TOWN:
if (index < 0xC0) break; // Town name
/* These strings are 'random' and have no meaning.
diff --git a/src/settings.cpp b/src/settings.cpp
index 9fba3a13f..d81945022 100644
--- a/src/settings.cpp
+++ b/src/settings.cpp
@@ -178,7 +178,8 @@ static int ParseIntList(const char *p, int *items, int maxitems)
/* Do not accept multiple commas between numbers */
if (!comma) return -1;
comma = false;
- /* FALL THROUGH */
+ FALLTHROUGH;
+
case ' ':
p++;
break;
diff --git a/src/signal.cpp b/src/signal.cpp
index 8e870b53d..b37e15074 100644
--- a/src/signal.cpp
+++ b/src/signal.cpp
@@ -504,7 +504,8 @@ static SigSegState UpdateSignalsInBuffer(Owner owner)
_tbdset.Add(tile, INVALID_DIAGDIR); // start from depot inside
break;
}
- /* FALL THROUGH */
+ FALLTHROUGH;
+
case MP_STATION:
case MP_ROAD:
if ((TrackStatusToTrackBits(GetTileTrackStatus(tile, TRANSPORT_RAIL, 0)) & _enterdir_to_trackbits[dir]) != TRACK_BIT_NONE) {
@@ -513,7 +514,8 @@ static SigSegState UpdateSignalsInBuffer(Owner owner)
_tbdset.Add(tile + TileOffsByDiagDir(dir), ReverseDiagDir(dir));
break;
}
- /* FALL THROUGH */
+ FALLTHROUGH;
+
default:
/* jump to next tile */
tile = tile + TileOffsByDiagDir(dir);
diff --git a/src/signs_gui.cpp b/src/signs_gui.cpp
index 020ee1b6e..15adef089 100644
--- a/src/signs_gui.cpp
+++ b/src/signs_gui.cpp
@@ -514,7 +514,7 @@ struct SignWindow : Window, SignList {
case WID_QES_OK:
if (RenameSign(this->cur_sign, this->name_editbox.text.buf)) break;
- /* FALL THROUGH */
+ FALLTHROUGH;
case WID_QES_CANCEL:
delete this;
diff --git a/src/smallmap_gui.cpp b/src/smallmap_gui.cpp
index f4bcdece1..0bb2997e5 100644
--- a/src/smallmap_gui.cpp
+++ b/src/smallmap_gui.cpp
@@ -1229,10 +1229,12 @@ void SmallMapWindow::RebuildColourIndexIfNecessary()
if (tbl->show_on_map && tbl->type == _smallmap_industry_highlight) {
legend_colour = _smallmap_industry_highlight_state ? PC_WHITE : PC_BLACK;
}
- /* FALL THROUGH */
+ FALLTHROUGH;
+
case SMT_LINKSTATS:
SetDParam(0, tbl->legend);
- /* FALL_THROUGH */
+ FALLTHROUGH;
+
case SMT_OWNER:
if (this->map_type != SMT_OWNER || tbl->company != INVALID_COMPANY) {
if (this->map_type == SMT_OWNER) SetDParam(0, tbl->company);
@@ -1246,7 +1248,8 @@ void SmallMapWindow::RebuildColourIndexIfNecessary()
}
break;
}
- /* FALL_THROUGH */
+ FALLTHROUGH;
+
default:
if (this->map_type == SMT_CONTOUR) SetDParam(0, tbl->height * TILE_HEIGHT_STEP);
/* Anything that is not an industry or a company is using normal process */
@@ -1465,7 +1468,6 @@ int SmallMapWindow::GetPositionOnLegend(Point pt)
break;
case WID_SM_ENABLE_ALL:
- /* FALL THROUGH */
case WID_SM_DISABLE_ALL: {
LegendAndColour *tbl = NULL;
switch (this->map_type) {
diff --git a/src/spritecache.cpp b/src/spritecache.cpp
index 70a8834a9..579791d0d 100644
--- a/src/spritecache.cpp
+++ b/src/spritecache.cpp
@@ -818,7 +818,7 @@ static void *HandleInvalidSpriteRequest(SpriteID sprite, SpriteType requested, S
switch (requested) {
case ST_NORMAL:
if (sprite == SPR_IMG_QUERY) usererror("Uhm, would you be so kind not to load a NewGRF that makes the 'query' sprite a non-normal sprite?");
- /* FALL THROUGH */
+ FALLTHROUGH;
case ST_FONT:
return GetRawSprite(SPR_IMG_QUERY, ST_NORMAL, allocator);
case ST_RECOLOUR:
diff --git a/src/station_cmd.cpp b/src/station_cmd.cpp
index ea890688e..5fd865a0d 100644
--- a/src/station_cmd.cpp
+++ b/src/station_cmd.cpp
@@ -3091,7 +3091,8 @@ static void TileLoop_Station(TileIndex tile)
case STATION_DOCK:
if (!IsTileFlat(tile)) break; // only handle water part
- /* FALL THROUGH */
+ FALLTHROUGH;
+
case STATION_OILRIG: //(station part)
case STATION_BUOY:
TileLoop_Water(tile);
diff --git a/src/stdafx.h b/src/stdafx.h
index 4616212f1..43e52ff27 100644
--- a/src/stdafx.h
+++ b/src/stdafx.h
@@ -156,6 +156,17 @@
#else
#define FINAL
#endif
+
+ /* Use fallthrough attribute where supported */
+ #if __GNUC__ >= 7
+ #if __cplusplus > 201402L // C++17
+ #define FALLTHROUGH [[fallthrough]]
+ #else
+ #define FALLTHROUGH __attribute__((fallthrough))
+ #endif
+ #else
+ #define FALLTHROUGH
+ #endif
#endif /* __GNUC__ */
#if defined(__WATCOMC__)
@@ -164,6 +175,7 @@
#define GCC_PACK
#define WARN_FORMAT(string, args)
#define FINAL
+ #define FALLTHROUGH
#include <malloc.h>
#endif /* __WATCOMC__ */
@@ -235,6 +247,13 @@
#define WARN_FORMAT(string, args)
#define FINAL sealed
+ /* fallthrough attribute, VS 2017 */
+ #if (_MSC_VER >= 1910)
+ #define FALLTHROUGH [[fallthrough]]
+ #else
+ #define FALLTHROUGH
+ #endif
+
#if defined(WINCE)
int CDECL vsnprintf(char *str, size_t size, const char *format, va_list ap);
#endif
diff --git a/src/terraform_gui.cpp b/src/terraform_gui.cpp
index 6274de8cd..97749a8dc 100644
--- a/src/terraform_gui.cpp
+++ b/src/terraform_gui.cpp
@@ -80,12 +80,14 @@ static void GenerateRockyArea(TileIndex end, TileIndex start)
switch (GetTileType(tile)) {
case MP_TREES:
if (GetTreeGround(tile) == TREE_GROUND_SHORE) continue;
- /* FALL THROUGH */
+ FALLTHROUGH;
+
case MP_CLEAR:
MakeClear(tile, CLEAR_ROCKS, 3);
break;
- default: continue;
+ default:
+ continue;
}
MarkTileDirtyByTile(tile);
success = true;
diff --git a/src/timetable_gui.cpp b/src/timetable_gui.cpp
index ffea9a864..664dc8034 100644
--- a/src/timetable_gui.cpp
+++ b/src/timetable_gui.cpp
@@ -197,7 +197,8 @@ struct TimetableWindow : Window {
this->deparr_time_width = GetStringBoundingBox(STR_JUST_DATE_TINY).width;
this->deparr_abbr_width = max(GetStringBoundingBox(STR_TIMETABLE_ARRIVAL_ABBREVIATION).width, GetStringBoundingBox(STR_TIMETABLE_DEPARTURE_ABBREVIATION).width);
size->width = WD_FRAMERECT_LEFT + this->deparr_abbr_width + 10 + this->deparr_time_width + WD_FRAMERECT_RIGHT;
- /* FALL THROUGH */
+ FALLTHROUGH;
+
case WID_VT_ARRIVAL_DEPARTURE_SELECTION:
case WID_VT_TIMETABLE_PANEL:
resize->height = FONT_HEIGHT_NORMAL;
diff --git a/src/town_cmd.cpp b/src/town_cmd.cpp
index 66092ff34..daaad7e8d 100644
--- a/src/town_cmd.cpp
+++ b/src/town_cmd.cpp
@@ -1244,7 +1244,7 @@ static void GrowTownInTile(TileIndex *tile_ptr, RoadBits cur_rb, DiagDirection t
case TL_3X3_GRID: // Use 2x2 grid afterwards!
GrowTownWithExtraHouse(t1, TileAddByDiagDir(house_tile, target_dir));
- /* FALL THROUGH */
+ FALLTHROUGH;
case TL_2X2_GRID:
rcmd = GetTownRoadGridElement(t1, tile, target_dir);
@@ -1253,7 +1253,7 @@ static void GrowTownInTile(TileIndex *tile_ptr, RoadBits cur_rb, DiagDirection t
case TL_BETTER_ROADS: // Use original afterwards!
GrowTownWithExtraHouse(t1, TileAddByDiagDir(house_tile, target_dir));
- /* FALL THROUGH */
+ FALLTHROUGH;
case TL_ORIGINAL:
/* Allow a house at the edge. 60% chance or
@@ -3259,7 +3259,7 @@ Town *ClosestTownFromTile(TileIndex tile, uint threshold)
return town;
}
- /* FALL THROUGH */
+ FALLTHROUGH;
case MP_HOUSE:
return Town::GetByTile(tile);
diff --git a/src/town_gui.cpp b/src/town_gui.cpp
index 142966b69..696b71afd 100644
--- a/src/town_gui.cpp
+++ b/src/town_gui.cpp
@@ -267,9 +267,10 @@ public:
this->sel_index = y;
this->SetDirty();
}
- /* FALL THROUGH, when double-clicking. */
+ /* When double-clicking, continue */
if (click_count == 1 || y < 0) break;
}
+ FALLTHROUGH;
case WID_TA_EXECUTE:
DoCommandP(this->town->xy, this->window_number, this->sel_index, CMD_DO_TOWN_ACTION | CMD_MSG(STR_ERROR_CAN_T_DO_THIS));
diff --git a/src/train_cmd.cpp b/src/train_cmd.cpp
index 608ce2fee..fb1d2b1ee 100644
--- a/src/train_cmd.cpp
+++ b/src/train_cmd.cpp
@@ -2502,6 +2502,7 @@ public:
case OT_GOTO_DEPOT:
/* Skip service in depot orders when the train doesn't need service. */
if ((order->GetDepotOrderType() & ODTFB_SERVICE) && !this->v->NeedsServicing()) break;
+ FALLTHROUGH;
case OT_GOTO_STATION:
case OT_GOTO_WAYPOINT:
this->v->current_order = *order;
@@ -3608,7 +3609,7 @@ static bool TrainApproachingLineEnd(Train *v, bool signal, bool reverse)
* for other directions, it will be 1, 3, 5, ..., 15 */
switch (v->direction) {
case DIR_N : x = ~x + ~y + 25; break;
- case DIR_NW: x = y; // FALL THROUGH
+ case DIR_NW: x = y; FALLTHROUGH;
case DIR_NE: x = ~x + 16; break;
case DIR_E : x = ~x + y + 9; break;
case DIR_SE: x = y; break;
diff --git a/src/tree_cmd.cpp b/src/tree_cmd.cpp
index c862f0dbc..7240cf86d 100644
--- a/src/tree_cmd.cpp
+++ b/src/tree_cmd.cpp
@@ -375,7 +375,8 @@ CommandCost CmdPlantTree(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32
msg = STR_ERROR_CAN_T_BUILD_ON_WATER;
continue;
}
- /* FALL THROUGH */
+ FALLTHROUGH;
+
case MP_CLEAR: {
if (IsBridgeAbove(tile)) {
msg = STR_ERROR_SITE_UNSUITABLE;
@@ -680,7 +681,7 @@ static void TileLoop_Trees(TileIndex tile)
SetTreeGrowth(tile, 0);
break;
}
- /* FALL THROUGH */
+ FALLTHROUGH;
case 2: { // add a neighbouring tree
/* Don't plant extra trees if that's not allowed. */
diff --git a/src/vehicle.cpp b/src/vehicle.cpp
index 4dbdf24df..dff9febc0 100644
--- a/src/vehicle.cpp
+++ b/src/vehicle.cpp
@@ -1269,7 +1269,7 @@ bool Vehicle::HandleBreakdown()
SetWindowDirty(WC_VEHICLE_VIEW, this->index);
SetWindowDirty(WC_VEHICLE_DETAILS, this->index);
- /* FALL THROUGH */
+ FALLTHROUGH;
case 1:
/* Aircraft breakdowns end only when arriving at the airport */
if (this->type == VEH_AIRCRAFT) return false;
diff --git a/src/vehicle_gui.cpp b/src/vehicle_gui.cpp
index b9c24ddd0..b50457d21 100644
--- a/src/vehicle_gui.cpp
+++ b/src/vehicle_gui.cpp
@@ -817,8 +817,8 @@ struct RefitWindow : public Window {
Vehicle *v = Vehicle::Get(this->window_number);
this->selected_vehicle = v->index;
this->num_vehicles = UINT8_MAX;
- /* FALL THROUGH */
}
+ FALLTHROUGH;
case 2: { // The vehicle selection has changed; rebuild the entire list.
if (!gui_scope) break;
@@ -843,8 +843,8 @@ struct RefitWindow : public Window {
this->information_width = max_width;
this->ReInit();
}
- /* FALL THROUGH */
}
+ FALLTHROUGH;
case 1: // A new cargo has been selected.
if (!gui_scope) break;
@@ -905,8 +905,8 @@ struct RefitWindow : public Window {
if (_ctrl_pressed) this->num_vehicles = UINT8_MAX;
break;
}
- /* FALL THROUGH */
}
+ FALLTHROUGH;
default:
/* Clear the selection. */
@@ -940,8 +940,8 @@ struct RefitWindow : public Window {
this->InvalidateData(1);
if (click_count == 1) break;
- /* FALL THROUGH */
}
+ FALLTHROUGH;
case WID_VR_REFIT: // refit button
if (this->cargo != NULL) {
@@ -2638,8 +2638,7 @@ public:
str = STR_VEHICLE_STATUS_LEAVING;
break;
}
- /* FALL THROUGH, if aircraft. Does this even happen? */
-
+ FALLTHROUGH;
default:
if (v->GetNumManualOrders() == 0) {
str = STR_VEHICLE_STATUS_NO_ORDERS_VEL;
diff --git a/src/vehiclelist.cpp b/src/vehiclelist.cpp
index f1f5d0424..bfe4e5ffd 100644
--- a/src/vehiclelist.cpp
+++ b/src/vehiclelist.cpp
@@ -156,7 +156,7 @@ bool GenerateVehicleSortList(VehicleList *list, const VehicleListIdentifier &vli
}
break;
}
- /* FALL THROUGH */
+ FALLTHROUGH;
case VL_STANDARD:
FOR_ALL_VEHICLES(v) {
diff --git a/src/video/cocoa/event.mm b/src/video/cocoa/event.mm
index c8d10717e..1298961dc 100644
--- a/src/video/cocoa/event.mm
+++ b/src/video/cocoa/event.mm
@@ -610,7 +610,7 @@ static bool QZ_PollEvent()
* the mouse position programmatically, which would trigger OS X to show
* the default arrow cursor if the events are propagated. */
if (_cursor.fix_at) break;
- /* FALL THROUGH */
+ FALLTHROUGH;
default:
[ NSApp sendEvent:event ];
diff --git a/src/video/win32_v.cpp b/src/video/win32_v.cpp
index e536ae8e5..4a9861b64 100644
--- a/src/video/win32_v.cpp
+++ b/src/video/win32_v.cpp
@@ -680,7 +680,7 @@ static LRESULT CALLBACK WndProcGdi(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP
case WM_PALETTECHANGED:
if ((HWND)wParam == hwnd) return 0;
- /* FALL THROUGH */
+ FALLTHROUGH;
case WM_QUERYNEWPALETTE: {
HDC hDC = GetWindowDC(hwnd);
diff --git a/src/viewport.cpp b/src/viewport.cpp
index a1bb2c81d..df431ff3c 100644
--- a/src/viewport.cpp
+++ b/src/viewport.cpp
@@ -2633,8 +2633,8 @@ static int CalcHeightdiff(HighLightStyle style, uint distance, TileIndex start_t
byte style_t = (byte)(TileX(end_tile) > TileX(start_tile));
start_tile = TILE_ADD(start_tile, ToTileIndexDiff(heightdiff_area_by_dir[style_t]));
end_tile = TILE_ADD(end_tile, ToTileIndexDiff(heightdiff_area_by_dir[2 + style_t]));
- /* FALL THROUGH */
}
+ FALLTHROUGH;
case HT_POINT:
h0 = TileHeight(start_tile);
@@ -2979,7 +2979,7 @@ void VpSelectTilesWithMethod(int x, int y, ViewportPlaceMethod method)
case VPM_X_LIMITED: // Drag in X direction (limited size).
limit = (_thd.sizelimit - 1) * TILE_SIZE;
- /* FALL THROUGH */
+ FALLTHROUGH;
case VPM_FIX_X: // drag in Y direction
x = sx;
@@ -2988,7 +2988,7 @@ void VpSelectTilesWithMethod(int x, int y, ViewportPlaceMethod method)
case VPM_Y_LIMITED: // Drag in Y direction (limited size).
limit = (_thd.sizelimit - 1) * TILE_SIZE;
- /* FALL THROUGH */
+ FALLTHROUGH;
case VPM_FIX_Y: // drag in X direction
y = sy;
@@ -3026,7 +3026,7 @@ calc_heightdiff_single_direction:;
limit = (_thd.sizelimit - 1) * TILE_SIZE;
x = sx + Clamp(x - sx, -limit, limit);
y = sy + Clamp(y - sy, -limit, limit);
- /* FALL THROUGH */
+ FALLTHROUGH;
case VPM_X_AND_Y: // drag an X by Y area
if (_settings_client.gui.measure_tooltip) {
diff --git a/src/water_cmd.cpp b/src/water_cmd.cpp
index 4392eb210..edce4cda5 100644
--- a/src/water_cmd.cpp
+++ b/src/water_cmd.cpp
@@ -437,7 +437,7 @@ CommandCost CmdBuildCanal(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32
MakeSea(tile);
break;
}
- /* FALL THROUGH */
+ FALLTHROUGH;
default:
MakeCanal(tile, _current_company, Random());
@@ -1015,7 +1015,7 @@ FloodingBehaviour GetFloodingBehaviour(TileIndex tile)
Slope tileh = GetTileSlope(tile);
return (IsSlopeWithOneCornerRaised(tileh) ? FLOOD_ACTIVE : FLOOD_DRYUP);
}
- /* FALL THROUGH */
+ FALLTHROUGH;
case MP_STATION:
case MP_INDUSTRY:
case MP_OBJECT:
@@ -1064,7 +1064,7 @@ void DoFloodTile(TileIndex target)
flooded = true;
break;
}
- /* FALL THROUGH */
+ FALLTHROUGH;
case MP_CLEAR:
if (DoCommand(target, 0, 0, DC_EXEC, CMD_LANDSCAPE_CLEAR).Succeeded()) {
diff --git a/src/widget.cpp b/src/widget.cpp
index 0f1743b90..4e411ada2 100644
--- a/src/widget.cpp
+++ b/src/widget.cpp
@@ -2287,8 +2287,8 @@ void NWidgetLeaf::SetupSmallestSize(Window *w, bool init_array)
Dimension sprite_size = GetSpriteSize(_current_text_dir == TD_RTL ? SPR_IMG_DELETE_RIGHT : SPR_IMG_DELETE_LEFT);
size.width = max(size.width, 30 + sprite_size.width);
size.height = max(sprite_size.height, GetStringBoundingBox("_").height + WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM);
- /* FALL THROUGH */
}
+ FALLTHROUGH;
case WWT_PUSHBTN: {
static const Dimension extra = {WD_FRAMERECT_LEFT + WD_FRAMERECT_RIGHT, WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM};
padding = &extra;
diff --git a/src/window.cpp b/src/window.cpp
index 8378f60f7..6538caffd 100644
--- a/src/window.cpp
+++ b/src/window.cpp
@@ -1277,26 +1277,33 @@ static uint GetWindowZPriority(const Window *w)
switch (w->window_class) {
case WC_ENDSCREEN:
++z_priority;
+ FALLTHROUGH;
case WC_HIGHSCORE:
++z_priority;
+ FALLTHROUGH;
case WC_TOOLTIPS:
++z_priority;
+ FALLTHROUGH;
case WC_DROPDOWN_MENU:
++z_priority;
+ FALLTHROUGH;
case WC_MAIN_TOOLBAR:
case WC_STATUS_BAR:
++z_priority;
+ FALLTHROUGH;
case WC_OSK:
++z_priority;
+ FALLTHROUGH;
case WC_QUERY_STRING:
case WC_SEND_NETWORK_MSG:
++z_priority;
+ FALLTHROUGH;
case WC_ERRMSG:
case WC_CONFIRM_POPUP_QUERY:
@@ -1304,6 +1311,7 @@ static uint GetWindowZPriority(const Window *w)
case WC_NETWORK_STATUS_WINDOW:
case WC_SAVE_PRESET:
++z_priority;
+ FALLTHROUGH;
case WC_GENERATE_LANDSCAPE:
case WC_SAVELOAD:
@@ -1315,15 +1323,19 @@ static uint GetWindowZPriority(const Window *w)
case WC_AI_SETTINGS:
case WC_TEXTFILE:
++z_priority;
+ FALLTHROUGH;
case WC_CONSOLE:
++z_priority;
+ FALLTHROUGH;
case WC_NEWS_WINDOW:
++z_priority;
+ FALLTHROUGH;
default:
++z_priority;
+ FALLTHROUGH;
case WC_MAIN_WINDOW:
return z_priority;
@@ -2867,7 +2879,7 @@ static void MouseLoop(MouseClick click, int mousewheel)
if (!scrollwheel_scrolling || w == NULL || w->window_class != WC_SMALLMAP) break;
/* We try to use the scrollwheel to scroll since we didn't touch any of the buttons.
* Simulate a right button click so we can get started. */
- /* FALL THROUGH */
+ FALLTHROUGH;
case MC_RIGHT: DispatchRightClickEvent(w, x - w->left, y - w->top); break;