Skip to content

Commit 2169bcd

Browse files
committed
adapt to newest sfml
1 parent 44de468 commit 2169bcd

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+389
-383
lines changed

CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ set(SFML_ENABLE_PCH true)
9797
CPMAddPackage(
9898
NAME SFML
9999
GITHUB_REPOSITORY vittorioromeo/SFML
100-
GIT_TAG dd0cc60de5f07f4180821db9b3f89fbc15cdf03f
100+
GIT_TAG ae249dae3e3de4b1790098a1067c24750921c8ec
101101
)
102102

103103
set_target_properties(sfml-system PROPERTIES UNITY_BUILD ON)

include/SSVOpenHexagon/Core/HGStatus.hpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
#include <array>
1010
#include <cstddef>
11-
#include <optional>
11+
#include <SFML/Base/Optional.hpp>
1212
#include <string>
1313

1414
namespace hg {
@@ -78,7 +78,7 @@ struct HexagonGameStatus
7878
bool showPlayerTrail{true};
7979

8080
// Shaders
81-
std::array<std::optional<std::size_t>,
81+
std::array<sf::base::Optional<std::size_t>,
8282
static_cast<std::size_t>(RenderStage::Count)>
8383
fragmentShaderIds;
8484

include/SSVOpenHexagon/Core/HexagonClient.hpp

+8-8
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
#include <SFML/Network/Packet.hpp>
1515

1616
#include <deque>
17-
#include <optional>
17+
#include <SFML/Base/Optional.hpp>
1818
#include <sstream>
1919
#include <unordered_set>
2020
#include <variant>
@@ -84,7 +84,7 @@ class HexagonClient
8484
private:
8585
Steam::steam_manager& _steamManager;
8686

87-
std::optional<std::uint64_t> _ticketSteamID;
87+
sf::base::Optional<std::uint64_t> _ticketSteamID;
8888

8989
const sf::IpAddress _serverIp;
9090
const unsigned short _serverPort;
@@ -100,13 +100,13 @@ class HexagonClient
100100
bool _verbose;
101101

102102
const SodiumPSKeys _clientPSKeys;
103-
std::optional<SodiumPublicKeyArray> _serverPublicKey;
104-
std::optional<SodiumRTKeys> _clientRTKeys;
103+
sf::base::Optional<SodiumPublicKeyArray> _serverPublicKey;
104+
sf::base::Optional<SodiumRTKeys> _clientRTKeys;
105105

106106
State _state;
107107

108-
std::optional<std::uint64_t> _loginToken;
109-
std::optional<std::string> _loginName;
108+
sf::base::Optional<std::uint64_t> _loginToken;
109+
sf::base::Optional<std::string> _loginName;
110110

111111
std::deque<Event> _events;
112112

@@ -192,10 +192,10 @@ class HexagonClient
192192
[[nodiscard]] State getState() const noexcept;
193193
[[nodiscard]] bool hasRTKeys() const noexcept;
194194

195-
[[nodiscard]] const std::optional<std::string>&
195+
[[nodiscard]] const sf::base::Optional<std::string>&
196196
getLoginName() const noexcept;
197197

198-
[[nodiscard]] std::optional<Event> pollEvent();
198+
[[nodiscard]] sf::base::Optional<Event> pollEvent();
199199

200200
[[nodiscard]] bool isLevelSupportedByServer(
201201
const std::string& levelValidator) const noexcept;

include/SSVOpenHexagon/Core/HexagonGame.hpp

+11-11
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
#include <sstream>
4343
#include <unordered_set>
4444
#include <functional>
45-
#include <optional>
45+
#include <SFML/Base/Optional.hpp>
4646
#include <vector>
4747
#include <string>
4848
#include <string_view>
@@ -114,7 +114,7 @@ class HexagonGame
114114
std::int8_t steamAttempt{1};
115115

116116
HGAssets& assets;
117-
std::optional<TextUI> textUI;
117+
sf::base::Optional<TextUI> textUI;
118118

119119
Audio* audio;
120120

@@ -151,16 +151,16 @@ class HexagonGame
151151
float timeUntilRichPresenceUpdate = 0.f;
152152

153153
private:
154-
std::optional<ssvs::Camera> backgroundCamera;
155-
std::optional<ssvs::Camera> overlayCamera;
154+
sf::base::Optional<ssvs::Camera> backgroundCamera;
155+
sf::base::Optional<ssvs::Camera> overlayCamera;
156156

157157
struct PreShakeCenters
158158
{
159159
sf::Vector2f background;
160160
sf::Vector2f overlay;
161161
};
162162

163-
std::optional<PreShakeCenters> preShakeCenters;
163+
sf::base::Optional<PreShakeCenters> preShakeCenters;
164164

165165
const sf::Vector2f centerPos{0.f, 0.f};
166166

@@ -219,7 +219,7 @@ class HexagonGame
219219
float angle;
220220
};
221221

