GothicStarter ini file [OPTIONS] section not implemented
I maintainer di solito rispondono entro 2 giorni
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 72/100
Direzione di ricerca
Start in game/gothic.cpp and game/gothic.h to trace INI parsing and the proposed start-time state, then inspect game/game/gamesession.cpp where the initial time is set. Verify the OPTIONS/force_Parameters path with a GothicStarter INI containing -time:HH:MM; done means the game starts at that time while retaining the existing 8:00 default when the option is absent or invalid.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
I am trying to use an INI file which contains the following section:
[OPTIONS]
show_Info=1
show_Version=1
force_Subtitles=1
force_Parameters=-time:00:00
This INI works with vanilla Gothic II and G2MDK 2.6a installed.
Could a time parameter be added to OpenGothic to allow the game to start at a specific time?
Currently, the time can be changed through Marvin Mode using the "set time 0 0" option.
Parsing can be added with following diff:
diff --git a/game/game/gamesession.cpp b/game/game/gamesession.cpp
index 6f5c549..a954ae6 100644
--- a/game/game/gamesession.cpp
+++ b/game/game/gamesession.cpp
@@ -71,7 +71,7 @@ GameSession::GameSession(std::string file) {
Gothic::inst().setLoadingProgress(0);
setupSettings();
- setTime(gtime(8,0));
+ setTime(Gothic::inst().hasStartTime() ? Gothic::inst().startTime() : gtime(8,0));
vm.reset(new GameScript(*this));
initPerceptions();
diff --git a/game/gothic.cpp b/game/gothic.cpp
index e795b80..2aa01ba 100644
--- a/game/gothic.cpp
+++ b/game/gothic.cpp
@@ -6,6 +6,7 @@
#include <cstring>
#include <cctype>
#include <cassert>
+#include <cstdio>
#include <zenkit/addon/daedalus.hh>
@@ -212,6 +213,20 @@ Gothic::Gothic() {
if(!mod.empty())
modvdfs.emplace_back(std::move(mod));
}
+
+ if(modFile->has("OPTIONS","force_Parameters")) {
+ const std::string params(modFile->getS("OPTIONS","force_Parameters"));
+ const size_t tPos = params.find("-time:");
+ if(tPos!=std::string::npos) {
+ int hh=0, mm=0;
+ if(std::sscanf(params.c_str()+tPos, "-time:%d:%d", &hh, &mm)==2) {
+ startTimeVal = gtime(hh,mm);
+ startTimeSet = true;
+ } else {
+ Log::e("failed to parse -time from force_Parameters: \"",params,"\"");
+ }
+ }
+ }
}
/*
'/work' seem to have lowest priority
diff --git a/game/gothic.h b/game/gothic.h
index 00003a2..5ea19c7 100644
--- a/game/gothic.h
+++ b/game/gothic.h
@@ -75,6 +75,8 @@ class Gothic final {
std::string_view defaultWorld() const;
std::string_view defaultPlayer() const;
+ bool hasStartTime() const { return startTimeSet; }
+ gtime startTime() const { return startTimeVal; }
std::string_view defaultSave() const;
std::string_view defaultGameDatFile() const;
std::string_view defaultOutputUnits() const;
@@ -229,6 +231,8 @@ class Gothic final {
Benchmark isBenchmark = Benchmark::None;
std::string wrldDef, plDef, gameDatDef, ouDef;
+ bool startTimeSet = false;
+ gtime startTimeVal;
std::unique_ptr<IniFile> defaults;
std::unique_ptr<IniFile> baseIniFile;
- Lingua principale
- C++
- Stelle
- 1.6k
- Fork
- 138
- Merge medio
- 4g 21h
- PR unite (30g)
- 11
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di Try/OpenGothic
-
Build fails with GCC 16 and -march=native: -Werror=array-bounds in DynamicWorld::soundOclusion()Apertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
Try/OpenGothic#1010 · 2 commenti ·
I maintainer di solito rispondono entro 2 giorni
-
bug
Difficoltà 4/5 3-5 giorni Idoneità per principianti 52/100
Try/OpenGothic#1054 ·
I maintainer di solito rispondono entro 2 giorni
-
bug
Difficoltà 4/5 3-5 giorni Idoneità per principianti 42/100
Try/OpenGothic#1053 · 1 commento ·
I maintainer di solito rispondono entro 2 giorni
-
[Gothic I] Pyrokinesis spell does not cause damageForse già presa Una pull request collegata a questa issue è aperta o già unita. Apertabug
Difficoltà 4/5 3-5 giorni Idoneità per principianti 48/100
Try/OpenGothic#1052 · 3 commenti ·
I maintainer di solito rispondono entro 2 giorni
-
bug
Difficoltà 3/5 1-2 giorni Idoneità per principianti 54/100
Try/OpenGothic#1051 ·
I maintainer di solito rispondono entro 2 giorni
Tutte le issue di Try/OpenGothic
Issue simili
-
Bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 82/100
-
v3: Lua m.setvar() returns -1 on errors, so the script gets stack garbageForse già presa Una pull request collegata a questa issue è aperta o già unita. Aperta3.x bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
owasp-modsecurity/ModSecurity#3731 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
Sendspin/sendspin-cpp-cli#111 ·
I maintainer di solito rispondono entro 1 giorno
-
[Core/Config] The server fails to start due to an invalid config path when debuggingForse già presa Una pull request collegata a questa issue è aperta o già unita. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
azerothcore/azerothcore-wotlk#28350 ·
I maintainer di solito rispondono entro 1 giorno