Skip to content

Commit b3dba66

Browse files
Merge pull request #144 from Longwater1234/dev
2 parents f773c12 + df68667 commit b3dba66

File tree

12 files changed

+27
-27
lines changed

12 files changed

+27
-27
lines changed

CMakeLists.txt

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,13 @@ endif()
1414
# ==== UPDATE ME HERE ===========
1515
# Absolute path where you installed SFML (Required on Windows)
1616
set(SFML_HOME "C:/SFML/SFML-2.6.1")
17+
# ==========================
1718

19+
# Collect all sources
1820
file(GLOB_RECURSE GAME_SRC "src/*.cpp" "src/*.hpp")
19-
set(SFML_DIR ${SFML_HOME}/lib/cmake/SFML)
21+
set(SFML_DIR ${SFML_HOME}/lib/cmake/SFML)
2022

21-
find_package(SFML 2.6 REQUIRED COMPONENTS "graphics" "window" "system")
23+
find_package(SFML 2.6 REQUIRED COMPONENTS "graphics" "window" "system")
2224

2325
# download extra libs
2426
add_subdirectory(dependencies)
@@ -31,7 +33,7 @@ elseif(APPLE)
3133
find_library(FOUNDATION_FRAMEWORK Foundation)
3234
target_link_libraries(SpaceCheckers PRIVATE ${FOUNDATION_FRAMEWORK})
3335
else()
34-
add_executable(SpaceCheckers ${GAME_SRC})
36+
add_executable(SpaceCheckers ${GAME_SRC})
3537
endif()
3638

3739
# link all required libraries
@@ -43,14 +45,14 @@ include_directories(${SFML_HOME}/include)
4345

4446
# show warnings (depending on C++ compiler)
4547
if(MSVC)
46-
target_compile_options(SpaceCheckers PRIVATE /W4 /sdl)
48+
target_compile_options(SpaceCheckers PRIVATE /W4 /sdl /Qvec-report:1)
4749
else()
4850
target_compile_options(SpaceCheckers PRIVATE -Wall)
4951
endif()
5052

5153
# COPY resources folder to destination
5254
if(NOT APPLE)
53-
add_custom_command(
55+
add_custom_command(
5456
TARGET SpaceCheckers
5557
POST_BUILD
5658
COMMAND ${CMAKE_COMMAND} -E copy_directory ${PROJECT_SOURCE_DIR}/resources

dependencies/libcpr.cmake

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# add libcpr (HTTP Client) v1.10.5
1+
# add libcpr (HTTP Client) v1.11.1
22

33
SET(SSL_OPTION "CPR_FORCE_OPENSSL_BACKEND TRUE")
44
if(WIN32)
@@ -9,8 +9,8 @@ endif()
99

1010
CPMAddPackage(
1111
NAME cpr
12-
URL "https://github.com/libcpr/cpr/archive/refs/tags/1.10.5.tar.gz"
13-
VERSION 1.10.5
12+
URL "https://github.com/libcpr/cpr/archive/refs/tags/1.11.1.tar.gz"
13+
VERSION 1.11.1
1414
DOWNLOAD_EXTRACT_TIMESTAMP TRUE
15-
OPTIONS "BUILD_SHARED_LIBS FALSE" ${SSL_OPTION}
16-
)
15+
OPTIONS "BUILD_SHARED_LIBS FALSE" "CURL_USE_LIBPSL OFF" "USE_LIBIDN2 OFF" ${SSL_OPTION}
16+
)

src/CircularBuffer.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ template <typename T> class CircularBuffer
1717

1818
public:
1919
// Constructor, sets maxCapacity limit
20-
explicit CircularBuffer(const uint32_t &maxCapacity) : max_capacity(maxCapacity)
20+
explicit CircularBuffer(const uint32_t maxCapacity) : max_capacity(maxCapacity)
2121
{
2222
m_deque.resize(max_capacity);
2323
}
@@ -32,8 +32,8 @@ template <typename T> class CircularBuffer
3232
void clean();
3333

3434
private:
35-
uint32_t max_capacity{}; // max Capacity
36-
std::deque<T> m_deque{}; // actual container of elements
35+
uint32_t max_capacity; // max Capacity
36+
std::deque<T> m_deque; // actual container of elements
3737
};
3838

