Skip to content

Commit f2c1b58

Browse files
committed
Add VariantMap parse stubs for spell-only build
1 parent 6458202 commit f2c1b58

File tree

2 files changed

+27
-3
lines changed

2 files changed

+27
-3
lines changed

src/variant.cpp

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,26 @@ void VariantMap::init() {
8686
add("spell-chess", spell_chess_variant());
8787
}
8888

89+
// Spell-only build: keep variant parsing entry points as no-ops for link
90+
// compatibility with UCI VariantPath handling in other build configurations.
91+
template <bool DoCheck>
92+
void VariantMap::parse_istream(std::istream& file) {
93+
(void)file;
94+
// No-op: variants are hardcoded in this build.
95+
// If DoCheck is true, callers expect validation side effects; none apply here.
96+
}
97+
98+
template <bool DoCheck>
99+
void VariantMap::parse(const std::string& data) {
100+
std::istringstream ss(data);
101+
parse_istream<DoCheck>(ss);
102+
}
103+
104+
template void VariantMap::parse_istream<true>(std::istream& file);
105+
template void VariantMap::parse_istream<false>(std::istream& file);
106+
template void VariantMap::parse<true>(const std::string& data);
107+
template void VariantMap::parse<false>(const std::string& data);
108+
89109

90110
// Pre-calculate derived properties
91111
Variant* Variant::conclude() {

src/variant.h

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ namespace Stockfish {
3636
/// Variant struct stores information needed to determine the rules of a variant.
3737

3838
struct Variant {
39-
std::string variantTemplate = "fairy";
39+
std::string variantTemplate = "spell-chess";
4040
std::string pieceToCharTable = "-";
4141
int pocketSize = 0;
4242
Rank maxRank = RANK_8;
@@ -249,8 +249,12 @@ struct Variant {
249249
class VariantMap : public std::map<std::string, const Variant*> {
250250
public:
251251
void init();
252-
template <bool DoCheck> void parse(std::string path);
253-
template <bool DoCheck> void parse_istream(std::istream& file);
252+
// Spell-only build: keep parsing entry points as no-ops for link compatibility
253+
// with UCI VariantPath handling in other build configurations.
254+
template <bool DoCheck>
255+
void parse_istream(std::istream& file);
256+
template <bool DoCheck>
257+
void parse(const std::string& data);
254258
void clear_all();
255259
std::vector<std::string> get_keys();
256260

0 commit comments

Comments
 (0)