Skip to content

Commit

Permalink
Fix some msvc warnings.
Browse files Browse the repository at this point in the history
  • Loading branch information
Jarod42 committed Mar 7, 2024
1 parent 0cfca2c commit b60d083
Show file tree
Hide file tree
Showing 74 changed files with 124 additions and 142 deletions.
3 changes: 0 additions & 3 deletions premake5.lua
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,9 @@ end
filter { "action:vs*" }
nuget(nugetPackages)
filter { "toolset:msc*" }
--defines { "USE_CRASH_RPT" }
defines { "_CRT_SECURE_NO_WARNINGS" } -- 4996: '$func': This function or variable may be unsafe. Consider using $func2 instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
buildoptions { "/Zc:__cplusplus" } -- else __cplusplus would be 199711L
disablewarnings {
"4100", -- '%var': unreferenced formal parameter
"4013", -- '$func' undefined, assuming extern return int
"4458", -- declaration of '$var' hides class member
"4701", -- potentially uninitialized local variable '$var' used
"4703", -- potentially uninitialized local pointer variable '$var' used
Expand Down
4 changes: 2 additions & 2 deletions src/lib/chatcommand/chatcommandarguments.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ cChatCommandArgumentServer::cChatCommandArgumentServer (cServer*& serverPointer,
{}

//------------------------------------------------------------------------------
size_t cChatCommandArgumentServer::parse (const std::string& command, size_t position)
size_t cChatCommandArgumentServer::parse (const std::string&, size_t position)
{
value = serverPointer;
if (value == nullptr)
Expand Down Expand Up @@ -276,7 +276,7 @@ cChatCommandArgumentClient::cChatCommandArgumentClient (const std::shared_ptr<cC
{}

//------------------------------------------------------------------------------
size_t cChatCommandArgumentClient::parse (const std::string& command, size_t position)
size_t cChatCommandArgumentClient::parse (const std::string&, size_t position)
{
if (activeClientPointer == nullptr)
{
Expand Down
4 changes: 2 additions & 2 deletions src/lib/chatcommand/chatcommandparser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,13 @@ cChatCommandParser<>::cChatCommandParser (cChatCommand command_) :
{}

//------------------------------------------------------------------------------
size_t cChatCommandParser<>::parse (const std::string& command, size_t position) const
size_t cChatCommandParser<>::parse (const std::string&, size_t position) const
{
return position;
}

//------------------------------------------------------------------------------
void cChatCommandParser<>::printArguments (std::ostream& result) const
void cChatCommandParser<>::printArguments (std::ostream&) const
{}

//------------------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion src/lib/crashreporter/debug.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
# endif

//------------------------------------------------------------------------------
int CALLBACK CrashCallback (CR_CRASH_CALLBACK_INFO* pInfo)
int CALLBACK CrashCallback (CR_CRASH_CALLBACK_INFO*)
{
// The application has crashed!
if (cVideo::buffer)
Expand Down
2 changes: 1 addition & 1 deletion src/lib/game/connectionmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class cHandshakeTimeout

private:
//--------------------------------------------------------------------------
static uint32_t callback (uint32_t intervall, void* arg)
static uint32_t callback (uint32_t, void* arg)
{
cHandshakeTimeout* thisPtr = reinterpret_cast<cHandshakeTimeout*> (arg);
thisPtr->connectionManager->handshakeTimeoutCallback (*thisPtr);
Expand Down
2 changes: 1 addition & 1 deletion src/lib/game/data/model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@ cMoveJob* cModel::addMoveJob (cVehicle& vehicle, const std::forward_list<cPositi
currentMoveJob->removeVehicle();
}
}
auto moveJob = std::make_unique<cMoveJob> (path, vehicle, *this);
auto moveJob = std::make_unique<cMoveJob> (path, vehicle);
vehicle.setMoveJob (moveJob.get());

moveJobs.push_back (std::move (moveJob));
Expand Down
4 changes: 2 additions & 2 deletions src/lib/game/data/savegame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ namespace
}

//--------------------------------------------------------------------------
void writeHeader (nlohmann::json& json, int slot, const std::string& saveName, const cModel& model)
void writeHeader (nlohmann::json& json, const std::string& saveName, const cModel& model)
{
//init document
json["version"] = SAVE_FORMAT_VERSION;
Expand All @@ -97,7 +97,7 @@ namespace
void cSavegame::save (const cModel& model, int slot, const std::string& saveName) const
{
nlohmann::json json;
writeHeader (json, slot, saveName, model);
writeHeader (json, saveName, model);

cJsonArchiveOut archive (json);
archive << NVP (model);
Expand Down
2 changes: 1 addition & 1 deletion src/lib/game/logic/action/actionendturn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ cActionEndTurn::cActionEndTurn()
{}

//------------------------------------------------------------------------------
cActionEndTurn::cActionEndTurn (cBinaryArchiveIn& archive)
cActionEndTurn::cActionEndTurn (cBinaryArchiveIn&)
{}

//------------------------------------------------------------------------------
Expand Down
3 changes: 2 additions & 1 deletion src/lib/game/logic/client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,12 +146,13 @@ void cClient::sendSyncMessage (unsigned int gameTime, bool crcOK, unsigned int t
}

//------------------------------------------------------------------------------
void cClient::runClientJobs (const cModel& model)
void cClient::runClientJobs()
{
// run surveyor AI
handleSurveyorMoveJobs();
}

//------------------------------------------------------------------------------
void cClient::handleNetMessages()
{
std::unique_ptr<cNetMessage> message;
Expand Down
2 changes: 1 addition & 1 deletion src/lib/game/logic/client.h
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ class cClient : public INetMessageReceiver

void handleNetMessages();

void runClientJobs (const cModel&);
void runClientJobs();

const std::shared_ptr<cGameTimerClient>& getGameTimer() const { return gameTimer; }

Expand Down
2 changes: 1 addition & 1 deletion src/lib/game/logic/gametimer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ void cGameTimerClient::run (cClient& client, cModel& model)
if (syncMessageReceived)
{
model.advanceGameTime();
client.runClientJobs (model);
client.runClientJobs();

//check crc
localChecksum = model.getChecksum();
Expand Down
2 changes: 1 addition & 1 deletion src/lib/game/logic/movejob.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ cMoveJob::cMoveJob() :
{}

//------------------------------------------------------------------------------
cMoveJob::cMoveJob (const std::forward_list<cPosition>& path, cVehicle& vehicle, cModel& model) :
cMoveJob::cMoveJob (const std::forward_list<cPosition>& path, cVehicle& vehicle) :
vehicleId (vehicle.getId()),
path (path),
state (eMoveJobState::Waiting),
Expand Down
2 changes: 1 addition & 1 deletion src/lib/game/logic/movejob.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class cMoveJob
{
public:
cMoveJob();
cMoveJob (const std::forward_list<cPosition>& path, cVehicle&, cModel&);
cMoveJob (const std::forward_list<cPosition>& path, cVehicle&);
/**
* gets the list of position that make up the path. First element is the position,
* the unit will drive to when starting the next movement step.
Expand Down
3 changes: 2 additions & 1 deletion src/lib/game/logic/server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,9 @@ void cServer::loadGameState (int saveGameNumber)
gameTimer.setPlayerNumbers (model.getPlayerList());
}
//------------------------------------------------------------------------------
void cServer::sendGuiInfoToClients (int saveGameNumber, int playerNr /*= -1*/)
void cServer::sendGuiInfoToClients (int saveGameNumber, [[maybe_unused]] int playerNr /*= -1*/)
{
// TODO: handle playerNr
try
{
cSavegame savegame;
Expand Down
12 changes: 6 additions & 6 deletions src/lib/game/protocol/lobbymessage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ cMuMsgAskToFinishLobby::cMuMsgAskToFinishLobby()
{}

//------------------------------------------------------------------------------
cMuMsgAskToFinishLobby::cMuMsgAskToFinishLobby (cBinaryArchiveIn& archive)
cMuMsgAskToFinishLobby::cMuMsgAskToFinishLobby (cBinaryArchiveIn&)
{}

//------------------------------------------------------------------------------
Expand All @@ -287,7 +287,7 @@ void cMuMsgCannotEndLobby::serialize (cBinaryArchiveOut& archive)
cMuMsgDisconnectNotInSavedGame::cMuMsgDisconnectNotInSavedGame()
{}
//------------------------------------------------------------------------------
cMuMsgDisconnectNotInSavedGame::cMuMsgDisconnectNotInSavedGame (cBinaryArchiveIn& archive)
cMuMsgDisconnectNotInSavedGame::cMuMsgDisconnectNotInSavedGame (cBinaryArchiveIn&)
{}

//------------------------------------------------------------------------------
Expand Down Expand Up @@ -373,23 +373,23 @@ void cMuMsgLandingState::serialize (cBinaryArchiveOut& archive)
cMuMsgStartGame::cMuMsgStartGame()
{}
//------------------------------------------------------------------------------
cMuMsgStartGame::cMuMsgStartGame (cBinaryArchiveIn& archive)
cMuMsgStartGame::cMuMsgStartGame (cBinaryArchiveIn&)
{}

//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
cMuMsgPlayerAbortedGamePreparations::cMuMsgPlayerAbortedGamePreparations()
{}
//------------------------------------------------------------------------------
cMuMsgPlayerAbortedGamePreparations::cMuMsgPlayerAbortedGamePreparations (cBinaryArchiveIn& archive)
cMuMsgPlayerAbortedGamePreparations::cMuMsgPlayerAbortedGamePreparations (cBinaryArchiveIn&)
{}

//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
cMuMsgFinishedMapDownload::cMuMsgFinishedMapDownload()
{}
//------------------------------------------------------------------------------
cMuMsgFinishedMapDownload::cMuMsgFinishedMapDownload (cBinaryArchiveIn& archive)
cMuMsgFinishedMapDownload::cMuMsgFinishedMapDownload (cBinaryArchiveIn&)
{}

//------------------------------------------------------------------------------
Expand Down Expand Up @@ -473,7 +473,7 @@ void cMuMsgMapDownloadData::serialize (cBinaryArchiveOut& archive)
cMuMsgCanceledMapDownload::cMuMsgCanceledMapDownload()
{}
//------------------------------------------------------------------------------
cMuMsgCanceledMapDownload::cMuMsgCanceledMapDownload (cBinaryArchiveIn& archive)
cMuMsgCanceledMapDownload::cMuMsgCanceledMapDownload (cBinaryArchiveIn&)
{}

//------------------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion src/lib/game/protocol/netmessage.h
Original file line number Diff line number Diff line change
Expand Up @@ -689,7 +689,7 @@ class cNetMessageWantRejoinGame : public cNetMessageT<eNetMessageType::WANT_REJO
{
public:
cNetMessageWantRejoinGame() = default;
explicit cNetMessageWantRejoinGame (cBinaryArchiveIn& archive)
explicit cNetMessageWantRejoinGame (cBinaryArchiveIn&)
{}
};

Expand Down
4 changes: 2 additions & 2 deletions src/lib/game/startup/lobbyclient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ void cLobbyClient::handleNetMessage_TCP_CONNECT_FAILED (const cNetMessageTcpConn
}

//------------------------------------------------------------------------------
void cLobbyClient::handleNetMessage_TCP_CLOSE (const cNetMessageTcpClose& message)
void cLobbyClient::handleNetMessage_TCP_CLOSE (const cNetMessageTcpClose&)
{
localPlayer.setReady (false);
localPlayer.setNr (-1);
Expand Down Expand Up @@ -529,7 +529,7 @@ void cLobbyClient::handleNetMessage_MU_MSG_LANDING_STATE (const cMuMsgLandingSta
}

//------------------------------------------------------------------------------
void cLobbyClient::handleNetMessage_MU_MSG_START_GAME (const cMuMsgStartGame& message)
void cLobbyClient::handleNetMessage_MU_MSG_START_GAME (const cMuMsgStartGame&)
{
client = std::make_shared<cClient> (connectionManager);
client->setPlayers (players, localPlayer.getNr());
Expand Down
6 changes: 3 additions & 3 deletions src/ui/graphical/game/control/gameguicontroller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1130,7 +1130,7 @@ void cGameGuiController::connectReportSources (cClient& client)
playerGameGuiStates[player.getId()].reports = std::make_shared<std::vector<std::unique_ptr<cSavedReport>>>();

//report message received from server
allClientsSignalConnectionManager.connect (client.reportMessageReceived, [this] (int fromPlayerNr, std::unique_ptr<cSavedReport>& report, int toPlayerNr) {
allClientsSignalConnectionManager.connect (client.reportMessageReceived, [this] (int, std::unique_ptr<cSavedReport>& report, int toPlayerNr) {
addSavedReport (std::move (report), toPlayerNr);
});

Expand Down Expand Up @@ -1286,7 +1286,7 @@ void cGameGuiController::showFilesWindow()
gameGui->exit();
});
});
loadSaveWindow->load.connect ([this, loadSaveWindow] (const cSaveGameInfo& saveInfo) {
loadSaveWindow->load.connect ([this, loadSaveWindow] (const cSaveGameInfo&) {
// loading games while game is running is not yet implemented
application.show (std::make_shared<cDialogOk> (lngPack.i18n ("Error_Messages~INFO_Not_Implemented")));
});
Expand Down Expand Up @@ -1478,7 +1478,7 @@ void cGameGuiController::showStorageWindow (const cUnit& unit)
}
else
{
gameGui->getGameMap().startActivateVehicle (unit, index);
gameGui->getGameMap().startActivateVehicle (index);
}
storageWindow->close();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#include "ui/graphical/game/widgets/gamemapwidget.h"

//------------------------------------------------------------------------------
bool cMouseActionActivateFinished::executeLeftClick (cGameMapWidget& gameMapWidget, const cMapView& map, const cPosition& mapPosition, cUnitSelection& unitSelection, bool changeAllowed) const
bool cMouseActionActivateFinished::executeLeftClick (cGameMapWidget& gameMapWidget, const cMapView&, const cPosition& mapPosition, cUnitSelection& unitSelection, bool /* changeAllowed */) const /* override */
{
const auto selectedBuilding = unitSelection.getSelectedBuilding();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ cMouseActionActivateLoaded::cMouseActionActivateLoaded (int vehicleToActivateInd
{}

//------------------------------------------------------------------------------
bool cMouseActionActivateLoaded::executeLeftClick (cGameMapWidget& gameMapWidget, const cMapView& map, const cPosition& mapPosition, cUnitSelection& unitSelection, bool changeAllowed) const
bool cMouseActionActivateLoaded::executeLeftClick (cGameMapWidget& gameMapWidget, const cMapView&, const cPosition& mapPosition, cUnitSelection& unitSelection, bool /* changeAllowed */) const /* override */
{
const auto selectedUnit = unitSelection.getSelectedUnit();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
#include "ui/graphical/game/widgets/gamemapwidget.h"

//------------------------------------------------------------------------------
bool cMouseActionAttack::executeLeftClick (cGameMapWidget& gameMapWidget, const cMapView& map, const cPosition& mapPosition, cUnitSelection& unitSelection, bool changeAllowed) const
bool cMouseActionAttack::executeLeftClick (cGameMapWidget& gameMapWidget, const cMapView&, const cPosition& mapPosition, cUnitSelection& unitSelection, bool /* changeAllowed */) const /* override */
{
const auto selectedVehicle = unitSelection.getSelectedVehicle();
const auto selectedBuilding = unitSelection.getSelectedBuilding();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
#include "ui/graphical/game/widgets/gamemapwidget.h"

//------------------------------------------------------------------------------
bool cMouseActionDisable::executeLeftClick (cGameMapWidget& gameMapWidget, const cMapView& map, const cPosition& mapPosition, cUnitSelection& unitSelection, bool changeAllowed) const
bool cMouseActionDisable::executeLeftClick (cGameMapWidget& gameMapWidget, const cMapView& map, const cPosition& mapPosition, cUnitSelection& unitSelection, bool /* changeAllowed */) const /* override */
{
const auto selectedVehicle = unitSelection.getSelectedVehicle();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
#include "ui/graphical/game/widgets/gamemapwidget.h"

//------------------------------------------------------------------------------
bool cMouseActionEnter::executeLeftClick (cGameMapWidget& gameMapWidget, const cMapView& map, const cPosition& mapPosition, cUnitSelection& unitSelection, bool changeAllowed) const
bool cMouseActionEnter::executeLeftClick (cGameMapWidget& gameMapWidget, const cMapView& map, const cPosition& mapPosition, cUnitSelection& unitSelection, bool /* changeAllowed */) const /* override */
{
const auto selectedVehicle = unitSelection.getSelectedVehicle();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
#include "ui/graphical/game/widgets/gamemapwidget.h"

//------------------------------------------------------------------------------
bool cMouseActionHelp::executeLeftClick (cGameMapWidget& gameMapWidget, const cMapView& map, const cPosition& mapPosition, cUnitSelection& unitSelection, bool changeAllowed) const
bool cMouseActionHelp::executeLeftClick (cGameMapWidget& gameMapWidget, const cMapView& map, const cPosition& mapPosition, cUnitSelection&, bool /* changeAllowed */) const /* override */
{
const auto& field = map.getField (mapPosition);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#include "ui/graphical/game/widgets/gamemapwidget.h"

//------------------------------------------------------------------------------
bool cMouseActionLoad::executeLeftClick (cGameMapWidget& gameMapWidget, const cMapView& map, const cPosition& mapPosition, cUnitSelection& unitSelection, bool changeAllowed) const
bool cMouseActionLoad::executeLeftClick (cGameMapWidget& gameMapWidget, const cMapView&, const cPosition& mapPosition, cUnitSelection& unitSelection, bool /* changeAllowed */) const /* override */
{
const auto selectedUnit = unitSelection.getSelectedUnit();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ cMouseActionMove::cMouseActionMove (eStart start) :
{}

//------------------------------------------------------------------------------
bool cMouseActionMove::executeLeftClick (cGameMapWidget& gameMapWidget, const cMapView& map, const cPosition& mapPosition, cUnitSelection& unitSelection, bool changeAllowed) const
bool cMouseActionMove::executeLeftClick (cGameMapWidget& gameMapWidget, const cMapView&, const cPosition& mapPosition, cUnitSelection& unitSelection, bool /* changeAllowed */) const /* override */
{
const auto selectedVehicle = unitSelection.getSelectedVehicle();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
#include "ui/graphical/game/widgets/gamemapwidget.h"

//------------------------------------------------------------------------------
bool cMouseActionRepair::executeLeftClick (cGameMapWidget& gameMapWidget, const cMapView& map, const cPosition& mapPosition, cUnitSelection& unitSelection, bool changeAllowed) const
bool cMouseActionRepair::executeLeftClick (cGameMapWidget& gameMapWidget, const cMapView& map, const cPosition& mapPosition, cUnitSelection& unitSelection, bool /* changeAllowed */) const /* override */
{
const auto selectedVehicle = unitSelection.getSelectedVehicle();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
#include "utility/listhelpers.h"

//------------------------------------------------------------------------------
bool cMouseActionSelect::executeLeftClick (cGameMapWidget& gameMapWidget, const cMapView& map, const cPosition& mapPosition, cUnitSelection& unitSelection, bool changeAllowed) const
bool cMouseActionSelect::executeLeftClick (cGameMapWidget&, const cMapView& map, const cPosition& mapPosition, cUnitSelection& unitSelection, bool changeAllowed) const /* override */
{
const auto selectedVehicle = unitSelection.getSelectedVehicle();
const auto selectedBuilding = unitSelection.getSelectedBuilding();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#include "ui/graphical/game/widgets/gamemapwidget.h"

//------------------------------------------------------------------------------
bool cMouseActionSelectBuildPathDestination::executeLeftClick (cGameMapWidget& gameMapWidget, const cMapView& map, const cPosition& mapPosition, cUnitSelection& unitSelection, bool changeAllowed) const
bool cMouseActionSelectBuildPathDestination::executeLeftClick (cGameMapWidget& gameMapWidget, const cMapView&, const cPosition& mapPosition, cUnitSelection& unitSelection, bool /* changeAllowed */) const /* override */
{
const auto selectedVehicle = unitSelection.getSelectedVehicle();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ cMouseActionSelectBuildPosition::cMouseActionSelectBuildPosition (sID buildId_,
{}

//------------------------------------------------------------------------------
bool cMouseActionSelectBuildPosition::executeLeftClick (cGameMapWidget& gameMapWidget, const cMapView& map, const cPosition& mapPosition, cUnitSelection& unitSelection, bool changeAllowed) const
bool cMouseActionSelectBuildPosition::executeLeftClick (cGameMapWidget& gameMapWidget, const cMapView&, const cPosition&, cUnitSelection& unitSelection, bool /* changeAllowed */) const /* override */
{
const auto selectedVehicle = unitSelection.getSelectedVehicle();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#include "ui/graphical/game/widgets/gamemapwidget.h"

//------------------------------------------------------------------------------
bool cMouseActionSteal::executeLeftClick (cGameMapWidget& gameMapWidget, const cMapView& map, const cPosition& mapPosition, cUnitSelection& unitSelection, bool changeAllowed) const
bool cMouseActionSteal::executeLeftClick (cGameMapWidget& gameMapWidget, const cMapView& map, const cPosition& mapPosition, cUnitSelection& unitSelection, bool /* changeAllowed */) const /* override */
{
const auto selectedVehicle = unitSelection.getSelectedVehicle();

Expand Down
Loading

0 comments on commit b60d083

Please sign in to comment.