Skip to content

Commit e7d93fa

Browse files
Merge pull request #169 from Longwater1234/dev
Build badge status on README
2 parents e6c7082 + d880a2a commit e7d93fa

File tree

6 files changed

+14
-7
lines changed

6 files changed

+14
-7
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ target_include_directories(SpaceCheckers PUBLIC ${SFML_HOME}/include)
6363
if(MSVC)
6464
target_compile_options(SpaceCheckers PRIVATE /W4 /sdl)
6565
else()
66-
target_compile_options(SpaceCheckers PRIVATE -Wall -Werror=constant-conversion)
66+
target_compile_options(SpaceCheckers PRIVATE -Wall -Werror=constant-conversion -Werror=fortify-source)
6767
endif()
6868

6969
# COPY resources folder to destination

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# space - checkers
22

3+
[![CMake on Windows platform](https://github.com/Longwater1234/space-checkers/actions/workflows/cmake-single-platform.yml/badge.svg?branch=main)](https://github.com/Longwater1234/space-checkers/actions/workflows/cmake-single-platform.yml)
4+
35
Offline & Online Multiplayer Checkers game in C++ built with SFML 2.6, imGui, Protobuf and ixWebsockets. With very minimal dependencies
46
and a simple build process. All dependencies are auto-downloaded (as `.tar.gz`) and configured for you using [CPM.cmake](https://github.com/cpm-cmake/CPM.cmake). The only dependency you need pre-installed on your OS is SFML 2.6.x (or newer).
57

src/GameManager.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@
2323

2424
namespace chk
2525
{
26+
// cell ptr
2627
using Block = std::unique_ptr<chk::Cell>;
28+
// player ptr
2729
using PlayerPtr = std::unique_ptr<chk::Player>;
2830

2931
constexpr uint16_t NUM_ROWS{8};

src/WsClient.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,9 @@ void WsClient::parseServerList(const cpr::Response &response)
170170
{
171171
this->deathNote = ex.what();
172172
this->isDead = true;
173+
#ifndef NDEBUG
174+
spdlog::error(ex.what());
175+
#endif // DEBUG
173176
}
174177
}
175178

src/managers/LocalGameManager.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,12 @@ inline LocalGameManager::LocalGameManager(sf::RenderWindow *windowPtr)
3636
}
3737

3838
/**
39-
* Create all pieces for both players and add them to pieceList, using std C++ random num generator
39+
* Create all pieces for both players (using std C++ PRNG), then place them on the board.
4040
*/
4141
inline void LocalGameManager::createAllPieces()
4242
{
4343
std::random_device randomDevice;
44-
std::mt19937 randEngine(randomDevice());
44+
std::mt19937 randEngine{randomDevice()};
4545
std::uniform_int_distribution<short> dist(1, std::numeric_limits<short>::max());
4646

4747
// Reserve container for pieces on board

src/managers/OnlineGameManager.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,9 @@ inline void chk::OnlineGameManager::createAllPieces()
8787
std::vector<chk::PiecePtr> pieceList;
8888
pieceList.reserve(chk::NUM_PIECES);
8989

90-
auto redItr = payload.pieces_red().begin();
91-
auto blackItr = payload.pieces_black().begin();
92-
// create pieces objects, and position them on Board
90+
auto redItr = payload.pieces_red().begin(); // red iterator
91+
auto blackItr = payload.pieces_black().begin(); // black iterator
92+
// place them on board
9393
for (uint16_t row = 0; row < chk::NUM_ROWS; row++)
9494
{
9595
for (uint16_t col = 0; col < chk::NUM_COLS; col++)
@@ -132,7 +132,7 @@ inline void chk::OnlineGameManager::createAllPieces()
132132
this->playerBlack->receivePiece(pp);
133133
}
134134
}
135-
pieceList.clear(); // SAFE! no longer used.
135+
pieceList.clear(); // SAFE! no longer needed.
136136
this->startMoveListener();
137137
this->startCaptureListener();
138138
});

0 commit comments

Comments
 (0)