3939
/**

src/GameManager.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//
2-
// Created by Davis on 10/29/2023.
2+
// Created by Davis on 2023-10-29.
33
//
44
#pragma once
55

@@ -87,7 +87,7 @@ class GameManager
8787
[[nodiscard]] const std::vector<chk::Block> &getBlockList() const;
8888
[[nodiscard]] bool isHunterActive() const;
8989
[[nodiscard]] const bool isGameOver() const;
90-
void setSourceCell(int src_cell);
90+
void setSourceCell(const int src_cell);
9191
void doCleanup();
9292
void identifyTargets(const chk::PlayerPtr &hunter, const chk::Block &singleCell = nullptr);
9393
virtual void handleMovePiece(const chk::PlayerPtr &player, const chk::PlayerPtr &opponent, const Block &destCell,

src/MainMenu.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ constexpr auto ICON_PATH = "win-icon-16.png";
2020
constexpr auto FONT_PATH = "notosans-regular.ttf";
2121
constexpr auto APP_VERSION = "v1.0.9";
2222

23-
enum class UserChoice : uint16_t
23+
enum class UserChoice
2424
{
2525
LOCAL_PLAY = 38483, // playing offline
2626
ONLINE_PLAY, // playing online

src/Piece.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ inline bool Piece::moveCapture(const sf::Vector2f &destPos)
243243
return false;
244244
}
245245

246-
this->move(sf::Vector2f{deltaX, deltaY});
246+
this->move(sf::Vector2f{deltaX, deltaY}); // means "move by (x,y) amout"
247247
this->myCircle.setPosition(this->getPosition());
248248
if ((this->pieceType == PieceType::Red && destPos.y == 0) ||
249249
(this->pieceType == PieceType::Black && destPos.y == 7 * chk::SIZE_CELL))

src/Player.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ inline void Player::receivePiece(chk::PiecePtr &piecePtr)
6262
}
6363

6464
/**
65-
* When a player's piece is captured, -1 from list
65+
* When a player's piece is captured, remove it from basket
6666
* @param targetId the captured piece Id
6767
*/
6868
inline void Player::losePiece(const short targetId)

src/WsClient.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ inline void WsClient::showConnectWindow()
134134
}
135135

136136
// =================== PRIVATE SERVERS ===============================
137-
ImGui::SetNextWindowSize(ImVec2{300.0, 300.0});
137+
ImGui::SetNextWindowSize(ImVec2{300.0f, 300.0f});
138138
static char inputUrl[256] = "127.0.0.1:9876/game";
139139
if (ImGui::Begin("Private Server", nullptr, ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoCollapse))
140140
{
@@ -498,7 +498,7 @@ inline void WsClient::runServerLoop()
498498
}
499499
}
500500
}
501-
std::scoped_lock lg(this->mut);
501+
std::scoped_lock lg{this->mut};
502502
this->msgBuffer.clean();
503503
}
504504

@@ -513,7 +513,7 @@ inline void WsClient::showErrorPopup()
513513
}
514514
// Always center this next dialog
515515
ImVec2 center = ImGui::GetMainViewport()->GetCenter();
516-
ImGui::SetNextWindowPos(center, ImGuiCond_Always, ImVec2{0.5, 0.5});
516+
ImGui::SetNextWindowPos(center, ImGuiCond_Always, ImVec2{0.5f, 0.5f});
517517
ImGui::OpenPopup("Error", ImGuiPopupFlags_NoOpenOverExistingPopup);
518518
if (ImGui::BeginPopupModal("Error", nullptr, ImGuiWindowFlags_AlwaysAutoResize))
519519
{
@@ -536,7 +536,7 @@ inline void WsClient::showWinnerPopup()
536536
{
537537
// Always center this next dialog
538538
ImVec2 center = ImGui::GetMainViewport()->GetCenter();
539-
ImGui::SetNextWindowPos(center, ImGuiCond_Always, ImVec2{0.5, 0.5});
539+
ImGui::SetNextWindowPos(center, ImGuiCond_Always, ImVec2{0.5f, 0.5f});
540540
ImGui::OpenPopup("GameOver", ImGuiPopupFlags_NoOpenOverExistingPopup);
541541
if (ImGui::BeginPopupModal("GameOver", nullptr, ImGuiWindowFlags_AlwaysAutoResize))
542542
{

src/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ int main()
6262
// create pieces and give each player their own
6363
manager->createAllPieces();
6464

65-
// Storing currently clicked Piece. (NOTE: using braces constructor)
65+
// Storing currently clicked Piece. (NOTE: using curly braces)
6666
chk::CircularBuffer<short> circularBuffer{1};
6767

6868
// THE STATUS TEXT

src/managers/GameManager.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ const bool GameManager::isPlayerRedTurn() const
190190
* Store the cell idx from which the piece is LEAVING
191191
* @param src_cell index of the cell
192192
*/
193-
void GameManager::setSourceCell(int src_cell)
193+
void GameManager::setSourceCell(const int src_cell)
194194
{
195195
this->sourceCell = src_cell;
196196
}
@@ -225,7 +225,7 @@ bool GameManager::isHunterActive() const
225225
}
226226

227227
/**
228-
* Using cached gameMap, get the PieceId placed at this cell_index
228+
* Using cached gameMap, get the PieceId found at this cell_index
229229
*
230230
* @param cell_idx the clicked cell
231231
* @return positive number or -1 if not found

0 commit comments

Comments
 (0)