222-
std::optional<SwapParticleSpawnInfo> swapParticlesSpawnInfo;
222+
sf::base::Optional<SwapParticleSpawnInfo> swapParticlesSpawnInfo;
223223
float nextPBParticleSpawn{0.f};
224224
float pbTextGrowth{0.f};
225225

@@ -261,7 +261,7 @@ class HexagonGame
261261
explicit ActiveReplay(const replay_file& mReplayFile);
262262
};
263263

264-
std::optional<ActiveReplay> activeReplay;
264+
sf::base::Optional<ActiveReplay> activeReplay;
265265

266266
random_number_generator::seed_type lastSeed{};
267267
replay_data lastReplayData{};
@@ -347,11 +347,11 @@ class HexagonGame
347347
void initFlashEffect(int r, int g, int b);
348348

349349
// Fast-forward
350-
std::optional<double> fastForwardTarget;
350+
sf::base::Optional<double> fastForwardTarget;
351351
void fastForwardTo(const double target);
352352

353353
// Advance by ticks
354-
std::optional<int> advanceTickCount;
354+
sf::base::Optional<int> advanceTickCount;
355355
void advanceByTicks(const int nTicks);
356356

357357
// Update methods
@@ -501,10 +501,10 @@ class HexagonGame
501501
float customScore;
502502
};
503503

504-
[[nodiscard]] std::optional<GameExecutionResult> executeGameUntilDeath(
504+
[[nodiscard]] sf::base::Optional<GameExecutionResult> executeGameUntilDeath(
505505
const int maxProcessingSeconds, const float timescale);
506506

507-
[[nodiscard]] std::optional<GameExecutionResult>
507+
[[nodiscard]] sf::base::Optional<GameExecutionResult>
508508
runReplayUntilDeathAndGetScore(const replay_file& mReplayFile,
509509
const int maxProcessingSeconds, const float timescale);
510510

include/SSVOpenHexagon/Core/HexagonServer.hpp

+6-6
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
#include <SFML/Network/UdpSocket.hpp>
2020

2121
#include <list>
22-
#include <optional>
22+
#include <SFML/Base/Optional.hpp>
2323
#include <sstream>
2424
#include <string>
2525
#include <unordered_set>
@@ -69,8 +69,8 @@ class HexagonServer
6969
Utils::SCTimePoint _lastActivity;
7070
int _consecutiveFailures;
7171
bool _mustDisconnect;
72-
std::optional<SodiumPublicKeyArray> _clientPublicKey;
73-
std::optional<SodiumRTKeys> _rtKeys;
72+
sf::base::Optional<SodiumPublicKeyArray> _clientPublicKey;
73+
sf::base::Optional<SodiumRTKeys> _rtKeys;
7474

7575
struct LoginData
7676
{
@@ -81,7 +81,7 @@ class HexagonServer
8181
std::uint64_t _loginToken;
8282
};
8383

84-
std::optional<LoginData> _loginData;
84+
sf::base::Optional<LoginData> _loginData;
8585

8686
State _state;
8787

@@ -91,7 +91,7 @@ class HexagonServer
9191
std::string _levelValidator;
9292
};
9393

94-
std::optional<GameStatus> _gameStatus;
94+
sf::base::Optional<GameStatus> _gameStatus;
9595

9696
explicit ConnectedClient(const Utils::SCTimePoint lastActivity);
9797
~ConnectedClient();
@@ -139,7 +139,7 @@ class HexagonServer
139139
[[nodiscard]] bool sendTopScoresAndOwnScore(ConnectedClient& c,
140140
const std::string& levelValidator,
141141
const std::vector<Database::ProcessedScore>& scores,
142-
const std::optional<Database::ProcessedScore>& ownScore);
142+
const sf::base::Optional<Database::ProcessedScore>& ownScore);
143143
[[nodiscard]] bool sendServerStatus(ConnectedClient& c,
144144
const ProtocolVersion& protocolVersion, const GameVersion& gameVersion,
145145
const std::vector<std::string>& supportedLevelValidators);

