本文整理汇总了C++中log::Logger::DoNoticeCode方法的典型用法代码示例。如果您正苦于以下问题:C++ Logger::DoNoticeCode方法的具体用法?C++ Logger::DoNoticeCode怎么用?C++ Logger::DoNoticeCode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类log::Logger
的用法示例。
在下文中一共展示了Logger::DoNoticeCode方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: HandleIgnite
void IgnitableComponent::HandleIgnite(gentity_t* fireStarter) {
if (!fireStarter) {
// TODO: Find out why this happens.
fireLogger.Notice("Received ignite message with no fire starter.");
}
if (level.time < immuneUntil) {
fireLogger.Debug("Not ignited: Immune against fire.");
return;
}
// Start burning on initial ignition.
if (!onFire) {
onFire = true;
this->fireStarter = fireStarter;
fireLogger.Notice("Ignited.");
} else {
if (alwaysOnFire && !this->fireStarter) {
// HACK: Igniting an alwaysOnFire entity will initialize the fire starter.
this->fireStarter = fireStarter;
fireLogger.Debug("Firestarter set.");
} else {
fireLogger.Debug("Re-ignited.");
}
}
// Refresh ignite time even if already burning.
igniteTime = level.time;
// The spread delay follows a normal distribution: More likely to spread early than late.
int spreadTarget = level.time + (int)std::abs(normalDistribution(randomGenerator));
// Allow re-ignition to update the spread delay to a lower value.
if (spreadTarget < spreadAt) {
fireLogger.DoNoticeCode([&]{
int newDelay = spreadTarget - level.time;
if (spreadAt == INT_MAX) {
fireLogger.Notice("Spread delay set to %.1fs.", newDelay * 0.001f);
} else {
int oldDelay = spreadAt - level.time;
fireLogger.Notice("Spread delay updated from %.1fs to %.1fs.",
oldDelay * 0.001f, newDelay * 0.001f);
}
});
spreadAt = spreadTarget;
}
}