From bc4cef92d8efbf97a9215122abc2d7247c287f12 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20Ankarstr=C3=B6m?= Date: Fri, 2 Sep 2022 20:16:04 +0200 Subject: Improve Window object. --- c/ext.cpp | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) (limited to 'c/ext.cpp') diff --git a/c/ext.cpp b/c/ext.cpp index 77028d1..ea6718a 100644 --- a/c/ext.cpp +++ b/c/ext.cpp @@ -3,14 +3,12 @@ #include #include "data.h" -#include "main.h" +#include "window.h" -extern Window* g_window; - -bool OpenOnline(int iEp) +bool OpenOnline(const CfgA& cfg, int iEp) { - wchar_t url[sizeof(g_window->cfg.url)+4]; - Swprintf(url, L"%s%d", g_window->cfg.url, iEp); + wchar_t url[sizeof(cfg.url)+4]; + Swprintf(url, L"%s%d", cfg.url, iEp); INT_PTR r = reinterpret_cast( ShellExecuteW(nullptr, L"open", url, nullptr, nullptr, SW_SHOWNORMAL)); if (r <= 32) @@ -18,9 +16,8 @@ bool OpenOnline(int iEp) return true; } -bool OpenWiki(int iEp) +bool OpenWiki(const DlvDataA& d) { - const DlvDataA& d = g_window->fvDlv.At(iEp-1); wchar_t url[sizeof(d.wiki)+35]; Swprintf(url, L"https://www.detectiveconanworld.com%s", d.wiki); INT_PTR r = reinterpret_cast( @@ -110,10 +107,10 @@ static bool FindMatchingFile(wchar_t (&file)[MAX_PATH], const wchar_t* const roo return false; } -bool OpenLocally(int iEp) +bool OpenLocally(CfgA& cfg, const ElvDataA& e) { wchar_t file[MAX_PATH]; - if (FindMatchingFile(file, g_window->cfg.root, g_window->fvElv.At(iEp-1).siEp)) { + if (FindMatchingFile(file, cfg.root, e.siEp)) { INT_PTR r = reinterpret_cast( ShellExecuteW(nullptr, L"open", file, nullptr, nullptr, SW_SHOWNORMAL)); if (r <= 32) -- cgit v1.2.3