include/SSVOpenHexagon/Core/LeaderboardCache.hpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#include <string>
1212
#include <vector>
1313
#include <unordered_map>
14-
#include <optional>
14+
#include <SFML/Base/Optional.hpp>
1515

1616
namespace hg {
1717

@@ -21,7 +21,7 @@ class LeaderboardCache
2121
struct CachedScores
2222
{
2323
std::vector<Database::ProcessedScore> _scores;
24-
std::optional<Database::ProcessedScore> _ownScore;
24+
sf::base::Optional<Database::ProcessedScore> _ownScore;
2525
HRTimePoint _cacheTime;
2626
};
2727

include/SSVOpenHexagon/Core/MenuGame.hpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
#include <array>
3434
#include <cctype>
3535
#include <functional>
36-
#include <optional>
36+
#include <SFML/Base/Optional.hpp>
3737
#include <string_view>
3838
#include <string>
3939
#include <utility>
@@ -272,9 +272,9 @@ class MenuGame
272272
bool mousePressed{false};
273273
bool mustFavorite{false};
274274
bool mustPlay{false};
275-
std::optional<int> mustChangeIndexTo;
276-
std::optional<int> mustChangePackIndexTo;
277-
std::optional<int> mustUseMenuItem;
275+
sf::base::Optional<int> mustChangeIndexTo;
276+
sf::base::Optional<int> mustChangePackIndexTo;
277+
sf::base::Optional<int> mustUseMenuItem;
278278
bool mouseCursorVisible{true};
279279
sf::Vector2i lastMouseMovedPosition{};
280280

include/SSVOpenHexagon/Core/Replay.hpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#include <cstdint>
1212
#include <cstring>
1313
#include <filesystem>
14-
#include <optional>
14+
#include <SFML/Base/Optional.hpp>
1515
#include <string>
1616
#include <vector>
1717

@@ -161,10 +161,10 @@ struct compressed_replay_file
161161
[[nodiscard]] bool deserialize_from_packet(sf::Packet& p);
162162
};
163163

164-
[[nodiscard]] std::optional<compressed_replay_file> compress_replay_file(
164+
[[nodiscard]] sf::base::Optional<compressed_replay_file> compress_replay_file(
165165
const replay_file& rf);
166166

167-
[[nodiscard]] std::optional<replay_file> decompress_replay_file(
167+
[[nodiscard]] sf::base::Optional<replay_file> decompress_replay_file(
168168
const compressed_replay_file& crf);
169169

170170
} // namespace hg

include/SSVOpenHexagon/Core/Steam.hpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
#include <cstdint>
1010
#include <functional>
11-
#include <optional>
11+
#include <SFML/Base/Optional.hpp>
1212
#include <string_view>
1313
#include <string>
1414

@@ -62,7 +62,7 @@ class steam_manager
6262

6363
[[nodiscard]] bool got_encrypted_app_ticket() const noexcept;
6464

65-
[[nodiscard]] std::optional<std::uint64_t>
65+
[[nodiscard]] sf::base::Optional<std::uint64_t>
6666
get_ticket_steam_id() const noexcept;
6767
};
6868

include/SSVOpenHexagon/Global/Assets.hpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#include "SSVOpenHexagon/Utils/UniquePtr.hpp"
88

99
#include <cstddef>
10-
#include <optional>
10+
#include <SFML/Base/Optional.hpp>
1111
#include <string>
1212
#include <unordered_map>
1313
#include <unordered_set>
@@ -94,9 +94,9 @@ class HGAssets
9494
[[nodiscard]] sf::Shader* getShader(
9595
const std::string& mPackId, const std::string& mId);
9696

