Skip to content

Commit

Permalink
xrEngine/EngineAPI.cpp: optimization
Browse files Browse the repository at this point in the history
  • Loading branch information
Xottab-DUTY committed May 28, 2018
1 parent a232aa2 commit 4cfc50d
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions src/xrEngine/EngineAPI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -208,21 +208,19 @@ void CEngineAPI::Destroy(void)

void CEngineAPI::CreateRendererList()
{
if (!vid_quality_token.empty())
return;

hRenderR1 = XRay::LoadModule("xrRender_R1");

xr_vector<xr_token> modes;
if (GEnv.isDedicatedServer)
{
R_ASSERT2(hRenderR1->IsLoaded(), "Dedicated server needs xrRender_R1 to work");
modes.emplace_back(xr_token("renderer_r1", 0));
modes.emplace_back(xr_token(nullptr, -1));
vid_quality_token = std::move(modes);
vid_quality_token.emplace_back(xr_token("renderer_r1", 0));
vid_quality_token.emplace_back(xr_token(nullptr, -1));
return;
}

if (!vid_quality_token.empty())
return;

// Hide "d3d10.dll not found" message box for XP
SetErrorMode(SEM_FAILCRITICALERRORS);

Expand All @@ -234,6 +232,8 @@ void CEngineAPI::CreateRendererList()
// Restore error handling
SetErrorMode(0);

auto& modes = vid_quality_token;

if (hRenderR1->IsLoaded())
{
modes.emplace_back(xr_token("renderer_r1", 0));
Expand Down Expand Up @@ -276,6 +276,4 @@ void CEngineAPI::CreateRendererList()
for (const auto& mode : modes)
if (mode.name)
Log(mode.name);

vid_quality_token = std::move(modes);
}

0 comments on commit 4cfc50d

Please sign in to comment.