本文整理汇总了C++中LOG_L函数的典型用法代码示例。如果您正苦于以下问题:C++ LOG_L函数的具体用法?C++ LOG_L怎么用?C++ LOG_L使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了LOG_L函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: LOG_L
IModelDrawer::~IModelDrawer()
{
eventHandler.RemoveClient(this);
for (int modelType = MODELTYPE_3DO; modelType < MODELTYPE_OTHER; modelType++) {
delete opaqueModelRenderers[modelType];
delete cloakedModelRenderers[modelType];
}
opaqueModelRenderers.clear();
cloakedModelRenderers.clear();
LOG_L(L_DEBUG, "[%s]", __FUNCTION__);
}
示例2: LOG_L
bool CKeyBindings::SetFakeMetaKey(const std::string& keystr)
{
CKeySet ks;
if (StringToLower(keystr) == "none") {
fakeMetaKey = -1;
return true;
}
if (!ks.Parse(keystr)) {
LOG_L(L_WARNING, "SetFakeMetaKey: could not parse key: %s", keystr.c_str());
return false;
}
fakeMetaKey = ks.Key();
return true;
}
示例3: saveFileName
void CQuitBox::MouseRelease(int x,int y,int button)
{
float mx=MouseX(x);
float my=MouseY(y);
scrolling = false;
scrollGrab = 0.0f;
if(InBox(mx,my,box+resignBox)
|| (InBox(mx,my,box+saveBox) && !teamHandler->Team(gu->myTeam)->isDead)
|| (InBox(mx,my,box+giveAwayBox) && !teamHandler->Team(shareTeam)->isDead && !teamHandler->Team(gu->myTeam)->isDead)) {
// give away all units (and resources)
if(InBox(mx,my,box+giveAwayBox) && !playerHandler->Player(gu->myPlayerNum)->spectator) {
net->Send(CBaseNetProtocol::Get().SendGiveAwayEverything(gu->myPlayerNum, shareTeam, playerHandler->Player(gu->myPlayerNum)->team));
}
// resign, so self-d all units
if (InBox(mx,my,box+resignBox) && !playerHandler->Player(gu->myPlayerNum)->spectator) {
net->Send(CBaseNetProtocol::Get().SendResign(gu->myPlayerNum));
}
// save current game state
if (InBox(mx,my,box+saveBox)) {
if (FileSystem::CreateDirectory("Saves")) {
std::string timeStr = CTimeUtil::GetCurrentTimeStr();
std::string saveFileName(timeStr + "_" + modInfo.filename + "_" + gameSetup->mapName);
saveFileName = "Saves/" + saveFileName + ".ssf";
if (!FileSystem::FileExists(saveFileName)) {
LOG("Saving game to %s", saveFileName.c_str());
ILoadSaveHandler* ls = ILoadSaveHandler::Create();
ls->mapName = gameSetup->mapName;
ls->modName = modInfo.filename;
ls->SaveGame(saveFileName);
delete ls;
} else {
LOG_L(L_ERROR, "File %s already exists, game NOT saved!",
saveFileName.c_str());
}
}
}
}
else if (InBox(mx, my, box + quitBox)) {
LOG("User exited");
gu->globalQuit = true;
}
// if we're still in the game, remove the resign box
if(InBox(mx,my,box+resignBox) || InBox(mx,my,box+saveBox) || InBox(mx,my,box+giveAwayBox) || InBox(mx,my,box+cancelBox) || InBox(mx,my,box+quitBox)){
delete this;
return;
}
moveBox=false;
}
示例4: LOG_L
CSound::~CSound()
{
soundThreadQuit = true;
configHandler->RemoveObserver(this);
LOG_L(L_INFO, "[%s][1] soundThread=%p", __FUNCTION__, soundThread);
if (soundThread != NULL) {
soundThread->join();
delete soundThread;
soundThread = NULL;
}
LOG_L(L_INFO, "[%s][2]", __FUNCTION__);
for (soundVecT::iterator it = sounds.begin(); it != sounds.end(); ++it)
delete *it;
sounds.clear();
SoundBuffer::Deinitialise();
LOG_L(L_INFO, "[%s][3]", __FUNCTION__);
}
示例5: LOG_L
void Gui::Draw()
{
for (ElList::iterator it = toBeAdded.begin(); it != toBeAdded.end(); ++it)
{
bool duplicate = false;
for (ElList::iterator elIt = elements.begin(); elIt != elements.end(); ++elIt)
{
if (it->element == elIt->element)
{
LOG_L(L_DEBUG, "Gui::AddElement: skipping duplicated object");
duplicate = true;
break;
}
}
if (!duplicate)
{
if (it->asBackground)
elements.push_back(*it);
else
elements.push_front(*it);
}
}
toBeAdded.clear();
for (ElList::iterator it = toBeRemoved.begin(); it != toBeRemoved.end(); ++it)
{
for (ElList::iterator elIt = elements.begin(); elIt != elements.end(); ++elIt)
{
if (it->element == elIt->element)
{
delete (elIt->element);
elements.erase(elIt);
break;
}
}
}
toBeRemoved.clear();
glDisable(GL_TEXTURE_2D);
glDisable(GL_ALPHA_TEST);
glEnable(GL_BLEND);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluOrtho2D(0, 1, 0, 1);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
for (ElList::reverse_iterator it = elements.rbegin(); it != elements.rend(); ++it) {
(*it).element->Draw();
}
}
示例6: switch
//A thread wants to continue running at a later time, and adds itself to the scheduler
void CCobEngine::AddThread(CCobThread *thread)
{
switch (thread->state) {
case CCobThread::Run:
wantToRun.push_front(thread);
break;
case CCobThread::Sleep:
sleeping.push(thread);
break;
default:
LOG_L(L_ERROR, "thread added to scheduler with unknown state (%d)", thread->state);
break;
}
}
示例7: SuspendedStacktrace
/**
*
* This entry point is tailored for the Watchdog module.
* Since the thread to be traced may be running, it requires a ThreadControls object in order to suspend/resume the thread.
* @brief RemoteStacktrace
*/
void SuspendedStacktrace(Threading::ThreadControls* ctls, const std::string& threadName)
{
#if !(DEDICATED || UNIT_TEST)
Watchdog::ClearTimer();
#endif
assert(ctls != nullptr);
assert(ctls->handle != 0);
assert(threadName.size() > 0);
LOG_L(L_WARNING, "Suspended-thread Stacktrace (%s) for Spring %s:", threadName.c_str(), (SpringVersion::GetFull()).c_str());
LOG_L(L_DEBUG, "SuspendedStacktrace[1]");
StackTrace stacktrace;
// Get untranslated stacktrace symbols
{
// process and analyse the raw stack trace
void* iparray[MAX_STACKTRACE_DEPTH];
ctls->Suspend();
const int numLines = thread_unwind(&ctls->ucontext, iparray, stacktrace);
ctls->Resume();
LOG_L(L_DEBUG, "SuspendedStacktrace[2]");
if(numLines > MAX_STACKTRACE_DEPTH) {
LOG_L(L_ERROR, "thread_unwind returned more lines than we allotted space for!");
}
char** lines = backtrace_symbols(iparray, numLines); // give them meaningfull names
ExtractSymbols(lines, stacktrace);
}
if (stacktrace.empty()) {
LOG_L(L_WARNING, " Unable to create suspended stacktrace");
return;
}
LOG_L(L_DEBUG, "SuspendedStacktrace[3]");
// Translate symbols into code line numbers
TranslateStackTrace(NULL, stacktrace, LOG_LEVEL_WARNING);
LOG_L(L_DEBUG, "SuspendedStacktrace[4]");
// Print out the translated StackTrace
LogStacktrace(LOG_LEVEL_WARNING, stacktrace);
}
示例8: lck
void CSound::PrintDebugInfo()
{
boost::recursive_mutex::scoped_lock lck(soundMutex);
LOG_L(L_DEBUG, "OpenAL Sound System:");
LOG_L(L_DEBUG, "# SoundSources: %i", (int)sources.size());
LOG_L(L_DEBUG, "# SoundBuffers: %i", (int)SoundBuffer::Count());
LOG_L(L_DEBUG, "# reserved for buffers: %i kB", (int)(SoundBuffer::AllocedSize() / 1024));
LOG_L(L_DEBUG, "# PlayRequests for empty sound: %i", numEmptyPlayRequests);
LOG_L(L_DEBUG, "# Samples disrupted: %i", numAbortedPlays);
LOG_L(L_DEBUG, "# SoundItems: %i", (int)sounds.size());
}
示例9: TestCregClasses2
static bool TestCregClasses2()
{
PreCregTest("CREG: Test2 (Class' Sizes)");
int fineClasses = 0;
int brokenClasses = 0;
const std::vector<creg::Class*>& cregClasses = creg::System::GetClasses();
for (std::vector<creg::Class*>::const_iterator it = cregClasses.begin(); it != cregClasses.end(); ++it) {
const creg::Class* c = *it;
const std::string& className = c->name;
const size_t classSize = c->size;
size_t cregSize = 1; // c++ class is min. 1byte large (part of sizeof definition)
const creg::Class* c_base = c;
while (c_base){
const std::vector<creg::Class::Member*>& classMembers = c_base->members;
for (std::vector<creg::Class::Member*>::const_iterator jt = classMembers.begin(); jt != classMembers.end(); ++jt) {
const size_t memberOffset = (*jt)->offset;
const size_t typeSize = (*jt)->type->GetSize();
cregSize = std::max(cregSize, memberOffset + typeSize);
}
c_base = c_base->base;
}
// alignment padding
const float alignment = c->alignment;
cregSize = std::ceil(cregSize / alignment) * alignment; //FIXME too simple, gcc's appending rules are ways more complicated
if (cregSize != classSize) {
brokenClasses++;
LOG_L(L_WARNING, " Missing member(s) in class %s, real size %u, creg size %u", className.c_str(), classSize, cregSize);
/*for (std::vector<creg::Class::Member*>::const_iterator jt = classMembers.begin(); jt != classMembers.end(); ++jt) {
const std::string memberName = (*jt)->name;
const size_t memberOffset = (*jt)->offset;
const std::string typeName = (*jt)->type->GetName();
const size_t typeSize = (*jt)->type->GetSize();
LOG_L(L_WARNING, " member %20s, type %12s, offset %3u, size %u", memberName.c_str(), typeName.c_str(), memberOffset, typeSize);
}*/
} else {
//LOG( "CREG: Class %s fine, size %u", className.c_str(), classSize);
fineClasses++;
}
}
return PostCregTest(fineClasses, brokenClasses, 15);
}
示例10: CCannon
CWeapon* CWeaponLoader::LoadWeapon(CUnit* owner, const UnitDefWeapon* defWeapon)
{
CWeapon* weapon = NULL;
const WeaponDef* weaponDef = defWeapon->def;
const std::string& weaponType = weaponDef->type;
if (weaponType == "Cannon") {
weapon = new CCannon(owner, weaponDef);
} else if (weaponType == "Rifle") {
weapon = new CRifle(owner, weaponDef);
} else if (weaponType == "Melee") {
weapon = new CMeleeWeapon(owner, weaponDef);
} else if (weaponType == "Shield") {
weapon = new CPlasmaRepulser(owner, weaponDef);
} else if (weaponType == "Flame") {
weapon = new CFlameThrower(owner, weaponDef);
} else if (weaponType == "MissileLauncher") {
weapon = new CMissileLauncher(owner, weaponDef);
} else if (weaponType == "AircraftBomb") {
weapon = new CBombDropper(owner, weaponDef, false);
} else if (weaponType == "TorpedoLauncher") {
if (owner->unitDef->canfly && !weaponDef->submissile) {
weapon = new CBombDropper(owner, weaponDef, true);
} else {
weapon = new CTorpedoLauncher(owner, weaponDef);
}
} else if (weaponType == "LaserCannon") {
weapon = new CLaserCannon(owner, weaponDef);
} else if (weaponType == "BeamLaser") {
weapon = new CBeamLaser(owner, weaponDef);
} else if (weaponType == "LightningCannon") {
weapon = new CLightningCannon(owner, weaponDef);
} else if (weaponType == "EmgCannon") {
weapon = new CEmgCannon(owner, weaponDef);
} else if (weaponType == "DGun") {
// NOTE: no special connection to UnitDef::canManualFire
// (any type of weapon may be slaved to the button which
// controls manual firing) or the CMD_MANUALFIRE command
weapon = new CDGunWeapon(owner, weaponDef);
} else if (weaponType == "StarburstLauncher") {
weapon = new CStarburstLauncher(owner, weaponDef);
} else {
weapon = new CNoWeapon(owner, weaponDef);
LOG_L(L_ERROR, "weapon-type %s unknown or NOWEAPON", weaponType.c_str());
}
return weapon;
}
示例11: sprintf
void CGameSetup::LoadAllyTeams(const TdfParser& file)
{
// i = allyteam index in game (no gaps), a = allyteam index in script
int i = 0;
for (int a = 0; a < MAX_TEAMS; ++a) {
char section[50];
sprintf(section,"GAME\\ALLYTEAM%i",a);
string s(section);
if (!file.SectionExist(s))
continue;
AllyTeam data;
std::map<std::string, std::string> setup = file.GetAllValues(s);
for (std::map<std::string, std::string>::const_iterator it = setup.begin(); it != setup.end(); ++it)
data.SetValue(it->first, it->second);
allyStartingData.push_back(data);
allyteamRemap[a] = i;
++i;
}
{
const size_t numAllyTeams = allyStartingData.size();
for (size_t a = 0; a < numAllyTeams; ++a) {
allyStartingData[a].allies.resize(numAllyTeams, false);
allyStartingData[a].allies[a] = true; // each team is allied with itself
std::ostringstream section;
section << "GAME\\ALLYTEAM" << a << "\\";
const size_t numAllies = atoi(file.SGetValueDef("0", section.str() + "NumAllies").c_str());
for (size_t b = 0; b < numAllies; ++b) {
std::ostringstream key;
key << "GAME\\ALLYTEAM" << a << "\\Ally" << b;
const int other = atoi(file.SGetValueDef("0",key.str()).c_str());
allyStartingData[a].allies[allyteamRemap[other]] = true;
}
}
}
unsigned allyCount = 0;
if (file.GetValue(allyCount, "GAME\\NumAllyTeams") && (allyStartingData.size() != allyCount)) {
LOG_L(L_WARNING, "Incorrect number of ally teams in GameSetup script");
}
}
示例12: LOG_L
int CSkirmishAILibrary::HandleEvent(int skirmishAIId, int topic, const void* data) const
{
int ret = sSAI.handleEvent(skirmishAIId, topic, data);
if (ret != 0) {
// event handling failed!
const int teamId = skirmishAIHandler.GetSkirmishAI(skirmishAIId)->team;
LOG_L(L_WARNING,
"AI for team %i (ID: %i) failed handling event with topic %i, error: %i",
teamId, skirmishAIId, topic, ret
);
}
return ret;
}
示例13: sSAI
CSkirmishAILibrary::CSkirmishAILibrary(const SSkirmishAILibrary& ai,
const SkirmishAIKey& key)
: sSAI(ai), key(key) {
if (sSAI.handleEvent == NULL) {
LOG_L(L_ERROR,
"Fetched AI library %s-%s has no handleEvent function"
"available. It is therefore illegal and will not be used."
"This usually indicates a problem in the used AI Interface"
"library (%s-%s).",
key.GetShortName().c_str(), key.GetVersion().c_str(),
key.GetInterface().GetShortName().c_str(),
key.GetInterface().GetVersion().c_str());
}
}
示例14: CEventClient
IModelDrawer::IModelDrawer(const std::string& name, int order, bool synced): CEventClient(name, order, synced)
{
eventHandler.AddClient(this);
opaqueModelRenderers.resize(MODELTYPE_OTHER, NULL);
cloakedModelRenderers.resize(MODELTYPE_OTHER, NULL);
for (int modelType = MODELTYPE_3DO; modelType < MODELTYPE_OTHER; modelType++) {
opaqueModelRenderers[modelType] = IWorldObjectModelRenderer::GetInstance(modelType);
cloakedModelRenderers[modelType] = IWorldObjectModelRenderer::GetInstance(modelType);
}
LOG_L(L_DEBUG, "[%s] this=%p, name=%s, order=%d, synced=%d",
__FUNCTION__, this, name.c_str(), order, synced);
}
示例15: ClearTimer
void ClearTimer(const std::string &name, bool disable)
{
if (hangDetectorThread == NULL)
return; //! Watchdog isn't running
std::map<std::string, unsigned int>::iterator i = threadNameToNum.find(name);
unsigned int num;
WatchDogThreadInfo* th_info;
if (i == threadNameToNum.end() || (num = i->second) >= WDT_LAST || !(th_info = registeredThreads[num])->numreg) {
LOG_L(L_ERROR, "[Watchdog::ClearTimer] Invalid thread name");
return;
}
th_info->timer = disable ? spring_notime : spring_gettime();
}