97-
[[nodiscard]] std::optional<std::size_t> getShaderId(
97+
[[nodiscard]] sf::base::Optional<std::size_t> getShaderId(
9898
const std::string& mPackId, const std::string& mId);
99-
[[nodiscard]] std::optional<std::size_t> getShaderIdByPath(
99+
[[nodiscard]] sf::base::Optional<std::size_t> getShaderIdByPath(
100100
const std::string& mShaderPath);
101101
[[nodiscard]] sf::Shader* getShaderByShaderId(const std::size_t mShaderId);
102102
[[nodiscard]] bool isValidShaderId(const std::size_t mShaderId) const;

include/SSVOpenHexagon/Global/PCH.hpp

+3-4
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@
4747
#include <list>
4848
#include <map>
4949
#include <memory>
50-
#include <optional>
5150
#include <random>
5251
#include <sstream>
5352
#include <stdexcept>
@@ -229,9 +228,9 @@
229228

230229
extern template class std::vector<std::string>;
231230

232-
extern template class std::optional<int>;
233-
extern template class std::optional<std::size_t>;
234-
extern template class std::optional<std::string>;
231+
extern template class sf::base::Optional<int>;
232+
extern template class sf::base::Optional<std::size_t>;
233+
extern template class sf::base::Optional<std::string>;
235234

236235
extern template class std::unordered_map<std::string, float>;
237236
extern template class std::unordered_map<float, std::string>;

include/SSVOpenHexagon/Online/Database.hpp

+5-5
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
#include <string>
1010
#include <cstdint>
11-
#include <optional>
11+
#include <SFML/Base/Optional.hpp>
1212
#include <vector>
1313

1414
// TODO (P2): remove reliance on steam ID for future platforms
@@ -25,7 +25,7 @@ void dumpUsers();
2525

2626
[[nodiscard]] bool anyUserWithName(const std::string& name);
2727

28-
[[nodiscard]] std::optional<User> getUserWithSteamIdAndName(
28+
[[nodiscard]] sf::base::Optional<User> getUserWithSteamIdAndName(
2929
const std::uint64_t steamId, const std::string& name);
3030

3131
void removeAllLoginTokensForUser(const std::uint32_t userId);
@@ -35,7 +35,7 @@ void addLoginToken(const LoginToken& loginToken);
3535
[[nodiscard]] std::vector<User> getAllUsersWithSteamId(
3636
const std::uint64_t steamId);
3737

38-
[[nodiscard]] std::optional<User> getUserWithSteamId(
38+
[[nodiscard]] sf::base::Optional<User> getUserWithSteamId(
3939
const std::uint64_t steamId);
4040

4141
[[nodiscard]] std::vector<LoginToken> getAllStaleLoginTokens();
@@ -49,9 +49,9 @@ void removeAllStaleLoginTokens();
4949
void addScore(const std::string& levelValidator, const std::uint64_t timestamp,
5050
const std::uint64_t userSteamId, const double value);
5151

52-
[[nodiscard]] std::optional<ProcessedScore> getScore(
52+
[[nodiscard]] sf::base::Optional<ProcessedScore> getScore(
5353
const std::string& levelValidator, const std::uint64_t userSteamId);
5454

55-
[[nodiscard]] std::optional<std::string> execute(const std::string& query);
55+
[[nodiscard]] sf::base::Optional<std::string> execute(const std::string& query);
5656

5757
} // namespace hg::Database

include/SSVOpenHexagon/Online/Shared.hpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
#include <sodium.h>
1818

1919
#include <sstream>
20-
#include <optional>
20+
#include <SFML/Base/Optional.hpp>
2121
#include <variant>
2222
#include <string>
2323
#include <vector>
@@ -113,7 +113,7 @@ struct STCPDeleteAccountSuccess { };
113113
struct STCPDeleteAccountFailure { std::string error; };
114114
struct STCPTopScores { std::string levelValidator; std::vector<Database::ProcessedScore> scores; };
115115
struct STCPOwnScore { std::string levelValidator; Database::ProcessedScore score; };
116-
struct STCPTopScoresAndOwnScore { std::string levelValidator; std::vector<Database::ProcessedScore> scores; std::optional<Database::ProcessedScore> ownScore; };
116+
struct STCPTopScoresAndOwnScore { std::string levelValidator; std::vector<Database::ProcessedScore> scores; sf::base::Optional<Database::ProcessedScore> ownScore; };
117117
struct STCPServerStatus { ProtocolVersion protocolVersion; GameVersion gameVersion; std::vector<std::string> supportedLevelValidators; };
118118
// clang-format on
119119

0 commit comments

Comments
 (0)