Skip to content

Commit

Permalink
fix co_await discard warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
braindigitalis committed Jul 11, 2024
1 parent 1ce7906 commit 1f13e7d
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 25 deletions.
4 changes: 2 additions & 2 deletions lang.json
Original file line number Diff line number Diff line change
Expand Up @@ -8464,7 +8464,7 @@
},
"RENAMED_GUILD_TO": {
"en": "Your guild has been renamed to: **{}**",
"fr": "Votre guilde a été renommée : **{}**",
"fr": "Votre guilde a été renommée: **{}**",
"pt": "Sua guilda foi renomeada para: **{}**",
"tr": "Loncanızın adı şu şekilde değiştirildi: **{}**",
"es": "Tu gremio ha sido renombrado a: **{}**",
Expand Down Expand Up @@ -9179,7 +9179,7 @@
"en": "rename",
"fr": "renommer",
"pt": "renomear",
"tr": "yenidenisimlendirmek",
"tr": "yenidenisimlendir",
"es": "rebautizar",
"de": "umbenennen",
"hi": "नामबदलने",
Expand Down
18 changes: 9 additions & 9 deletions src/combat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,8 @@ dpp::task<void> update_opponent_message(const dpp::interaction_create_t& event,
opponent.save(event.command.usr.id);
update_live_player(event, p);
update_save_opponent(event, opponent);
update_opponent_message(event, co_await get_pvp_round(opponent.event), std::stringstream(tr("TIMEOUT", event, opponent.name)));
update_opponent_message(opponent.event, co_await get_pvp_round(event), std::stringstream(tr("TIMEOUT", event, opponent.name)));
co_await update_opponent_message(event, co_await get_pvp_round(opponent.event), std::stringstream(tr("TIMEOUT", event, opponent.name)));
co_await update_opponent_message(opponent.event, co_await get_pvp_round(event), std::stringstream(tr("TIMEOUT", event, opponent.name)));
p = end_pvp_combat(event);
/* To the victor go the spoils */
co_await p.add_experience(opponent.xp_worth());
Expand Down Expand Up @@ -252,8 +252,8 @@ dpp::task<void> end_abandoned_pvp() {
p.save(event.command.usr.id);
update_live_player(event, p);
update_save_opponent(event, opponent);
update_opponent_message(event, co_await get_pvp_round(opponent.event), std::stringstream(tr("TIMEOUT5", event, p.name)));
update_opponent_message(opponent.event, co_await get_pvp_round(event), std::stringstream(tr("TIMEOUT5", event, p.name)));
co_await update_opponent_message(event, co_await get_pvp_round(opponent.event), std::stringstream(tr("TIMEOUT5", event, p.name)));
co_await update_opponent_message(opponent.event, co_await get_pvp_round(event), std::stringstream(tr("TIMEOUT5", event, p.name)));
p = end_pvp_combat(event);
/* To the victor go the spoils */
co_await opponent.add_experience(p.xp_worth());
Expand Down Expand Up @@ -334,7 +334,7 @@ dpp::task<dpp::message> get_pvp_round(const dpp::interaction_create_t& event) {
}

if (p.stamina < 1) {
death(p, cb);
co_await death(p, cb);
co_await achievement_check("PVP_LOSE", event, p, {});
p.save(event.command.usr.id);
update_live_player(event, p);
Expand Down Expand Up @@ -565,8 +565,8 @@ dpp::task<bool> pvp_combat_nav(const dpp::button_click_t& event, player p, const
p.save(event.command.usr.id);
update_live_player(event, p);
update_save_opponent(event, opponent);
update_opponent_message(event, co_await get_pvp_round(opponent.event), output2);
continue_pvp_combat(event, p, output1);
co_await update_opponent_message(event, co_await get_pvp_round(opponent.event), output2);
co_await continue_pvp_combat(event, p, output1);
if (p.stamina < 1 || opponent.stamina < 1) {
p = end_pvp_combat(event);
/* To the victor go the spoils */
Expand Down Expand Up @@ -620,7 +620,7 @@ dpp::task<bool> combat_nav(const dpp::button_click_t& event, player p, const std
}

if (claimed) {
continue_combat(event, p);
co_await continue_combat(event, p);
co_return true;
}
co_return false;
Expand Down Expand Up @@ -924,7 +924,7 @@ dpp::task<void> continue_combat(const dpp::interaction_create_t& event, player p
bool CombatEnded = false;
if (p.stamina < 1) {
co_await achievement_check("COMBAT_PLAYER_DEAD", event, p, {{"enemy", p.combatant.name}});
death(p, cb);
co_await death(p, cb);
p.save(event.command.usr.id);
update_live_player(event, p);
CombatEnded = true;
Expand Down
18 changes: 9 additions & 9 deletions src/game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ dpp::task<void> game_select(const dpp::select_click_t &event) {
p.add_mana(-si.mana_cost);
auto effect = co_await db::co_query("SELECT * FROM passive_effect_types WHERE type = 'Spell' AND requirements = ?", {parts[0]});
if (!effect.empty()) {
trigger_effect(bot, event, p, "Spell", parts[0]);
co_await trigger_effect(bot, event, p, "Spell", parts[0]);
}
}
co_await achievement_check("CAST_SPELL", event, p, {{"spell", parts[0]}});
Expand Down Expand Up @@ -422,7 +422,7 @@ dpp::task<void> game_select(const dpp::select_click_t &event) {
co_await achievement_check("USE_ITEM", event, p, {{"name", parts[0]},{"flags", parts[1]}});
auto effect = co_await db::co_query("SELECT * FROM passive_effect_types WHERE type = 'Consumable' AND requirements = ?", {parts[0]});
if (!effect.empty()) {
trigger_effect(bot, event, p, "Consumable", parts[0]);
co_await trigger_effect(bot, event, p, "Consumable", parts[0]);
co_await achievement_check("USE_CONSUMABLE", event, p, {{"name", parts[0]}});
}
auto food = co_await db::co_query("SELECT * FROM food WHERE name = ?", {parts[0]});
Expand Down Expand Up @@ -1034,11 +1034,11 @@ dpp::task<void> game_nav(const dpp::button_click_t& event) {
claimed = true;
} else if (parts[0] == "pvp_accept" && p.stamina > 0) {
dpp::snowflake opponent = get_pvp_opponent_id(event.command.usr.id);
accept_pvp(event.command.usr.id, opponent);
co_await accept_pvp(event.command.usr.id, opponent);
player p2 = get_pvp_opponent(event.command.usr.id, event.from);
p.in_pvp_picker = false;
p = set_in_pvp_combat(event);
update_opponent_message(event, co_await get_pvp_round(p2.event), std::stringstream());
co_await update_opponent_message(event, co_await get_pvp_round(p2.event), std::stringstream());
co_await achievement_check("PVP_ACCEPT", event, p, {{"opponent", opponent.str()}});
claimed = true;
} else if (parts[0] == "chat" && p.stamina > 0) {
Expand Down Expand Up @@ -1330,9 +1330,9 @@ dpp::task<uint64_t> get_guild_id(const player& p) {
dpp::task<void> continue_game(const dpp::interaction_create_t& event, player p) {
if (p.in_combat) {
if (has_active_pvp(event.command.usr.id)) {
continue_pvp_combat(event, p, std::stringstream());
co_await continue_pvp_combat(event, p, std::stringstream());
} else {
continue_combat(event, p);
co_await continue_combat(event, p);
}
co_return;
} else if (p.in_pvp_picker) {
Expand Down Expand Up @@ -1510,7 +1510,7 @@ dpp::task<void> continue_game(const dpp::interaction_create_t& event, player p)
enabled_links++;
break;
case nav_type_respawn:
death(p, cb);
co_await death(p, cb);
p.save(event.command.usr.id);
update_live_player(event, p);
respawn_button_shown = true;
Expand Down Expand Up @@ -1545,9 +1545,9 @@ dpp::task<void> continue_game(const dpp::interaction_create_t& event, player p)
}
}
if (enabled_links == 0 && !respawn_button_shown) {
death(p, cb);
co_await death(p, cb);
} else if (p.stamina < 1) {
death(p, cb);
co_await death(p, cb);
}

co_await do_toasts(p, cb);
Expand Down
4 changes: 2 additions & 2 deletions src/js/js.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ static duk_ret_t js_tag(duk_context *cx) {
return 0;
}
paragraph inner(output, *p.cur_player);
inner.parse(*p.cur_player, p.cur_player->event.command.usr.id);
inner.parse(*p.cur_player, p.cur_player->event.command.usr.id).sync_wait();
*p.output << inner.text;
p.links += inner.links;
for (const auto& nav : inner.navigation_links) {
Expand Down Expand Up @@ -1324,4 +1324,4 @@ void sandbox_fatal(void *udata, const char *msg) {
throw std::runtime_error("Fatal JS error: " + std::string(msg));
}

}
}
2 changes: 1 addition & 1 deletion src/listeners.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ namespace listeners {
co_return;
}, 30);
bot.start_timer([&bot](dpp::timer t) -> dpp::task<void> {
end_abandoned_pvp();
co_await end_abandoned_pvp();
co_return;
}, 10);
bot.start_timer([&bot](dpp::timer t) -> dpp::task<void> {
Expand Down
2 changes: 1 addition & 1 deletion src/parser/effect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ struct effect_tag : public tag {
static dpp::task<void> route(paragraph& p, std::string& p_text, std::stringstream& paragraph_content, std::stringstream& output, player& current_player) {
paragraph_content >> p_text;
std::string effect_name = remove_last_char(p_text);
trigger_effect(*(current_player.event.from->creator), current_player.event, current_player, "Environmental", effect_name);
co_await trigger_effect(*(current_player.event.from->creator), current_player.event, current_player, "Environmental", effect_name);
p.words++;
co_return;
}
Expand Down
2 changes: 1 addition & 1 deletion src/parser/time.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ struct time_tag : public tag {
static dpp::task<void> route(paragraph& p, std::string& p_text, std::stringstream& paragraph_content, std::stringstream& output, player& current_player) {
if (!p.didntmove) {
current_player.eat_ration();
achievement_check("TIME", current_player.event, current_player);
co_await achievement_check("TIME", current_player.event, current_player);
}
co_return;
}
Expand Down

0 comments on commit 1f13e7d

Please sign in to comment.