MCPcopy Create free account
hub / github.com/BohemiaInteractive/CWR / ApplyCommandLine

Method ApplyCommandLine

engine/Poseidon/Core/Config/Configuration.cpp:141–224  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

139}
140
141void ConfigurationSystem::ApplyCommandLine(const AppConfig& cliArgs)
142{
143 LOG_TRACE(Config, " [2/2] Applying command-line arguments...");
144
145 auto& ec = *m_engineConfig;
146
147 // Runtime flags — only override when CLI flag is actually set
148 if (cliArgs.CheckInitAndExit())
149 m_runtimeFlags->checkInitAndExit = true;
150 if (cliArgs.NoSplash())
151 ec.noSplash = true;
152
153 // Display mode: CLI overrides config file only when explicitly provided
154 if (cliArgs.IsWindowMode())
155 {
156 ec.useWindow = true;
157 SetValue("display.windowed", "true", "CLI");
158 }
159 if (cliArgs.IsDisplayModeExplicit())
160 {
161 ec.displayMode = cliArgs.GetDisplayMode();
162 SetValue("display.mode", cliArgs.GetDisplayMode(), "CLI");
163 }
164
165 // Derive useWindow from displayMode
166 if (ec.displayMode == "windowed")
167 ec.useWindow = true;
168
169 if (cliArgs.NoSound())
170 ec.noSound = true;
171 if (cliArgs.NoLandscape())
172 m_runtimeFlags->noLandscape = true;
173 if (cliArgs.IsHostServer())
174 m_runtimeFlags->hostMultiplayer = true;
175 if (cliArgs.EnableHWTL())
176 {
177 ec.enableHWTL = true;
178 SetValue("graphics.hw_tnl", "true", "CLI");
179 }
180 if (cliArgs.EnablePIII())
181 ec.enablePIII = true;
182 if (cliArgs.NetLog())
183 ec.netLogEnabled = true;
184
185 // Display settings — only when explicitly provided on CLI
186 if (cliArgs.IsWidthExplicit())
187 {
188 ec.wantW = cliArgs.GetWindowWidth();
189 SetValue("display.width", std::to_string(cliArgs.GetWindowWidth()), "CLI");
190 }
191 if (cliArgs.IsHeightExplicit())
192 {
193 ec.wantH = cliArgs.GetWindowHeight();
194 SetValue("display.height", std::to_string(cliArgs.GetWindowHeight()), "CLI");
195 }
196
197 // Graphics
198 if (cliArgs.NoTextures())

Callers

nothing calls this directly

Calls 15

SetValueFunction · 0.85
CheckInitAndExitMethod · 0.80
NoSplashMethod · 0.80
IsWindowModeMethod · 0.80
IsDisplayModeExplicitMethod · 0.80
NoSoundMethod · 0.80
NoLandscapeMethod · 0.80
IsHostServerMethod · 0.80
EnableHWTLMethod · 0.80
EnablePIIIMethod · 0.80
NetLogMethod · 0.80
IsWidthExplicitMethod · 0.80

Tested by

no test coverage detected