Codechange: Silence warnings about intentionally unused parameters.

This commit is contained in:
frosch
2023-09-16 22:20:53 +02:00
committed by frosch
parent df400ef84a
commit b6c8f301be
227 changed files with 972 additions and 1039 deletions

View File

@@ -18,7 +18,7 @@
return ScriptObject::GetRandomizer().Next();
}
/* static */ SQInteger ScriptBase::RandItem(SQInteger unused_param)
/* static */ SQInteger ScriptBase::RandItem(SQInteger)
{
return ScriptBase::Rand();
}
@@ -29,7 +29,7 @@
return ScriptObject::GetRandomizer().Next(max);
}
/* static */ SQInteger ScriptBase::RandRangeItem(SQInteger unused_param, SQInteger max)
/* static */ SQInteger ScriptBase::RandRangeItem(SQInteger, SQInteger max)
{
return ScriptBase::RandRange(max);
}
@@ -42,7 +42,7 @@
return ScriptBase::RandRange(max) < out;
}
/* static */ bool ScriptBase::ChanceItem(SQInteger unused_param, SQInteger out, SQInteger max)
/* static */ bool ScriptBase::ChanceItem(SQInteger, SQInteger out, SQInteger max)
{
return ScriptBase::Chance(out, max);
}

View File

@@ -102,7 +102,7 @@ struct ScriptListWindow : public Window {
SetDParam(0, (this->slot == OWNER_DEITY) ? STR_AI_LIST_CAPTION_GAMESCRIPT : STR_AI_LIST_CAPTION_AI);
}
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_SCRL_LIST) return;
@@ -184,7 +184,7 @@ struct ScriptListWindow : public Window {
InvalidateWindowClassesData(WC_TEXTFILE);
}
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_SCRL_LIST: { // Select one of the Scripts
@@ -222,7 +222,7 @@ struct ScriptListWindow : 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 (_game_mode == GM_NORMAL && Company::IsValidID(this->slot)) {
this->Close();
@@ -342,7 +342,7 @@ struct ScriptSettingsWindow : public Window {
SetDParam(0, (this->slot == OWNER_DEITY) ? STR_AI_SETTINGS_CAPTION_GAMESCRIPT : STR_AI_SETTINGS_CAPTION_AI);
}
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_SCRS_BACKGROUND) return;
@@ -421,7 +421,7 @@ struct ScriptSettingsWindow : 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
{
switch (widget) {
case WID_SCRS_BACKGROUND: {
@@ -530,7 +530,7 @@ struct ScriptSettingsWindow : public Window {
SetValue(index);
}
void OnDropdownClose(Point pt, int widget, int index, bool instant_close) override
void OnDropdownClose(Point, int widget, int, bool) override
{
/* 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.
@@ -557,7 +557,7 @@ struct ScriptSettingsWindow : 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
{
this->RebuildVisibleSettings();
this->CloseChildWindows(WC_DROPDOWN_MENU);
@@ -640,7 +640,7 @@ struct ScriptTextfileWindow : public TextfileWindow {
}
}
void OnInvalidateData(int data = 0, bool gui_scope = true) override
void OnInvalidateData([[maybe_unused]] int data = 0, [[maybe_unused]] bool gui_scope = true) override
{
auto textfile = GetConfig(slot)->GetTextfile(file_type, slot);
if (!textfile.has_value()) {
@@ -788,7 +788,7 @@ struct ScriptDebugWindow : public Window {
this->InvalidateData(-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
{
if (widget == WID_SCRD_LOG_PANEL) {
resize->height = FONT_HEIGHT_NORMAL + WidgetDimensions::scaled.vsep_normal;
@@ -948,7 +948,7 @@ struct ScriptDebugWindow : public Window {
this->last_vscroll_pos = this->vscroll->GetPosition();
}
void OnClick(Point pt, int widget, int click_count) override
void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override
{
/* Also called for hotkeys, so check for disabledness */
if (this->IsWidgetDisabled(widget)) return;
@@ -1032,7 +1032,7 @@ struct ScriptDebugWindow : public Window {
* This is the company ID of the AI/GS which wrote a new log message, or -1 in other cases.
* @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 the log message is related to the active company tab, check the break string.
* This needs to be done in gameloop-scope, so the AI is suspended immediately. */

View File

@@ -23,7 +23,7 @@
#include "../safeguards.h"
bool ScriptScanner::AddFile(const std::string &filename, size_t basepath_length, const std::string &tar_filename)
bool ScriptScanner::AddFile(const std::string &filename, size_t, const std::string &tar_filename)
{
this->main_script = filename;
this->tar_file = tar_filename;
@@ -161,7 +161,7 @@ struct ScriptFileChecksumCreator : FileScanner {
ScriptFileChecksumCreator(Subdirectory dir) : dir(dir) {}
/* Add the file and calculate the md5 sum. */
virtual bool AddFile(const std::string &filename, size_t basepath_length, const std::string &tar_filename)
bool AddFile(const std::string &filename, size_t, const std::string &) override
{
Md5 checksum;
uint8_t buffer[1024];

View File

@@ -131,7 +131,7 @@ namespace SQConvert {
private:
template <size_t... i>
static int SQCall(void *instance, Tretval(*func)(Targs...), [[maybe_unused]] HSQUIRRELVM vm, std::index_sequence<i...>)
static int SQCall(void *, Tretval(*func)(Targs...), [[maybe_unused]] HSQUIRRELVM vm, std::index_sequence<i...>)
{
if constexpr (std::is_void_v<Tretval>) {
(*func)(
@@ -180,7 +180,7 @@ namespace SQConvert {
}
template <size_t... i>
static Tcls *SQConstruct(Tcls *, Tretval(Tcls:: *func)(Targs...), [[maybe_unused]] HSQUIRRELVM vm, std::index_sequence<i...>)
static Tcls *SQConstruct(Tcls *, Tretval(Tcls:: *)(Targs...), [[maybe_unused]] HSQUIRRELVM vm, std::index_sequence<i...>)
{
Tcls *inst = new Tcls(
Param<Targs>::Get(vm, 2 + i)...
@@ -321,7 +321,7 @@ namespace SQConvert {
* here as it has to be in the same scope as DefSQConstructorCallback.
*/
template <typename Tcls>
static SQInteger DefSQDestructorCallback(SQUserPointer p, SQInteger size)
static SQInteger DefSQDestructorCallback(SQUserPointer p, SQInteger)
{
/* Remove the real instance too */
if (p != nullptr) ((Tcls *)p)->Release();