1
0
Fork 0

Compare commits

...

11 Commits

Author SHA1 Message Date
frosch 6b586dddad Cleanup: TransmitNotesOff is only called with buffer==_buffer. 2023-09-19 22:49:59 +02:00
frosch c84fd30317 Codechange: Add missing 'override'. 2023-09-19 22:49:59 +02:00
frosch 2ff4248032 Codechange: Enable more warnings. 2023-09-19 22:49:59 +02:00
frosch a7707302e6 Codechange: silence false warning. 2023-09-19 22:49:59 +02:00
frosch 55da426d44 Codechange: All ParagraphLayoutFactory::AppendToBuffer assume that the buffer has at least some space.
Assert on that.
2023-09-19 22:49:59 +02:00
frosch baf7cc858b Codechange: Rename ship docking tile related functions. 2023-09-19 22:49:59 +02:00
frosch 5733145c59 Cleanup: Remove unneeded parameters. 2023-09-19 22:49:59 +02:00
frosch b5885295f0 Codechange: Use parameters, which should be used. 2023-09-19 22:49:59 +02:00
frosch b6c8f301be Codechange: Silence warnings about intentionally unused parameters. 2023-09-19 22:49:59 +02:00
Patric Stout df400ef84a
Fix: only count distance traveled in vehicles for cargo payment (#11283)
No longer you can utilize the free (and instant) labour of station
workers, transporting your cargo from one part of the station to
the other. No more!

Based on patch by dP.
2023-09-19 22:16:31 +02:00
translators 710722e3c1 Update: Translations from eints
korean: 1 change by telk5093
2023-09-19 18:38:46 +00:00
247 changed files with 1260 additions and 1231 deletions

View File

@ -38,7 +38,11 @@ macro(compile_flags)
set(IS_STABLE_RELEASE "$<AND:$<NOT:$<CONFIG:Debug>>,$<NOT:$<BOOL:${OPTION_USE_ASSERTS}>>>")
if(MSVC)
add_compile_options(/W3)
add_compile_options(
/W3
/w34100 # 'identifier' : unreferenced formal parameter
/w34189 # 'identifier' : local variable is initialized but not referenced
)
if(MSVC_VERSION GREATER 1929 AND MSVC_VERSION LESS 1937 AND CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
# Starting with version 19.30 (fixed in version 19.37), there is an optimisation bug, see #9966 for details
# This flag disables the broken optimisation to work around the bug
@ -60,8 +64,6 @@ macro(compile_flags)
-Winit-self
-Wnon-virtual-dtor
# Often parameters are unused, which is fine.
-Wno-unused-parameter
# We use 'ABCD' multichar for SaveLoad chunks identifiers
-Wno-multichar
@ -72,22 +74,6 @@ macro(compile_flags)
-fno-strict-aliasing
)
# When we are a stable release (Release build + USE_ASSERTS not set),
# assertations are off, which trigger a lot of warnings. We disable
# these warnings for these releases.
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
add_compile_options(
"$<${IS_STABLE_RELEASE}:-Wno-unused-variable>"
"$<${IS_STABLE_RELEASE}:-Wno-unused-but-set-parameter>"
"$<${IS_STABLE_RELEASE}:-Wno-unused-but-set-variable>"
)
else()
add_compile_options(
"$<${IS_STABLE_RELEASE}:-Wno-unused-variable>"
"$<${IS_STABLE_RELEASE}:-Wno-unused-parameter>"
)
endif()
# Ninja processes the output so the output from the compiler
# isn't directly to a terminal; hence, the default is
# non-coloured output. We can override this to get nicely

View File

@ -559,7 +559,7 @@ bool _hsort_sift_down(HSQUIRRELVM v,SQArray *arr, SQInteger root, SQInteger bott
return true;
}
bool _hsort(HSQUIRRELVM v,SQObjectPtr &arr, SQInteger l, SQInteger r,SQInteger func)
bool _hsort(HSQUIRRELVM v,SQObjectPtr &arr, SQInteger, SQInteger,SQInteger func)
{
SQArray *a = _array(arr);
SQInteger i;

View File

@ -187,7 +187,7 @@ SQInstance::~SQInstance()
if(_class){ Finalize(); } //if _class is null it was already finalized by the GC
}
bool SQInstance::GetMetaMethod(SQVM *v,SQMetaMethod mm,SQObjectPtr &res)
bool SQInstance::GetMetaMethod(SQVM *,SQMetaMethod mm,SQObjectPtr &res)
{
if(type(_class->_metamethods[mm]) != OT_NULL) {
res = _class->_metamethods[mm];

View File

@ -76,7 +76,7 @@ struct SQRefCounted
}
/* Never used but required. */
inline void operator delete(void *ptr) { NOT_REACHED(); }
inline void operator delete(void *) { NOT_REACHED(); }
private:
size_t size;

View File

@ -274,7 +274,7 @@ void SQSharedState::EnqueueMarkObject(SQObjectPtr &o,SQGCMarkerQueue &queue)
}
SQInteger SQSharedState::CollectGarbage(SQVM *vm)
SQInteger SQSharedState::CollectGarbage(SQVM *)
{
SQInteger n=0;
SQVM *vms = _thread(_root_vm);

View File

@ -119,7 +119,7 @@ struct AIConfigWindow : public Window {
}
}
void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override
void UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override
{
switch (widget) {
case WID_AIC_DECREASE_NUMBER:
@ -181,7 +181,7 @@ struct AIConfigWindow : public Window {
}
}
void OnClick(Point pt, int widget, int click_count) override
void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override
{
if (widget >= WID_AIC_TEXTFILE && widget < WID_AIC_TEXTFILE + TFT_CONTENT_END) {
if (this->selected_slot == INVALID_COMPANY || AIConfig::GetConfig(this->selected_slot) == nullptr) return;
@ -267,7 +267,7 @@ struct AIConfigWindow : public Window {
* @param data Information about the changed data.
* @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details.
*/
void OnInvalidateData(int data = 0, bool gui_scope = true) override
void OnInvalidateData([[maybe_unused]] int data = 0, [[maybe_unused]] bool gui_scope = true) override
{
if (!IsEditable(this->selected_slot)) {
this->selected_slot = INVALID_COMPANY;

View File

@ -1282,7 +1282,7 @@ void HandleMissingAircraftOrders(Aircraft *v)
}
TileIndex Aircraft::GetOrderStationLocation(StationID station)
TileIndex Aircraft::GetOrderStationLocation(StationID)
{
/* Orders are changed in flight, ensure going to the right station. */
if (this->state == FLYING) {
@ -1599,31 +1599,31 @@ static void AircraftEventHandler_AtTerminal(Aircraft *v, const AirportFTAClass *
AirportMove(v, apc);
}
static void AircraftEventHandler_General(Aircraft *v, const AirportFTAClass *apc)
static void AircraftEventHandler_General(Aircraft *, const AirportFTAClass *)
{
FatalError("OK, you shouldn't be here, check your Airport Scheme!");
}
static void AircraftEventHandler_TakeOff(Aircraft *v, const AirportFTAClass *apc)
static void AircraftEventHandler_TakeOff(Aircraft *v, const AirportFTAClass *)
{
PlayAircraftSound(v); // play takeoffsound for airplanes
v->state = STARTTAKEOFF;
}
static void AircraftEventHandler_StartTakeOff(Aircraft *v, const AirportFTAClass *apc)
static void AircraftEventHandler_StartTakeOff(Aircraft *v, const AirportFTAClass *)
{
v->state = ENDTAKEOFF;
v->UpdateDeltaXY();
}
static void AircraftEventHandler_EndTakeOff(Aircraft *v, const AirportFTAClass *apc)
static void AircraftEventHandler_EndTakeOff(Aircraft *v, const AirportFTAClass *)
{
v->state = FLYING;
/* get the next position to go to, differs per airport */
AircraftNextAirportPos_and_Order(v);
}
static void AircraftEventHandler_HeliTakeOff(Aircraft *v, const AirportFTAClass *apc)
static void AircraftEventHandler_HeliTakeOff(Aircraft *v, const AirportFTAClass *)
{
v->state = FLYING;
v->UpdateDeltaXY();
@ -1677,7 +1677,7 @@ static void AircraftEventHandler_Flying(Aircraft *v, const AirportFTAClass *apc)
v->pos = apc->layout[v->pos].next_position;
}
static void AircraftEventHandler_Landing(Aircraft *v, const AirportFTAClass *apc)
static void AircraftEventHandler_Landing(Aircraft *v, const AirportFTAClass *)
{
v->state = ENDLANDING;
AircraftLandAirplane(v); // maybe crash airplane
@ -1690,7 +1690,7 @@ static void AircraftEventHandler_Landing(Aircraft *v, const AirportFTAClass *apc
}
}
static void AircraftEventHandler_HeliLanding(Aircraft *v, const AirportFTAClass *apc)
static void AircraftEventHandler_HeliLanding(Aircraft *v, const AirportFTAClass *)
{
v->state = HELIENDLANDING;
v->UpdateDeltaXY();

View File

@ -47,7 +47,7 @@ static void ShowBuildAirportPicker(Window *parent);
SpriteID GetCustomAirportSprite(const AirportSpec *as, byte layout);
void CcBuildAirport(Commands cmd, const CommandCost &result, TileIndex tile)
void CcBuildAirport(Commands, const CommandCost &result, TileIndex tile)
{
if (result.Failed()) return;
@ -102,7 +102,7 @@ struct BuildAirToolbarWindow : Window {
* @param data Information about the changed data.
* @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details.
*/
void OnInvalidateData(int data = 0, bool gui_scope = true) override
void OnInvalidateData([[maybe_unused]] int data = 0, [[maybe_unused]] bool gui_scope = true) override
{
if (!gui_scope) return;
@ -118,7 +118,7 @@ struct BuildAirToolbarWindow : Window {
}
}
void OnClick(Point pt, int widget, int click_count) override
void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override
{
switch (widget) {
case WID_AT_AIRPORT:
@ -138,7 +138,7 @@ struct BuildAirToolbarWindow : Window {
}
void OnPlaceObject(Point pt, TileIndex tile) override
void OnPlaceObject([[maybe_unused]] Point pt, TileIndex tile) override
{
switch (this->last_user_action) {
case WID_AT_AIRPORT:
@ -153,12 +153,12 @@ struct BuildAirToolbarWindow : Window {
}
}
void OnPlaceDrag(ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, Point pt) override
void OnPlaceDrag(ViewportPlaceMethod select_method, [[maybe_unused]] ViewportDragDropSelectionProcess select_proc, [[maybe_unused]] Point pt) override
{
VpSelectTilesWithMethod(pt.x, pt.y, select_method);
}
void OnPlaceMouseUp(ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, Point pt, TileIndex start_tile, TileIndex end_tile) override
void OnPlaceMouseUp([[maybe_unused]] ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, [[maybe_unused]] Point pt, TileIndex start_tile, TileIndex end_tile) override
{
if (pt.x != -1 && select_proc == DDSP_DEMOLISH_AREA) {
GUIPlaceProcDragXY(select_proc, start_tile, end_tile);
@ -316,7 +316,7 @@ public:
}
}
void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override
void UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override
{
switch (widget) {
case WID_AP_CLASS_DROPDOWN: {
@ -487,7 +487,7 @@ public:
}
}
void OnClick(Point pt, int widget, int click_count) override
void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override
{
switch (widget) {
case WID_AP_CLASS_DROPDOWN:
@ -563,13 +563,14 @@ public:
void OnDropdownSelect(int widget, int index) override
{
assert(widget == WID_AP_CLASS_DROPDOWN);
_selected_airport_class = (AirportClassID)index;
this->vscroll->SetCount(AirportClass::Get(_selected_airport_class)->GetSpecCount());
this->SelectFirstAvailableAirport(false);
if (widget == WID_AP_CLASS_DROPDOWN) {
_selected_airport_class = (AirportClassID)index;
this->vscroll->SetCount(AirportClass::Get(_selected_airport_class)->GetSpecCount());
this->SelectFirstAvailableAirport(false);
}
}
void OnRealtimeTick(uint delta_ms) override
void OnRealtimeTick([[maybe_unused]] uint delta_ms) override
{
CheckRedrawStationCoverage(this);
}

View File

@ -300,7 +300,7 @@ public:
this->sel_group = id_g;
}
void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override
void UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override
{
switch (widget) {
case WID_RV_SORT_ASCENDING_DESCENDING: {
@ -539,7 +539,7 @@ public:
}
}
void OnClick(Point pt, int widget, int click_count) override
void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override
{
switch (widget) {
case WID_RV_SORT_ASCENDING_DESCENDING:
@ -712,7 +712,7 @@ public:
}
}
bool OnTooltip(Point pt, int widget, TooltipCloseCondition close_cond) override
bool OnTooltip([[maybe_unused]] Point pt, int widget, TooltipCloseCondition close_cond) override
{
if (widget != WID_RV_TRAIN_WAGONREMOVE_TOGGLE) return false;
@ -736,7 +736,7 @@ public:
* @param data Information about the changed data.
* @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details.
*/
void OnInvalidateData(int data = 0, bool gui_scope = true) override
void OnInvalidateData([[maybe_unused]] int data = 0, [[maybe_unused]] bool gui_scope = true) override
{
if (data != 0) {
/* This needs to be done in command-scope to enforce rebuilding before resorting invalid data */

View File

@ -153,7 +153,7 @@ bool BaseSet<T, Tnum_files, Tsearch_in_tars>::FillSetDetails(IniFile *ini, const
}
template <class Tbase_set>
bool BaseMedia<Tbase_set>::AddFile(const std::string &filename, size_t basepath_length, const std::string &tar_filename)
bool BaseMedia<Tbase_set>::AddFile(const std::string &filename, size_t basepath_length, const std::string &)
{
bool ret = false;
Debug(grf, 1, "Checking {} for base " SET_TYPE " set", filename);

View File

@ -145,7 +145,7 @@ size_t Blitter_32bppBase::BufferSize(uint width, uint height)
return sizeof(uint32_t) * width * height;
}
void Blitter_32bppBase::PaletteAnimate(const Palette &palette)
void Blitter_32bppBase::PaletteAnimate(const Palette &)
{
/* By default, 32bpp doesn't have palette animation */
}

View File

@ -154,7 +154,7 @@ static inline Colour AdjustBrightneSSE(Colour colour, uint8_t brightness)
}
GNU_TARGET(SSE_TARGET)
static inline __m128i AdjustBrightnessOfTwoPixels(__m128i from, uint32_t brightness)
static inline __m128i AdjustBrightnessOfTwoPixels([[maybe_unused]] __m128i from, [[maybe_unused]] uint32_t brightness)
{
#if (SSE_VERSION < 3)
NOT_REACHED();

View File

@ -149,7 +149,7 @@ size_t Blitter_8bppBase::BufferSize(uint width, uint height)
return static_cast<size_t>(width) * height;
}
void Blitter_8bppBase::PaletteAnimate(const Palette &palette)
void Blitter_8bppBase::PaletteAnimate(const Palette &)
{
/* Video backend takes care of the palette animation */
}

View File

@ -16,19 +16,19 @@
class Blitter_Null : public Blitter {
public:
uint8_t GetScreenDepth() override { return 0; }
void Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom) override {};
void DrawColourMappingRect(void *dst, int width, int height, PaletteID pal) override {};
void Draw(Blitter::BlitterParams *, BlitterMode, ZoomLevel) override {};
void DrawColourMappingRect(void *, int, int, PaletteID) override {};
Sprite *Encode(const SpriteLoader::Sprite *sprite, AllocatorProc *allocator) override;
void *MoveTo(void *video, int x, int y) override { return nullptr; };
void SetPixel(void *video, int x, int y, uint8_t colour) override {};
void DrawRect(void *video, int width, int height, uint8_t colour) override {};
void DrawLine(void *video, int x, int y, int x2, int y2, int screen_width, int screen_height, uint8_t colour, int width, int dash) override {};
void CopyFromBuffer(void *video, const void *src, int width, int height) override {};
void CopyToBuffer(const void *video, void *dst, int width, int height) override {};
void CopyImageToBuffer(const void *video, void *dst, int width, int height, int dst_pitch) override {};
void ScrollBuffer(void *video, int &left, int &top, int &width, int &height, int scroll_x, int scroll_y) override {};
size_t BufferSize(uint width, uint height) override { return 0; };
void PaletteAnimate(const Palette &palette) override { };
void *MoveTo(void *, int, int) override { return nullptr; };
void SetPixel(void *, int, int, uint8_t) override {};
void DrawRect(void *, int, int, uint8_t) override {};
void DrawLine(void *, int, int, int, int, int, int, uint8_t, int, int) override {};
void CopyFromBuffer(void *, const void *, int, int) override {};
void CopyToBuffer(const void *, void *, int, int) override {};
void CopyImageToBuffer(const void *, void *, int, int, int) override {};
void ScrollBuffer(void *, int &, int &, int &, int &, int, int) override {};
size_t BufferSize(uint, uint) override { return 0; };
void PaletteAnimate(const Palette &) override { };
Blitter::PaletteAnimation UsePaletteAnimation() override { return Blitter::PALETTE_ANIMATION_NONE; };
const char *GetName() override { return "null"; }

View File

@ -56,7 +56,7 @@ public:
ResizeWindow(this, _screen.width, _screen.height);
}
void DrawWidget(const Rect &r, int widget) const override
void DrawWidget(const Rect &r, int) const override
{
GfxFillRect(r.left, r.top, r.right, r.bottom, 4, FILLRECT_OPAQUE);
GfxFillRect(r.left, r.top, r.right, r.bottom, 0, FILLRECT_CHECKER);
@ -98,7 +98,7 @@ public:
this->Window::Close();
}
void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override
void UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override
{
if (widget == WID_BEM_MESSAGE) {
*size = GetStringBoundingBox(STR_MISSING_GRAPHICS_ERROR);
@ -114,7 +114,7 @@ public:
}
}
void OnClick(Point pt, int widget, int click_count) override
void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override
{
if (widget == WID_BEM_QUIT) {
_exit_game = true;
@ -159,7 +159,7 @@ public:
this->BaseNetworkContentDownloadStatusWindow::Close();
}
void OnDownloadComplete(ContentID cid) override
void OnDownloadComplete(ContentID) override
{
/* We have completed downloading. We can trigger finding the right set now. */
BaseGraphics::FindSets();
@ -214,7 +214,7 @@ public:
this->Window::Close();
}
void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override
void UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override
{
/* We cache the button size. This is safe as no reinit can happen here. */
if (this->button_size.width == 0) {
@ -244,7 +244,7 @@ public:
DrawStringMultiLine(r.Shrink(WidgetDimensions::scaled.frametext), STR_MISSING_GRAPHICS_SET_MESSAGE, TC_FROMSTRING, SA_CENTER);
}
void OnClick(Point pt, int widget, int click_count) override
void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override
{
switch (widget) {
case WID_BAFD_YES:
@ -334,7 +334,7 @@ public:
EM_ASM({ if (window["openttd_bootstrap"]) openttd_bootstrap($0, $1); }, this->downloaded_bytes, this->total_bytes);
}
void OnDownloadProgress(const ContentInfo *ci, int bytes) override
void OnDownloadProgress(const ContentInfo *, int bytes) override
{
/* A negative value means we are resetting; for example, when retrying or using a fallback. */
if (bytes < 0) {
@ -346,7 +346,7 @@ public:
EM_ASM({ if (window["openttd_bootstrap"]) openttd_bootstrap($0, $1); }, this->downloaded_bytes, this->total_bytes);
}
void OnDownloadComplete(ContentID cid) override
void OnDownloadComplete(ContentID) override
{
/* _exit_game is used to break out of the outer video driver's MainLoop. */
_exit_game = true;

View File

@ -50,12 +50,11 @@ typedef GUIList<BuildBridgeData> GUIBridgeList; ///< List of bridges, used in #B
* Callback executed after a build Bridge CMD has been called
*
* @param result Whether the build succeeded
* @param cmd unused
* @param end_tile End tile of the bridge.
* @param tile_start start tile
* @param transport_type transport type.
*/
void CcBuildBridge(Commands cmd, const CommandCost &result, TileIndex end_tile, TileIndex tile_start, TransportType transport_type, BridgeType, byte)
void CcBuildBridge(Commands, const CommandCost &result, TileIndex end_tile, TileIndex tile_start, TransportType transport_type, BridgeType, byte)
{
if (result.Failed()) return;
if (_settings_client.sound.confirm) SndPlayTileFx(SND_27_CONSTRUCTION_BRIDGE, end_tile);
@ -175,7 +174,7 @@ public:
this->last_sorting = this->bridges.GetListing();
}
void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override
void UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override
{
switch (widget) {
case WID_BBS_DROPDOWN_ORDER: {
@ -212,7 +211,7 @@ public:
}
}
Point OnInitialPosition(int16_t sm_width, int16_t sm_height, int window_number) override
Point OnInitialPosition([[maybe_unused]] int16_t sm_width, [[maybe_unused]] int16_t sm_height, [[maybe_unused]] int window_number) override
{
/* Position the window so hopefully the first bridge from the list is under the mouse pointer. */
NWidgetBase *list = this->GetWidget<NWidgetBase>(WID_BBS_BRIDGE_LIST);
@ -244,7 +243,7 @@ public:
}
}
EventState OnKeyPress(char32_t key, uint16_t keycode) override
EventState OnKeyPress([[maybe_unused]] char32_t key, uint16_t keycode) override
{
const uint8_t i = keycode - '1';
if (i < 9 && i < this->bridges.size()) {
@ -256,7 +255,7 @@ public:
return ES_NOT_HANDLED;
}
void OnClick(Point pt, int widget, int click_count) override
void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override
{
switch (widget) {
default: break;

View File

@ -1581,7 +1581,7 @@ struct BuildVehicleWindow : Window {
this->eng_list.RebuildDone();
}
void OnClick(Point pt, int widget, int click_count) override
void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override
{
switch (widget) {
case WID_BV_SORT_ASCENDING_DESCENDING:
@ -1688,7 +1688,7 @@ struct BuildVehicleWindow : Window {
* @param data Information about the changed data.
* @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details.
*/
void OnInvalidateData(int data = 0, bool gui_scope = true) override
void OnInvalidateData([[maybe_unused]] int data = 0, [[maybe_unused]] bool gui_scope = true) override
{
if (!gui_scope) return;
/* When switching to original acceleration model for road vehicles, clear the selected sort criteria if it is not available now. */
@ -1736,7 +1736,7 @@ struct BuildVehicleWindow : Window {
}
}
void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override
void UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override
{
switch (widget) {
case WID_BV_LIST:

View File

@ -120,7 +120,7 @@ bool CargoLoad::operator()(CargoPacket *cp)
{
CargoPacket *cp_new = this->Preprocess(cp);
if (cp_new == nullptr) return false;
cp_new->SetSourceXY(this->current_tile);
cp_new->UpdateLoadingTile(this->current_tile);
this->source->RemoveFromCache(cp_new, cp_new->Count());
this->destination->Append(cp_new, VehicleCargoList::MTA_KEEP);
return cp_new == cp;
@ -135,7 +135,7 @@ bool CargoReservation::operator()(CargoPacket *cp)
{
CargoPacket *cp_new = this->Preprocess(cp);
if (cp_new == nullptr) return false;
cp_new->SetSourceXY(this->current_tile);
cp_new->UpdateLoadingTile(this->current_tile);
this->source->reserved_count += cp_new->Count();
this->source->RemoveFromCache(cp_new, cp_new->Count());
this->destination->Append(cp_new, VehicleCargoList::MTA_LOAD);
@ -152,6 +152,7 @@ bool CargoReturn::operator()(CargoPacket *cp)
CargoPacket *cp_new = this->Preprocess(cp);
if (cp_new == nullptr) cp_new = cp;
assert(cp_new->Count() <= this->destination->reserved_count);
cp_new->UpdateUnloadingTile(this->current_tile);
this->source->RemoveFromMeta(cp_new, VehicleCargoList::MTA_LOAD, cp_new->Count());
this->destination->reserved_count -= cp_new->Count();
this->destination->Append(cp_new, this->next);
@ -167,6 +168,7 @@ bool CargoTransfer::operator()(CargoPacket *cp)
{
CargoPacket *cp_new = this->Preprocess(cp);
if (cp_new == nullptr) return false;
cp_new->UpdateUnloadingTile(this->current_tile);
this->source->RemoveFromMeta(cp_new, VehicleCargoList::MTA_TRANSFER, cp_new->Count());
/* No transfer credits here as they were already granted during Stage(). */
this->destination->Append(cp_new, cp_new->GetNextHop());

View File

@ -70,9 +70,11 @@ public:
/** Action of transferring cargo from a vehicle to a station. */
class CargoTransfer : public CargoMovement<VehicleCargoList, StationCargoList> {
protected:
TileIndex current_tile; ///< Current tile cargo unloading is happening.
public:
CargoTransfer(VehicleCargoList *source, StationCargoList *destination, uint max_move) :
CargoMovement<VehicleCargoList, StationCargoList>(source, destination, max_move) {}
CargoTransfer(VehicleCargoList *source, StationCargoList *destination, uint max_move, TileIndex current_tile) :
CargoMovement<VehicleCargoList, StationCargoList>(source, destination, max_move), current_tile(current_tile) {}
bool operator()(CargoPacket *cp);
};
@ -96,10 +98,12 @@ public:
/** Action of returning previously reserved cargo from the vehicle to the station. */
class CargoReturn : public CargoMovement<VehicleCargoList, StationCargoList> {
protected:
TileIndex current_tile; ///< Current tile cargo unloading is happening.
StationID next;
public:
CargoReturn(VehicleCargoList *source, StationCargoList *destination, uint max_move, StationID next) :
CargoMovement<VehicleCargoList, StationCargoList>(source, destination, max_move), next(next) {}
CargoReturn(VehicleCargoList *source, StationCargoList *destination, uint max_move, StationID next, TileIndex current_tile) :
CargoMovement<VehicleCargoList, StationCargoList>(source, destination, max_move), current_tile(current_tile), next(next) {}
bool operator()(CargoPacket *cp);
};

View File

@ -79,8 +79,12 @@ CargoPacket::CargoPacket(uint16_t count, Money feeder_share, CargoPacket &origin
periods_in_transit(original.periods_in_transit),
feeder_share(feeder_share),
source_xy(original.source_xy),
travelled(original.travelled),
source_id(original.source_id),
source_type(original.source_type),
#ifdef WITH_ASSERT
in_vehicle(original.in_vehicle),
#endif /* WITH_ASSERT */
first_station(original.first_station),
next_hop(original.next_hop)
{
@ -587,12 +591,13 @@ uint VehicleCargoList::Reassign<VehicleCargoList::MTA_DELIVER, VehicleCargoList:
* @param max_move Maximum amount of cargo to move.
* @param dest Station the cargo is returned to.
* @param next ID of the next station the cargo wants to go to.
* @param current_tile Current tile the cargo handling is happening on.
* @return Amount of cargo actually returned.
*/
uint VehicleCargoList::Return(uint max_move, StationCargoList *dest, StationID next)
uint VehicleCargoList::Return(uint max_move, StationCargoList *dest, StationID next, TileIndex current_tile)
{
max_move = std::min(this->action_counts[MTA_LOAD], max_move);
this->PopCargo(CargoReturn(this, dest, max_move, next));
this->PopCargo(CargoReturn(this, dest, max_move, next, current_tile));
return max_move;
}
@ -623,7 +628,7 @@ uint VehicleCargoList::Unload(uint max_move, StationCargoList *dest, CargoPaymen
uint moved = 0;
if (this->action_counts[MTA_TRANSFER] > 0) {
uint move = std::min(this->action_counts[MTA_TRANSFER], max_move);
this->ShiftCargo(CargoTransfer(this, dest, move));
this->ShiftCargo(CargoTransfer(this, dest, move, current_tile));
moved += move;
}
if (this->action_counts[MTA_TRANSFER] == 0 && this->action_counts[MTA_DELIVER] > 0 && moved < max_move) {

View File

@ -39,15 +39,27 @@ extern SaveLoadTable GetCargoPacketDesc();
*/
struct CargoPacket : CargoPacketPool::PoolItem<&_cargopacket_pool> {
private:
/* A mathematical vector from (0,0). */
struct Vector {
int16_t x;
int16_t y;
};
uint16_t count{0}; ///< The amount of cargo in this packet.
uint16_t periods_in_transit{0}; ///< Amount of cargo aging periods this packet has been in transit.
Money feeder_share{0}; ///< Value of feeder pickup to be paid for on delivery of cargo.
TileIndex source_xy{INVALID_TILE}; ///< The origin of the cargo.
Vector travelled{0, 0}; ///< If cargo is in station: the vector from the unload tile to the source tile. If in vehicle: an intermediate value.
SourceID source_id{INVALID_SOURCE}; ///< Index of industry/town/HQ, INVALID_SOURCE if unknown/invalid.
SourceType source_type{SourceType::Industry}; ///< Type of \c source_id.
#ifdef WITH_ASSERT
bool in_vehicle{false}; ///< NOSAVE: Whether this cargo is in a vehicle or not.
#endif /* WITH_ASSERT */
StationID first_station{INVALID_STATION}; ///< The station where the cargo came from first.
StationID next_hop{INVALID_STATION}; ///< Station where the cargo wants to go next.
@ -83,22 +95,51 @@ public:
}
/**
* Set the origin of the packet.
* Update for the cargo being loaded on this tile.
*
* Can only be set once.
* When a CargoPacket is created, it is moved to a station. But at that
* moment in time it is not known yet at which tile the cargo will be
* picked up. As this tile is used for payment information, we delay
* setting the source_xy till first pickup, getting a better idea where
* a cargo started from.
*
* When a packet is created, it is moved to a station. But at that moment
* in time it is not known yet at which tile the cargo will be picked up.
* As this tile is used for payment information, we delay setting the
* source_xy till first pickup.
* Further more, we keep track of the amount of tiles the cargo moved
* inside a vehicle. This is used in GetDistance() below.
*
* @param tile Tile the cargo is being picked up from.
*/
void SetSourceXY(TileIndex tile)
void UpdateLoadingTile(TileIndex tile)
{
if (this->source_xy == INVALID_TILE) {
this->source_xy = tile;
}
#ifdef WITH_ASSERT
assert(!this->in_vehicle);
this->in_vehicle = true;
#endif /* WITH_ASSERT */
/* We want to calculate the vector from tile-unload to tile-load. As
* we currently only know the latter, add it. When we know where we unload,
* we subtract is, giving us our vector (unload - load). */
this->travelled.x += TileX(tile);
this->travelled.y += TileY(tile);
}
/**
* Update for the cargo being unloaded on this tile.
*
* @param tile Tile the cargo is being dropped off at.
*/
void UpdateUnloadingTile(TileIndex tile)
{
#ifdef WITH_ASSERT
assert(this->in_vehicle);
this->in_vehicle = false;
#endif /* WITH_ASSERT */
this->travelled.x -= TileX(tile);
this->travelled.y -= TileY(tile);
}
/**
@ -188,7 +229,36 @@ public:
inline uint GetDistance(TileIndex current_tile) const
{
assert(this->source_xy != INVALID_TILE);
return DistanceManhattan(this->source_xy, current_tile);
#ifdef WITH_ASSERT
assert(this->in_vehicle);
#endif /* WITH_ASSERT */
/* Distance is always requested when the cargo is still inside the
* vehicle. So first finish the calculation for travelled to
* become a vector. */
auto local_travelled = travelled;
local_travelled.x -= TileX(current_tile);
local_travelled.y -= TileY(current_tile);
/* Cargo-movement is a vector that indicates how much the cargo has
* actually traveled in a vehicle. This is the distance you get paid
* for. However, one could construct a route where this vector would
* be really long. To not overpay the player, cap out at the distance
* between source and destination.
*
* This way of calculating is to counter people moving cargo for free
* and instantly in stations, where you deliver it in one part of the
* station and pick it up in another. By using the actual distance
* traveled in a vehicle, using this trick doesn't give you more money.
*
* However, especially in large networks with large transfer station,
* etc, one could actually make the route a lot longer. In that case,
* use the actual distance between source and destination.
*/
uint distance_travelled = abs(local_travelled.x) + abs(local_travelled.y);
uint distance_source_dest = DistanceManhattan(this->source_xy, current_tile);
return std::min(distance_travelled, distance_source_dest);
}
/**
@ -427,7 +497,7 @@ public:
template<MoveToAction Tfrom, MoveToAction Tto>
uint Reassign(uint max_move);
uint Return(uint max_move, StationCargoList *dest, StationID next_station);
uint Return(uint max_move, StationCargoList *dest, StationID next_station, TileIndex current_tile);
uint Unload(uint max_move, StationCargoList *dest, CargoPayment *payment, TileIndex current_tile);
uint Shift(uint max_move, VehicleCargoList *dest);
uint Truncate(uint max_move = UINT_MAX);

View File

@ -51,11 +51,10 @@ static int32_t _money_cheat_amount = 10000000;
* Note that the amount of money of a company must be changed through a command
* rather than by setting a variable. Since the cheat data structure expects a
* variable, the amount of given/taken money is used for this purpose.
* @param new_value not used.
* @param change_direction is -1 or +1 (down/up)
* @return Amount of money cheat.
*/
static int32_t ClickMoneyCheat(int32_t new_value, int32_t change_direction)
static int32_t ClickMoneyCheat(int32_t, int32_t change_direction)
{
Command<CMD_MONEY_CHEAT>::Post(Money(_money_cheat_amount) * change_direction);
return _money_cheat_amount;
@ -83,10 +82,9 @@ static int32_t ClickChangeCompanyCheat(int32_t new_value, int32_t change_directi
/**
* Allow (or disallow) changing production of all industries.
* @param new_value new value
* @param change_direction unused
* @return New value allowing change of industry production.
*/
static int32_t ClickSetProdCheat(int32_t new_value, int32_t change_direction)
static int32_t ClickSetProdCheat(int32_t new_value, int32_t)
{
_cheats.setup_prod.value = (new_value != 0);
InvalidateWindowClassesData(WC_INDUSTRY_VIEW);
@ -98,10 +96,9 @@ extern void EnginesMonthlyLoop();
/**
* Handle changing of the current year.
* @param new_value The chosen year to change to.
* @param change_direction +1 (increase) or -1 (decrease).
* @return New year.
*/
static int32_t ClickChangeDateCheat(int32_t new_value, int32_t change_direction)
static int32_t ClickChangeDateCheat(int32_t new_value, int32_t)
{
/* Don't allow changing to an invalid year, or the current year. */
auto new_year = Clamp(TimerGameCalendar::Year(new_value), CalendarTime::MIN_YEAR, CalendarTime::MAX_YEAR);
@ -131,11 +128,10 @@ static int32_t ClickChangeDateCheat(int32_t new_value, int32_t change_direction)
/**
* Allow (or disallow) a change of the maximum allowed heightlevel.
* @param new_value new value
* @param change_direction unused
* @return New value (or unchanged old value) of the maximum
* allowed heightlevel value.
*/
static int32_t ClickChangeMaxHlCheat(int32_t new_value, int32_t change_direction)
static int32_t ClickChangeMaxHlCheat(int32_t new_value, int32_t)
{
new_value = Clamp(new_value, MIN_MAP_HEIGHT_LIMIT, MAX_MAP_HEIGHT_LIMIT);
@ -301,7 +297,7 @@ struct CheatWindow : Window {
}
}
void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override
void UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override
{
if (widget != WID_C_PANEL) return;
@ -347,8 +343,10 @@ struct CheatWindow : Window {
size->height = WidgetDimensions::scaled.framerect.Vertical() + this->line_height * lengthof(_cheats_ui);
}
void OnClick(Point pt, int widget, int click_count) override
void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override
{
if (widget != WID_C_PANEL) return;
Rect r = this->GetWidget<NWidgetBase>(WID_C_PANEL)->GetCurrentRect().Shrink(WidgetDimensions::scaled.framerect);
uint btn = (pt.y - r.top) / this->line_height;
uint x = pt.x - r.left;

View File

@ -127,7 +127,7 @@ static void DrawTile_Clear(TileInfo *ti)
DrawBridgeMiddle(ti);
}
static int GetSlopePixelZ_Clear(TileIndex tile, uint x, uint y, bool ground_vehicle)
static int GetSlopePixelZ_Clear(TileIndex tile, uint x, uint y, bool)
{
int z;
Slope tileh = GetTilePixelSlope(tile, &z);
@ -135,7 +135,7 @@ static int GetSlopePixelZ_Clear(TileIndex tile, uint x, uint y, bool ground_vehi
return z + GetPartialPixelZ(x & 0xF, y & 0xF, tileh);
}
static Foundation GetFoundation_Clear(TileIndex tile, Slope tileh)
static Foundation GetFoundation_Clear(TileIndex, Slope)
{
return FOUNDATION_NONE;
}
@ -341,7 +341,7 @@ get_out:;
} while (--i);
}
static TrackStatus GetTileTrackStatus_Clear(TileIndex tile, TransportType mode, uint sub_mode, DiagDirection side)
static TrackStatus GetTileTrackStatus_Clear(TileIndex, TransportType, uint, DiagDirection)
{
return 0;
}
@ -365,12 +365,12 @@ static void GetTileDesc_Clear(TileIndex tile, TileDesc *td)
td->owner[0] = GetTileOwner(tile);
}
static void ChangeTileOwner_Clear(TileIndex tile, Owner old_owner, Owner new_owner)
static void ChangeTileOwner_Clear(TileIndex, Owner, Owner)
{
return;
}
static CommandCost TerraformTile_Clear(TileIndex tile, DoCommandFlag flags, int z_new, Slope tileh_new)
static CommandCost TerraformTile_Clear(TileIndex tile, DoCommandFlag flags, int, Slope)
{
return Command<CMD_LANDSCAPE_CLEAR>::Do(flags, tile);
}

View File

@ -280,11 +280,10 @@ void CommandHelperBase::LogCommandExecution(Commands cmd, StringID err_message,
/**
* Prepare for the test run of a command proc call.
* @param cmd_flags Command flags.
* @param tile Tile of command execution.
* @param[in,out] cur_company Backup of current company at start of command execution.
* @return True if test run can go ahead, false on error.
*/
bool CommandHelperBase::InternalExecutePrepTest(CommandFlags cmd_flags, TileIndex tile, Backup<CompanyID> &cur_company)
bool CommandHelperBase::InternalExecutePrepTest(CommandFlags cmd_flags, TileIndex, Backup<CompanyID> &cur_company)
{
/* Always execute server and spectator commands as spectator */
bool exec_as_spectator = (cmd_flags & (CMD_SPECTATOR | CMD_SERVER)) != 0;
@ -314,7 +313,7 @@ bool CommandHelperBase::InternalExecutePrepTest(CommandFlags cmd_flags, TileInde
* @param[in,out] cur_company Backup of current company at start of command execution.
* @return True if test run can go ahead, false on error.
*/
std::tuple<bool, bool, bool> CommandHelperBase::InternalExecuteValidateTestAndPrepExec(CommandCost &res, CommandFlags cmd_flags, bool estimate_only, bool network_command, Backup<CompanyID> &cur_company)
std::tuple<bool, bool, bool> CommandHelperBase::InternalExecuteValidateTestAndPrepExec(CommandCost &res, CommandFlags cmd_flags, bool estimate_only, bool network_command, [[maybe_unused]] Backup<CompanyID> &cur_company)
{
BasePersistentStorageArray::SwitchMode(PSM_LEAVE_TESTMODE);
SetTownRatingTestMode(false);
@ -354,7 +353,7 @@ std::tuple<bool, bool, bool> CommandHelperBase::InternalExecuteValidateTestAndPr
* @param[in,out] cur_company Backup of current company at start of command execution.
* @return Final command result.
*/
CommandCost CommandHelperBase::InternalExecuteProcessResult(Commands cmd, CommandFlags cmd_flags, const CommandCost &res_test, const CommandCost &res_exec, Money extra_cash, TileIndex tile, Backup<CompanyID> &cur_company)
CommandCost CommandHelperBase::InternalExecuteProcessResult(Commands cmd, CommandFlags cmd_flags, [[maybe_unused]] const CommandCost &res_test, const CommandCost &res_exec, Money extra_cash, TileIndex tile, Backup<CompanyID> &cur_company)
{
BasePersistentStorageArray::SwitchMode(PSM_LEAVE_COMMAND);

View File

@ -257,7 +257,7 @@ public:
protected:
/** Helper to process a single ClientID argument. */
template <class T>
static inline void SetClientIdHelper(T &data)
static inline void SetClientIdHelper([[maybe_unused]] T &data)
{
if constexpr (std::is_same_v<ClientID, T>) {
if (data == INVALID_CLIENT_ID) data = CLIENT_ID_SERVER;
@ -333,7 +333,7 @@ protected:
/** Helper to process a single ClientID argument. */
template <class T>
static inline bool ClientIdIsSet(T &data)
static inline bool ClientIdIsSet([[maybe_unused]] T &data)
{
if constexpr (std::is_same_v<ClientID, T>) {
return data != INVALID_CLIENT_ID;
@ -350,7 +350,7 @@ protected:
}
template<class Ttuple>
static inline Money ExtractAdditionalMoney(Ttuple &values)
static inline Money ExtractAdditionalMoney([[maybe_unused]] Ttuple &values)
{
if constexpr (std::is_same_v<std::tuple_element_t<1, Tret>, Money>) {
return std::get<1>(values);
@ -359,7 +359,7 @@ protected:
}
}
static Tret Execute(StringID err_message, CommandCallback *callback, bool my_cmd, bool estimate_only, bool network_command, TileIndex tile, std::tuple<Targs...> args)
static Tret Execute(StringID err_message, CommandCallback *callback, bool, bool estimate_only, bool network_command, TileIndex tile, std::tuple<Targs...> args)
{
/* Prevent recursion; it gives a mess over the network */
RecursiveCommandCounter counter{};

View File

@ -396,7 +396,7 @@ struct CompanyFinancesWindow : Window {
}
}
void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override
void UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override
{
switch (widget) {
case WID_CF_EXPS_CATEGORY:
@ -492,7 +492,7 @@ struct CompanyFinancesWindow : Window {
this->DrawWidgets();
}
void OnClick(Point pt, int widget, int click_count) override
void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override
{
switch (widget) {
case WID_CF_TOGGLE_SIZE: // toggle size
@ -597,7 +597,7 @@ public:
return ScaleGUITrad(28) + WidgetDimensions::scaled.hsep_normal + GetStringBoundingBox(this->String()).width + WidgetDimensions::scaled.dropdowntext.Horizontal();
}
uint Height(uint width) const override
uint Height(uint) const override
{
return std::max(FONT_HEIGHT_NORMAL, ScaleGUITrad(12) + WidgetDimensions::scaled.vsep_normal);
}
@ -607,7 +607,7 @@ public:
return true;
}
void Draw(const Rect &r, bool sel, Colours bg_colour) const override
void Draw(const Rect &r, bool sel, Colours) const override
{
bool rtl = _current_text_dir == TD_RTL;
int icon_y = CenterBounds(r.top, r.bottom, 0);
@ -806,7 +806,7 @@ public:
}
}
void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override
void UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override
{
switch (widget) {
case WID_SCL_SPACER_DROPDOWN: {
@ -977,7 +977,7 @@ public:
}
}
void OnClick(Point pt, int widget, int click_count) override
void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override
{
switch (widget) {
/* Livery Class buttons */
@ -1082,7 +1082,7 @@ public:
* @param data Information about the changed data.
* @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details.
*/
void OnInvalidateData(int data = 0, bool gui_scope = true) override
void OnInvalidateData([[maybe_unused]] int data = 0, [[maybe_unused]] bool gui_scope = true) override
{
if (!gui_scope) return;
@ -1471,7 +1471,7 @@ public:
this->number_dim = number_dim;
}
void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override
void UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override
{
switch (widget) {
case WID_SCMF_HAS_MOUSTACHE_EARRING_TEXT:
@ -1647,7 +1647,7 @@ public:
}
}
void OnClick(Point pt, int widget, int click_count) override
void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override
{
switch (widget) {
/* Toggle size, advanced/simple face selection */
@ -1909,7 +1909,7 @@ struct CompanyInfrastructureWindow : Window
}
}
void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override
void UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override
{
const Company *c = Company::Get((CompanyID)this->window_number);
@ -2136,7 +2136,7 @@ struct CompanyInfrastructureWindow : Window
* @param data Information about the changed data.
* @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details.
*/
void OnInvalidateData(int data = 0, bool gui_scope = true) override
void OnInvalidateData([[maybe_unused]] int data = 0, [[maybe_unused]] bool gui_scope = true) override
{
if (!gui_scope) return;
@ -2359,7 +2359,7 @@ struct CompanyWindow : Window
this->DrawWidgets();
}
void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override
void UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override
{
switch (widget) {
case WID_C_FACE: {
@ -2545,7 +2545,7 @@ struct CompanyWindow : Window
}
}
void OnClick(Point pt, int widget, int click_count) override
void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override
{
switch (widget) {
case WID_C_NEW_FACE: DoSelectCompanyManagerFace(this); break;
@ -2641,7 +2641,7 @@ struct CompanyWindow : Window
this->SetDirty();
}};
void OnPlaceObject(Point pt, TileIndex tile) override
void OnPlaceObject([[maybe_unused]] Point pt, TileIndex tile) override
{
if (Command<CMD_BUILD_OBJECT>::Post(STR_ERROR_CAN_T_BUILD_COMPANY_HEADQUARTERS, tile, OBJECT_HQ, 0) && !_shift_pressed) {
ResetObjectToPlace();
@ -2719,7 +2719,7 @@ struct BuyCompanyWindow : Window {
this->company_value = hostile_takeover ? CalculateHostileTakeoverValue(c) : c->bankrupt_value;
}
void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override
void UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override
{
switch (widget) {
case WID_BC_FACE:
@ -2764,7 +2764,7 @@ struct BuyCompanyWindow : Window {
}
}
void OnClick(Point pt, int widget, int click_count) override
void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override
{
switch (widget) {
case WID_BC_NO:

View File

@ -93,7 +93,7 @@ static_assert(lengthof(_cmf_info) == CMFV_END);
* @pre _cmf_info[cmfv].valid_values[ge] != 0
* @return the requested bits
*/
static inline uint GetCompanyManagerFaceBits(CompanyManagerFace cmf, CompanyManagerFaceVariable cmfv, GenderEthnicity ge)
static inline uint GetCompanyManagerFaceBits(CompanyManagerFace cmf, CompanyManagerFaceVariable cmfv, [[maybe_unused]] GenderEthnicity ge)
{
assert(_cmf_info[cmfv].valid_values[ge] != 0);
@ -108,7 +108,7 @@ static inline uint GetCompanyManagerFaceBits(CompanyManagerFace cmf, CompanyMana
* @param val the new value
* @pre val < _cmf_info[cmfv].valid_values[ge]
*/
static inline void SetCompanyManagerFaceBits(CompanyManagerFace &cmf, CompanyManagerFaceVariable cmfv, GenderEthnicity ge, uint val)
static inline void SetCompanyManagerFaceBits(CompanyManagerFace &cmf, CompanyManagerFaceVariable cmfv, [[maybe_unused]] GenderEthnicity ge, uint val)
{
assert(val < _cmf_info[cmfv].valid_values[ge]);

View File

@ -86,7 +86,7 @@ public:
static ConsoleFileList _console_file_list; ///< File storage cache for the console.
/* console command defines */
#define DEF_CONSOLE_CMD(function) static bool function(byte argc, char *argv[])
#define DEF_CONSOLE_CMD(function) static bool function([[maybe_unused]] byte argc, [[maybe_unused]] char *argv[])
#define DEF_CONSOLE_HOOK(function) static ConsoleHookResult function(bool echo)

View File

@ -200,7 +200,7 @@ struct IConsoleWindow : Window
if (_iconsole_cmdline.HandleCaret()) this->SetDirty();
}
EventState OnKeyPress(char32_t key, uint16_t keycode) override
EventState OnKeyPress([[maybe_unused]] char32_t key, uint16_t keycode) override
{
if (_focused_window != this) return ES_NOT_HANDLED;
@ -271,7 +271,7 @@ struct IConsoleWindow : Window
return ES_HANDLED;
}
void InsertTextString(int wid, const char *str, bool marked, const char *caret, const char *insert_location, const char *replacement_end) override
void InsertTextString(int, const char *str, bool marked, const char *caret, const char *insert_location, const char *replacement_end) override
{
if (_iconsole_cmdline.InsertString(str, marked, caret, insert_location, replacement_end)) {
IConsoleWindow::scroll = 0;
@ -323,7 +323,7 @@ struct IConsoleWindow : Window
VideoDriver::GetInstance()->EditBoxGainedFocus();
}
void OnFocusLost(bool closing) override
void OnFocusLost(bool) override
{
VideoDriver::GetInstance()->EditBoxLostFocus();
}

View File

@ -275,13 +275,12 @@ struct Pool : PoolBase {
/**
* Allocates space for new Titem at given memory address
* @param size size of Titem
* @param ptr where are we allocating the item?
* @return pointer to allocated memory (== ptr)
* @note use of this is strongly discouraged
* @pre the memory must not be allocated in the Pool!
*/
inline void *operator new(size_t size, void *ptr)
inline void *operator new(size_t, void *ptr)
{
for (size_t i = 0; i < Tpool->first_unused; i++) {
/* Don't allow creating new objects over existing.
@ -375,7 +374,7 @@ struct Pool : PoolBase {
* @note when this function is called, PoolItem::Get(index) == nullptr.
* @note it's called only when !CleaningPool()
*/
static inline void PostDestructor(size_t index) { }
static inline void PostDestructor([[maybe_unused]] size_t index) { }
/**
* Returns an iterable ensemble of all valid Titem

View File

@ -155,7 +155,7 @@ void ottd_cpuid(int info[4], int type)
}
}
#else
void ottd_cpuid(int info[4], int type)
void ottd_cpuid(int info[4], int)
{
info[0] = info[1] = info[2] = info[3] = 0;
}

View File

@ -55,7 +55,7 @@ struct SetDateWindow : Window {
this->date.year = Clamp(this->date.year, min_year, max_year);
}
Point OnInitialPosition(int16_t sm_width, int16_t sm_height, int window_number) override
Point OnInitialPosition([[maybe_unused]] int16_t sm_width, [[maybe_unused]] int16_t sm_height, [[maybe_unused]] int window_number) override
{
Point pt = { this->parent->left + this->parent->width / 2 - sm_width / 2, this->parent->top + this->parent->height / 2 - sm_height / 2 };
return pt;
@ -99,7 +99,7 @@ struct SetDateWindow : Window {
ShowDropDownList(this, std::move(list), selected, widget);
}
void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override
void UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override
{
Dimension d = {0, 0};
switch (widget) {
@ -137,7 +137,7 @@ struct SetDateWindow : Window {
}
}
void OnClick(Point pt, int widget, int click_count) override
void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override
{
switch (widget) {
case WID_SD_DAY:

View File

@ -117,11 +117,10 @@ extern void DepotSortList(VehicleList *list);
/**
* This is the Callback method after the cloning attempt of a vehicle
* @param cmd unused
* @param result the result of the cloning command
* @param veh_id cloned vehicle ID
*/
void CcCloneVehicle(Commands cmd, const CommandCost &result, VehicleID veh_id)
void CcCloneVehicle(Commands, const CommandCost &result, VehicleID veh_id)
{
if (result.Failed()) return;
@ -656,7 +655,7 @@ struct DepotWindow : Window {
this->flag_size = maxdim(GetScaledSpriteSize(SPR_FLAG_VEH_STOPPED), GetScaledSpriteSize(SPR_FLAG_VEH_RUNNING));
}
void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override
void UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override
{
switch (widget) {
case WID_D_MATRIX: {
@ -704,7 +703,7 @@ struct DepotWindow : Window {
* @param data Information about the changed data.
* @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details.
*/
void OnInvalidateData(int data = 0, bool gui_scope = true) override
void OnInvalidateData([[maybe_unused]] int data = 0, [[maybe_unused]] bool gui_scope = true) override
{
this->generate_list = true;
}
@ -760,7 +759,7 @@ struct DepotWindow : Window {
this->DrawWidgets();
}
void OnClick(Point pt, int widget, int click_count) override
void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override
{
switch (widget) {
case WID_D_MATRIX: // List
@ -842,7 +841,7 @@ struct DepotWindow : Window {
Command<CMD_RENAME_DEPOT>::Post(STR_ERROR_CAN_T_RENAME_DEPOT, this->GetDepotIndex(), str);
}
bool OnRightClick(Point pt, int widget) override
bool OnRightClick([[maybe_unused]] Point pt, int widget) override
{
if (widget != WID_D_MATRIX) return false;

View File

@ -690,7 +690,7 @@ static bool DisasterTick_Submarine(DisasterVehicle *v)
}
static bool DisasterTick_NULL(DisasterVehicle *v)
static bool DisasterTick_NULL(DisasterVehicle *)
{
return true;
}

View File

@ -45,7 +45,7 @@ static void ShowBuildDocksDepotPicker(Window *parent);
static Axis _ship_depot_direction;
void CcBuildDocks(Commands cmd, const CommandCost &result, TileIndex tile)
void CcBuildDocks(Commands, const CommandCost &result, TileIndex tile)
{
if (result.Failed()) return;
@ -53,7 +53,7 @@ void CcBuildDocks(Commands cmd, const CommandCost &result, TileIndex tile)
if (!_settings_client.gui.persistent_buildingtools) ResetObjectToPlace();
}
void CcPlaySound_CONSTRUCTION_WATER(Commands cmd, const CommandCost &result, TileIndex tile)
void CcPlaySound_CONSTRUCTION_WATER(Commands, const CommandCost &result, TileIndex tile)
{
if (result.Succeeded() && _settings_client.sound.confirm) SndPlayTileFx(SND_02_CONSTRUCTION_WATER, tile);
}
@ -120,7 +120,7 @@ struct BuildDocksToolbarWindow : Window {
* @param data Information about the changed data.
* @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details.
*/
void OnInvalidateData(int data = 0, bool gui_scope = true) override
void OnInvalidateData([[maybe_unused]] int data = 0, [[maybe_unused]] bool gui_scope = true) override
{
if (!gui_scope) return;
@ -148,7 +148,7 @@ struct BuildDocksToolbarWindow : Window {
}
}
void OnClick(Point pt, int widget, int click_count) override
void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override
{
switch (widget) {
case WID_DT_CANAL: // Build canal button
@ -189,7 +189,7 @@ struct BuildDocksToolbarWindow : Window {
this->last_clicked_widget = (DockToolbarWidgets)widget;
}
void OnPlaceObject(Point pt, TileIndex tile) override
void OnPlaceObject([[maybe_unused]] Point pt, TileIndex tile) override
{
switch (this->last_clicked_widget) {
case WID_DT_CANAL: // Build canal button
@ -242,12 +242,12 @@ struct BuildDocksToolbarWindow : Window {
}
}
void OnPlaceDrag(ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, Point pt) override
void OnPlaceDrag(ViewportPlaceMethod select_method, [[maybe_unused]] ViewportDragDropSelectionProcess select_proc, [[maybe_unused]] Point pt) override
{
VpSelectTilesWithMethod(pt.x, pt.y, select_method);
}
void OnPlaceMouseUp(ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, Point pt, TileIndex start_tile, TileIndex end_tile) override
void OnPlaceMouseUp([[maybe_unused]] ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, [[maybe_unused]] Point pt, TileIndex start_tile, TileIndex end_tile) override
{
if (pt.x != -1) {
switch (select_proc) {
@ -278,7 +278,7 @@ struct BuildDocksToolbarWindow : Window {
CloseWindowByClass(WC_BUILD_BRIDGE);
}
void OnPlacePresize(Point pt, TileIndex tile_from) override
void OnPlacePresize([[maybe_unused]] Point pt, TileIndex tile_from) override
{
TileIndex tile_to = tile_from;
@ -453,7 +453,7 @@ public:
}
}
void OnClick(Point pt, int widget, int click_count) override
void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override
{
switch (widget) {
case BDSW_LT_OFF:
@ -468,7 +468,7 @@ public:
}
}
void OnRealtimeTick(uint delta_ms) override
void OnRealtimeTick([[maybe_unused]] uint delta_ms) override
{
CheckRedrawStationCoverage(this);
}
@ -525,7 +525,7 @@ public:
UpdateDocksDirection();
}
void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override
void UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override
{
switch (widget) {
case WID_BDD_X:
@ -559,7 +559,7 @@ public:
}
}
void OnClick(Point pt, int widget, int click_count) override
void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override
{
switch (widget) {
case WID_BDD_X:

View File

@ -1438,7 +1438,7 @@ struct ReturnCargoAction
*/
bool operator()(Vehicle *v)
{
v->cargo.Return(UINT_MAX, &this->st->goods[v->cargo_type].cargo, this->next_hop);
v->cargo.Return(UINT_MAX, &this->st->goods[v->cargo_type].cargo, this->next_hop, v->tile);
return true;
}
};
@ -1698,7 +1698,7 @@ static void LoadUnloadVehicle(Vehicle *front)
uint new_remaining = v->cargo.RemainingCount() + v->cargo.ActionCount(VehicleCargoList::MTA_DELIVER);
if (v->cargo_cap < new_remaining) {
/* Return some of the reserved cargo to not overload the vehicle. */
v->cargo.Return(new_remaining - v->cargo_cap, &ge->cargo, INVALID_STATION);
v->cargo.Return(new_remaining - v->cargo_cap, &ge->cargo, INVALID_STATION, v->tile);
}
/* Keep instead of delivering. This may lead to no cargo being unloaded, so ...*/

View File

@ -77,7 +77,7 @@ struct EnginePreviewWindow : Window {
this->flags |= WF_STICKY;
}
void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override
void UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override
{
if (widget != WID_EP_QUESTION) return;
@ -122,7 +122,7 @@ struct EnginePreviewWindow : Window {
DrawStringMultiLine(r.left, r.right, y, r.bottom, GetEngineInfoString(engine), TC_FROMSTRING, SA_CENTER);
}
void OnClick(Point pt, int widget, int click_count) override
void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override
{
switch (widget) {
case WID_EP_YES:
@ -134,7 +134,7 @@ struct EnginePreviewWindow : Window {
}
}
void OnInvalidateData(int data = 0, bool gui_scope = true) override
void OnInvalidateData([[maybe_unused]] int data = 0, [[maybe_unused]] bool gui_scope = true) override
{
if (!gui_scope) return;

View File

@ -188,7 +188,7 @@ public:
}
}
void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override
void UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override
{
switch (widget) {
case WID_EM_MESSAGE: {
@ -217,7 +217,7 @@ public:
}
}
Point OnInitialPosition(int16_t sm_width, int16_t sm_height, int window_number) override
Point OnInitialPosition([[maybe_unused]] int16_t sm_width, [[maybe_unused]] int16_t sm_height, [[maybe_unused]] int window_number) override
{
/* Position (0, 0) given, center the window. */
if (this->position.x == 0 && this->position.y == 0) {
@ -253,7 +253,7 @@ public:
* @param data Information about the changed data.
* @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details.
*/
void OnInvalidateData(int data = 0, bool gui_scope = true) override
void OnInvalidateData([[maybe_unused]] int data = 0, [[maybe_unused]] bool gui_scope = true) override
{
/* If company gets shut down, while displaying an error about it, remove the error message. */
if (this->face != INVALID_COMPANY && !Company::IsValidID(this->face)) this->Close();

View File

@ -474,7 +474,7 @@ static std::string ExtractString(char *buffer, size_t buffer_length)
return StrMakeValid(std::string(buffer, length));
}
bool TarScanner::AddFile(const std::string &filename, size_t basepath_length, const std::string &tar_filename)
bool TarScanner::AddFile(const std::string &filename, size_t, [[maybe_unused]] const std::string &tar_filename)
{
/* No tar within tar. */
assert(tar_filename.empty());

View File

@ -275,10 +275,9 @@ public:
/**
* Try to add a fios item set with the given filename.
* @param filename the full path to the file to read
* @param basepath_length amount of characters to chop of before to get a relative filename
* @return true if the file is added.
*/
bool FiosFileScanner::AddFile(const std::string &filename, size_t basepath_length, const std::string &tar_filename)
bool FiosFileScanner::AddFile(const std::string &filename, size_t, const std::string &)
{
auto sep = filename.rfind('.');
if (sep == std::string::npos) return false;
@ -531,7 +530,7 @@ void FiosGetScenarioList(SaveLoadOperation fop, FileList &file_list)
FiosGetFileList(fop, &FiosGetScenarioListCallback, subdir, file_list);
}
static std::tuple<FiosType, std::string> FiosGetHeightmapListCallback(SaveLoadOperation fop, const std::string &file, const std::string_view ext)
static std::tuple<FiosType, std::string> FiosGetHeightmapListCallback(SaveLoadOperation, const std::string &file, const std::string_view ext)
{
/* Show heightmap files
* .PNG PNG Based heightmap files
@ -640,7 +639,7 @@ public:
this->scanned = true;
}
bool AddFile(const std::string &filename, size_t basepath_length, const std::string &tar_filename) override
bool AddFile(const std::string &filename, size_t, const std::string &) override
{
FILE *f = FioFOpenFile(filename, "r", SCENARIO_DIR);
if (f == nullptr) return false;
@ -729,7 +728,7 @@ FiosNumberedSaveName::FiosNumberedSaveName(const std::string &prefix) : prefix(p
static std::string _prefix; ///< Static as the lambda needs access to it.
/* Callback for FiosFileScanner. */
static FiosGetTypeAndNameProc *proc = [](SaveLoadOperation fop, const std::string &file, const std::string_view ext) {
static FiosGetTypeAndNameProc *proc = [](SaveLoadOperation, const std::string &file, const std::string_view ext) {
if (StrEqualsIgnoreCase(ext, ".sav") && StrStartsWith(file, _prefix)) return std::tuple(FIOS_TYPE_FILE, std::string{});
return std::tuple(FIOS_TYPE_INVALID, std::string{});
};

View File

@ -282,13 +282,13 @@ private:
QueryString filter_editbox; ///< Filter editbox;
std::vector<FiosItem *> display_list; ///< Filtered display list
static void SaveGameConfirmationCallback(Window *w, bool confirmed)
static void SaveGameConfirmationCallback(Window *, bool confirmed)
{
/* File name has already been written to _file_to_saveload */
if (confirmed) _switch_mode = SM_SAVE_GAME;
}
static void SaveHeightmapConfirmationCallback(Window *w, bool confirmed)
static void SaveHeightmapConfirmationCallback(Window *, bool confirmed)
{
/* File name has already been written to _file_to_saveload */
if (confirmed) _switch_mode = SM_SAVE_HEIGHTMAP;
@ -561,7 +561,7 @@ public:
}
}
void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override
void UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override
{
switch (widget) {
case WID_SL_BACKGROUND:
@ -594,7 +594,7 @@ public:
this->DrawWidgets();
}
void OnClick(Point pt, int widget, int click_count) override
void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override
{
switch (widget) {
case WID_SL_SORT_BYNAME: // Sort save names by name
@ -716,7 +716,7 @@ public:
}
}
void OnMouseOver(Point pt, int widget) override
void OnMouseOver([[maybe_unused]] Point pt, int widget) override
{
if (widget == WID_SL_DRIVES_DIRECTORIES_LIST) {
auto it = this->vscroll->GetScrolledItemFromWidget(this->display_list, pt.y, this, WID_SL_DRIVES_DIRECTORIES_LIST, WidgetDimensions::scaled.inset.top);
@ -735,7 +735,7 @@ public:
}
}
EventState OnKeyPress(char32_t key, uint16_t keycode) override
EventState OnKeyPress([[maybe_unused]] char32_t key, uint16_t keycode) override
{
if (keycode == WKC_ESC) {
this->Close();

View File

@ -204,5 +204,5 @@ bool HasAntialiasedFonts()
#if !defined(_WIN32) && !defined(__APPLE__) && !defined(WITH_FONTCONFIG) && !defined(WITH_COCOA)
bool SetFallbackFont(FontCacheSettings *settings, const std::string &language_isocode, int winlangid, MissingGlyphSearcher *callback) { return false; }
bool SetFallbackFont(FontCacheSettings *, const std::string &, int, MissingGlyphSearcher *) { return false; }
#endif /* !defined(_WIN32) && !defined(__APPLE__) && !defined(WITH_FONTCONFIG) && !defined(WITH_COCOA) */

View File

@ -63,7 +63,7 @@ FreeTypeFontCache::FreeTypeFontCache(FontSize fs, FT_Face face, int pixels) : Tr
this->SetFontSize(fs, face, pixels);
}
void FreeTypeFontCache::SetFontSize(FontSize fs, FT_Face face, int pixels)
void FreeTypeFontCache::SetFontSize(FontSize, FT_Face, int pixels)
{
if (pixels == 0) {
/* Try to determine a good height based on the minimal height recommended by the font. */

View File

@ -23,16 +23,16 @@ private:
public:
SpriteFontCache(FontSize fs);
~SpriteFontCache();
virtual void SetUnicodeGlyph(char32_t key, SpriteID sprite);
virtual void InitializeUnicodeGlyphMap();
virtual void ClearFontCache();
virtual const Sprite *GetGlyph(GlyphID key);
virtual uint GetGlyphWidth(GlyphID key);
virtual bool GetDrawGlyphShadow();
virtual GlyphID MapCharToGlyph(char32_t key) { assert(IsPrintable(key)); return SPRITE_GLYPH | key; }
virtual const void *GetFontTable(uint32_t tag, size_t &length) { length = 0; return nullptr; }
virtual std::string GetFontName() { return "sprite"; }
virtual bool IsBuiltInFont() { return true; }
void SetUnicodeGlyph(char32_t key, SpriteID sprite) override;
void InitializeUnicodeGlyphMap() override;
void ClearFontCache() override;
const Sprite *GetGlyph(GlyphID key) override;
uint GetGlyphWidth(GlyphID key) override;
bool GetDrawGlyphShadow() override;
GlyphID MapCharToGlyph(char32_t key) override { assert(IsPrintable(key)); return SPRITE_GLYPH | key; }
const void *GetFontTable(uint32_t, size_t &length) override { length = 0; return nullptr; }
std::string GetFontName() override { return "sprite"; }
bool IsBuiltInFont() override { return true; }
};
#endif /* SPRITEFONTCACHE_H */

View File

@ -460,7 +460,7 @@ struct FramerateWindow : Window {
ResizeWindow(this, 0, (std::max(MIN_ELEMENTS, this->num_displayed) - MIN_ELEMENTS) * FONT_HEIGHT_NORMAL);
}
void OnRealtimeTick(uint delta_ms) override
void OnRealtimeTick([[maybe_unused]] uint delta_ms) override
{
/* Check if the shaded state has changed, switch caption text if it has */
if (this->small != this->IsShaded()) {
@ -540,7 +540,7 @@ struct FramerateWindow : Window {
}
}
void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override
void UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override
{
switch (widget) {
case WID_FRW_RATE_GAMELOOP:
@ -693,7 +693,7 @@ struct FramerateWindow : Window {
}
}
void OnClick(Point pt, int widget, int click_count) override
void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override
{
switch (widget) {
case WID_FRW_TIMES_NAMES:
@ -780,7 +780,7 @@ struct FrametimeGraphWindow : Window {
}
}
void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override
void UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override
{
if (widget == WID_FGW_GRAPH) {
SetDParam(0, 100);
@ -883,7 +883,7 @@ struct FrametimeGraphWindow : Window {
this->UpdateScale();
}};
void OnRealtimeTick(uint delta_ms) override
void OnRealtimeTick([[maybe_unused]] uint delta_ms) override
{
this->SetDirty();
}

View File

@ -130,7 +130,7 @@ struct GSConfigWindow : public Window {
this->vscroll->SetCount(this->visible_settings.size());
}
void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override
void UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override
{
switch (widget) {
case WID_GSC_SETTINGS:
@ -238,7 +238,7 @@ struct GSConfigWindow : public Window {
this->DrawWidgets();
}
void OnClick(Point pt, int widget, int click_count) override
void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override
{
if (widget >= WID_GSC_TEXTFILE && widget < WID_GSC_TEXTFILE + TFT_CONTENT_END) {
if (GameConfig::GetConfig() == nullptr) return;
@ -367,12 +367,14 @@ struct GSConfigWindow : public Window {
void OnDropdownSelect(int widget, int index) override
{
if (widget >= 0) return;
assert(this->clicked_dropdown);
SetValue(index);
}
void OnDropdownClose(Point pt, int widget, int index, bool instant_close) override
void OnDropdownClose(Point, int widget, int, bool) override
{
if (widget >= 0) return;
/* We cannot raise the dropdown button just yet. OnClick needs some hint, whether
* the same dropdown button was clicked again, and then not open the dropdown again.
* So, we only remember that it was closed, and process it on the next OnPaint, which is
@ -398,7 +400,7 @@ struct GSConfigWindow : public Window {
* @param data Information about the changed data.
* @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details.
*/
void OnInvalidateData(int data = 0, bool gui_scope = true) override
void OnInvalidateData([[maybe_unused]] int data = 0, [[maybe_unused]] bool gui_scope = true) override
{
if (!gui_scope) return;

View File

@ -121,7 +121,7 @@ struct TranslationWriter : LanguageWriter {
{
}
void WriteHeader(const LanguagePackHeader *header)
void WriteHeader(const LanguagePackHeader *)
{
/* We don't use the header. */
}
@ -131,7 +131,7 @@ struct TranslationWriter : LanguageWriter {
/* Nothing to do. */
}
void WriteLength(uint length)
void WriteLength(uint)
{
/* We don't write the length. */
}
@ -159,7 +159,7 @@ struct StringNameWriter : HeaderWriter {
if (stringid == (int)this->strings.size()) this->strings.emplace_back(name);
}
void Finalise(const StringData &data)
void Finalise(const StringData &)
{
/* Nothing to do. */
}
@ -185,7 +185,7 @@ public:
this->FileScanner::Scan(".txt", directory, false);
}
bool AddFile(const std::string &filename, size_t basepath_length, const std::string &tar_filename) override
bool AddFile(const std::string &filename, size_t, const std::string &) override
{
if (exclude == filename) return true;

View File

@ -168,13 +168,13 @@ void Gamelog::Print(std::function<void(const std::string &)> proc)
}
/* virtual */ void LoggedChangeMode::FormatTo(std::back_insert_iterator<std::string> &output_iterator, GrfIDMapping &grf_names, GamelogActionType action_type)
/* virtual */ void LoggedChangeMode::FormatTo(std::back_insert_iterator<std::string> &output_iterator, GrfIDMapping &, GamelogActionType)
{
/* Changing landscape, or going from scenario editor to game or back. */
fmt::format_to(output_iterator, "New game mode: {} landscape: {}", this->mode, this->landscape);
}
/* virtual */ void LoggedChangeRevision::FormatTo(std::back_insert_iterator<std::string> &output_iterator, GrfIDMapping &grf_names, GamelogActionType action_type)
/* virtual */ void LoggedChangeRevision::FormatTo(std::back_insert_iterator<std::string> &output_iterator, GrfIDMapping &, GamelogActionType)
{
/* The game was loaded in a diffferent version than before. */
fmt::format_to(output_iterator, "Revision text changed to {}, savegame version {}, ",
@ -189,7 +189,7 @@ void Gamelog::Print(std::function<void(const std::string &)> proc)
fmt::format_to(output_iterator, "modified, _openttd_newgrf_version = 0x{:08x}", this->newgrf);
}
/* virtual */ void LoggedChangeOldVersion::FormatTo(std::back_insert_iterator<std::string> &output_iterator, GrfIDMapping &grf_names, GamelogActionType action_type)
/* virtual */ void LoggedChangeOldVersion::FormatTo(std::back_insert_iterator<std::string> &output_iterator, GrfIDMapping &, GamelogActionType)
{
/* The game was loaded from before 0.7.0-beta1. */
fmt::format_to(output_iterator, "Conversion from ");
@ -221,13 +221,13 @@ void Gamelog::Print(std::function<void(const std::string &)> proc)
}
}
/* virtual */ void LoggedChangeSettingChanged::FormatTo(std::back_insert_iterator<std::string> &output_iterator, GrfIDMapping &grf_names, GamelogActionType action_type)
/* virtual */ void LoggedChangeSettingChanged::FormatTo(std::back_insert_iterator<std::string> &output_iterator, GrfIDMapping &, GamelogActionType)
{
/* A setting with the SF_NO_NETWORK flag got changed; these settings usually affect NewGRFs, such as road side or wagon speed limits. */
fmt::format_to(output_iterator, "Setting changed: {} : {} -> {}", this->name, this->oldval, this->newval);
}
/* virtual */ void LoggedChangeGRFAdd::FormatTo(std::back_insert_iterator<std::string> &output_iterator, GrfIDMapping &grf_names, GamelogActionType action_type)
/* virtual */ void LoggedChangeGRFAdd::FormatTo(std::back_insert_iterator<std::string> &output_iterator, GrfIDMapping &grf_names, GamelogActionType)
{
/* A NewGRF got added to the game, either at the start of the game (never an issue), or later on when it could be an issue. */
const GRFConfig *gc = FindGRFConfig(this->grfid, FGCM_EXACT, &this->md5sum);
@ -256,7 +256,7 @@ void Gamelog::Print(std::function<void(const std::string &)> proc)
}
}
/* virtual */ void LoggedChangeGRFChanged::FormatTo(std::back_insert_iterator<std::string> &output_iterator, GrfIDMapping &grf_names, GamelogActionType action_type)
/* virtual */ void LoggedChangeGRFChanged::FormatTo(std::back_insert_iterator<std::string> &output_iterator, GrfIDMapping &grf_names, GamelogActionType)
{
/* Another version of the same NewGRF got loaded. */
const GRFConfig *gc = FindGRFConfig(this->grfid, FGCM_EXACT, &this->md5sum);
@ -266,7 +266,7 @@ void Gamelog::Print(std::function<void(const std::string &)> proc)
grf_names[this->grfid] = gc;
}
/* virtual */ void LoggedChangeGRFParameterChanged::FormatTo(std::back_insert_iterator<std::string> &output_iterator, GrfIDMapping &grf_names, GamelogActionType action_type)
/* virtual */ void LoggedChangeGRFParameterChanged::FormatTo(std::back_insert_iterator<std::string> &output_iterator, GrfIDMapping &grf_names, GamelogActionType)
{
/* A parameter of a NewGRF got changed after the game was started. */
auto gm = grf_names.find(this->grfid);
@ -275,7 +275,7 @@ void Gamelog::Print(std::function<void(const std::string &)> proc)
if (gm == grf_names.end()) fmt::format_to(output_iterator, ". Gamelog inconsistency: GrfID was never added!");
}
/* virtual */ void LoggedChangeGRFMoved::FormatTo(std::back_insert_iterator<std::string> &output_iterator, GrfIDMapping &grf_names, GamelogActionType action_type)
/* virtual */ void LoggedChangeGRFMoved::FormatTo(std::back_insert_iterator<std::string> &output_iterator, GrfIDMapping &grf_names, GamelogActionType)
{
/* The order of NewGRFs got changed, which might cause some other NewGRFs to behave differently. */
auto gm = grf_names.find(this->grfid);
@ -285,7 +285,7 @@ void Gamelog::Print(std::function<void(const std::string &)> proc)
if (gm == grf_names.end()) fmt::format_to(output_iterator, ". Gamelog inconsistency: GrfID was never added!");
}
/* virtual */ void LoggedChangeGRFBug::FormatTo(std::back_insert_iterator<std::string> &output_iterator, GrfIDMapping &grf_names, GamelogActionType action_type)
/* virtual */ void LoggedChangeGRFBug::FormatTo(std::back_insert_iterator<std::string> &output_iterator, GrfIDMapping &grf_names, GamelogActionType)
{
/* A specific bug in a NewGRF, that could cause wide spread problems, has been noted during the execution of the game. */
auto gm = grf_names.find(this->grfid);
@ -296,7 +296,7 @@ void Gamelog::Print(std::function<void(const std::string &)> proc)
if (gm == grf_names.end()) fmt::format_to(output_iterator, ". Gamelog inconsistency: GrfID was never added!");
}
/* virtual */ void LoggedChangeEmergencySave::FormatTo(std::back_insert_iterator<std::string> &output_iterator, GrfIDMapping &grf_names, GamelogActionType action_type)
/* virtual */ void LoggedChangeEmergencySave::FormatTo(std::back_insert_iterator<std::string> &, GrfIDMapping &, GamelogActionType)
{
/* At one point the savegame was made during the handling of a game crash.
* The generic code already mentioned the emergency savegame, and there is no extra information to log. */

View File

@ -520,7 +520,7 @@ struct GenerateLandscapeWindow : public Window {
* @param data Information about the changed data.
* @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details.
*/
void OnInvalidateData(int data = 0, bool gui_scope = true) override
void OnInvalidateData([[maybe_unused]] int data = 0, [[maybe_unused]] bool gui_scope = true) override
{
if (!gui_scope) return;
/* Update the climate buttons */
@ -588,7 +588,7 @@ struct GenerateLandscapeWindow : public Window {
}
void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override
void UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override
{
Dimension d{0, (uint)FONT_HEIGHT_NORMAL};
const StringID *strs = nullptr;
@ -681,7 +681,7 @@ struct GenerateLandscapeWindow : public Window {
*size = maxdim(*size, d);
}
void OnClick(Point pt, int widget, int click_count) override
void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override
{
switch (widget) {
case WID_GL_TEMPERATE:
@ -1132,7 +1132,7 @@ struct CreateScenarioWindow : public Window
this->DrawWidgets();
}
void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override
void UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override
{
StringID str = STR_JUST_INT;
switch (widget) {
@ -1159,7 +1159,7 @@ struct CreateScenarioWindow : public Window
*size = maxdim(*size, d);
}
void OnClick(Point pt, int widget, int click_count) override
void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override
{
switch (widget) {
case WID_CS_TEMPERATE:
@ -1372,7 +1372,7 @@ static const StringID _generation_class_table[] = {
static_assert(lengthof(_generation_class_table) == GWP_CLASS_COUNT);
static void AbortGeneratingWorldCallback(Window *w, bool confirmed)
static void AbortGeneratingWorldCallback(Window *, bool confirmed)
{
if (confirmed) {
AbortGeneratingWorld();
@ -1388,7 +1388,7 @@ struct GenerateProgressWindow : public Window {
this->InitNested();
}
void OnClick(Point pt, int widget, int click_count) override
void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override
{
switch (widget) {
case WID_GP_ABORT:
@ -1403,7 +1403,7 @@ struct GenerateProgressWindow : public Window {
}
}
void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override
void UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override
{
switch (widget) {
case WID_GP_PROGRESS_BAR: {

View File

@ -65,7 +65,7 @@ public:
int CountRuns() const override;
const ParagraphLayouter::VisualRun &GetVisualRun(int run) const override;
int GetInternalCharLength(char32_t c) const override { return 1; }
int GetInternalCharLength(char32_t) const override { return 1; }
};
const char32_t *buffer_begin; ///< Begin of the buffer.
@ -96,8 +96,9 @@ public:
* @param c The character to add.
* @return The number of buffer spaces that were used.
*/
/* static */ size_t FallbackParagraphLayoutFactory::AppendToBuffer(char32_t *buff, const char32_t *buffer_last, char32_t c)
/* static */ size_t FallbackParagraphLayoutFactory::AppendToBuffer(char32_t *buff, [[maybe_unused]] const char32_t *buffer_last, char32_t c)
{
assert(buff < buffer_last);
*buff = c;
return 1;
}
@ -265,7 +266,7 @@ const ParagraphLayouter::VisualRun &FallbackParagraphLayout::FallbackLine::GetVi
* @param length The length of the paragraph.
* @param runs The font mapping of this paragraph.
*/
FallbackParagraphLayout::FallbackParagraphLayout(char32_t *buffer, int length, FontMap &runs) : buffer_begin(buffer), buffer(buffer), runs(runs)
FallbackParagraphLayout::FallbackParagraphLayout(char32_t *buffer, [[maybe_unused]] int length, FontMap &runs) : buffer_begin(buffer), buffer(buffer), runs(runs)
{
assert(runs.rbegin()->first == length);
}

View File

@ -340,13 +340,11 @@ std::vector<ICURun> ItemizeScript(UChar *buff, size_t length, std::vector<ICURun
*
* Basically, this always returns the same or more runs than given.
*
* @param buff The string to itemize.
* @param length The length of the string.
* @param runs_current The current runs.
* @param font_mapping The font mapping.
* @return The runs.
*/
std::vector<ICURun> ItemizeStyle(UChar *buff, size_t length, std::vector<ICURun> &runs_current, FontMap &font_mapping)
std::vector<ICURun> ItemizeStyle(std::vector<ICURun> &runs_current, FontMap &font_mapping)
{
std::vector<ICURun> runs;
@ -380,7 +378,7 @@ std::vector<ICURun> ItemizeStyle(UChar *buff, size_t length, std::vector<ICURun>
auto runs = ItemizeBidi(buff, length);
runs = ItemizeScript(buff, length, runs);
runs = ItemizeStyle(buff, length, runs, font_mapping);
runs = ItemizeStyle(runs, font_mapping);
if (runs.size() == 0) return nullptr;
@ -524,6 +522,7 @@ std::unique_ptr<const ICUParagraphLayout::Line> ICUParagraphLayout::NextLine(int
/* static */ size_t ICUParagraphLayoutFactory::AppendToBuffer(UChar *buff, const UChar *buffer_last, char32_t c)
{
assert(buff < buffer_last);
/* Transform from UTF-32 to internal ICU format of UTF-16. */
int32_t length = 0;
UErrorCode err = U_ZERO_ERROR;

View File

@ -63,7 +63,7 @@ struct GoalListWindow : public Window {
}
}
void OnClick(Point pt, int widget, int click_count) override
void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override
{
switch (widget) {
case WID_GOAL_GLOBAL_BUTTON:
@ -168,7 +168,7 @@ struct GoalListWindow : public Window {
return num;
}
void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override
void UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override
{
if (widget != WID_GOAL_LIST) return;
Dimension d = GetStringBoundingBox(STR_GOALS_NONE);
@ -269,7 +269,7 @@ struct GoalListWindow : public Window {
* @param data Information about the changed data.
* @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details.
*/
void OnInvalidateData(int data = 0, bool gui_scope = true) override
void OnInvalidateData([[maybe_unused]] int data = 0, [[maybe_unused]] bool gui_scope = true) override
{
if (!gui_scope) return;
this->vscroll->SetCount(this->CountLines());
@ -370,7 +370,7 @@ struct GoalQuestionWindow : public Window {
}
}
void OnClick(Point pt, int widget, int click_count) override
void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override
{
switch (widget) {
case WID_GQ_BUTTON_1:
@ -390,7 +390,7 @@ struct GoalQuestionWindow : public Window {
}
}
void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override
void UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override
{
if (widget != WID_GQ_QUESTION) return;

View File

@ -76,7 +76,7 @@ struct GraphLegendWindow : Window {
DrawString(tr.left, tr.right, CenterBounds(tr.top, tr.bottom, FONT_HEIGHT_NORMAL), STR_COMPANY_NAME_COMPANY_NUM, HasBit(_legend_excluded_companies, cid) ? TC_BLACK : TC_WHITE);
}
void OnClick(Point pt, int widget, int click_count) override
void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override
{
if (!IsInsideMM(widget, WID_GL_FIRST_COMPANY, MAX_COMPANIES + WID_GL_FIRST_COMPANY)) return;
@ -95,7 +95,7 @@ struct GraphLegendWindow : Window {
* @param data Information about the changed data.
* @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details.
*/
void OnInvalidateData(int data = 0, bool gui_scope = true) override
void OnInvalidateData([[maybe_unused]] int data = 0, [[maybe_unused]] bool gui_scope = true) override
{
if (!gui_scope) return;
if (Company::IsValidID(data)) return;
@ -493,7 +493,7 @@ protected:
}
public:
void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override
void UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override
{
if (widget != this->graph_widget) return;
@ -536,12 +536,12 @@ public:
DrawGraph(r);
}
virtual OverflowSafeInt64 GetGraphData(const Company *c, int j)
virtual OverflowSafeInt64 GetGraphData(const Company *, int)
{
return INVALID_DATAPOINT;
}
void OnClick(Point pt, int widget, int click_count) override
void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override
{
/* Clicked on legend? */
if (widget == WID_CV_KEY_BUTTON) ShowGraphLegend();
@ -557,7 +557,7 @@ public:
* @param data Information about the changed data.
* @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details.
*/
void OnInvalidateData(int data = 0, bool gui_scope = true) override
void OnInvalidateData([[maybe_unused]] int data = 0, [[maybe_unused]] bool gui_scope = true) override
{
if (!gui_scope) return;
this->UpdateStatistics(true);
@ -782,7 +782,7 @@ struct PerformanceHistoryGraphWindow : BaseGraphWindow {
return c->old_economy[j].performance_history;
}
void OnClick(Point pt, int widget, int click_count) override
void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override
{
if (widget == WID_PHG_DETAILED_PERFORMANCE) ShowPerformanceRatingDetail();
this->BaseGraphWindow::OnClick(pt, widget, click_count);
@ -916,7 +916,7 @@ struct PaymentRatesGraphWindow : BaseGraphWindow {
}
}
void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override
void UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override
{
if (widget != WID_CPR_MATRIX) {
BaseGraphWindow::UpdateWidgetSize(widget, size, padding, fill, resize);
@ -975,7 +975,7 @@ struct PaymentRatesGraphWindow : BaseGraphWindow {
}
}
void OnClick(Point pt, int widget, int click_count) override
void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override
{
switch (widget) {
case WID_CPR_ENABLE_CARGOES:
@ -1025,7 +1025,7 @@ struct PaymentRatesGraphWindow : BaseGraphWindow {
* @param data Information about the changed data.
* @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details.
*/
void OnInvalidateData(int data = 0, bool gui_scope = true) override
void OnInvalidateData([[maybe_unused]] int data = 0, [[maybe_unused]] bool gui_scope = true) override
{
if (!gui_scope) return;
this->UpdatePaymentRates();
@ -1142,7 +1142,7 @@ struct PerformanceRatingDetailWindow : Window {
uint score_detail_left;
uint score_detail_right;
void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override
void UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override
{
switch (widget) {
case WID_PRD_SCORE_FIRST:
@ -1279,7 +1279,7 @@ struct PerformanceRatingDetailWindow : Window {
}
}
void OnClick(Point pt, int widget, int click_count) override
void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override
{
/* Check which button is clicked */
if (IsInsideMM(widget, WID_PRD_COMPANY_FIRST, WID_PRD_COMPANY_LAST + 1)) {
@ -1307,7 +1307,7 @@ struct PerformanceRatingDetailWindow : Window {
* @param data the company ID of the company that is going to be removed
* @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details.
*/
void OnInvalidateData(int data = 0, bool gui_scope = true) override
void OnInvalidateData([[maybe_unused]] int data = 0, [[maybe_unused]] bool gui_scope = true) override
{
if (!gui_scope) return;
/* Disable the companies who are not active */

View File

@ -384,7 +384,7 @@ public:
*this->sorting = this->vehgroups.GetListing();
}
void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override
void UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override
{
switch (widget) {
case WID_GL_LIST_GROUP:
@ -442,7 +442,7 @@ public:
* @param data Information about the changed data.
* @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details.
*/
void OnInvalidateData(int data = 0, bool gui_scope = true) override
void OnInvalidateData([[maybe_unused]] int data = 0, [[maybe_unused]] bool gui_scope = true) override
{
if (data == 0) {
/* This needs to be done in command-scope to enforce rebuilding before resorting invalid data */
@ -651,7 +651,7 @@ public:
}
}
void OnClick(Point pt, int widget, int click_count) override
void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override
{
switch (widget) {
case WID_GL_SORT_BY_ORDER: // Flip sorting method ascending/descending
@ -1169,14 +1169,12 @@ static void CcCreateGroup(GroupID gid, VehicleType veh_type)
/**
* Opens a 'Rename group' window for newly created group.
* @param cmd Unused.
* @param result Did command succeed?
* @param new_group ID of the created group.
* @param vt Vehicle type.
* @param parent_group Parent group of the new group.
* @see CmdCreateGroup
*/
void CcCreateGroup(Commands cmd, const CommandCost &result, GroupID new_group, VehicleType vt, GroupID parent_group)
void CcCreateGroup(Commands, const CommandCost &result, GroupID new_group, VehicleType vt, GroupID)
{
if (result.Failed()) return;
@ -1186,12 +1184,10 @@ void CcCreateGroup(Commands cmd, const CommandCost &result, GroupID new_group, V
/**
* Open rename window after adding a vehicle to a new group via drag and drop.
* @param cmd Unused.
* @param result Did command succeed?
* @param new_group ID of the created group.
* @param veh_id vehicle to add to a group
*/
void CcAddVehicleNewGroup(Commands cmd, const CommandCost &result, GroupID new_group, GroupID, VehicleID veh_id, bool, const VehicleListIdentifier &)
void CcAddVehicleNewGroup(Commands, const CommandCost &result, GroupID new_group, GroupID, VehicleID, bool, const VehicleListIdentifier &)
{
if (result.Failed()) return;

View File

@ -129,7 +129,7 @@ struct HelpWindow : public Window {
this->EnableTextfileButton(LICENSE_FILENAME, WID_HW_LICENSE);
}
void OnClick(Point pt, int widget, int click_count) override
void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override
{
switch (widget) {
case WID_HW_README:

View File

@ -65,12 +65,12 @@ struct EndGameHighScoreBaseWindow : Window {
return pt;
}
void OnClick(Point pt, int widget, int click_count) override
void OnClick([[maybe_unused]] Point pt, [[maybe_unused]] int widget, [[maybe_unused]] int click_count) override
{
this->Close();
}
EventState OnKeyPress(char32_t key, uint16_t keycode) override
EventState OnKeyPress([[maybe_unused]] char32_t key, uint16_t keycode) override
{
/* All keys are 'handled' by this window but we want to make
* sure that 'quit' still works correctly. Not handling the

View File

@ -348,7 +348,7 @@ void SaveHotkeysToConfig()
SaveLoadHotkeys(true);
}
void HandleGlobalHotkeys(char32_t key, uint16_t keycode)
void HandleGlobalHotkeys([[maybe_unused]] char32_t key, uint16_t keycode)
{
for (HotkeyList *list : *_hotkey_lists) {
if (list->global_hotkey_handler == nullptr) continue;

View File

@ -206,7 +206,7 @@ Industry::~Industry()
* Invalidating some stuff after removing item from the pool.
* @param index index of deleted item
*/
void Industry::PostDestructor(size_t index)
void Industry::PostDestructor(size_t)
{
InvalidateWindowData(WC_INDUSTRY_DIRECTORY, 0, IDIWD_FORCE_REBUILD);
SetWindowDirty(WC_BUILD_INDUSTRY, 0);
@ -385,7 +385,7 @@ static void DrawTile_Industry(TileInfo *ti)
}
}
static int GetSlopePixelZ_Industry(TileIndex tile, uint x, uint y, bool ground_vehicle)
static int GetSlopePixelZ_Industry(TileIndex tile, uint, uint, bool)
{
return GetTileMaxPixelZ(tile);
}
@ -952,7 +952,7 @@ static bool ClickTile_Industry(TileIndex tile)
return true;
}
static TrackStatus GetTileTrackStatus_Industry(TileIndex tile, TransportType mode, uint sub_mode, DiagDirection side)
static TrackStatus GetTileTrackStatus_Industry(TileIndex, TransportType, uint, DiagDirection)
{
return 0;
}
@ -1094,10 +1094,9 @@ void PlantRandomFarmField(const Industry *i)
/**
* Search callback function for ChopLumberMillTrees
* @param tile to test
* @param user_data that is passed by the caller. In this case, nothing
* @return the result of the test
*/
static bool SearchLumberMillTrees(TileIndex tile, void *user_data)
static bool SearchLumberMillTrees(TileIndex tile, void *)
{
if (IsTileType(tile, MP_TREES) && GetTreeGrowth(tile) > 2) { ///< 3 and up means all fully grown trees
/* found a tree */
@ -1225,10 +1224,9 @@ void OnTick_Industry()
/**
* Check the conditions of #CHECK_NOTHING (Always succeeds).
* @param tile %Tile to perform the checking.
* @return Succeeded or failed command.
*/
static CommandCost CheckNewIndustry_NULL(TileIndex tile)
static CommandCost CheckNewIndustry_NULL(TileIndex)
{
return CommandCost();
}
@ -1587,7 +1585,7 @@ static bool CheckCanTerraformSurroundingTiles(TileIndex tile, uint height, int i
* This function tries to flatten out the land below an industry, without
* damaging the surroundings too much.
*/
static bool CheckIfCanLevelIndustryPlatform(TileIndex tile, DoCommandFlag flags, const IndustryTileLayout &layout, int type)
static bool CheckIfCanLevelIndustryPlatform(TileIndex tile, DoCommandFlag flags, const IndustryTileLayout &layout)
{
int max_x = 0;
int max_y = 0;
@ -1992,7 +1990,7 @@ static CommandCost CreateNewIndustryHelper(TileIndex tile, IndustryType type, Do
if (ret.Failed()) return ret;
if (!custom_shape_check && _settings_game.game_creation.land_generator == LG_TERRAGENESIS && _generating_world &&
!_ignore_restrictions && !CheckIfCanLevelIndustryPlatform(tile, DC_NO_WATER, layout, type)) {
!_ignore_restrictions && !CheckIfCanLevelIndustryPlatform(tile, DC_NO_WATER, layout)) {
return_cmd_error(STR_ERROR_SITE_UNSUITABLE);
}
@ -2000,7 +1998,7 @@ static CommandCost CreateNewIndustryHelper(TileIndex tile, IndustryType type, Do
if (flags & DC_EXEC) {
*ip = new Industry(tile);
if (!custom_shape_check) CheckIfCanLevelIndustryPlatform(tile, DC_NO_WATER | DC_EXEC, layout, type);
if (!custom_shape_check) CheckIfCanLevelIndustryPlatform(tile, DC_NO_WATER | DC_EXEC, layout);
DoCreateNewIndustry(*ip, tile, type, layout, layout_index, t, founder, random_initial_bits);
}

View File

@ -243,12 +243,11 @@ void SortIndustryTypes()
/**
* Command callback. In case of failure to build an industry, show an error message.
* @param cmd Unused.
* @param result Result of the command.
* @param tile Tile where the industry is placed.
* @param indtype Industry type.
*/
void CcBuildIndustry(Commands cmd, const CommandCost &result, TileIndex tile, IndustryType indtype, uint32_t, bool, uint32_t)
void CcBuildIndustry(Commands, const CommandCost &result, TileIndex tile, IndustryType indtype, uint32_t, bool, uint32_t)
{
if (result.Succeeded()) return;
@ -425,7 +424,7 @@ public:
this->SetupArrays();
}
void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override
void UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override
{
switch (widget) {
case WID_DPI_MATRIX_WIDGET: {
@ -598,7 +597,7 @@ public:
}
}
static void AskManyRandomIndustriesCallback(Window *w, bool confirmed)
static void AskManyRandomIndustriesCallback(Window *, bool confirmed)
{
if (!confirmed) return;
@ -613,7 +612,7 @@ public:
}
}
static void AskRemoveAllIndustriesCallback(Window *w, bool confirmed)
static void AskRemoveAllIndustriesCallback(Window *, bool confirmed)
{
if (!confirmed) return;
@ -629,7 +628,7 @@ public:
MarkWholeScreenDirty();
}
void OnClick(Point pt, int widget, int click_count) override
void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override
{
switch (widget) {
case WID_DPI_CREATE_RANDOM_INDUSTRIES_WIDGET: {
@ -693,7 +692,7 @@ public:
this->vscroll->SetCapacityFromWidget(this, WID_DPI_MATRIX_WIDGET);
}
void OnPlaceObject(Point pt, TileIndex tile) override
void OnPlaceObject([[maybe_unused]] Point pt, TileIndex tile) override
{
bool success = true;
/* We do not need to protect ourselves against "Random Many Industries" in this mode */
@ -753,7 +752,7 @@ public:
* @param data Information about the changed data.
* @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details.
*/
void OnInvalidateData(int data = 0, bool gui_scope = true) override
void OnInvalidateData([[maybe_unused]] int data = 0, [[maybe_unused]] bool gui_scope = true) override
{
if (!gui_scope) return;
this->SetupArrays();
@ -989,12 +988,12 @@ public:
if (widget == WID_IV_CAPTION) SetDParam(0, this->window_number);
}
void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override
void UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override
{
if (widget == WID_IV_INFO) size->height = this->info_height;
}
void OnClick(Point pt, int widget, int click_count) override
void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override
{
switch (widget) {
case WID_IV_INFO: {
@ -1142,7 +1141,7 @@ public:
* @param data Information about the changed data.
* @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details.
*/
void OnInvalidateData(int data = 0, bool gui_scope = true) override
void OnInvalidateData([[maybe_unused]] int data = 0, [[maybe_unused]] bool gui_scope = true) override
{
if (!gui_scope) return;
const Industry *i = Industry::Get(this->window_number);
@ -1617,7 +1616,7 @@ protected:
}
public:
IndustryDirectoryWindow(WindowDesc *desc, WindowNumber number) : Window(desc), industry_editbox(MAX_FILTER_LENGTH * MAX_CHAR_LENGTH, MAX_FILTER_LENGTH)
IndustryDirectoryWindow(WindowDesc *desc, WindowNumber) : Window(desc), industry_editbox(MAX_FILTER_LENGTH * MAX_CHAR_LENGTH, MAX_FILTER_LENGTH)
{
this->CreateNestedTree();
this->vscroll = this->GetScrollbar(WID_ID_SCROLLBAR);
@ -1694,7 +1693,7 @@ public:
}
}
void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override
void UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override
{
switch (widget) {
case WID_ID_DROPDOWN_ORDER: {
@ -1732,7 +1731,7 @@ public:
}
void OnClick(Point pt, int widget, int click_count) override
void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override
{
switch (widget) {
case WID_ID_DROPDOWN_ORDER:
@ -1821,7 +1820,7 @@ public:
* @param data Information about the changed data.
* @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details.
*/
void OnInvalidateData(int data = 0, bool gui_scope = true) override
void OnInvalidateData([[maybe_unused]] int data = 0, [[maybe_unused]] bool gui_scope = true) override
{
switch (data) {
case IDIWD_FORCE_REBUILD:
@ -2586,7 +2585,7 @@ struct IndustryCargoesWindow : public Window {
CargoesField::cargo_field_width = CargoesField::cargo_border.width * 2 + CargoesField::cargo_line.width * CargoesField::max_cargoes + CargoesField::cargo_space.width * (CargoesField::max_cargoes - 1);
}
void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override
void UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override
{
switch (widget) {
case WID_IC_PANEL:
@ -2924,7 +2923,7 @@ struct IndustryCargoesWindow : public Window {
* - data = NUM_INDUSTRYTYPES: Stop sending updates to the smallmap window.
* @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details.
*/
void OnInvalidateData(int data = 0, bool gui_scope = true) override
void OnInvalidateData([[maybe_unused]] int data = 0, [[maybe_unused]] bool gui_scope = true) override
{
if (!gui_scope) return;
if (data == NUM_INDUSTRYTYPES) {
@ -3021,7 +3020,7 @@ struct IndustryCargoesWindow : public Window {
return true;
}
void OnClick(Point pt, int widget, int click_count) override
void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override
{
switch (widget) {
case WID_IC_PANEL: {
@ -3108,7 +3107,7 @@ struct IndustryCargoesWindow : public Window {
}
}
bool OnTooltip(Point pt, int widget, TooltipCloseCondition close_cond) override
bool OnTooltip([[maybe_unused]] Point pt, int widget, TooltipCloseCondition close_cond) override
{
if (widget != WID_IC_PANEL) return false;

View File

@ -190,7 +190,7 @@ struct SelectGameWindow : public Window {
this->mouse_idle_pos = _cursor.pos;
}
void OnRealtimeTick(uint delta_ms) override
void OnRealtimeTick([[maybe_unused]] uint delta_ms) override
{
/* Move the main game viewport according to intro viewport commands. */
@ -264,7 +264,7 @@ struct SelectGameWindow : public Window {
* @param data Information about the changed data.
* @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details.
*/
void OnInvalidateData(int data = 0, bool gui_scope = true) override
void OnInvalidateData([[maybe_unused]] int data = 0, [[maybe_unused]] bool gui_scope = true) override
{
if (!gui_scope) return;
this->SetWidgetLoweredState(WID_SGI_TEMPERATE_LANDSCAPE, _settings_newgame.game_creation.landscape == LT_TEMPERATE);
@ -297,7 +297,7 @@ struct SelectGameWindow : public Window {
}
}
void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override
void UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override
{
StringID str = 0;
switch (widget) {
@ -326,7 +326,7 @@ struct SelectGameWindow : public Window {
}
}
void OnClick(Point pt, int widget, int click_count) override
void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override
{
/* Do not create a network server when you (just) have closed one of the game
* creation/load windows for the network server. */
@ -507,7 +507,7 @@ void ShowSelectGameWindow()
new SelectGameWindow(&_select_game_desc);
}
static void AskExitGameCallback(Window *w, bool confirmed)
static void AskExitGameCallback(Window *, bool confirmed)
{
if (confirmed) {
_survey.Transmit(NetworkSurveyHandler::Reason::EXIT, true);
@ -527,7 +527,7 @@ void AskExitGame()
}
static void AskExitToGameMenuCallback(Window *w, bool confirmed)
static void AskExitToGameMenuCallback(Window *, bool confirmed)
{
if (confirmed) {
_switch_mode = SM_MENU;

View File

@ -978,10 +978,9 @@ static void CreateDesertOrRainForest(uint desert_tropic_line)
/**
* Find the spring of a river.
* @param tile The tile to consider for being the spring.
* @param user_data Ignored data.
* @return True iff it is suitable as a spring.
*/
static bool FindSpring(TileIndex tile, void *user_data)
static bool FindSpring(TileIndex tile, void *)
{
int referenceHeight;
if (!IsTileFlat(tile, &referenceHeight) || IsWaterTile(tile)) return false;
@ -1216,13 +1215,13 @@ static int32_t River_EndNodeCheck(const AyStar *aystar, const OpenListNode *curr
}
/* AyStar callback for getting the cost of the current node. */
static int32_t River_CalculateG(AyStar *aystar, AyStarNode *current, OpenListNode *parent)
static int32_t River_CalculateG(AyStar *, AyStarNode *, OpenListNode *)
{
return 1 + RandomRange(_settings_game.game_creation.river_route_random);
}
/* AyStar callback for getting the estimated cost to the destination. */
static int32_t River_CalculateH(AyStar *aystar, AyStarNode *current, OpenListNode *parent)
static int32_t River_CalculateH(AyStar *aystar, AyStarNode *current, OpenListNode *)
{
return DistanceManhattan(*(TileIndex*)aystar->user_target, current->tile);
}
@ -1283,10 +1282,9 @@ static const uint RIVER_HASH_SIZE = 8; ///< The number of bits the hash for rive
/**
* Simple hash function for river tiles to be used by AyStar.
* @param tile The tile to hash.
* @param dir The unused direction.
* @return The hash for the tile.
*/
static uint River_Hash(TileIndex tile, Trackdir dir)
static uint River_Hash(TileIndex tile, Trackdir)
{
return GB(TileHash(TileX(tile), TileY(tile)), 0, RIVER_HASH_SIZE);
}

View File

@ -930,7 +930,7 @@ STR_NEWS_STATION_NO_LONGER_ACCEPTS_CARGO_OR_CARGO :{WHITE}{STATION
STR_NEWS_STATION_NOW_ACCEPTS_CARGO :{WHITE}{STATION}에서 이제 {STRING}{G 1 "을" "를"} 받을 수 있습니다.
STR_NEWS_STATION_NOW_ACCEPTS_CARGO_AND_CARGO :{WHITE}{STATION}에서 이제 {STRING}/{STRING}{G 2 "을" "를"} 받을 수 있습니다.
STR_NEWS_OFFER_OF_SUBSIDY_EXPIRED :{BIG_FONT}{BLACK}보조금 지급 계약 파기:{}{}{1:STRING}에서 {2:STRING}까지의 {0:STRING} 수송은{}더 이상 보조금을 지급하지 않습니다.
STR_NEWS_OFFER_OF_SUBSIDY_EXPIRED :{BIG_FONT}{BLACK}보조금 지급 종료:{}{}{1:STRING}에서 {2:STRING}까지의 {0:STRING} 수송은{}더 이상 보조금을 지급하지 않습니다.
STR_NEWS_SUBSIDY_WITHDRAWN_SERVICE :{BIG_FONT}{BLACK}보조금 지급 만료:{}{}{1:STRING}에서 {2:STRING}까지의{}{0:STRING} 수송 보조금은 더 이상 지급되지 않습니다.
STR_NEWS_SERVICE_SUBSIDY_OFFERED :{BIG_FONT}{BLACK}보조금 지급 안내{}{}처음으로 {1:STRING}에서 {2:STRING}까지{}{0:STRING}{G 0 "을" "를"} 수송하는 회사는{}지역 당국으로부터 {3:NUM}년 동안 보조금을 받게 될 것입니다!
###length 4

View File

@ -127,7 +127,7 @@ public:
}
}
void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override
void UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override
{
if (widget != WID_PLT_BACKGROUND) return;
@ -175,7 +175,7 @@ public:
* @param data Information about the changed data.
* @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details.
*/
void OnInvalidateData(int data = 0, bool gui_scope = true) override
void OnInvalidateData([[maybe_unused]] int data = 0, [[maybe_unused]] bool gui_scope = true) override
{
if (data == 0) {
/* This needs to be done in command-scope to enforce rebuilding before resorting invalid data */
@ -354,7 +354,7 @@ public:
}
}
void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override
void UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override
{
if (widget != WID_SLT_BACKGROUND) return;
@ -394,7 +394,7 @@ public:
}
}
void OnClick(Point pt, int widget, int click_count) override
void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override
{
if (widget != WID_SLT_BACKGROUND) return;
@ -411,7 +411,7 @@ public:
* @param data Information about the changed data.
* @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details.
*/
void OnInvalidateData(int data = 0, bool gui_scope = true) override
void OnInvalidateData([[maybe_unused]] int data = 0, [[maybe_unused]] bool gui_scope = true) override
{
this->BuildTable();
this->ReInit();

View File

@ -580,7 +580,7 @@ void LinkGraphLegendWindow::SetOverlay(std::shared_ptr<LinkGraphOverlay> overlay
}
}
void LinkGraphLegendWindow::UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize)
void LinkGraphLegendWindow::UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize)
{
if (IsInsideMM(widget, WID_LGL_SATURATION_FIRST, WID_LGL_SATURATION_LAST + 1)) {
StringID str = STR_NULL;
@ -639,7 +639,7 @@ void LinkGraphLegendWindow::DrawWidget(const Rect &r, int widget) const
}
}
bool LinkGraphLegendWindow::OnTooltip(Point pt, int widget, TooltipCloseCondition close_cond)
bool LinkGraphLegendWindow::OnTooltip([[maybe_unused]] Point, int widget, TooltipCloseCondition close_cond)
{
if (IsInsideMM(widget, WID_LGL_COMPANY_FIRST, WID_LGL_COMPANY_LAST + 1)) {
if (this->IsWidgetDisabled(widget)) {
@ -686,7 +686,7 @@ void LinkGraphLegendWindow::UpdateOverlayCargoes()
this->overlay->SetCargoMask(mask);
}
void LinkGraphLegendWindow::OnClick(Point pt, int widget, int click_count)
void LinkGraphLegendWindow::OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count)
{
/* Check which button is clicked */
if (IsInsideMM(widget, WID_LGL_COMPANY_FIRST, WID_LGL_COMPANY_LAST + 1)) {
@ -718,7 +718,7 @@ void LinkGraphLegendWindow::OnClick(Point pt, int widget, int click_count)
* @param data ignored
* @param gui_scope ignored
*/
void LinkGraphLegendWindow::OnInvalidateData(int data, bool gui_scope)
void LinkGraphLegendWindow::OnInvalidateData([[maybe_unused]] int data, [[maybe_unused]] bool gui_scope)
{
if (this->num_cargo != _sorted_cargo_specs.size()) {
this->Close();

View File

@ -108,10 +108,10 @@ public:
LinkGraphLegendWindow(WindowDesc *desc, int window_number);
void SetOverlay(std::shared_ptr<LinkGraphOverlay> overlay);
void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override;
void UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override;
void DrawWidget(const Rect &r, int widget) const override;
bool OnTooltip(Point pt, int widget, TooltipCloseCondition close_cond) override;
void OnClick(Point pt, int widget, int click_count) override;
bool OnTooltip([[maybe_unused]] Point pt, int widget, TooltipCloseCondition close_cond) override;
void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override;
void OnInvalidateData(int data = 0, bool gui_scope = true) override;
private:

View File

@ -108,10 +108,9 @@ public:
/**
* Setup the node to start iterating at.
* @param source Unused.
* @param node Node to start iterating at.
*/
void SetNode(NodeID source, NodeID node)
void SetNode(NodeID, NodeID node)
{
this->i = this->job[node].edges.cbegin();
this->end = this->job[node].edges.cend();
@ -197,7 +196,7 @@ public:
* @return True if base + the new edge would be better than the path associated
* with this annotation.
*/
bool DistanceAnnotation::IsBetter(const DistanceAnnotation *base, uint cap,
bool DistanceAnnotation::IsBetter(const DistanceAnnotation *base, uint,
int free_cap, uint dist) const
{
/* If any of the paths is disconnected, the other one is better. If both

View File

@ -78,7 +78,7 @@ bool HandlePlacePushButton(Window *w, int widget, CursorID cursor, HighLightStyl
}
void CcPlaySound_EXPLOSION(Commands cmd, const CommandCost &result, TileIndex tile)
void CcPlaySound_EXPLOSION(Commands, const CommandCost &result, TileIndex tile)
{
if (result.Succeeded() && _settings_client.sound.confirm) SndPlayTileFx(SND_12_EXPLOSION, tile);
}
@ -443,7 +443,7 @@ struct MainWindow : Window
}
}
bool OnTooltip(Point pt, int widget, TooltipCloseCondition close_cond) override
bool OnTooltip([[maybe_unused]] Point pt, int widget, TooltipCloseCondition close_cond) override
{
if (widget != WID_M_VIEWPORT) return false;
return this->viewport->overlay->ShowTooltip(pt, close_cond);
@ -454,7 +454,7 @@ struct MainWindow : Window
* @param data Information about the changed data.
* @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details.
*/
void OnInvalidateData(int data = 0, bool gui_scope = true) override
void OnInvalidateData([[maybe_unused]] int data = 0, [[maybe_unused]] bool gui_scope = true) override
{
if (!gui_scope) return;
/* Forward the message to the appropriate toolbar (ingame or scenario editor) */

View File

@ -121,10 +121,9 @@ CommandCost CmdDecreaseLoan(DoCommandFlag flags, LoanCommand cmd, Money amount)
/**
* In case of an unsafe unpause, we want the
* user to confirm that it might crash.
* @param w unused
* @param confirmed whether the user confirmed their action
*/
static void AskUnsafeUnpauseCallback(Window *w, bool confirmed)
static void AskUnsafeUnpauseCallback(Window *, bool confirmed)
{
if (confirmed) {
Command<CMD_PAUSE>::Post(PM_PAUSED_ERROR, false);
@ -191,11 +190,10 @@ CommandCost CmdPause(DoCommandFlag flags, PauseMode mode, bool pause)
/**
* Change the financial flow of your company.
* @param flags operation to perform
* @param amount the amount of money to receive (if positive), or spend (if negative)
* @return the cost of this operation or an error
*/
CommandCost CmdMoneyCheat(DoCommandFlag flags, Money amount)
CommandCost CmdMoneyCheat(DoCommandFlag, Money amount)
{
return CommandCost(EXPENSES_OTHER, -amount);
}

View File

@ -88,7 +88,7 @@ public:
}
}
void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override
void UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override
{
if (widget != WID_LI_BACKGROUND) return;
@ -339,7 +339,7 @@ public:
::ShowNewGRFInspectWindow(GetGrfSpecFeature(this->tile), static_cast<uint32_t>(this->tile));
}
void OnClick(Point pt, int widget, int click_count) override
void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override
{
switch (widget) {
case WID_LI_LOCATION:
@ -357,7 +357,7 @@ public:
* @param data Information about the changed data.
* @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details.
*/
void OnInvalidateData(int data = 0, bool gui_scope = true) override
void OnInvalidateData([[maybe_unused]] int data = 0, [[maybe_unused]] bool gui_scope = true) override
{
if (!gui_scope) return;
@ -483,7 +483,7 @@ struct AboutWindow : public Window {
if (widget == WID_A_COPYRIGHT) SetDParamStr(0, _openttd_revision_year);
}
void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override
void UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override
{
if (widget != WID_A_SCROLLING_TEXT) return;
@ -676,7 +676,7 @@ struct TooltipsWindow : public Window
CLRBITS(this->flags, WF_WHITE_BORDER);
}
Point OnInitialPosition(int16_t sm_width, int16_t sm_height, int window_number) override
Point OnInitialPosition([[maybe_unused]] int16_t sm_width, [[maybe_unused]] int16_t sm_height, [[maybe_unused]] int window_number) override
{
/* Find the free screen space between the main toolbar at the top, and the statusbar at the bottom.
* Add a fixed distance 2 so the tooltip floats free from both bars.
@ -696,9 +696,9 @@ struct TooltipsWindow : public Window
return pt;
}
void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override
void UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override
{
/* There is only one widget. */
if (widget != WID_TT_BACKGROUND) return;
CopyInDParam(this->params);
size->width = std::min<uint>(GetStringBoundingBox(this->string_id).width, ScaleGUITrad(194));
@ -711,7 +711,7 @@ struct TooltipsWindow : public Window
void DrawWidget(const Rect &r, int widget) const override
{
/* There is only one widget. */
if (widget != WID_TT_BACKGROUND) return;
GfxFillRect(r, PC_BLACK);
GfxFillRect(r.Shrink(WidgetDimensions::scaled.bevel), PC_LIGHT_YELLOW);
@ -980,7 +980,7 @@ struct QueryStringWindow : public Window
this->ReInit();
}
void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override
void UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override
{
if (widget == WID_QS_DEFAULT && (this->flags & QSF_ENABLE_DEFAULT) == 0) {
/* We don't want this widget to show! */
@ -1019,7 +1019,7 @@ struct QueryStringWindow : public Window
}
}
void OnClick(Point pt, int widget, int click_count) override
void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override
{
switch (widget) {
case WID_QS_DEFAULT:
@ -1115,7 +1115,7 @@ struct QueryWindow : public Window {
this->Window::Close();
}
void FindWindowPlacementAndResize(int def_width, int def_height) override
void FindWindowPlacementAndResize([[maybe_unused]] int def_width, [[maybe_unused]] int def_height) override
{
/* Position query window over the calling window, ensuring it's within screen bounds. */
this->left = SoftClamp(parent->left + (parent->width / 2) - (this->width / 2), 0, _screen.width - this->width);
@ -1133,7 +1133,7 @@ struct QueryWindow : public Window {
}
}
void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override
void UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override
{
if (widget != WID_Q_TEXT) return;
@ -1151,7 +1151,7 @@ struct QueryWindow : public Window {
this->message, TC_FROMSTRING, SA_CENTER);
}
void OnClick(Point pt, int widget, int click_count) override
void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override
{
switch (widget) {
case WID_Q_YES: {
@ -1174,7 +1174,7 @@ struct QueryWindow : public Window {
}
}
EventState OnKeyPress(char32_t key, uint16_t keycode) override
EventState OnKeyPress([[maybe_unused]] char32_t key, uint16_t keycode) override
{
/* ESC closes the window, Enter confirms the action */
switch (keycode) {

View File

@ -26,7 +26,7 @@ static MIDI *_midi = nullptr;
*/
extern int _allegro_instance_count;
const char *MusicDriver_Allegro::Start(const StringList &param)
const char *MusicDriver_Allegro::Start(const StringList &)
{
if (_allegro_instance_count == 0 && install_allegro(SYSTEM_AUTODETECT, &errno, nullptr)) {
Debug(driver, 0, "allegro: install_allegro failed '{}'", allegro_error);

View File

@ -79,7 +79,7 @@ static void DoSetVolume()
/**
* Initialized the MIDI player, including QuickTime initialization.
*/
const char *MusicDriver_Cocoa::Start(const StringList &parm)
const char *MusicDriver_Cocoa::Start(const StringList &)
{
if (NewMusicPlayer(&_player) != noErr) return "failed to create music player";

View File

@ -565,19 +565,19 @@ static void TransmitStandardSysex(IDirectMusicBuffer *buffer, REFERENCE_TIME rt,
static void TransmitNotesOff(IDirectMusicBuffer *buffer, REFERENCE_TIME block_time, REFERENCE_TIME cur_time)
{
for (int ch = 0; ch < 16; ch++) {
TransmitChannelMsg(_buffer, block_time + 10, MIDIST_CONTROLLER | ch, MIDICT_MODE_ALLNOTESOFF, 0);
TransmitChannelMsg(_buffer, block_time + 10, MIDIST_CONTROLLER | ch, MIDICT_SUSTAINSW, 0);
TransmitChannelMsg(_buffer, block_time + 10, MIDIST_CONTROLLER | ch, MIDICT_MODE_RESETALLCTRL, 0);
TransmitChannelMsg(buffer, block_time + 10, MIDIST_CONTROLLER | ch, MIDICT_MODE_ALLNOTESOFF, 0);
TransmitChannelMsg(buffer, block_time + 10, MIDIST_CONTROLLER | ch, MIDICT_SUSTAINSW, 0);
TransmitChannelMsg(buffer, block_time + 10, MIDIST_CONTROLLER | ch, MIDICT_MODE_RESETALLCTRL, 0);
}
/* Performing a GM reset stops all sound and resets all parameters. */
TransmitStandardSysex(_buffer, block_time + 20, MidiSysexMessage::ResetGM);
TransmitStandardSysex(_buffer, block_time + 30, MidiSysexMessage::RolandSetReverb);
TransmitStandardSysex(buffer, block_time + 20, MidiSysexMessage::ResetGM);
TransmitStandardSysex(buffer, block_time + 30, MidiSysexMessage::RolandSetReverb);
/* Explicitly flush buffer to make sure the messages are processed,
* as we want sound to stop immediately. */
_port->PlayBuffer(_buffer);
_buffer->Flush();
_port->PlayBuffer(buffer);
buffer->Flush();
/* Wait until message time has passed. */
Sleep(Clamp((block_time - cur_time) / MS_TO_REFTIME, 5, 1000));

View File

@ -95,7 +95,7 @@ bool MusicDriver_ExtMidi::IsSongPlaying()
return this->pid != -1;
}
void MusicDriver_ExtMidi::SetVolume(byte vol)
void MusicDriver_ExtMidi::SetVolume(byte)
{
Debug(driver, 1, "extmidi: set volume not implemented");
}

View File

@ -15,17 +15,17 @@
/** The music player that does nothing. */
class MusicDriver_Null : public MusicDriver {
public:
const char *Start(const StringList &param) override { return nullptr; }
const char *Start(const StringList &) override { return nullptr; }
void Stop() override { }
void PlaySong(const MusicSongInfo &song) override { }
void PlaySong(const MusicSongInfo &) override { }
void StopSong() override { }
bool IsSongPlaying() override { return true; }
void SetVolume(byte vol) override { }
void SetVolume(byte) override { }
const char *GetName() const override { return "null"; }
};

View File

@ -59,7 +59,7 @@ static byte ScaleVolume(byte original, byte scale)
}
void CALLBACK MidiOutProc(HMIDIOUT hmo, UINT wMsg, DWORD_PTR dwInstance, DWORD_PTR dwParam1, DWORD_PTR dwParam2)
void CALLBACK MidiOutProc(HMIDIOUT hmo, UINT wMsg, DWORD_PTR, DWORD_PTR dwParam1, DWORD_PTR)
{
if (wMsg == MOM_DONE) {
MIDIHDR *hdr = (LPMIDIHDR)dwParam1;
@ -108,7 +108,7 @@ static void TransmitStandardSysex(MidiSysexMessage msg)
* Realtime MIDI playback service routine.
* This is called by the multimedia timer.
*/
void CALLBACK TimerCallback(UINT uTimerID, UINT, DWORD_PTR dwUser, DWORD_PTR, DWORD_PTR)
void CALLBACK TimerCallback(UINT uTimerID, UINT, DWORD_PTR, DWORD_PTR, DWORD_PTR)
{
/* Ensure only one timer callback is running at once, and prevent races on status flags */
std::unique_lock<std::mutex> mutex_lock(_midi.lock, std::defer_lock);

View File

@ -477,7 +477,7 @@ struct MusicTrackSelectionWindow : public Window {
* @param data Information about the changed data.
* @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details.
*/
void OnInvalidateData(int data = 0, bool gui_scope = true) override
void OnInvalidateData([[maybe_unused]] int data = 0, [[maybe_unused]] bool gui_scope = true) override
{
if (!gui_scope) return;
for (int i = 0; i < 6; i++) {
@ -492,7 +492,7 @@ struct MusicTrackSelectionWindow : public Window {
}
}
void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override
void UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override
{
switch (widget) {
case WID_MTS_PLAYLIST: {
@ -560,7 +560,7 @@ struct MusicTrackSelectionWindow : public Window {
}
}
void OnClick(Point pt, int widget, int click_count) override
void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override
{
switch (widget) {
case WID_MTS_LIST_LEFT: { // add to playlist
@ -674,7 +674,7 @@ struct MusicWindow : public Window {
);
}
void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override
void UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override
{
switch (widget) {
/* Make sure that WID_M_SHUFFLE and WID_M_PROGRAMME have the same size.
@ -763,7 +763,7 @@ struct MusicWindow : public Window {
* @param data Information about the changed data.
* @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details.
*/
void OnInvalidateData(int data = 0, bool gui_scope = true) override
void OnInvalidateData([[maybe_unused]] int data = 0, [[maybe_unused]] bool gui_scope = true) override
{
if (!gui_scope) return;
for (int i = 0; i < 6; i++) {
@ -779,7 +779,7 @@ struct MusicWindow : public Window {
}
}
void OnClick(Point pt, int widget, int click_count) override
void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override
{
switch (widget) {
case WID_M_PREV: // skip to prev

View File

@ -98,10 +98,9 @@ std::string NetworkAddress::GetAddressAsString(bool with_family)
/**
* Helper function to resolve without opening a socket.
* @param runp information about the socket to try not
* @return the opened socket or INVALID_SOCKET
*/
static SOCKET ResolveLoopProc(addrinfo *runp)
static SOCKET ResolveLoopProc(addrinfo *)
{
/* We just want the first 'entry', so return a valid socket. */
return !INVALID_SOCKET;

View File

@ -174,7 +174,7 @@ void HttpThread()
* up to a second before this callback is called. There is little we can
* do about this. */
curl_easy_setopt(curl, CURLOPT_NOPROGRESS, 0L);
curl_easy_setopt(curl, CURLOPT_XFERINFOFUNCTION, +[](void *userdata, curl_off_t dltotal, curl_off_t dlnow, curl_off_t ultotal, curl_off_t ulnow) -> int {
curl_easy_setopt(curl, CURLOPT_XFERINFOFUNCTION, +[](void *userdata, curl_off_t /*dltotal*/, curl_off_t /*dlnow*/, curl_off_t /*ultotal*/, curl_off_t /*ulnow*/) -> int {
const HTTPCallback *callback = static_cast<HTTPCallback *>(userdata);
return (callback->IsCancelled() || _http_thread_exit) ? 1 : 0;
});

View File

@ -18,7 +18,7 @@
#include "../../safeguards.h"
/* static */ void NetworkHTTPSocketHandler::Connect(const std::string &uri, HTTPCallback *callback, const std::string data)
/* static */ void NetworkHTTPSocketHandler::Connect(const std::string &, HTTPCallback *callback, const std::string)
{
/* No valid HTTP backend was compiled in, so we fail all HTTP requests. */
callback->OnFailure();

View File

@ -186,7 +186,7 @@ void NetworkHTTPRequest::WinHttpCallback(DWORD code, void *info, DWORD length)
}
}
static void CALLBACK StaticWinHttpCallback(HINTERNET handle, DWORD_PTR context, DWORD code, void *info, DWORD length)
static void CALLBACK StaticWinHttpCallback(HINTERNET, DWORD_PTR context, DWORD code, void *info, DWORD length)
{
if (context == 0) return;

View File

@ -129,7 +129,7 @@ bool NetworkError::HasError() const
* @param d The socket to set the non-blocking more for.
* @return True if setting the non-blocking mode succeeded, otherwise false.
*/
bool SetNonBlocking(SOCKET d)
bool SetNonBlocking([[maybe_unused]] SOCKET d)
{
#if defined(_WIN32)
u_long nonblocking = 1;
@ -147,7 +147,7 @@ bool SetNonBlocking(SOCKET d)
* @param d The socket to disable the delaying for.
* @return True if disabling the delaying succeeded, otherwise false.
*/
bool SetNoDelay(SOCKET d)
bool SetNoDelay([[maybe_unused]] SOCKET d)
{
#ifdef __EMSCRIPTEN__
return true;

View File

@ -62,7 +62,7 @@ void NetworkTCPSocketHandler::CloseSocket()
* @param error Whether we quit under an error condition or not.
* @return new status of the connection.
*/
NetworkRecvStatus NetworkTCPSocketHandler::CloseConnection(bool error)
NetworkRecvStatus NetworkTCPSocketHandler::CloseConnection([[maybe_unused]] bool error)
{
this->MarkClosed();
this->writable = false;

View File

@ -121,7 +121,7 @@ public:
* Callback when the connection succeeded.
* @param s the socket that we opened
*/
virtual void OnConnect(SOCKET s) {}
virtual void OnConnect([[maybe_unused]] SOCKET s) {}
/**
* Callback for when the connection attempt failed.

View File

@ -32,7 +32,7 @@ NetworkAdminSocketHandler::NetworkAdminSocketHandler(SOCKET s) : status(ADMIN_ST
this->sock = s;
}
NetworkRecvStatus NetworkAdminSocketHandler::CloseConnection(bool error)
NetworkRecvStatus NetworkAdminSocketHandler::CloseConnection(bool)
{
delete this;
return NETWORK_RECV_STATUS_CLIENT_QUIT;
@ -129,40 +129,40 @@ NetworkRecvStatus NetworkAdminSocketHandler::ReceiveInvalidPacket(PacketAdminTyp
return NETWORK_RECV_STATUS_MALFORMED_PACKET;
}
NetworkRecvStatus NetworkAdminSocketHandler::Receive_ADMIN_JOIN(Packet *p) { return this->ReceiveInvalidPacket(ADMIN_PACKET_ADMIN_JOIN); }
NetworkRecvStatus NetworkAdminSocketHandler::Receive_ADMIN_QUIT(Packet *p) { return this->ReceiveInvalidPacket(ADMIN_PACKET_ADMIN_QUIT); }
NetworkRecvStatus NetworkAdminSocketHandler::Receive_ADMIN_UPDATE_FREQUENCY(Packet *p) { return this->ReceiveInvalidPacket(ADMIN_PACKET_ADMIN_UPDATE_FREQUENCY); }
NetworkRecvStatus NetworkAdminSocketHandler::Receive_ADMIN_POLL(Packet *p) { return this->ReceiveInvalidPacket(ADMIN_PACKET_ADMIN_POLL); }
NetworkRecvStatus NetworkAdminSocketHandler::Receive_ADMIN_CHAT(Packet *p) { return this->ReceiveInvalidPacket(ADMIN_PACKET_ADMIN_CHAT); }
NetworkRecvStatus NetworkAdminSocketHandler::Receive_ADMIN_EXTERNAL_CHAT(Packet *p) { return this->ReceiveInvalidPacket(ADMIN_PACKET_ADMIN_EXTERNAL_CHAT); }
NetworkRecvStatus NetworkAdminSocketHandler::Receive_ADMIN_RCON(Packet *p) { return this->ReceiveInvalidPacket(ADMIN_PACKET_ADMIN_RCON); }
NetworkRecvStatus NetworkAdminSocketHandler::Receive_ADMIN_GAMESCRIPT(Packet *p) { return this->ReceiveInvalidPacket(ADMIN_PACKET_ADMIN_GAMESCRIPT); }
NetworkRecvStatus NetworkAdminSocketHandler::Receive_ADMIN_PING(Packet *p) { return this->ReceiveInvalidPacket(ADMIN_PACKET_ADMIN_PING); }
NetworkRecvStatus NetworkAdminSocketHandler::Receive_ADMIN_JOIN(Packet *) { return this->ReceiveInvalidPacket(ADMIN_PACKET_ADMIN_JOIN); }
NetworkRecvStatus NetworkAdminSocketHandler::Receive_ADMIN_QUIT(Packet *) { return this->ReceiveInvalidPacket(ADMIN_PACKET_ADMIN_QUIT); }
NetworkRecvStatus NetworkAdminSocketHandler::Receive_ADMIN_UPDATE_FREQUENCY(Packet *) { return this->ReceiveInvalidPacket(ADMIN_PACKET_ADMIN_UPDATE_FREQUENCY); }
NetworkRecvStatus NetworkAdminSocketHandler::Receive_ADMIN_POLL(Packet *) { return this->ReceiveInvalidPacket(ADMIN_PACKET_ADMIN_POLL); }
NetworkRecvStatus NetworkAdminSocketHandler::Receive_ADMIN_CHAT(Packet *) { return this->ReceiveInvalidPacket(ADMIN_PACKET_ADMIN_CHAT); }
NetworkRecvStatus NetworkAdminSocketHandler::Receive_ADMIN_EXTERNAL_CHAT(Packet *) { return this->ReceiveInvalidPacket(ADMIN_PACKET_ADMIN_EXTERNAL_CHAT); }
NetworkRecvStatus NetworkAdminSocketHandler::Receive_ADMIN_RCON(Packet *) { return this->ReceiveInvalidPacket(ADMIN_PACKET_ADMIN_RCON); }
NetworkRecvStatus NetworkAdminSocketHandler::Receive_ADMIN_GAMESCRIPT(Packet *) { return this->ReceiveInvalidPacket(ADMIN_PACKET_ADMIN_GAMESCRIPT); }
NetworkRecvStatus NetworkAdminSocketHandler::Receive_ADMIN_PING(Packet *) { return this->ReceiveInvalidPacket(ADMIN_PACKET_ADMIN_PING); }
NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_FULL(Packet *p) { return this->ReceiveInvalidPacket(ADMIN_PACKET_SERVER_FULL); }
NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_BANNED(Packet *p) { return this->ReceiveInvalidPacket(ADMIN_PACKET_SERVER_BANNED); }
NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_ERROR(Packet *p) { return this->ReceiveInvalidPacket(ADMIN_PACKET_SERVER_ERROR); }
NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_PROTOCOL(Packet *p) { return this->ReceiveInvalidPacket(ADMIN_PACKET_SERVER_PROTOCOL); }
NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_WELCOME(Packet *p) { return this->ReceiveInvalidPacket(ADMIN_PACKET_SERVER_WELCOME); }
NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_NEWGAME(Packet *p) { return this->ReceiveInvalidPacket(ADMIN_PACKET_SERVER_NEWGAME); }
NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_SHUTDOWN(Packet *p) { return this->ReceiveInvalidPacket(ADMIN_PACKET_SERVER_SHUTDOWN); }
NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_FULL(Packet *) { return this->ReceiveInvalidPacket(ADMIN_PACKET_SERVER_FULL); }
NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_BANNED(Packet *) { return this->ReceiveInvalidPacket(ADMIN_PACKET_SERVER_BANNED); }
NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_ERROR(Packet *) { return this->ReceiveInvalidPacket(ADMIN_PACKET_SERVER_ERROR); }
NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_PROTOCOL(Packet *) { return this->ReceiveInvalidPacket(ADMIN_PACKET_SERVER_PROTOCOL); }
NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_WELCOME(Packet *) { return this->ReceiveInvalidPacket(ADMIN_PACKET_SERVER_WELCOME); }
NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_NEWGAME(Packet *) { return this->ReceiveInvalidPacket(ADMIN_PACKET_SERVER_NEWGAME); }
NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_SHUTDOWN(Packet *) { return this->ReceiveInvalidPacket(ADMIN_PACKET_SERVER_SHUTDOWN); }
NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_DATE(Packet *p) { return this->ReceiveInvalidPacket(ADMIN_PACKET_SERVER_DATE); }
NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_CLIENT_JOIN(Packet *p) { return this->ReceiveInvalidPacket(ADMIN_PACKET_SERVER_CLIENT_JOIN); }
NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_CLIENT_INFO(Packet *p) { return this->ReceiveInvalidPacket(ADMIN_PACKET_SERVER_CLIENT_INFO); }
NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_CLIENT_UPDATE(Packet *p) { return this->ReceiveInvalidPacket(ADMIN_PACKET_SERVER_CLIENT_UPDATE); }
NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_CLIENT_QUIT(Packet *p) { return this->ReceiveInvalidPacket(ADMIN_PACKET_SERVER_CLIENT_QUIT); }
NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_CLIENT_ERROR(Packet *p) { return this->ReceiveInvalidPacket(ADMIN_PACKET_SERVER_CLIENT_ERROR); }
NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_COMPANY_NEW(Packet *p) { return this->ReceiveInvalidPacket(ADMIN_PACKET_SERVER_COMPANY_NEW); }
NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_COMPANY_INFO(Packet *p) { return this->ReceiveInvalidPacket(ADMIN_PACKET_SERVER_COMPANY_INFO); }
NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_COMPANY_UPDATE(Packet *p) { return this->ReceiveInvalidPacket(ADMIN_PACKET_SERVER_COMPANY_UPDATE); }
NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_COMPANY_REMOVE(Packet *p) { return this->ReceiveInvalidPacket(ADMIN_PACKET_SERVER_COMPANY_REMOVE); }
NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_COMPANY_ECONOMY(Packet *p) { return this->ReceiveInvalidPacket(ADMIN_PACKET_SERVER_COMPANY_ECONOMY); }
NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_COMPANY_STATS(Packet *p) { return this->ReceiveInvalidPacket(ADMIN_PACKET_SERVER_COMPANY_STATS); }
NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_CHAT(Packet *p) { return this->ReceiveInvalidPacket(ADMIN_PACKET_SERVER_CHAT); }
NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_RCON(Packet *p) { return this->ReceiveInvalidPacket(ADMIN_PACKET_SERVER_RCON); }
NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_CONSOLE(Packet *p) { return this->ReceiveInvalidPacket(ADMIN_PACKET_SERVER_CONSOLE); }
NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_CMD_NAMES(Packet *p) { return this->ReceiveInvalidPacket(ADMIN_PACKET_SERVER_CMD_NAMES); }
NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_CMD_LOGGING(Packet *p) { return this->ReceiveInvalidPacket(ADMIN_PACKET_SERVER_CMD_LOGGING); }
NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_RCON_END(Packet *p) { return this->ReceiveInvalidPacket(ADMIN_PACKET_SERVER_RCON_END); }
NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_PONG(Packet *p) { return this->ReceiveInvalidPacket(ADMIN_PACKET_SERVER_PONG); }
NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_DATE(Packet *) { return this->ReceiveInvalidPacket(ADMIN_PACKET_SERVER_DATE); }
NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_CLIENT_JOIN(Packet *) { return this->ReceiveInvalidPacket(ADMIN_PACKET_SERVER_CLIENT_JOIN); }
NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_CLIENT_INFO(Packet *) { return this->ReceiveInvalidPacket(ADMIN_PACKET_SERVER_CLIENT_INFO); }
NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_CLIENT_UPDATE(Packet *) { return this->ReceiveInvalidPacket(ADMIN_PACKET_SERVER_CLIENT_UPDATE); }
NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_CLIENT_QUIT(Packet *) { return this->ReceiveInvalidPacket(ADMIN_PACKET_SERVER_CLIENT_QUIT); }
NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_CLIENT_ERROR(Packet *) { return this->ReceiveInvalidPacket(ADMIN_PACKET_SERVER_CLIENT_ERROR); }
NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_COMPANY_NEW(Packet *) { return this->ReceiveInvalidPacket(ADMIN_PACKET_SERVER_COMPANY_NEW); }
NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_COMPANY_INFO(Packet *) { return this->ReceiveInvalidPacket(ADMIN_PACKET_SERVER_COMPANY_INFO); }
NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_COMPANY_UPDATE(Packet *) { return this->ReceiveInvalidPacket(ADMIN_PACKET_SERVER_COMPANY_UPDATE); }
NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_COMPANY_REMOVE(Packet *) { return this->ReceiveInvalidPacket(ADMIN_PACKET_SERVER_COMPANY_REMOVE); }
NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_COMPANY_ECONOMY(Packet *) { return this->ReceiveInvalidPacket(ADMIN_PACKET_SERVER_COMPANY_ECONOMY); }
NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_COMPANY_STATS(Packet *) { return this->ReceiveInvalidPacket(ADMIN_PACKET_SERVER_COMPANY_STATS); }
NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_CHAT(Packet *) { return this->ReceiveInvalidPacket(ADMIN_PACKET_SERVER_CHAT); }
NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_RCON(Packet *) { return this->ReceiveInvalidPacket(ADMIN_PACKET_SERVER_RCON); }
NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_CONSOLE(Packet *) { return this->ReceiveInvalidPacket(ADMIN_PACKET_SERVER_CONSOLE); }
NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_CMD_NAMES(Packet *) { return this->ReceiveInvalidPacket(ADMIN_PACKET_SERVER_CMD_NAMES); }
NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_CMD_LOGGING(Packet *) { return this->ReceiveInvalidPacket(ADMIN_PACKET_SERVER_CMD_LOGGING); }
NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_RCON_END(Packet *) { return this->ReceiveInvalidPacket(ADMIN_PACKET_SERVER_RCON_END); }
NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_PONG(Packet *) { return this->ReceiveInvalidPacket(ADMIN_PACKET_SERVER_PONG); }

View File

@ -170,13 +170,13 @@ bool NetworkContentSocketHandler::ReceiveInvalidPacket(PacketContentType type)
return false;
}
bool NetworkContentSocketHandler::Receive_CLIENT_INFO_LIST(Packet *p) { return this->ReceiveInvalidPacket(PACKET_CONTENT_CLIENT_INFO_LIST); }
bool NetworkContentSocketHandler::Receive_CLIENT_INFO_ID(Packet *p) { return this->ReceiveInvalidPacket(PACKET_CONTENT_CLIENT_INFO_ID); }
bool NetworkContentSocketHandler::Receive_CLIENT_INFO_EXTID(Packet *p) { return this->ReceiveInvalidPacket(PACKET_CONTENT_CLIENT_INFO_EXTID); }
bool NetworkContentSocketHandler::Receive_CLIENT_INFO_EXTID_MD5(Packet *p) { return this->ReceiveInvalidPacket(PACKET_CONTENT_CLIENT_INFO_EXTID_MD5); }
bool NetworkContentSocketHandler::Receive_SERVER_INFO(Packet *p) { return this->ReceiveInvalidPacket(PACKET_CONTENT_SERVER_INFO); }
bool NetworkContentSocketHandler::Receive_CLIENT_CONTENT(Packet *p) { return this->ReceiveInvalidPacket(PACKET_CONTENT_CLIENT_CONTENT); }
bool NetworkContentSocketHandler::Receive_SERVER_CONTENT(Packet *p) { return this->ReceiveInvalidPacket(PACKET_CONTENT_SERVER_CONTENT); }
bool NetworkContentSocketHandler::Receive_CLIENT_INFO_LIST(Packet *) { return this->ReceiveInvalidPacket(PACKET_CONTENT_CLIENT_INFO_LIST); }
bool NetworkContentSocketHandler::Receive_CLIENT_INFO_ID(Packet *) { return this->ReceiveInvalidPacket(PACKET_CONTENT_CLIENT_INFO_ID); }
bool NetworkContentSocketHandler::Receive_CLIENT_INFO_EXTID(Packet *) { return this->ReceiveInvalidPacket(PACKET_CONTENT_CLIENT_INFO_EXTID); }
bool NetworkContentSocketHandler::Receive_CLIENT_INFO_EXTID_MD5(Packet *) { return this->ReceiveInvalidPacket(PACKET_CONTENT_CLIENT_INFO_EXTID_MD5); }
bool NetworkContentSocketHandler::Receive_SERVER_INFO(Packet *) { return this->ReceiveInvalidPacket(PACKET_CONTENT_SERVER_INFO); }
bool NetworkContentSocketHandler::Receive_CLIENT_CONTENT(Packet *) { return this->ReceiveInvalidPacket(PACKET_CONTENT_CLIENT_CONTENT); }
bool NetworkContentSocketHandler::Receive_SERVER_CONTENT(Packet *) { return this->ReceiveInvalidPacket(PACKET_CONTENT_SERVER_CONTENT); }
/**
* Helper to get the subdirectory a #ContentInfo is located in.

View File

@ -87,20 +87,20 @@ bool NetworkCoordinatorSocketHandler::ReceiveInvalidPacket(PacketCoordinatorType
return false;
}
bool NetworkCoordinatorSocketHandler::Receive_GC_ERROR(Packet *p) { return this->ReceiveInvalidPacket(PACKET_COORDINATOR_GC_ERROR); }
bool NetworkCoordinatorSocketHandler::Receive_SERVER_REGISTER(Packet *p) { return this->ReceiveInvalidPacket(PACKET_COORDINATOR_SERVER_REGISTER); }
bool NetworkCoordinatorSocketHandler::Receive_GC_REGISTER_ACK(Packet *p) { return this->ReceiveInvalidPacket(PACKET_COORDINATOR_GC_REGISTER_ACK); }
bool NetworkCoordinatorSocketHandler::Receive_SERVER_UPDATE(Packet *p) { return this->ReceiveInvalidPacket(PACKET_COORDINATOR_SERVER_UPDATE); }
bool NetworkCoordinatorSocketHandler::Receive_CLIENT_LISTING(Packet *p) { return this->ReceiveInvalidPacket(PACKET_COORDINATOR_CLIENT_LISTING); }
bool NetworkCoordinatorSocketHandler::Receive_GC_LISTING(Packet *p) { return this->ReceiveInvalidPacket(PACKET_COORDINATOR_GC_LISTING); }
bool NetworkCoordinatorSocketHandler::Receive_CLIENT_CONNECT(Packet *p) { return this->ReceiveInvalidPacket(PACKET_COORDINATOR_CLIENT_CONNECT); }
bool NetworkCoordinatorSocketHandler::Receive_GC_CONNECTING(Packet *p) { return this->ReceiveInvalidPacket(PACKET_COORDINATOR_GC_CONNECTING); }
bool NetworkCoordinatorSocketHandler::Receive_SERCLI_CONNECT_FAILED(Packet *p) { return this->ReceiveInvalidPacket(PACKET_COORDINATOR_SERCLI_CONNECT_FAILED); }
bool NetworkCoordinatorSocketHandler::Receive_GC_CONNECT_FAILED(Packet *p) { return this->ReceiveInvalidPacket(PACKET_COORDINATOR_GC_CONNECT_FAILED); }
bool NetworkCoordinatorSocketHandler::Receive_CLIENT_CONNECTED(Packet *p) { return this->ReceiveInvalidPacket(PACKET_COORDINATOR_CLIENT_CONNECTED); }
bool NetworkCoordinatorSocketHandler::Receive_GC_DIRECT_CONNECT(Packet *p) { return this->ReceiveInvalidPacket(PACKET_COORDINATOR_GC_DIRECT_CONNECT); }
bool NetworkCoordinatorSocketHandler::Receive_GC_STUN_REQUEST(Packet *p) { return this->ReceiveInvalidPacket(PACKET_COORDINATOR_GC_STUN_REQUEST); }
bool NetworkCoordinatorSocketHandler::Receive_SERCLI_STUN_RESULT(Packet *p) { return this->ReceiveInvalidPacket(PACKET_COORDINATOR_SERCLI_STUN_RESULT); }
bool NetworkCoordinatorSocketHandler::Receive_GC_STUN_CONNECT(Packet *p) { return this->ReceiveInvalidPacket(PACKET_COORDINATOR_GC_STUN_CONNECT); }
bool NetworkCoordinatorSocketHandler::Receive_GC_NEWGRF_LOOKUP(Packet *p) { return this->ReceiveInvalidPacket(PACKET_COORDINATOR_GC_NEWGRF_LOOKUP); }
bool NetworkCoordinatorSocketHandler::Receive_GC_TURN_CONNECT(Packet *p) { return this->ReceiveInvalidPacket(PACKET_COORDINATOR_GC_TURN_CONNECT); }
bool NetworkCoordinatorSocketHandler::Receive_GC_ERROR(Packet *) { return this->ReceiveInvalidPacket(PACKET_COORDINATOR_GC_ERROR); }
bool NetworkCoordinatorSocketHandler::Receive_SERVER_REGISTER(Packet *) { return this->ReceiveInvalidPacket(PACKET_COORDINATOR_SERVER_REGISTER); }
bool NetworkCoordinatorSocketHandler::Receive_GC_REGISTER_ACK(Packet *) { return this->ReceiveInvalidPacket(PACKET_COORDINATOR_GC_REGISTER_ACK); }
bool NetworkCoordinatorSocketHandler::Receive_SERVER_UPDATE(Packet *) { return this->ReceiveInvalidPacket(PACKET_COORDINATOR_SERVER_UPDATE); }
bool NetworkCoordinatorSocketHandler::Receive_CLIENT_LISTING(Packet *) { return this->ReceiveInvalidPacket(PACKET_COORDINATOR_CLIENT_LISTING); }
bool NetworkCoordinatorSocketHandler::Receive_GC_LISTING(Packet *) { return this->ReceiveInvalidPacket(PACKET_COORDINATOR_GC_LISTING); }
bool NetworkCoordinatorSocketHandler::Receive_CLIENT_CONNECT(Packet *) { return this->ReceiveInvalidPacket(PACKET_COORDINATOR_CLIENT_CONNECT); }
bool NetworkCoordinatorSocketHandler::Receive_GC_CONNECTING(Packet *) { return this->ReceiveInvalidPacket(PACKET_COORDINATOR_GC_CONNECTING); }
bool NetworkCoordinatorSocketHandler::Receive_SERCLI_CONNECT_FAILED(Packet *) { return this->ReceiveInvalidPacket(PACKET_COORDINATOR_SERCLI_CONNECT_FAILED); }
bool NetworkCoordinatorSocketHandler::Receive_GC_CONNECT_FAILED(Packet *) { return this->ReceiveInvalidPacket(PACKET_COORDINATOR_GC_CONNECT_FAILED); }
bool NetworkCoordinatorSocketHandler::Receive_CLIENT_CONNECTED(Packet *) { return this->ReceiveInvalidPacket(PACKET_COORDINATOR_CLIENT_CONNECTED); }
bool NetworkCoordinatorSocketHandler::Receive_GC_DIRECT_CONNECT(Packet *) { return this->ReceiveInvalidPacket(PACKET_COORDINATOR_GC_DIRECT_CONNECT); }
bool NetworkCoordinatorSocketHandler::Receive_GC_STUN_REQUEST(Packet *) { return this->ReceiveInvalidPacket(PACKET_COORDINATOR_GC_STUN_REQUEST); }
bool NetworkCoordinatorSocketHandler::Receive_SERCLI_STUN_RESULT(Packet *) { return this->ReceiveInvalidPacket(PACKET_COORDINATOR_SERCLI_STUN_RESULT); }
bool NetworkCoordinatorSocketHandler::Receive_GC_STUN_CONNECT(Packet *) { return this->ReceiveInvalidPacket(PACKET_COORDINATOR_GC_STUN_CONNECT); }
bool NetworkCoordinatorSocketHandler::Receive_GC_NEWGRF_LOOKUP(Packet *) { return this->ReceiveInvalidPacket(PACKET_COORDINATOR_GC_NEWGRF_LOOKUP); }
bool NetworkCoordinatorSocketHandler::Receive_GC_TURN_CONNECT(Packet *) { return this->ReceiveInvalidPacket(PACKET_COORDINATOR_GC_TURN_CONNECT); }

View File

@ -40,7 +40,7 @@ NetworkGameSocketHandler::NetworkGameSocketHandler(SOCKET s) : info(nullptr), cl
* For servers: close connection and that is it
* @return the new status
*/
NetworkRecvStatus NetworkGameSocketHandler::CloseConnection(bool error)
NetworkRecvStatus NetworkGameSocketHandler::CloseConnection(bool)
{
/* Clients drop back to the main menu */
if (!_network_server && _networking) {
@ -156,50 +156,50 @@ NetworkRecvStatus NetworkGameSocketHandler::ReceiveInvalidPacket(PacketGameType
return NETWORK_RECV_STATUS_MALFORMED_PACKET;
}
NetworkRecvStatus NetworkGameSocketHandler::Receive_SERVER_FULL(Packet *p) { return this->ReceiveInvalidPacket(PACKET_SERVER_FULL); }
NetworkRecvStatus NetworkGameSocketHandler::Receive_SERVER_BANNED(Packet *p) { return this->ReceiveInvalidPacket(PACKET_SERVER_BANNED); }
NetworkRecvStatus NetworkGameSocketHandler::Receive_CLIENT_JOIN(Packet *p) { return this->ReceiveInvalidPacket(PACKET_CLIENT_JOIN); }
NetworkRecvStatus NetworkGameSocketHandler::Receive_SERVER_ERROR(Packet *p) { return this->ReceiveInvalidPacket(PACKET_SERVER_ERROR); }
NetworkRecvStatus NetworkGameSocketHandler::Receive_CLIENT_GAME_INFO(Packet *p) { return this->ReceiveInvalidPacket(PACKET_CLIENT_GAME_INFO); }
NetworkRecvStatus NetworkGameSocketHandler::Receive_SERVER_GAME_INFO(Packet *p) { return this->ReceiveInvalidPacket(PACKET_SERVER_GAME_INFO); }
NetworkRecvStatus NetworkGameSocketHandler::Receive_SERVER_CLIENT_INFO(Packet *p) { return this->ReceiveInvalidPacket(PACKET_SERVER_CLIENT_INFO); }
NetworkRecvStatus NetworkGameSocketHandler::Receive_SERVER_NEED_GAME_PASSWORD(Packet *p) { return this->ReceiveInvalidPacket(PACKET_SERVER_NEED_GAME_PASSWORD); }
NetworkRecvStatus NetworkGameSocketHandler::Receive_SERVER_NEED_COMPANY_PASSWORD(Packet *p) { return this->ReceiveInvalidPacket(PACKET_SERVER_NEED_COMPANY_PASSWORD); }
NetworkRecvStatus NetworkGameSocketHandler::Receive_CLIENT_GAME_PASSWORD(Packet *p) { return this->ReceiveInvalidPacket(PACKET_CLIENT_GAME_PASSWORD); }
NetworkRecvStatus NetworkGameSocketHandler::Receive_CLIENT_COMPANY_PASSWORD(Packet *p) { return this->ReceiveInvalidPacket(PACKET_CLIENT_COMPANY_PASSWORD); }
NetworkRecvStatus NetworkGameSocketHandler::Receive_SERVER_WELCOME(Packet *p) { return this->ReceiveInvalidPacket(PACKET_SERVER_WELCOME); }
NetworkRecvStatus NetworkGameSocketHandler::Receive_CLIENT_GETMAP(Packet *p) { return this->ReceiveInvalidPacket(PACKET_CLIENT_GETMAP); }
NetworkRecvStatus NetworkGameSocketHandler::Receive_SERVER_WAIT(Packet *p) { return this->ReceiveInvalidPacket(PACKET_SERVER_WAIT); }
NetworkRecvStatus NetworkGameSocketHandler::Receive_SERVER_MAP_BEGIN(Packet *p) { return this->ReceiveInvalidPacket(PACKET_SERVER_MAP_BEGIN); }
NetworkRecvStatus NetworkGameSocketHandler::Receive_SERVER_MAP_SIZE(Packet *p) { return this->ReceiveInvalidPacket(PACKET_SERVER_MAP_SIZE); }
NetworkRecvStatus NetworkGameSocketHandler::Receive_SERVER_MAP_DATA(Packet *p) { return this->ReceiveInvalidPacket(PACKET_SERVER_MAP_DATA); }
NetworkRecvStatus NetworkGameSocketHandler::Receive_SERVER_MAP_DONE(Packet *p) { return this->ReceiveInvalidPacket(PACKET_SERVER_MAP_DONE); }
NetworkRecvStatus NetworkGameSocketHandler::Receive_CLIENT_MAP_OK(Packet *p) { return this->ReceiveInvalidPacket(PACKET_CLIENT_MAP_OK); }
NetworkRecvStatus NetworkGameSocketHandler::Receive_SERVER_JOIN(Packet *p) { return this->ReceiveInvalidPacket(PACKET_SERVER_JOIN); }
NetworkRecvStatus NetworkGameSocketHandler::Receive_SERVER_FRAME(Packet *p) { return this->ReceiveInvalidPacket(PACKET_SERVER_FRAME); }
NetworkRecvStatus NetworkGameSocketHandler::Receive_SERVER_SYNC(Packet *p) { return this->ReceiveInvalidPacket(PACKET_SERVER_SYNC); }
NetworkRecvStatus NetworkGameSocketHandler::Receive_CLIENT_ACK(Packet *p) { return this->ReceiveInvalidPacket(PACKET_CLIENT_ACK); }
NetworkRecvStatus NetworkGameSocketHandler::Receive_CLIENT_COMMAND(Packet *p) { return this->ReceiveInvalidPacket(PACKET_CLIENT_COMMAND); }
NetworkRecvStatus NetworkGameSocketHandler::Receive_SERVER_COMMAND(Packet *p) { return this->ReceiveInvalidPacket(PACKET_SERVER_COMMAND); }
NetworkRecvStatus NetworkGameSocketHandler::Receive_CLIENT_CHAT(Packet *p) { return this->ReceiveInvalidPacket(PACKET_CLIENT_CHAT); }
NetworkRecvStatus NetworkGameSocketHandler::Receive_SERVER_CHAT(Packet *p) { return this->ReceiveInvalidPacket(PACKET_SERVER_CHAT); }
NetworkRecvStatus NetworkGameSocketHandler::Receive_SERVER_EXTERNAL_CHAT(Packet *p) { return this->ReceiveInvalidPacket(PACKET_SERVER_EXTERNAL_CHAT); }
NetworkRecvStatus NetworkGameSocketHandler::Receive_CLIENT_SET_PASSWORD(Packet *p) { return this->ReceiveInvalidPacket(PACKET_CLIENT_SET_PASSWORD); }
NetworkRecvStatus NetworkGameSocketHandler::Receive_CLIENT_SET_NAME(Packet *p) { return this->ReceiveInvalidPacket(PACKET_CLIENT_SET_NAME); }
NetworkRecvStatus NetworkGameSocketHandler::Receive_CLIENT_QUIT(Packet *p) { return this->ReceiveInvalidPacket(PACKET_CLIENT_QUIT); }
NetworkRecvStatus NetworkGameSocketHandler::Receive_CLIENT_ERROR(Packet *p) { return this->ReceiveInvalidPacket(PACKET_CLIENT_ERROR); }
NetworkRecvStatus NetworkGameSocketHandler::Receive_SERVER_QUIT(Packet *p) { return this->ReceiveInvalidPacket(PACKET_SERVER_QUIT); }
NetworkRecvStatus NetworkGameSocketHandler::Receive_SERVER_ERROR_QUIT(Packet *p) { return this->ReceiveInvalidPacket(PACKET_SERVER_ERROR_QUIT); }
NetworkRecvStatus NetworkGameSocketHandler::Receive_SERVER_SHUTDOWN(Packet *p) { return this->ReceiveInvalidPacket(PACKET_SERVER_SHUTDOWN); }
NetworkRecvStatus NetworkGameSocketHandler::Receive_SERVER_NEWGAME(Packet *p) { return this->ReceiveInvalidPacket(PACKET_SERVER_NEWGAME); }
NetworkRecvStatus NetworkGameSocketHandler::Receive_SERVER_RCON(Packet *p) { return this->ReceiveInvalidPacket(PACKET_SERVER_RCON); }
NetworkRecvStatus NetworkGameSocketHandler::Receive_CLIENT_RCON(Packet *p) { return this->ReceiveInvalidPacket(PACKET_CLIENT_RCON); }
NetworkRecvStatus NetworkGameSocketHandler::Receive_SERVER_CHECK_NEWGRFS(Packet *p) { return this->ReceiveInvalidPacket(PACKET_SERVER_CHECK_NEWGRFS); }
NetworkRecvStatus NetworkGameSocketHandler::Receive_CLIENT_NEWGRFS_CHECKED(Packet *p) { return this->ReceiveInvalidPacket(PACKET_CLIENT_NEWGRFS_CHECKED); }
NetworkRecvStatus NetworkGameSocketHandler::Receive_SERVER_MOVE(Packet *p) { return this->ReceiveInvalidPacket(PACKET_SERVER_MOVE); }
NetworkRecvStatus NetworkGameSocketHandler::Receive_CLIENT_MOVE(Packet *p) { return this->ReceiveInvalidPacket(PACKET_CLIENT_MOVE); }
NetworkRecvStatus NetworkGameSocketHandler::Receive_SERVER_COMPANY_UPDATE(Packet *p) { return this->ReceiveInvalidPacket(PACKET_SERVER_COMPANY_UPDATE); }
NetworkRecvStatus NetworkGameSocketHandler::Receive_SERVER_CONFIG_UPDATE(Packet *p) { return this->ReceiveInvalidPacket(PACKET_SERVER_CONFIG_UPDATE); }
NetworkRecvStatus NetworkGameSocketHandler::Receive_SERVER_FULL(Packet *) { return this->ReceiveInvalidPacket(PACKET_SERVER_FULL); }
NetworkRecvStatus NetworkGameSocketHandler::Receive_SERVER_BANNED(Packet *) { return this->ReceiveInvalidPacket(PACKET_SERVER_BANNED); }
NetworkRecvStatus NetworkGameSocketHandler::Receive_CLIENT_JOIN(Packet *) { return this->ReceiveInvalidPacket(PACKET_CLIENT_JOIN); }
NetworkRecvStatus NetworkGameSocketHandler::Receive_SERVER_ERROR(Packet *) { return this->ReceiveInvalidPacket(PACKET_SERVER_ERROR); }
NetworkRecvStatus NetworkGameSocketHandler::Receive_CLIENT_GAME_INFO(Packet *) { return this->ReceiveInvalidPacket(PACKET_CLIENT_GAME_INFO); }
NetworkRecvStatus NetworkGameSocketHandler::Receive_SERVER_GAME_INFO(Packet *) { return this->ReceiveInvalidPacket(PACKET_SERVER_GAME_INFO); }
NetworkRecvStatus NetworkGameSocketHandler::Receive_SERVER_CLIENT_INFO(Packet *) { return this->ReceiveInvalidPacket(PACKET_SERVER_CLIENT_INFO); }
NetworkRecvStatus NetworkGameSocketHandler::Receive_SERVER_NEED_GAME_PASSWORD(Packet *) { return this->ReceiveInvalidPacket(PACKET_SERVER_NEED_GAME_PASSWORD); }
NetworkRecvStatus NetworkGameSocketHandler::Receive_SERVER_NEED_COMPANY_PASSWORD(Packet *) { return this->ReceiveInvalidPacket(PACKET_SERVER_NEED_COMPANY_PASSWORD); }
NetworkRecvStatus NetworkGameSocketHandler::Receive_CLIENT_GAME_PASSWORD(Packet *) { return this->ReceiveInvalidPacket(PACKET_CLIENT_GAME_PASSWORD); }
NetworkRecvStatus NetworkGameSocketHandler::Receive_CLIENT_COMPANY_PASSWORD(Packet *) { return this->ReceiveInvalidPacket(PACKET_CLIENT_COMPANY_PASSWORD); }
NetworkRecvStatus NetworkGameSocketHandler::Receive_SERVER_WELCOME(Packet *) { return this->ReceiveInvalidPacket(PACKET_SERVER_WELCOME); }
NetworkRecvStatus NetworkGameSocketHandler::Receive_CLIENT_GETMAP(Packet *) { return this->ReceiveInvalidPacket(PACKET_CLIENT_GETMAP); }
NetworkRecvStatus NetworkGameSocketHandler::Receive_SERVER_WAIT(Packet *) { return this->ReceiveInvalidPacket(PACKET_SERVER_WAIT); }
NetworkRecvStatus NetworkGameSocketHandler::Receive_SERVER_MAP_BEGIN(Packet *) { return this->ReceiveInvalidPacket(PACKET_SERVER_MAP_BEGIN); }
NetworkRecvStatus NetworkGameSocketHandler::Receive_SERVER_MAP_SIZE(Packet *) { return this->ReceiveInvalidPacket(PACKET_SERVER_MAP_SIZE); }
NetworkRecvStatus NetworkGameSocketHandler::Receive_SERVER_MAP_DATA(Packet *) { return this->ReceiveInvalidPacket(PACKET_SERVER_MAP_DATA); }
NetworkRecvStatus NetworkGameSocketHandler::Receive_SERVER_MAP_DONE(Packet *) { return this->ReceiveInvalidPacket(PACKET_SERVER_MAP_DONE); }
NetworkRecvStatus NetworkGameSocketHandler::Receive_CLIENT_MAP_OK(Packet *) { return this->ReceiveInvalidPacket(PACKET_CLIENT_MAP_OK); }
NetworkRecvStatus NetworkGameSocketHandler::Receive_SERVER_JOIN(Packet *) { return this->ReceiveInvalidPacket(PACKET_SERVER_JOIN); }
NetworkRecvStatus NetworkGameSocketHandler::Receive_SERVER_FRAME(Packet *) { return this->ReceiveInvalidPacket(PACKET_SERVER_FRAME); }
NetworkRecvStatus NetworkGameSocketHandler::Receive_SERVER_SYNC(Packet *) { return this->ReceiveInvalidPacket(PACKET_SERVER_SYNC); }
NetworkRecvStatus NetworkGameSocketHandler::Receive_CLIENT_ACK(Packet *) { return this->ReceiveInvalidPacket(PACKET_CLIENT_ACK); }
NetworkRecvStatus NetworkGameSocketHandler::Receive_CLIENT_COMMAND(Packet *) { return this->ReceiveInvalidPacket(PACKET_CLIENT_COMMAND); }
NetworkRecvStatus NetworkGameSocketHandler::Receive_SERVER_COMMAND(Packet *) { return this->ReceiveInvalidPacket(PACKET_SERVER_COMMAND); }
NetworkRecvStatus NetworkGameSocketHandler::Receive_CLIENT_CHAT(Packet *) { return this->ReceiveInvalidPacket(PACKET_CLIENT_CHAT); }
NetworkRecvStatus NetworkGameSocketHandler::Receive_SERVER_CHAT(Packet *) { return this->ReceiveInvalidPacket(PACKET_SERVER_CHAT); }
NetworkRecvStatus NetworkGameSocketHandler::Receive_SERVER_EXTERNAL_CHAT(Packet *) { return this->ReceiveInvalidPacket(PACKET_SERVER_EXTERNAL_CHAT); }
NetworkRecvStatus NetworkGameSocketHandler::Receive_CLIENT_SET_PASSWORD(Packet *) { return this->ReceiveInvalidPacket(PACKET_CLIENT_SET_PASSWORD); }
NetworkRecvStatus NetworkGameSocketHandler::Receive_CLIENT_SET_NAME(Packet *) { return this->ReceiveInvalidPacket(PACKET_CLIENT_SET_NAME); }
NetworkRecvStatus NetworkGameSocketHandler::Receive_CLIENT_QUIT(Packet *) { return this->ReceiveInvalidPacket(PACKET_CLIENT_QUIT); }
NetworkRecvStatus NetworkGameSocketHandler::Receive_CLIENT_ERROR(Packet *) { return this->ReceiveInvalidPacket(PACKET_CLIENT_ERROR); }
NetworkRecvStatus NetworkGameSocketHandler::Receive_SERVER_QUIT(Packet *) { return this->ReceiveInvalidPacket(PACKET_SERVER_QUIT); }
NetworkRecvStatus NetworkGameSocketHandler::Receive_SERVER_ERROR_QUIT(Packet *) { return this->ReceiveInvalidPacket(PACKET_SERVER_ERROR_QUIT); }
NetworkRecvStatus NetworkGameSocketHandler::Receive_SERVER_SHUTDOWN(Packet *) { return this->ReceiveInvalidPacket(PACKET_SERVER_SHUTDOWN); }
NetworkRecvStatus NetworkGameSocketHandler::Receive_SERVER_NEWGAME(Packet *) { return this->ReceiveInvalidPacket(PACKET_SERVER_NEWGAME); }
NetworkRecvStatus NetworkGameSocketHandler::Receive_SERVER_RCON(Packet *) { return this->ReceiveInvalidPacket(PACKET_SERVER_RCON); }
NetworkRecvStatus NetworkGameSocketHandler::Receive_CLIENT_RCON(Packet *) { return this->ReceiveInvalidPacket(PACKET_CLIENT_RCON); }
NetworkRecvStatus NetworkGameSocketHandler::Receive_SERVER_CHECK_NEWGRFS(Packet *) { return this->ReceiveInvalidPacket(PACKET_SERVER_CHECK_NEWGRFS); }
NetworkRecvStatus NetworkGameSocketHandler::Receive_CLIENT_NEWGRFS_CHECKED(Packet *) { return this->ReceiveInvalidPacket(PACKET_CLIENT_NEWGRFS_CHECKED); }
NetworkRecvStatus NetworkGameSocketHandler::Receive_SERVER_MOVE(Packet *) { return this->ReceiveInvalidPacket(PACKET_SERVER_MOVE); }
NetworkRecvStatus NetworkGameSocketHandler::Receive_CLIENT_MOVE(Packet *) { return this->ReceiveInvalidPacket(PACKET_CLIENT_MOVE); }
NetworkRecvStatus NetworkGameSocketHandler::Receive_SERVER_COMPANY_UPDATE(Packet *) { return this->ReceiveInvalidPacket(PACKET_SERVER_COMPANY_UPDATE); }
NetworkRecvStatus NetworkGameSocketHandler::Receive_SERVER_CONFIG_UPDATE(Packet *) { return this->ReceiveInvalidPacket(PACKET_SERVER_CONFIG_UPDATE); }
void NetworkGameSocketHandler::DeferDeletion()
{

View File

@ -26,4 +26,4 @@ bool NetworkStunSocketHandler::ReceiveInvalidPacket(PacketStunType type)
return false;
}
bool NetworkStunSocketHandler::Receive_SERCLI_STUN(Packet *p) { return this->ReceiveInvalidPacket(PACKET_STUN_SERCLI_STUN); }
bool NetworkStunSocketHandler::Receive_SERCLI_STUN(Packet *) { return this->ReceiveInvalidPacket(PACKET_STUN_SERCLI_STUN); }

View File

@ -66,6 +66,6 @@ bool NetworkTurnSocketHandler::ReceiveInvalidPacket(PacketTurnType type)
return false;
}
bool NetworkTurnSocketHandler::Receive_TURN_ERROR(Packet *p) { return this->ReceiveInvalidPacket(PACKET_TURN_TURN_ERROR); }
bool NetworkTurnSocketHandler::Receive_SERCLI_CONNECT(Packet *p) { return this->ReceiveInvalidPacket(PACKET_TURN_SERCLI_CONNECT); }
bool NetworkTurnSocketHandler::Receive_TURN_CONNECTED(Packet *p) { return this->ReceiveInvalidPacket(PACKET_TURN_TURN_CONNECTED); }
bool NetworkTurnSocketHandler::Receive_TURN_ERROR(Packet *) { return this->ReceiveInvalidPacket(PACKET_TURN_TURN_ERROR); }
bool NetworkTurnSocketHandler::Receive_SERCLI_CONNECT(Packet *) { return this->ReceiveInvalidPacket(PACKET_TURN_SERCLI_CONNECT); }
bool NetworkTurnSocketHandler::Receive_TURN_CONNECTED(Packet *) { return this->ReceiveInvalidPacket(PACKET_TURN_TURN_CONNECTED); }

View File

@ -183,5 +183,5 @@ void NetworkUDPSocketHandler::ReceiveInvalidPacket(PacketUDPType type, NetworkAd
Debug(net, 0, "[udp] Received packet type {} on wrong port from {}", type, client_addr->GetAddressAsString());
}
void NetworkUDPSocketHandler::Receive_CLIENT_FIND_SERVER(Packet *p, NetworkAddress *client_addr) { this->ReceiveInvalidPacket(PACKET_UDP_CLIENT_FIND_SERVER, client_addr); }
void NetworkUDPSocketHandler::Receive_SERVER_RESPONSE(Packet *p, NetworkAddress *client_addr) { this->ReceiveInvalidPacket(PACKET_UDP_SERVER_RESPONSE, client_addr); }
void NetworkUDPSocketHandler::Receive_CLIENT_FIND_SERVER(Packet *, NetworkAddress *client_addr) { this->ReceiveInvalidPacket(PACKET_UDP_CLIENT_FIND_SERVER, client_addr); }
void NetworkUDPSocketHandler::Receive_SERVER_RESPONSE(Packet *, NetworkAddress *client_addr) { this->ReceiveInvalidPacket(PACKET_UDP_SERVER_RESPONSE, client_addr); }

View File

@ -870,7 +870,7 @@ bool NetworkServerStart()
/* Check for the client and server names to be set, but only after the scripts had a chance to set them.*/
if (_network_dedicated) CheckClientAndServerName();
NetworkDisconnect(false, false);
NetworkDisconnect(false);
NetworkInitialize(false);
NetworkUDPInitialize();
Debug(net, 5, "Starting listeners for clients");
@ -938,10 +938,9 @@ void NetworkReboot()
/**
* We want to disconnect from the host/clients.
* @param blocking whether to wait till everything has been closed.
* @param close_admins Whether the admin sockets need to be closed as well.
*/
void NetworkDisconnect(bool blocking, bool close_admins)
void NetworkDisconnect(bool close_admins)
{
if (_network_server) {
for (NetworkClientSocket *cs : NetworkClientSocket::Iterate()) {
@ -1263,7 +1262,7 @@ void NetworkStartUp()
/** This shuts the network down */
void NetworkShutDown()
{
NetworkDisconnect(true);
NetworkDisconnect();
NetworkHTTPUninitialize();
NetworkUDPClose();

View File

@ -654,7 +654,7 @@ NetworkRecvStatus ServerNetworkAdminSocketHandler::Receive_ADMIN_JOIN(Packet *p)
return this->SendProtocol();
}
NetworkRecvStatus ServerNetworkAdminSocketHandler::Receive_ADMIN_QUIT(Packet *p)
NetworkRecvStatus ServerNetworkAdminSocketHandler::Receive_ADMIN_QUIT(Packet *)
{
/* The admin is leaving nothing else to do */
return this->CloseConnection();

View File

@ -308,7 +308,7 @@ struct NetworkChatWindow : public Window {
this->Window::Close();
}
void FindWindowPlacementAndResize(int def_width, int def_height) override
void FindWindowPlacementAndResize([[maybe_unused]] int def_width, [[maybe_unused]] int def_height) override
{
Window::FindWindowPlacementAndResize(_toolbar_width, def_height);
}
@ -436,7 +436,7 @@ struct NetworkChatWindow : public Window {
}
}
Point OnInitialPosition(int16_t sm_width, int16_t sm_height, int window_number) override
Point OnInitialPosition([[maybe_unused]] int16_t sm_width, [[maybe_unused]] int16_t sm_height, [[maybe_unused]] int window_number) override
{
Point pt = { 0, _screen.height - sm_height - FindWindowById(WC_STATUS_BAR, 0)->height };
return pt;
@ -451,7 +451,7 @@ struct NetworkChatWindow : public Window {
}
}
void OnClick(Point pt, int widget, int click_count) override
void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override
{
switch (widget) {
case WID_NC_SENDBUTTON: /* Send */
@ -464,7 +464,7 @@ struct NetworkChatWindow : public Window {
}
}
EventState OnKeyPress(char32_t key, uint16_t keycode) override
EventState OnKeyPress([[maybe_unused]] char32_t key, uint16_t keycode) override
{
EventState state = ES_NOT_HANDLED;
if (keycode == WKC_TAB) {
@ -474,9 +474,11 @@ struct NetworkChatWindow : public Window {
return state;
}
void OnEditboxChanged(int wid) override
void OnEditboxChanged(int widget) override
{
_chat_tab_completion_active = false;
if (widget == WID_NC_TEXTBOX) {
_chat_tab_completion_active = false;
}
}
/**
@ -484,7 +486,7 @@ struct NetworkChatWindow : public Window {
* @param data Information about the changed data.
* @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details.
*/
void OnInvalidateData(int data = 0, bool gui_scope = true) override
void OnInvalidateData([[maybe_unused]] int data = 0, [[maybe_unused]] bool gui_scope = true) override
{
if (data == this->dest) this->Close();
}

View File

@ -534,7 +534,7 @@ bool ClientNetworkGameSocketHandler::IsConnected()
extern bool SafeLoad(const std::string &filename, SaveLoadOperation fop, DetailedFileType dft, GameMode newgm, Subdirectory subdir, struct LoadFilter *lf = nullptr);
NetworkRecvStatus ClientNetworkGameSocketHandler::Receive_SERVER_FULL(Packet *p)
NetworkRecvStatus ClientNetworkGameSocketHandler::Receive_SERVER_FULL(Packet *)
{
/* We try to join a server which is full */
ShowErrorMessage(STR_NETWORK_ERROR_SERVER_FULL, INVALID_STRING_ID, WL_CRITICAL);
@ -542,7 +542,7 @@ NetworkRecvStatus ClientNetworkGameSocketHandler::Receive_SERVER_FULL(Packet *p)
return NETWORK_RECV_STATUS_SERVER_FULL;
}
NetworkRecvStatus ClientNetworkGameSocketHandler::Receive_SERVER_BANNED(Packet *p)
NetworkRecvStatus ClientNetworkGameSocketHandler::Receive_SERVER_BANNED(Packet *)
{
/* We try to join a server where we are banned */
ShowErrorMessage(STR_NETWORK_ERROR_SERVER_BANNED, INVALID_STRING_ID, WL_CRITICAL);
@ -685,7 +685,7 @@ NetworkRecvStatus ClientNetworkGameSocketHandler::Receive_SERVER_CHECK_NEWGRFS(P
return ret;
}
NetworkRecvStatus ClientNetworkGameSocketHandler::Receive_SERVER_NEED_GAME_PASSWORD(Packet *p)
NetworkRecvStatus ClientNetworkGameSocketHandler::Receive_SERVER_NEED_GAME_PASSWORD(Packet *)
{
if (this->status < STATUS_JOIN || this->status >= STATUS_AUTH_GAME) return NETWORK_RECV_STATUS_MALFORMED_PACKET;
this->status = STATUS_AUTH_GAME;
@ -790,7 +790,7 @@ NetworkRecvStatus ClientNetworkGameSocketHandler::Receive_SERVER_MAP_DATA(Packet
return NETWORK_RECV_STATUS_OKAY;
}
NetworkRecvStatus ClientNetworkGameSocketHandler::Receive_SERVER_MAP_DONE(Packet *p)
NetworkRecvStatus ClientNetworkGameSocketHandler::Receive_SERVER_MAP_DONE(Packet *)
{
if (this->status != STATUS_MAP) return NETWORK_RECV_STATUS_MALFORMED_PACKET;
if (this->savegame == nullptr) return NETWORK_RECV_STATUS_MALFORMED_PACKET;
@ -1035,7 +1035,7 @@ NetworkRecvStatus ClientNetworkGameSocketHandler::Receive_SERVER_JOIN(Packet *p)
return NETWORK_RECV_STATUS_OKAY;
}
NetworkRecvStatus ClientNetworkGameSocketHandler::Receive_SERVER_SHUTDOWN(Packet *p)
NetworkRecvStatus ClientNetworkGameSocketHandler::Receive_SERVER_SHUTDOWN(Packet *)
{
/* Only when we're trying to join we really
* care about the server shutting down. */
@ -1048,7 +1048,7 @@ NetworkRecvStatus ClientNetworkGameSocketHandler::Receive_SERVER_SHUTDOWN(Packet
return NETWORK_RECV_STATUS_SERVER_ERROR;
}
NetworkRecvStatus ClientNetworkGameSocketHandler::Receive_SERVER_NEWGAME(Packet *p)
NetworkRecvStatus ClientNetworkGameSocketHandler::Receive_SERVER_NEWGAME(Packet *)
{
/* Only when we're trying to join we really
* care about the server shutting down. */

View File

@ -792,7 +792,7 @@ void ClientNetworkContentSocketHandler::Connect()
/**
* Disconnect from the content server.
*/
NetworkRecvStatus ClientNetworkContentSocketHandler::CloseConnection(bool error)
NetworkRecvStatus ClientNetworkContentSocketHandler::CloseConnection(bool)
{
this->isCancelled = true;
NetworkContentSocketHandler::CloseConnection();

View File

@ -31,7 +31,7 @@ struct ContentCallback {
* Callback for when the connection has finished
* @param success whether the connection was made or that we failed to make it
*/
virtual void OnConnect(bool success) {}
virtual void OnConnect([[maybe_unused]] bool success) {}
/**
* Callback for when the connection got disconnected.
@ -42,20 +42,20 @@ struct ContentCallback {
* We received a content info.
* @param ci the content info
*/
virtual void OnReceiveContentInfo(const ContentInfo *ci) {}
virtual void OnReceiveContentInfo([[maybe_unused]] const ContentInfo *ci) {}
/**
* We have progress in the download of a file
* @param ci the content info of the file
* @param bytes the number of bytes downloaded since the previous call
*/
virtual void OnDownloadProgress(const ContentInfo *ci, int bytes) {}
virtual void OnDownloadProgress([[maybe_unused]] const ContentInfo *ci, [[maybe_unused]] int bytes) {}
/**
* We have finished downloading a file
* @param cid the ContentID of the downloaded file
*/
virtual void OnDownloadComplete(ContentID cid) {}
virtual void OnDownloadComplete([[maybe_unused]] ContentID cid) {}
/** Silentium */
virtual ~ContentCallback() = default;

View File

@ -114,7 +114,7 @@ void BaseNetworkContentDownloadStatusWindow::Close()
this->Window::Close();
}
void BaseNetworkContentDownloadStatusWindow::UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize)
void BaseNetworkContentDownloadStatusWindow::UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize)
{
switch (widget) {
case WID_NCDS_PROGRESS_BAR:
@ -285,7 +285,7 @@ public:
this->BaseNetworkContentDownloadStatusWindow::Close();
}
void OnClick(Point pt, int widget, int click_count) override
void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override
{
if (widget == WID_NCDS_CANCELOK) {
if (this->downloaded_bytes != this->total_bytes) {
@ -581,7 +581,7 @@ public:
this->checkbox_size = maxdim(maxdim(GetSpriteSize(SPR_BOX_EMPTY), GetSpriteSize(SPR_BOX_CHECKED)), GetSpriteSize(SPR_BLOT));
}
void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override
void UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override
{
switch (widget) {
case WID_NCL_CHECKBOX:
@ -788,7 +788,7 @@ public:
}
}
void OnClick(Point pt, int widget, int click_count) override
void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override
{
if (widget >= WID_NCL_TEXTFILE && widget < WID_NCL_TEXTFILE + TFT_CONTENT_END) {
if (this->selected == nullptr || this->selected->state != ContentInfo::ALREADY_HERE) return;
@ -873,7 +873,7 @@ public:
}
}
EventState OnKeyPress(char32_t key, uint16_t keycode) override
EventState OnKeyPress([[maybe_unused]] char32_t key, uint16_t keycode) override
{
if (this->vscroll->UpdateListPositionOnKeyPress(this->list_pos, keycode) == ES_NOT_HANDLED) {
switch (keycode) {
@ -943,7 +943,7 @@ public:
this->InvalidateData(0, false);
}
void OnDownloadComplete(ContentID cid) override
void OnDownloadComplete(ContentID) override
{
this->content.ForceResort();
this->InvalidateData();
@ -965,7 +965,7 @@ public:
* @param data Information about the changed data.
* @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details.
*/
void OnInvalidateData(int data = 0, bool gui_scope = true) override
void OnInvalidateData([[maybe_unused]] int data = 0, [[maybe_unused]] bool gui_scope = true) override
{
if (!gui_scope) return;
if (this->content.NeedRebuild()) this->BuildContentList();

View File

@ -33,7 +33,7 @@ public:
BaseNetworkContentDownloadStatusWindow(WindowDesc *desc);
void Close() override;
void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override;
void UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override;
void DrawWidget(const Rect &r, int widget) const override;
void OnDownloadProgress(const ContentInfo *ci, int bytes) override;
};

View File

@ -43,7 +43,7 @@ void NetworkUpdateServerGameType();
bool NetworkCompanyHasClients(CompanyID company);
std::string NetworkChangeCompanyPassword(CompanyID company_id, std::string password);
void NetworkReboot();
void NetworkDisconnect(bool blocking = false, bool close_admins = true);
void NetworkDisconnect(bool close_admins = true);
void NetworkGameLoop();
void NetworkBackgroundLoop();
std::string_view ParseFullConnectionString(const std::string &connection_string, uint16_t &port, CompanyID *company_id = nullptr);

View File

@ -515,7 +515,7 @@ public:
this->flag_offset = this->blot_offset + ScaleGUITrad(2) + GetSpriteSize(SPR_BLOT).width;
}
void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override
void UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override
{
switch (widget) {
case WID_NG_MATRIX:
@ -720,7 +720,7 @@ public:
}
}
void OnClick(Point pt, int widget, int click_count) override
void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override
{
switch (widget) {
case WID_NG_CANCEL: // Cancel button
@ -818,13 +818,13 @@ public:
* @param data Information about the changed data.
* @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details.
*/
void OnInvalidateData(int data = 0, bool gui_scope = true) override
void OnInvalidateData([[maybe_unused]] int data = 0, [[maybe_unused]] bool gui_scope = true) override
{
this->servers.ForceRebuild();
this->SetDirty();
}
EventState OnKeyPress(char32_t key, uint16_t keycode) override
EventState OnKeyPress([[maybe_unused]] char32_t key, uint16_t keycode) override
{
EventState state = ES_NOT_HANDLED;
@ -888,7 +888,7 @@ public:
}
/** Refresh the online servers on a regular interval. */
IntervalTimer<TimerWindow> refresh_interval = {std::chrono::seconds(30), [this](uint count) {
IntervalTimer<TimerWindow> refresh_interval = {std::chrono::seconds(30), [this](uint) {
if (!this->searched_internet) return;
_network_coordinator_client.GetListing();
@ -1058,7 +1058,7 @@ struct NetworkStartServerWindow : public Window {
}
}
void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override
void UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override
{
switch (widget) {
case WID_NSS_CONNTYPE_BTN:
@ -1078,7 +1078,7 @@ struct NetworkStartServerWindow : public Window {
}
}
void OnClick(Point pt, int widget, int click_count) override
void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override
{
switch (widget) {
case WID_NSS_CANCEL: // Cancel button
@ -1369,30 +1369,27 @@ enum DropDownAdmin {
/**
* Callback function for admin command to kick client.
* @param w The window which initiated the confirmation dialog.
* @param confirmed Iff the user pressed Yes.
*/
static void AdminClientKickCallback(Window *w, bool confirmed)
static void AdminClientKickCallback(Window *, bool confirmed)
{
if (confirmed) NetworkServerKickClient(_admin_client_id, {});
}
/**
* Callback function for admin command to ban client.
* @param w The window which initiated the confirmation dialog.
* @param confirmed Iff the user pressed Yes.
*/
static void AdminClientBanCallback(Window *w, bool confirmed)
static void AdminClientBanCallback(Window *, bool confirmed)
{
if (confirmed) NetworkServerKickOrBanIP(_admin_client_id, true, {});
}
/**
* Callback function for admin command to reset company.
* @param w The window which initiated the confirmation dialog.
* @param confirmed Iff the user pressed Yes.
*/
static void AdminCompanyResetCallback(Window *w, bool confirmed)
static void AdminCompanyResetCallback(Window *, bool confirmed)
{
if (confirmed) {
if (NetworkCompanyHasClients(_admin_company_id)) return;
@ -1402,10 +1399,9 @@ static void AdminCompanyResetCallback(Window *w, bool confirmed)
/**
* Callback function for admin command to unlock company.
* @param w The window which initiated the confirmation dialog.
* @param confirmed Iff the user pressed Yes.
*/
static void AdminCompanyUnlockCallback(Window *w, bool confirmed)
static void AdminCompanyUnlockCallback(Window *, bool confirmed)
{
if (confirmed) NetworkServerSetCompanyPassword(_admin_company_id, "", false);
}
@ -1500,7 +1496,7 @@ private:
* @param pt The point where this button was clicked.
* @param company_id The company this button was assigned to.
*/
static void OnClickCompanyChat(NetworkClientListWindow *w, Point pt, CompanyID company_id)
static void OnClickCompanyChat([[maybe_unused]] NetworkClientListWindow *w, [[maybe_unused]] Point pt, CompanyID company_id)
{
ShowNetworkChatQueryWindow(DESTTYPE_TEAM, company_id);
}
@ -1511,7 +1507,7 @@ private:
* @param pt The point where this button was clicked.
* @param company_id The company this button was assigned to.
*/
static void OnClickCompanyJoin(NetworkClientListWindow *w, Point pt, CompanyID company_id)
static void OnClickCompanyJoin([[maybe_unused]] NetworkClientListWindow *w, [[maybe_unused]] Point pt, CompanyID company_id)
{
if (_network_server) {
NetworkServerDoMove(CLIENT_ID_SERVER, company_id);
@ -1529,9 +1525,8 @@ private:
* Crete new company button is clicked.
* @param w The instance of this window.
* @param pt The point where this button was clicked.
* @param company_id The company this button was assigned to.
*/
static void OnClickCompanyNew(NetworkClientListWindow *w, Point pt, CompanyID company_id)
static void OnClickCompanyNew([[maybe_unused]] NetworkClientListWindow *w, [[maybe_unused]] Point pt, CompanyID)
{
if (_network_server) {
Command<CMD_COMPANY_CTRL>::Post(CCA_NEW, INVALID_COMPANY, CRR_NONE, _network_own_client_id);
@ -1546,7 +1541,7 @@ private:
* @param pt The point where this button was clicked.
* @param client_id The client this button was assigned to.
*/
static void OnClickClientAdmin(NetworkClientListWindow *w, Point pt, ClientID client_id)
static void OnClickClientAdmin([[maybe_unused]] NetworkClientListWindow *w, [[maybe_unused]] Point pt, ClientID client_id)
{
DropDownList list;
list.emplace_back(new DropDownListStringItem(STR_NETWORK_CLIENT_LIST_ADMIN_CLIENT_KICK, DD_CLIENT_ADMIN_KICK, false));
@ -1568,7 +1563,7 @@ private:
* @param pt The point where this button was clicked.
* @param company_id The company this button was assigned to.
*/
static void OnClickCompanyAdmin(NetworkClientListWindow *w, Point pt, CompanyID company_id)
static void OnClickCompanyAdmin([[maybe_unused]] NetworkClientListWindow *w, [[maybe_unused]] Point pt, CompanyID company_id)
{
DropDownList list;
list.emplace_back(new DropDownListStringItem(STR_NETWORK_CLIENT_LIST_ADMIN_COMPANY_RESET, DD_COMPANY_ADMIN_RESET, NetworkCompanyHasClients(company_id)));
@ -1589,7 +1584,7 @@ private:
* @param pt The point where this button was clicked.
* @param client_id The client this button was assigned to.
*/
static void OnClickClientChat(NetworkClientListWindow *w, Point pt, ClientID client_id)
static void OnClickClientChat([[maybe_unused]] NetworkClientListWindow *w, [[maybe_unused]] Point pt, ClientID client_id)
{
ShowNetworkChatQueryWindow(DESTTYPE_CLIENT, client_id);
}
@ -1717,7 +1712,7 @@ public:
RebuildList();
}
void OnInvalidateData(int data = 0, bool gui_scope = true) override
void OnInvalidateData([[maybe_unused]] int data = 0, [[maybe_unused]] bool gui_scope = true) override
{
this->RebuildList();
@ -1726,7 +1721,7 @@ public:
this->SetWidgetDisabledState(WID_CL_SERVER_NAME_EDIT, !_network_server);
}
void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override
void UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override
{
switch (widget) {
case WID_CL_SERVER_VISIBILITY:
@ -1789,7 +1784,7 @@ public:
}
}
void OnClick(Point pt, int widget, int click_count) override
void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override
{
switch (widget) {
case WID_CL_SERVER_NAME_EDIT:
@ -1823,7 +1818,7 @@ public:
}
}
bool OnTooltip(Point pt, int widget, TooltipCloseCondition close_cond) override
bool OnTooltip([[maybe_unused]] Point pt, int widget, TooltipCloseCondition close_cond) override
{
switch (widget) {
case WID_CL_MATRIX: {
@ -2116,7 +2111,7 @@ public:
}
}
void OnMouseOver(Point pt, int widget) override
void OnMouseOver([[maybe_unused]] Point pt, int widget) override
{
if (widget != WID_CL_MATRIX) {
if (this->hover_index != -1) {
@ -2203,7 +2198,7 @@ struct NetworkJoinStatusWindow : Window {
}
}
void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override
void UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override
{
switch (widget) {
case WID_NJS_PROGRESS_BAR:
@ -2229,7 +2224,7 @@ struct NetworkJoinStatusWindow : Window {
}
}
void OnClick(Point pt, int widget, int click_count) override
void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override
{
if (widget == WID_NJS_CANCELOK) { // Disconnect button
NetworkDisconnect();
@ -2318,7 +2313,7 @@ struct NetworkCompanyPasswordWindow : public Window {
this->ReInit();
}
void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override
void UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override
{
if (widget == WID_NCP_WARNING) {
*size = this->warning_size;
@ -2342,7 +2337,7 @@ struct NetworkCompanyPasswordWindow : public Window {
NetworkChangeCompanyPassword(_local_company, this->password_editbox.text.buf);
}
void OnClick(Point pt, int widget, int click_count) override
void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override
{
switch (widget) {
case WID_NCP_OK:
@ -2418,7 +2413,7 @@ struct NetworkAskRelayWindow : public Window {
this->InitNested(0);
}
void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override
void UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override
{
if (widget == WID_NAR_TEXT) {
*size = GetStringBoundingBox(STR_NETWORK_ASK_RELAY_TEXT);
@ -2434,7 +2429,7 @@ struct NetworkAskRelayWindow : public Window {
}
}
void FindWindowPlacementAndResize(int def_width, int def_height) override
void FindWindowPlacementAndResize([[maybe_unused]] int def_width, [[maybe_unused]] int def_height) override
{
/* Position query window over the calling window, ensuring it's within screen bounds. */
this->left = Clamp(parent->left + (parent->width / 2) - (this->width / 2), 0, _screen.width - this->width);
@ -2452,7 +2447,7 @@ struct NetworkAskRelayWindow : public Window {
}
}
void OnClick(Point pt, int widget, int click_count) override
void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override
{
switch (widget) {
case WID_NAR_NO:
@ -2521,7 +2516,7 @@ struct NetworkAskSurveyWindow : public Window {
this->InitNested(0);
}
void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override
void UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override
{
if (widget == WID_NAS_TEXT) {
*size = GetStringBoundingBox(STR_NETWORK_ASK_SURVEY_TEXT);
@ -2537,7 +2532,7 @@ struct NetworkAskSurveyWindow : public Window {
}
}
void FindWindowPlacementAndResize(int def_width, int def_height) override
void FindWindowPlacementAndResize([[maybe_unused]] int def_width, [[maybe_unused]] int def_height) override
{
/* Position query window over the calling window, ensuring it's within screen bounds. */
this->left = Clamp(parent->left + (parent->width / 2) - (this->width / 2), 0, _screen.width - this->width);
@ -2545,7 +2540,7 @@ struct NetworkAskSurveyWindow : public Window {
this->SetDirty();
}
void OnClick(Point pt, int widget, int click_count) override
void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override
{
switch (widget) {
case WID_NAS_PREVIEW:

Some files were not shown because too many files have changed in this diff Show More