do not switch if entry is uninitialized for window, time, region, random

This commit is contained in:
WarmUpTill
2020-10-18 01:52:19 +02:00
parent 491108678e
commit 51612d9e7f
4 changed files with 12 additions and 0 deletions

View File

@@ -47,6 +47,9 @@ void SwitcherData::checkRandom(bool &match, OBSWeakSource &scene,
std::mt19937 urng(rng());
std::shuffle(rs.begin(), rs.end(), urng);
for (RandomSwitch &r : rs) {
if (!r.initialized())
continue;
if (r.scene == lastRandomScene)
continue;
scene = r.scene;

View File

@@ -129,6 +129,9 @@ void SwitcherData::checkScreenRegionSwitch(bool &match, OBSWeakSource &scene,
int minRegionSize = 99999;
for (auto &s : screenRegionSwitches) {
if (!s.initialized())
continue;
if (cursorPos.first >= s.minX && cursorPos.second >= s.minY &&
cursorPos.first <= s.maxX && cursorPos.second <= s.maxY) {
int regionSize = (s.maxX - s.minX) + (s.maxY - s.minY);

View File

@@ -113,6 +113,9 @@ void SwitcherData::checkTimeSwitch(bool &match, OBSWeakSource &scene,
return;
for (TimeSwitch &s : timeSwitches) {
if (!s.initialized())
continue;
if (s.trigger == LIVE)
match = checkLiveTime(s, liveTime, interval);
else

View File

@@ -215,6 +215,9 @@ void SwitcherData::checkWindowTitleSwitch(bool &match, OBSWeakSource &scene,
// Check for match
for (WindowSwitch &s : windowSwitches) {
if (!s.initialized())
continue;
// True if fullscreen is disabled OR current window is fullscreen
bool fullscreen = (!s.fullscreen || isFullscreen(s.window));
// True if maximized is disabled OR current window is maximized