Skip to content

Commit bd64446

Browse files
authored
add support for load-once.conf (#2761)
1 parent e0c7030 commit bd64446

4 files changed

Lines changed: 12 additions & 64 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
/WindBot
1414
/cards.cdb
1515
/error.log
16+
/system.conf
1617
/bot.conf
1718
/Bot.exe
1819
/bot

gframe/game.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,8 @@ void DuelInfo::Clear() {
6868
}
6969

7070
bool Game::Initialize() {
71-
LoadConfig();
71+
LoadConfig("system.conf");
72+
LoadConfig("load-once.conf");
7273
irr::SIrrlichtCreationParameters params{};
7374
params.AntiAlias = gameConf.antialias;
7475
if(gameConf.use_d3d)
@@ -1392,8 +1393,8 @@ void Game::RefreshBot() {
13921393
RefreshCategoryDeck(cbBotDeckCategory, cbBotDeck);
13931394
}
13941395
}
1395-
void Game::LoadConfig() {
1396-
FILE* fp = myfopen("system.conf", "r");
1396+
void Game::LoadConfig(const char* file) {
1397+
FILE* fp = myfopen(file, "r");
13971398
if(!fp)
13981399
return;
13991400
char linebuf[CONFIG_LINE_SIZE]{};
@@ -1534,6 +1535,7 @@ void Game::LoadConfig() {
15341535
std::fclose(fp);
15351536
}
15361537
void Game::SaveConfig() {
1538+
FileSystem::RemoveFile("load-once.conf");
15371539
FILE* fp = myfopen("system.conf", "w");
15381540
std::fprintf(fp, "#config file\n#nickname & gamename should be less than 20 characters\n");
15391541
char linebuf[CONFIG_LINE_SIZE];

gframe/game.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,24 +48,24 @@ struct Config {
4848
bool use_d3d{ false };
4949
bool use_image_scale_multi_thread{ false };
5050
bool use_image_load_background_thread{ false };
51-
unsigned short antialias{ 0 };
51+
unsigned short antialias{ 2 };
5252
unsigned int enable_log{ 0x3 };
5353
unsigned short serverport{ 7911 };
5454
unsigned char textfontsize{ 14 };
5555
wchar_t lasthost[100]{};
5656
wchar_t lastport[10]{};
57-
wchar_t nickname[20]{};
58-
wchar_t gamename[20]{};
57+
wchar_t nickname[20]{ L"Player" };
58+
wchar_t gamename[20]{ L"Game" };
5959
wchar_t roompass[20]{};
6060
//path
6161
wchar_t lastcategory[256]{};
6262
wchar_t lastdeck[256]{};
6363
char textfont[256]{};
6464
char numfont[256]{};
65-
wchar_t bot_deck_path[256]{};
65+
wchar_t bot_deck_path[256]{ L"./botdeck" };
6666
//settings
6767
int chkMAutoPos{ 0 };
68-
int chkSTAutoPos{ 1 };
68+
int chkSTAutoPos{ 0 };
6969
int chkRandomPos{ 0 };
7070
int chkAutoChain{ 0 };
7171
int chkWaitChain{ 0 };
@@ -192,7 +192,7 @@ class Game {
192192
void WaitFrameSignal(int frame);
193193
void DrawThumb(const CardDataC* cp, irr::core::vector2di pos, const LFList* lflist, bool drag = false);
194194
void DrawDeckBd();
195-
void LoadConfig();
195+
void LoadConfig(const char* file);
196196
void SaveConfig();
197197
void ShowCardInfo(int code, bool resize = false);
198198
void ClearCardInfo(int player = 0);

system.conf

Lines changed: 0 additions & 55 deletions
This file was deleted.

0 commit comments

Comments
 (0)