Return NULL instead of ((T*)false) from more functions

Nicolas Hake 2011-09-28 19:42:56 +02:00
parent a04b06f98f
commit 8d8b087808
5 changed files with 11 additions and 11 deletions

View File

@ -354,13 +354,13 @@ C4Group *C4GroupSet::RegisterParentFolders(const char *szScenFilename)
if (!pGroup->OpenAsChild(pParentGroup, szParentfolder+iPos))
{
LogFatal(FormatString("%s: %s", LoadResStr("IDS_PRC_FILENOTFOUND"), szParentfolder+iPos).getData());
delete pGroup; return false;
delete pGroup; return NULL;
}
}
else if (!Reloc.Open(*pGroup, szParentfolder+iPos))
{
LogFatal(FormatString("%s: %s", LoadResStr("IDS_PRC_FILENOTFOUND"), szParentfolder+iPos).getData());
delete pGroup; return false;
delete pGroup; return NULL;
}
// set this group as new parent
pParentGroup=pGroup;
@ -371,7 +371,7 @@ C4Group *C4GroupSet::RegisterParentFolders(const char *szScenFilename)
else
iContentsMask = C4GSCnt_Directory;
if (!RegisterGroup(*pParentGroup, true, C4GSPrio_Folder+iGroupIndex++, iContentsMask))
{ delete pParentGroup; LogFatal ("RegGrp: internal error"); return false; }
{ delete pParentGroup; LogFatal ("RegGrp: internal error"); return NULL; }
// advance by file name length
iPos+=SLen(szParentfolder+iPos);
}

View File

@ -680,8 +680,8 @@ C4PropList *C4Def::GetActionByName(C4String *actname)
if (!actname || actname == &Strings.P[P_Idle]) return NULL;
// otherwise, query actmap
C4Value ActMap; GetProperty(P_ActMap, &ActMap);
if (!ActMap.getPropList()) return false;
if (!ActMap.getPropList()) return NULL;
C4Value Action; ActMap.getPropList()->GetPropertyByS(actname, &Action);
if (!Action.getPropList()) return false;
if (!Action.getPropList()) return NULL;
return Action.getPropList();
}

View File

@ -163,7 +163,7 @@ C4ObjectInfo* C4ObjectInfoList::New(C4ID n_id, C4DefList *pDefs)
C4Def *pDef = NULL;
if (pDefs)
if (!(pDef = pDefs->ID2Def(n_id)))
{ delete pInfo; return false; }
{ delete pInfo; return NULL; }
// Set name source
const char *cpNames = Game.Names.GetData();
if (pDef->pClonkNames) cpNames = pDef->pClonkNames->GetData();

View File

@ -1040,7 +1040,7 @@ namespace C4GUI
if (pDlg->IsFullscreenDialog())
if (fIncludeFading || !pDlg->IsFading())
return pDlg;
return false;
return NULL;
}
void Screen::UpdateGamepadGUIControlEnabled()

View File

@ -575,10 +575,10 @@ C4SoundEffect* C4SoundSystem::GetEffect(const char *szSndName)
C4SoundInstance *C4SoundSystem::NewEffect(const char *szSndName, bool fLoop, int32_t iVolume, C4Object *pObj, int32_t iCustomFalloffDistance)
{
// Sound not active
if (!Config.Sound.RXSound) return false;
if (!Config.Sound.RXSound) return NULL;
// Get sound
C4SoundEffect *csfx;
if (!(csfx=GetEffect(szSndName))) return false;
if (!(csfx=GetEffect(szSndName))) return NULL;
// Play
return csfx->New(fLoop, iVolume, pObj, iCustomFalloffDistance);
}
@ -665,7 +665,7 @@ void C4SoundSystem::ClearPointers(C4Object *pObj)
C4SoundInstance *StartSoundEffect(const char *szSndName, bool fLoop, int32_t iVolume, C4Object *pObj, int32_t iCustomFalloffDistance)
{
// Sound check
if (!Config.Sound.RXSound) return false;
if (!Config.Sound.RXSound) return NULL;
// Start new
return Application.SoundSystem.NewEffect(szSndName, fLoop, iVolume, pObj, iCustomFalloffDistance);
}
@ -673,7 +673,7 @@ C4SoundInstance *StartSoundEffect(const char *szSndName, bool fLoop, int32_t iVo
C4SoundInstance *StartSoundEffectAt(const char *szSndName, int32_t iX, int32_t iY, bool fLoop, int32_t iVolume)
{
// Sound check
if (!Config.Sound.RXSound) return false;
if (!Config.Sound.RXSound) return NULL;
// Create
C4SoundInstance *pInst = StartSoundEffect(szSndName, fLoop, iVolume);
// Set volume by position