Skip to content

Commit 423c001

Browse files
committed
views again...
1 parent 56744b6 commit 423c001

6 files changed

Lines changed: 18 additions & 13 deletions

File tree

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,9 @@ class $modify(MyPlayLayer, PlayLayer) {
6464

6565
// a vanilla hook
6666
void setupHasCompleted() {
67-
// do insane stuff with my option!
68-
6967
PlayLayer::setupHasCompleted();
68+
69+
// do insane stuff with my option!
7070
};
7171
};
7272
```

about.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,9 @@ class $modify(MyPlayLayer, PlayLayer) {
6060

6161
// a vanilla hook
6262
void setupHasCompleted() {
63-
// do insane stuff with my option!
64-
6563
PlayLayer::setupHasCompleted();
64+
65+
// do insane stuff with my option!
6666
};
6767
};
6868
```

include/Horrible.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ namespace horrible {
116116
* @param id The ID of the option to set the delegate for
117117
* @param callback The hook callback to register for this option's delegate
118118
*/
119-
void addDelegate(std::string id, geode::Function<void(bool)>&& callback);
119+
void addDelegate(geode::ZStringView id, geode::Function<void(bool)>&& callback);
120120

121121
/**
122122
* Returns a reference to the array of all registered categories
@@ -132,7 +132,7 @@ namespace horrible {
132132
* @param id The ID of the option to delegate for
133133
* @param hooks The map of hooks to delegate
134134
*/
135-
AWCW_HORRIBLE_API_DLL void delegateHooks(std::string id, geode::utils::StringMap<std::shared_ptr<geode::Hook>>& hooks);
135+
AWCW_HORRIBLE_API_DLL void delegateHooks(geode::ZStringView id, geode::utils::StringMap<std::shared_ptr<geode::Hook>>& hooks);
136136
};
137137

138138
// Statically register an option

src/classes/ui/src/SpamChallenge.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ bool SpamChallenge::init() {
3232
setID("spam-jumps"_spr);
3333

3434
// increase spam target for mobile players
35-
m_impl->m_inputTarget = randng::get(50, 20) * ((GEODE_PLATFORM_TARGET & PlatformID::Mobile) ? 2 : 1);
35+
m_impl->m_inputTarget = randng::get(50, 20) * ((GEODE_PLATFORM_TARGET & Platform::Mobile) ? 2 : 1);
3636

3737
auto const winSize = CCDirector::get()->getWinSize();
3838

src/hooks/Mock.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ inline static Option const o = {
1919
SillyTier::Medium,
2020
false,
2121
{
22-
PlatformID::Windows,
23-
PlatformID::Android,
22+
Platform::Windows,
23+
Platform::Android,
2424
},
2525
};
2626
HORRIBLE_REGISTER_OPTION(o);

src/include/Horrible.cpp

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ void OptionManager::registerOption(Option option) {
3030
};
3131
};
3232

33-
void OptionManager::addDelegate(std::string id, Function<void(bool)>&& callback) {
33+
void OptionManager::addDelegate(ZStringView id, Function<void(bool)>&& callback) {
3434
auto& thisDelegate = m_delegates[id];
3535
thisDelegate.push_back(std::move(callback));
3636
};
@@ -81,7 +81,9 @@ OptionManager* OptionManager::get() noexcept {
8181
return inst;
8282
};
8383

84-
void horrible::delegateHooks(std::string id, utils::StringMap<std::shared_ptr<Hook>>& hooks) {
84+
void horrible::delegateHooks(ZStringView id, utils::StringMap<std::shared_ptr<Hook>>& hooks) {
85+
log::debug("Attempting to delegate {} hooks for option {}", hooks.size(), id);
86+
8587
if (auto om = OptionManager::get()) {
8688
auto value = om->getOption(id);
8789

@@ -95,11 +97,14 @@ void horrible::delegateHooks(std::string id, utils::StringMap<std::shared_ptr<Ho
9597
log::debug("Delegating {} hooks for {}", allHooks.size(), id);
9698

9799
om->addDelegate(
98-
std::move(id),
99-
[allHooks = std::move(allHooks)](bool value) {
100+
id,
101+
[allHooks = std::move(allHooks), id](bool value) {
100102
for (auto hook : allHooks) (void)hook->toggle(value);
103+
log::debug("Toggled {} hooks {} for option {}", allHooks.size(), value ? "ON" : "OFF", id);
101104
}
102105
);
106+
} else {
107+
log::error("Failed to get OptionManager to delegate hooks for option {}", id);
103108
};
104109
};
105110

0 commit comments

Comments
 (0)