id stringlengths 27 29 | content stringlengths 226 3.24k |
|---|---|
codereview_new_cpp_data_5185 | disk_monitor(disk_monitor_actor::stateful_pointer<disk_monitor_state> self,
}
VAST_VERBOSE("{} checks db-directory of size {}", *self, *size);
if (*size > self->state.config.high_water_mark) {
- // TODO: Remove the static_cast when switching to CAF 0.18.
self
->request(s... |
codereview_new_cpp_data_5186 | struct fixture {
auto [root, _] = system::make_application(argv[0]);
REQUIRE(root);
// Parse the CLI.
- cfg.command_line = ::sanitize_arguments(*root, cfg.command_line.begin(),
- cfg.command_line.end());
auto invocation
= ::parse(*root, cfg.comma... |
codereview_new_cpp_data_5187 | catalog(catalog_actor::stateful_pointer<catalog_state> self,
r.data.reserve(num_partitions_and_events_per_schema_and_version.size());
for (const auto& [schema_and_version, num_partitions_and_events] :
num_partitions_and_events_per_schema_and_version) {
- auto schema_num_partitions = nu... |
codereview_new_cpp_data_5188 | auto test_schema = record_type{
auto test_layout2 = record_type{
{"struct", record_type{
- {"foo", type{string_type{}, {type::attribute_view{"required"}}}},
{"bar", string_type{}}
}}};
```suggestion
{"foo", type{string_type{}, {{"required"}}}},
```
auto test_schema = record_type{
auto te... |
codereview_new_cpp_data_5189 | caf::error make_blocking(int fd) {
}
caf::expected<bool> rpoll(int fd, int usec) {
- fd_set rdset;
- FD_ZERO(&rdset);
- FD_SET(fd, &rdset);
timeval timeout{0, usec};
- auto rc = ::select(fd + 1, &rdset, nullptr, nullptr, &timeout);
if (rc < 0)
return caf::make_error(ec::filesystem_error,
... |
codereview_new_cpp_data_5190 | struct accountant_state_impl {
/// Handle to the uds output channel.
std::unique_ptr<detail::uds_datagram_sender> uds_datagram_sink = nullptr;
- /// Handle to the uds output channel is currently dropping it's input.
bool uds_datagram_sink_dropping = false;
/// The configuration.
```suggestion
/// ... |
codereview_new_cpp_data_5191 | struct accountant_state_impl {
auto buf = to_json_line(actor_id, ts, key, x, meta1, meta2);
// Only poll the socket for write readiness if it did not drop the previous
// line. Not doing this could increase the average message processing time
- // of the accountant by timeout value, and just as with ... |
codereview_new_cpp_data_5192 | uds_datagram_sender::make(const std::string& path) {
caf::expected<bool>
uds_datagram_sender::send(std::span<char> data, int timeout_usec) {
- if (timeout_usec) {
auto ready = wpoll(src_fd, timeout_usec);
if (!ready)
return ready.error();
```suggestion
if (timeout_usec > 0) {
```
uds_datag... |
codereview_new_cpp_data_5193 | struct rebuilder_state {
detail::narrow_cast<int64_t>(desired_batch_size)));
}
emit_telemetry();
- // Newer partitions are more likely to contain undersized batches, so in the
- // interest of letting rebatching for the rebuild of the current set of
- // partitions not have to rebatch anyth... |
codereview_new_cpp_data_5194 | caf::expected<caf::actor>
spawn_catalog(node_actor::stateful_pointer<node_state> self,
spawn_arguments& args) {
auto [accountant] = self->state.registry.find<accountant_actor>();
- auto detached = get_or(args.inv.options, "vast.catalog-detached", true);
auto handle = detached ? self->spawn<caf::... |
codereview_new_cpp_data_5195 | partition_actor::behavior_type passive_partition(
msg.reason);
return;
}
- VAST_ERROR("{} cannot reach its {} store and shuts down: {}", *self,
self->state.store_id, msg.reason);
self->quit(msg.reason);
});
The grammar sounds a bit off, I suggest `{} shuts down ... |
codereview_new_cpp_data_5199 | system::filesystem_actor::behavior_type mock_filesystem(
},
[](vast::atom::move, const std::filesystem::path&,
const std::filesystem::path&) -> caf::result<vast::atom::done> {
- vast::die("not implemented");
},
[](
vast::atom::move,
const std::vector<std::pair<std::filesy... |
codereview_new_cpp_data_5200 | system::filesystem_actor::behavior_type mock_filesystem(
},
[](vast::atom::move, const std::filesystem::path&,
const std::filesystem::path&) -> caf::result<vast::atom::done> {
- vast::die("not implemented");
},
[](
vast::atom::move,
const std::vector<std::pair<std::filesy... |
codereview_new_cpp_data_5201 | caf::error segment_builder::add(table_slice x) {
if (x.offset() < min_table_slice_offset_)
return caf::make_error(ec::unspecified, "slice offsets not increasing");
if (!x.is_serialized()) {
- auto serialized_x = table_slice{to_record_batch(x), true};
serialized_x.import_time(x.import_time());
s... |
codereview_new_cpp_data_5202 | caf::error index_state::load_from_disk() {
VAST_WARN("{} failed to remove partition file {} after recovery: {}",
index, part_path, err);
for (auto slice : *seg)
- co_yield slice;
}
}(self, std::move(oversized_partitions), this->dir),
static_cast<index_... |
codereview_new_cpp_data_5203 | catalog(catalog_actor::stateful_pointer<catalog_state> self,
return caf::make_error(ec::invalid_argument, "catalog expects queries "
"not to have ids");
if (!has_expression)
- return caf::make_error(ec::invalid_argument, "query had neither an... |
codereview_new_cpp_data_5256 | static void proceed_handshake_picotls(h2o_socket_t *sock)
sock->ssl->async.ptls_wbuf = (ptls_buffer_t){NULL};
} else
#endif
ptls_buffer_init(&wbuf, "", 0);
int ret = ptls_handshake(sock->ssl->ptls, &wbuf, sock->ssl->input.encrypted->bytes, &consumed, NULL);
h2o_buffer_consume(&sock-... |
codereview_new_cpp_data_5257 | static char *append_unsafe_string_apache(char *pos, const char *src, size_t len)
if (len == 0)
return pos;
- const char *src_end = src + len;
- for (; src != src_end; ++src) {
if (' ' <= *src && *src < 0x7d && *src != '"') {
*pos++ = *src;
} else {
```suggestion
... |
codereview_new_cpp_data_5258 | static void build_request(h2o_req_t *req, h2o_iovec_t *method, h2o_url_t *url, h
h2o_iovec_vector_t cookie_values = {NULL};
int found_early_data = 0;
if (H2O_LIKELY(req->headers.size != 0)) {
- const h2o_header_t *h, *h_end;
- for (h = req->headers.entries, h_end = h + req->headers.size; h... |
codereview_new_cpp_data_5259 | void h2o_dispose_request(h2o_req_t *req)
h2o_timer_unlink(&req->_timeout_entry);
if (req->pathconf != NULL && req->num_loggers != 0) {
- h2o_logger_t **logger = req->loggers, **end = logger + req->num_loggers;
- for (; logger != end; ++logger) {
(*logger)->log_access((*logger), r... |
codereview_new_cpp_data_5260 | int h2o_dsr_parse_req(h2o_dsr_req_t *req, const char *_value, size_t _value_len,
const char *name;
size_t name_len;
int64_t n;
- struct st_h2o_dsr_req_quic_t quic_req;
- memset(req, 0, sizeof(*req));
- memset(&quic_req, 0, sizeof(quic_req));
- req->transport.quic.address.sa.sa_family = AF_... |
codereview_new_cpp_data_5261 | static void on_generator_dispose(void *_self)
h2o_buffer_dispose(&self->last_content_before_send);
}
h2o_doublebuffer_dispose(&self->sending);
- if (self->generator_disposed)
*self->generator_disposed = 1;
}
```suggestion
if (self->generator_disposed != NULL)
```
Let's use boo... |
codereview_new_cpp_data_5262 | static void on_write_complete(h2o_socket_t *sock, const char *err)
/* reset the other buffer */
h2o_buffer_dispose(&conn->output.buf_in_flight);
- /* as request write, unlink the deferred timeout that might have been set by `proceed_req` called above */
if (h2o_timer_is_linked(&conn->output.defer_t... |
codereview_new_cpp_data_5478 | int check_membership_Zr_star(const bn_t a){
return VALID;
}
-// Checks if input point s is in the subgroup G1.
// The function assumes the input is known to be on the curve E1.
int check_membership_G1(const ep_t p){
#if MEMBERSHIP_CHECK
If I read that correctly (haven't worked with C for quite some time �... |
codereview_new_cpp_data_5707 | void Player::createCard(const CardItem *sourceCard,
case CardRelation::AttachTo:
cmd.set_target_card_id(sourceCard->getId());
- cmd.set_target_mode(Command_CreateToken::REVERSE_ATTACH);
break;
case CardRelation::TransformInto:
cmd.set_target_card_... |
codereview_new_cpp_data_5708 | bool DeckList::loadFromStream_Plain(QTextStream &in)
}
// find sideboard position, if marks are used this won't be needed
- qsizetype sBStart = -1;
if (inputs.indexOf(reSBMark, deckStart) == -1) {
sBStart = inputs.indexOf(reSBComment, deckStart);
if (sBStart == -1) {
Qt 5.9.5 doe... |
codereview_new_cpp_data_5709 | int OracleImporter::importCardsFromSet(const CardSetPtr ¤tSet,
power = getStringPropertyFromMap(card, "power");
toughness = getStringPropertyFromMap(card, "toughness");
- if (power.isEmpty() || power == "" || toughness.isEmpty() || toughness == ""){
ptSeparator = "";
... |
codereview_new_cpp_data_5710 | void MessageLogWidget::logDrawCards(Player *player, int number)
logMulligan(player, number);
} else {
if (deckSize == 0 && number == 0) {
- appendHtmlServerMessage(tr("%1 had no cards left to draw.", "")
.arg(sanitizeHtml(player->getName())));
... |
codereview_new_cpp_data_5711 | void Player::createCard(const CardItem *sourceCard, const QString &dbCardName, b
} else {
cmd.set_annotation("");
}
- if (conjured) {
- cmd.set_destroy_on_zone_change(false);
- } else {
- cmd.set_destroy_on_zone_change(true);
- }
cmd.set_target_zone(sourceCard->getZone()->getName().toStdSt... |
codereview_new_cpp_data_5712 | int OracleImporter::importCardsFromSet(const CardSetPtr ¤tSet,
}
name = faceName;
}
- // support for array of cards this conjures
- if (card.contains("spellbook")) {
- auto spellbook = card.value("spellbook").toStringList();
- ... |
codereview_new_cpp_data_5717 | void print(const char* fmt, ...)
std::string get_cpu_arch()
{
-#define QUOTE(name) #name
-#define STR(name) QUOTE(name)
-#define ABI_NAME STR(REALM_ANDROID_ABI)
- return ABI_NAME;
-#undef STR
-#undef QUOTE
}
} // namespace realm
This looks a bit suspicious to me 🙂 But I [read a bit more about it](https://... |
codereview_new_cpp_data_5721 | void Clientlist::ProcessOPMailCommand(Client *c, std::string command_string, boo
//Append saved channels to params
auto const savedChannels = database.CurrentPlayerChannels(c->GetName());
if (savedChannels.length() > 0) {
- parameters = parameters + ", " + savedChannels;
}
parameters = RemoveDup... |
codereview_new_cpp_data_5722 | void Clientlist::ProcessOPMailCommand(Client *c, std::string command_string, boo
case CommandJoin:
if (!command_directed) {
//Append saved channels to params
- auto const savedChannels = database.CurrentPlayerChannels(c->GetName());
- if (savedChannels.length() > 0) {
- parameters += fmt::format(", {}"... |
codereview_new_cpp_data_5723 | Doors::Doors(const DoorsRepository::Doors &door) :
if (!door.dest_zone.empty() && Strings::ToLower(door.dest_zone) != "none" && !door.dest_zone.empty()) {
m_has_destination_zone = true;
}
- if (!door.dest_zone.empty() && !door.zone.empty() &&
- Strings::ToLower(door.dest_zone) == Strings::ToLower(door.zone)) {... |
codereview_new_cpp_data_5724 | void Object::HandleCombine(Client* user, const NewCombine_Struct* in_combine, Ob
spec.recipe_id);
auto results = content_db.QueryDatabase(query);
- if(!results.Success() || results.RowCount() < 1 || results.RowCount() > 10) {
auto outapp = new EQApplicationPacket(OP_TradeSkill... |
codereview_new_cpp_data_5725 | bool BotDatabase::SaveTimers(Bot* bot_inst)
if (bot_timers[timer_index] <= Timer::GetCurrentTime())
continue;
- query = StringFormat("REPLACE INTO `bot_timers` (`bot_id`, `timer_id`, `timer_value`) VALUES ('%u', '%u', '%u')", bot_inst->GetBotID(), (timer_index + 1), bot_timers[timer_index]);
auto results ... |
codereview_new_cpp_data_5726 | bool BotDatabase::SaveTimers(Bot* bot_inst)
continue;
query = fmt::format(
- "REPLACE INTO `bot_timers` (`bot_id`, `timer_id`, `timer_value`) VALUES ('%u', '%u', '%u')",
bot_inst->GetBotID(), (timer_index + 1), bot_timers[timer_index]
);
auto results = database.QueryDatabase(query);
Can use `{}... |
codereview_new_cpp_data_5727 | std::string BotDatabase::GetBotNameByID(const uint32 bot_id)
bool BotDatabase::SaveBotCasterRange(const uint32 owner_id, const uint32 bot_id, const uint32 bot_caster_range_value)
{
- if (!owner_id || !bot_id)
return false;
- query = StringFormat(
"UPDATE `bot_data`"
- " SET `caster_range` = '%u'"
- " ... |
codereview_new_cpp_data_5728 | void EntityList::ClearFeignAggro(Mob *targ)
if (it->second->IsNPC()) {
if (parse->HasQuestSub(it->second->GetNPCTypeID(), EVENT_FEIGN_DEATH)) {
- std::vector<std::any> args = { it->second };
-
int i = parse->EventNPC(EVENT_FEIGN_DEATH, it->second->CastToNPC(), targ, "", 0);
if (i != 0) ... |
codereview_new_cpp_data_5729 | void Bot::PerformTradeWithClient(int16 begin_slot_id, int16 end_slot_id, Client*
client->Message(
Chat::Yellow,
fmt::format(
- "This bot already has {}, the trade has been cancelled!",
item_link
).c_str()
);
Maybe send bot name here? Like `X already has {}, the trade has been c... |
codereview_new_cpp_data_5730 | void Client::SetEXP(uint64 set_exp, uint64 set_aaxp, bool isrezzexp) {
if (m_pp.exp != set_exp) {
const auto xp_value = set_exp - m_pp.exp;
- const auto export_string = fmt::format("{}",xp_value);
- parse->EventPlayer(EVENT_XP_GAIN, this,export_string, xp_value);
}
if (m_pp.expA... |
codereview_new_cpp_data_5731 | void Client::SetEXP(uint64 set_exp, uint64 set_aaxp, bool isrezzexp) {
}
}
- if (m_pp.exp != set_exp) {
const auto exp_value = set_exp - m_pp.exp;
const auto export_string = fmt::format("{}", exp_value);
parse->EventPlayer(EVENT_EXP_GAIN, this, export_string, 0);
}
- if (... |
codereview_new_cpp_data_5732 | void PerlembParser::ExportEventVariables(
}
case EVENT_AA_EXP_GAIN: {
- ExportVar(package_name.c_str(), "aa_exp_gained", data);
- break;
}
case EVENT_EXP_GAIN: {
- ExportVar(package_name.c_str(), "exp_gained", data);
- break;
}
... |
codereview_new_cpp_data_5733 | int64 Mob::GetActSpellDamage(uint16 spell_id, int64 value, Mob* target) {
chance += itembonuses.FrenziedDevastation + spellbonuses.FrenziedDevastation + aabonuses.FrenziedDevastation;
//Crtical Hit Calculation pathway
- if (chance > 0 || IsOfClientBot() && GetClass() == WIZARD && GetLevel() >= RuleI(Spells, Wiz... |
codereview_new_cpp_data_5734 | ChatChannel *ChatChannelList::CreateChannel(
{
uint8 max_perm_player_channels = RuleI(Chat, MaxPermanentPlayerChannels);
- if (!database.CheckChannelNameFilter(name) && !RuleB(Chat, ChannelsIgnoreNameFilter)) {
if (!(owner == SYSTEM_OWNER)) {
return nullptr;
}
Would put rule first so we’re not doing an... |
codereview_new_cpp_data_5735 | bool SharedDatabase::GetInventory(uint32 char_id, EQ::InventoryProfile *inv)
inst->SetCharges(charges);
if (item->RecastDelay) {
- if (item->RecastType != -1 && timestamps.count(item->RecastType)) {
inst->SetRecastTimestamp(timestamps.at(item->RecastType));
- } else if (item->RecastType == -1 && time... |
codereview_new_cpp_data_5736 | void ChatChannelList::AddToFilteredNames(const std::string& name) {
return;
}
- // Check if name is already in the FilteredNames vector
- bool is_found = Strings::Contains(ChatChannelList::GetFilteredNames(), name);
-
// Add name to the filtered names vector if it is not already present
- if (!is_found) {
... |
codereview_new_cpp_data_5737 | int main(int argc, char** argv) {
safe_delete(task_manager);
safe_delete(npc_scale_manager);
command_deinit();
- if (RuleB(Bots, AllowBots)) {
bot_command_deinit();
}
safe_delete(parse);
Nit: `AllowBots` seems strange, how about `Bots:Enabled`
int main(int argc, char** argv) {
safe_delete(task_manage... |
codereview_new_cpp_data_5738 | void NPC::AIYellForHelp(Mob *sender, Mob *attacker)
LogAIYellForHelp(
"NPC [{}] ID [{}] is starting to scan",
- (!this ? "NULL MOB" : GetCleanName()),
- (!this ? 0 : GetID())
);
for (auto &close_mob : entity_list.GetCloseMobList(sender)) {
This change shouldn't be necessary. `this` can never be null in... |
codereview_new_cpp_data_5739 | Mob* Mob::GetPet() {
}
bool Mob::HasPet() const {
-
if (GetPetID() == 0) {
return false;
}
Extra new line here.
Mob* Mob::GetPet() {
}
bool Mob::HasPet() const {
if (GetPetID() == 0) {
return false;
} |
codereview_new_cpp_data_5740 | void LuaMod::GetExperienceForKill(Client *self, Mob *against, uint64 &returnValu
}
}
-void LuaMod::CalcSpellEffectValue_formula(Mob *self, int64 formula, int64 base_value, int64 max_value, int caster_level, uint16 spell_id, int ticsremaining, int64 &returnValue, bool &ignoreDefault)
{
int start = lua_gettop(L)... |
codereview_new_cpp_data_5741 | uint64 LuaParser::GetExperienceForKill(Client *self, Mob *against, bool &ignoreD
return retval;
}
-int64 LuaParser::CalcSpellEffectValue_formula(Mob *self, int64 formula, int64 base_value, int64 max_value, int caster_level, uint16 spell_id, int ticsremaining, bool &ignoreDefault)
{
int64 retval = 0;
for (aut... |
codereview_new_cpp_data_5742 | int64 Mob::CalcSpellEffectValue(uint16 spell_id, int effect_id, int caster_level
}
// generic formula calculations
-int64 Mob::CalcSpellEffectValue_formula(int64 formula, int64 base_value, int64 max_value, int caster_level, uint16 spell_id, int ticsremaining)
{
#ifdef LUA_EQEMU
int64 lua_ret = 0;
Why is formu... |
codereview_new_cpp_data_5743 | void Client::CompleteConnect()
// enforce some rules..
if (!CanEnterZone()) {
LogInfo("Kicking character [{}] from zone, not allowed here (missing requirements)", GetCleanName());
- GoToSafeCoords(RuleI(World, FailedRequirementBootZoneID), 0);
return;
}
}
It's possible that the client still can't even e... |
codereview_new_cpp_data_5744 | uint32 ZoneDatabase::GetDoorsCountPlusOne()
int ZoneDatabase::GetDoorsDBCountPlusOne(std::string zone_short_name, int16 version)
{
const auto query = fmt::format(
- "SELECT COALESCE(MAX(doorid), 0) FROM doors "
"WHERE zone = '{}' AND (version = {} OR version = -1)",
zone_short_name,
version
Wouldn't you... |
codereview_new_cpp_data_5745 | std::string EQ::InventoryProfile::GetCustomItemData(int16 slot_id, std::string i
return "";
}
-int EQ::InventoryProfile::GetItemStatValue(uint32 item_id, std::string identifier) {
if (identifier.empty()) {
return 0;
}
Could be const.
std::string EQ::InventoryProfile::GetCustomItemData(int16 slot_id, std... |
codereview_new_cpp_data_5746 | luabind::scope lua_register_client() {
.def("SetEXP", (void(Lua_Client::*)(uint64,uint64))&Lua_Client::SetEXP)
.def("SetEXP", (void(Lua_Client::*)(uint64,uint64,bool))&Lua_Client::SetEXP)
.def("SetEXPEnabled", (void(Lua_Client::*)(bool))&Lua_Client::SetEXPEnabled)
-
.def("SetEXPModifier", (void(Lua_Client::*)(... |
codereview_new_cpp_data_5747 | void Client::CalculateExp(uint32 in_add_exp, uint32 &add_exp, uint32 &add_aaxp,
add_exp -= add_aaxp;
//Enforce Percent XP Cap per kill, if rule is enabled
- int KillPercentXPCap = RuleI(Character, KillExperiencePercentCap);
- if (KillPercentXPCap >= 0) { // If the cap is == -1, do nothing
- unsigned long i... |
codereview_new_cpp_data_5748 | void Client::CalculateExp(uint32 in_add_exp, uint32 &add_exp, uint32 &add_aaxp,
add_exp -= add_aaxp;
//Enforce Percent XP Cap per kill, if rule is enabled
- int KillPercentXPCap = RuleI(Character, KillExperiencePercentCap);
- if (KillPercentXPCap >= 0) { // If the cap is == -1, do nothing
- unsigned long i... |
codereview_new_cpp_data_5749 | void Client::MaxSkills()
for (const auto &s : EQ::skills::GetSkillTypeMap()) {
auto current_skill_value = (
EQ::skills::IsSpecializedSkill(s.first) ?
- 50 :
content_db.GetSkillCap(GetClass(), s.first, GetLevel())
);
Is 50 hard-coded or defined somewhere?
void Client::MaxSkills()
for (const aut... |
codereview_new_cpp_data_5750 | void command_suspendmulti(Client *c, const Seperator *sep)
const std::string reason = sep->arg[3] ? sep->argplus[3] : "";
auto l = AccountRepository::GetWhere(
- content_db,
fmt::format(
"LOWER(charname) IN ({})",
Strings::Implode(", ", v)
Accounts should be handled by `database` I think, not the co... |
codereview_new_cpp_data_5751 | void command_suspendmulti(Client *c, const Seperator *sep)
a.suspendeduntil = std::time(nullptr) + (days * 86400);
a.suspend_reason = reason;
- if (!AccountRepository::UpdateOne(content_db, a)) {
c->Message(
Chat::White,
fmt::format(
This one should be `database` too
void command_suspendmulti... |
codereview_new_cpp_data_5752 | void QuestManager::depop_withtimer(int npc_type) {
void QuestManager::depopall(int npc_type) {
QuestManagerCurrentQuestVars();
- if ((owner && owner->IsNPC() && (npc_type > 0)) || npc_type > 0) {
entity_list.DepopAll(npc_type);
} else {
LogQuests("QuestManager::depopall called with nullptr owner, non-NPC ... |
codereview_new_cpp_data_5753 | bool BotDatabase::LoadItemSlots(const uint32 bot_id, std::map<uint16, uint32>& m
fmt::format(
"bot_id = {}",
bot_id
- ).c_str()
);
if (l.empty() || !l[0].inventories_index) {
return false;
Not sure this needs to be `c_str()` as repositories take in native std strings
bool BotDatabase::LoadItemSlo... |
codereview_new_cpp_data_5754 | bool BotDatabase::LoadItemSlots(const uint32 bot_id, std::map<uint16, uint32>& m
fmt::format(
"bot_id = {}",
bot_id
- ).c_str()
);
if (l.empty() || !l[0].inventories_index) {
return false;
`l.empty()` should be suffice
bool BotDatabase::LoadItemSlots(const uint32 bot_id, std::map<uint16, uint32>&... |
codereview_new_cpp_data_5755 | std::map<uint16, uint32> Bot::GetBotItemSlots()
GetCleanName()
).c_str()
);
- return m;
}
return m;
This return seems redundant because the fallback will end up returning the same thing
std::map<uint16, uint32> Bot::GetBotItemSlots()
GetCleanName()
).c_str()
);
}
return m; |
codereview_new_cpp_data_5756 | int command_init(void)
command_add("nukeitem", "[Item ID] - Removes the specified Item ID from you or your player target's inventory", AccountStatus::GMLeadAdmin, command_nukeitem) ||
command_add("object", "List|Add|Edit|Move|Rotate|Copy|Save|Undo|Delete - Manipulate static and tradeskill objects within the zone... |
codereview_new_cpp_data_5757 | Bot* EntityList::GetRandomBot(const glm::vec3& location, float distance, Bot* ex
return nullptr;
}
- return bots_in_range[zone->random.Int(0, bots_in_range .size() - 1)];
}
#endif
Formatting with `bots_in_range` and `.size`
Bot* EntityList::GetRandomBot(const glm::vec3& location, float distance, Bot* ex... |
codereview_new_cpp_data_5758 | NPC::NPC(const NPCType *npc_type_data, Spawn2 *in_respawn, const glm::vec4 &posi
AISpellVar.idle_beneficial_chance = static_cast<uint8> (RuleI(Spells, AI_IdleBeneficialChance));
// It's possible for IsBot() to not be set yet during Bot loading, so have to use an alternative to catch Bots
- if (!EQ::Valu... |
codereview_new_cpp_data_5759 | bool EntityList::LimitCheckName(const char *npc_name)
while (it != npc_list.end()) {
NPC *npc = it->second;
if (npc) {
- if (strcasecmp(npc_name, npc->GetName()) == 0) {
return false;
}
}
We do want their name before `EntityList::MakeNameUnique()` has touched it, which `GetName()` does not get u... |
codereview_new_cpp_data_5760 | void Client::AddEXP(uint32 in_add_exp, uint8 conlevel, bool resexp) {
// Check for Unused AA Cap. If at or above cap, set AAs to cap, set aaexp to 0 and set aa percentage to 0.
// Doing this here means potentially one kill wasted worth of experience, but easiest to put it here than to rewrite this function.
- i... |
codereview_new_cpp_data_5761 | void Client::AddEXP(uint32 in_add_exp, uint8 conlevel, bool resexp) {
int aa_cap = RuleI(AA, UnusedAAPointCap);
if (aa_cap > 0 && aaexp > 0) {
- char val1[20] = {0};
- char val2[20] = {0};
-
if (m_pp.aapoints == aa_cap) {
MessageString(Chat::Red, AA_CAP);
aaexp = 0;
m_epp.perAA = 0;
} else ... |
codereview_new_cpp_data_5762 | void command_faction_association(Client *c, const Seperator *sep)
// default to self unless target is also a client
auto target = c;
- if (c->GetTarget() && c->GetTarget()->IsClient())
target = c->GetTarget()->CastToClient();
target->RewardFaction(atoi(sep->arg[1]), atoi(sep->arg[2]));
}
Would really pr... |
codereview_new_cpp_data_5764 | void WorldDatabase::GetCharSelectInfo(uint32 account_id, EQApplicationPacket **o
if (x == 0 && y == 0 && z == 0 && heading == 0) {
auto zone = GetZone(pp.binds[4].zone_id);
if (zone) {
- pp.binds[4].x = zone->safe_x;
- pp.binds[4].y = zone->safe_y;
- pp.binds[4].z ... |
codereview_new_cpp_data_5765 | void WorldDatabase::GetCharSelectInfo(uint32 account_id, EQApplicationPacket **o
heading = zone->safe_heading;
}
}
}
}
pp.binds[0] = pp.binds[4];
These need to be added back I think
void WorldDatabase::GetCharSelectInfo(uint32 account_id, EQApplicationPacket **o
heading = z... |
codereview_new_cpp_data_5766 | bool TaskManager::LoadTasks(int single_task)
activity_data->goal_match_list = task_activity.goal_match_list;
activity_data->goal_count = task_activity.goalcount;
activity_data->deliver_to_npc = task_activity.delivertonpc;
- activity_data->zone_version = task_activity.zone_version... |
codereview_new_cpp_data_5767 |
void command_lootsim(Client *c, const Seperator *sep)
{
int arguments = sep->argnum;
- if (arguments < 3) {
c->Message(Chat::White, "Usage: #lootsim [npc_type_id] [loottable_id] [iterations] [loot_log_enabled=0]");
return;
}
Since we're not validating below, we can just stop them from getting there with i... |
codereview_new_cpp_data_5768 | bool SharedTaskManager::HandleCompletedActivities(SharedTask* s)
std::array<bool, MAXACTIVITIESPERTASK> completed_steps;
completed_steps.fill(true);
auto activity_states = s->GetActivityState();
std::sort(activity_states.begin(), activity_states.end(),
[](const auto& lhs, const auto& rhs) { return lhs.ste... |
codereview_new_cpp_data_5769 | void NPC::AddLootDrop(
// unsure if required to equip, YOLO for now
- if (item2->ItemType == EQ::item::ItemTypeBow)
SetBowEquipped(true);
- if (item2->ItemType == EQ::item::ItemTypeArrow)
SetArrowEquipped(true);
if (loot_drop.equip_item > 0) {
uint8 eslot = 0xFF;
Brackets here maybe?
void NPC::... |
codereview_new_cpp_data_5770 | bool Client::Death(Mob* killerMob, int64 damage, uint16 spell, EQ::skills::Skill
}
if (exploss > 0 && RuleB(Character, DeathKeepLevel)) {
- int32 totalExp = GetEXP();
- uint32 levelMinExp = GetEXPForLevel(killed_level);
- int32 levelExp = totalExp - levelMinExp;
- if (exploss > levelExp) {
- exploss = leve... |
codereview_new_cpp_data_5771 | void perl_register_quest()
package.add("clear_zone_flag", &Perl__clear_zone_flag);
package.add("clearspawntimers", &Perl__clearspawntimers);
package.add("collectitems", &Perl__collectitems);
- package.add("Commify", &Perl__commify);
package.add("completedtasksinset", &Perl__completedtasksinset);
package.add(... |
codereview_new_cpp_data_5772 | void Client::Handle_OP_PickPocket(const EQApplicationPacket *app)
return;
}
else {
- Message(0, "Your attempt at stealing was unsuccessful.");
}
QueuePacket(outapp);
Could be a Client String:
12898 Your attempt at stealing was unsuccessful.
void Client::Handle_OP_PickPocket(const EQApplicationPacket ... |
codereview_new_cpp_data_5773 | void Client::Trader_EndTrader() {
}
safe_delete(outapp);
}
- safe_delete(gis);
}
database.DeleteTraderItem(CharacterID());
Just undo this change and push a new commit to this pr's branch to resolve the #2266 duplicate
void Client::Trader_EndTrader() {
}
safe_delete(outapp);
+ safe_de... |
codereview_new_cpp_data_5774 | void Client::Handle_OP_LootItem(const EQApplicationPacket *app)
return;
}
- auto* l = (LootItem_Struct*) app->pBuffer;
- auto entity = entity_list.GetID(l->entity_id);
if (!entity) {
auto outapp = new EQApplicationPacket(OP_LootComplete, 0);
QueuePacket(outapp);
Can just use the current `LootingItem_St... |
codereview_new_cpp_data_5775 | void Object::HandleAutoCombine(Client* user, const RecipeAutoCombine_Struct* rac
}
// Character does not have the required skill.
- if(spec.skill_needed > 0 && user->GetSkill(spec.tradeskill) < spec.skill_needed ) {
// Notify client.
user->Message(Chat::Red, "You are not skilled enough.");
user->QueuePa... |
codereview_new_cpp_data_5776 | bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial, int level_ove
if (IsClient()) {
if (caster->IsClient()) {
- if (!entity_list.IsInSameGroupOrRaidGroup(caster->CastToClient(), this->CastToClient())) {
caster->Message(Chat::Red, "Your target must be a group member for this spe... |
codereview_new_cpp_data_5777 | void Mob::FixZ(int32 z_find_offset /*= 5*/, bool fix_client_z /*= false*/) {
return;
}
- if (IsBoat()) {
return;
}
Since this is running through a significant hot path, I'd like this to reference a mob scoped private member variable boolean that is loaded on spawn and we don't have to run OR's in this c... |
codereview_new_cpp_data_5855 | bool strtolower(std::string &str, std::string::size_type offs)
bool IsValidChar(WChar key, CharSetFilter afilter)
{
switch (afilter) {
- case CS_ALPHANUMERAL: return IsPrintable(key);
- case CS_NUMERAL: return (key >= '0' && key <= '9');
- case CS_NUMERAL_SPACE: return (key >= '0' && key <= '9') || key =... |
codereview_new_cpp_data_5947 | void ThroughputSubscriber::DataReaderListener::on_data_available(
}
}
last_seq_num = seq_num;
}
if ((last_seq_num_ + size) < last_seq_num)
{
lost_samples_ += last_seq_num - last_seq_num_ - size;
}
last_seq_num_ = las... |
codereview_new_cpp_data_5948 | DataWriterImpl::DataWriterImpl(
, qos_(&qos == &DATAWRITER_QOS_DEFAULT ? publisher_->get_default_datawriter_qos() : qos)
, listener_(listen)
, history_(get_topic_attributes(qos_, *topic_, type_), type_->m_typeSize, qos_.endpoint().history_memory_policy,
- [&](
const InstanceH... |
codereview_new_cpp_data_5949 | bool StatefulWriter::has_been_fully_delivered(
std::lock_guard<RecursiveTimedMutex> guard(mp_mutex);
bool found = false;
// Sequence number has not been generated by this WriterHistory.
- if (seq_num > (mp_history->next_sequence_number() - 1))
{
return false;
}
```suggestion
... |
codereview_new_cpp_data_5950 | bool StatelessWriter::change_removed_by_history(
bool StatelessWriter::has_been_fully_delivered(
const SequenceNumber_t& seq_num) const
{
if (getMatchedReadersSize() > 0)
{
return is_acked_by_all(seq_num);
Should we also check here that the sequence has been generated?
Perhaps we shou... |
codereview_new_cpp_data_5951 | bool ReaderProxy::has_been_delivered(
const SequenceNumber_t& seq_number,
bool& found) const
{
- for (auto change : changes_for_reader_)
{
- if (change.getSequenceNumber() == seq_number)
- {
- found = true;
- return change.has_been_delivered();
- }
... |
codereview_new_cpp_data_5952 | bool StatefulWriter::has_been_fully_delivered(
bool ret_code = reader->has_been_delivered(seq_num, found);
if (found && !ret_code)
{
- // The change has not been fully delivered if at least is found in one ReaderProxy without having been
- // delivered.
ret... |
codereview_new_cpp_data_5953 | DataWriterImpl::DataWriterImpl(
, qos_(&qos == &DATAWRITER_QOS_DEFAULT ? publisher_->get_default_datawriter_qos() : qos)
, listener_(listen)
, history_(get_topic_attributes(qos_, *topic_, type_), type_->m_typeSize, qos_.endpoint().history_memory_policy,
- [&](
const InstanceH... |
codereview_new_cpp_data_5954 |
#include <fastdds/dds/log/Log.hpp>
#include <fastdds/rtps/common/Time_t.h>
#include <fastdds/rtps/writer/RTPSWriter.h>
-#include <fastdds/rtps/writer/StatefulWriter.h>
namespace eprosima {
namespace fastdds {
I think we don't need this anymore.
```suggestion
```
#include <fastdds/dds/log/Log.hpp>
#incl... |
codereview_new_cpp_data_5955 | bool StatelessWriter::change_removed_by_history(
}
const uint64_t sequence_number = change->sequenceNumber.to64long();
- if (sequence_number < last_sequence_number_sent_)
{
unsent_changes_cond_.notify_all();
}
Should this be `<=` ?
We should notify the condition whenever `wait_for... |
codereview_new_cpp_data_5958 | bool DataReaderHistory::get_first_untaken_info(
{
std::lock_guard<RecursiveTimedMutex> lock(*getMutex());
- for (auto &it : data_available_instances_)
{
auto& instance_changes = it.second->cache_changes;
if (!instance_changes.empty())
Minor Uncrustify
```suggestion
for (auto& ... |
codereview_new_cpp_data_5960 | TEST_F(UDPv6Tests, send_to_wrong_interface)
Locators locators_begin(locator_list.begin());
Locators locators_end(locator_list.end());
- IPLocator::setIPv6(outputChannelLocator, std::string("fe80::ffff:6f6f:6f6f"));
std::vector<octet> message = { 'H', 'e', 'l', 'l', 'o' };
ASSERT_FALSE(send_res... |
codereview_new_cpp_data_5961 | TEST_F(StatisticsDomainParticipantTests, DeleteParticipantAfterDeleteContainedEn
STATISTICS_DATAWRITER_QOS));
// 3. Perform a delete_contained_entities() in the statistics participant
- EXPECT_EQ(statistics_participant->delete_contained_entities(), ReturnCode_t::RETCODE_OK);
// 4. Delete ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.