mirror of
https://github.com/isledecomp/isle.git
synced 2025-10-24 00:44:21 +00:00
cmake+ci: run clang-tidy (#512)
* cmake+ci: run clang-tidy
* Remove DESCRIPTION from LEGO1/LegoOmni.mingw.def
* Add initial .clang-tidy and fixes
* fix file perms
* Comment out DESCRIPTION
* Remove LegoEntity::~LegoEntity and MxPresenter::~MxPresenter from mingw's LEGO1.def
* Looks like clang is allergic to the libs in the directx5 SDK
* Update .clang-tidy
* Fix typo in .clang-tidy
* Attempt to generate an action error
* Revert "Attempt to generate an action error"
This reverts commit 96c4c65fed.
* cmake: test with -Wparentheses + optionally with -Werror
* ci: -k0 is a Ninja argument
* Use -Werror only for msys2 builds
* cmake: only emit warnings for specific warnings
* cmake: and don't do -Werror/-WX anymore
* Fix warnings
* Fix mingw warnings
---------
Co-authored-by: Christian Semmler <mail@csemmler.com>
This commit is contained in:
committed by
GitHub
parent
97d1ba7c71
commit
9e686e2a87
@@ -65,16 +65,19 @@ MxResult LegoWorld::Create(MxDSAction& p_dsAction)
|
||||
|
||||
m_entityList = new LegoEntityList(TRUE);
|
||||
|
||||
if (!m_entityList)
|
||||
if (!m_entityList) {
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
m_cacheSoundList = new LegoCacheSoundList(TRUE);
|
||||
|
||||
if (!m_cacheSoundList)
|
||||
if (!m_cacheSoundList) {
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
if (!VTable0x54())
|
||||
if (!VTable0x54()) {
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
if (p_dsAction.GetFlags() & MxDSAction::c_enabled) {
|
||||
if (GetCurrentWorld()) {
|
||||
@@ -146,8 +149,9 @@ void LegoWorld::Destroy(MxBool p_fromDestructor)
|
||||
presenter->EndAction();
|
||||
}
|
||||
}
|
||||
else
|
||||
else {
|
||||
delete object;
|
||||
}
|
||||
}
|
||||
|
||||
MxPresenterListCursor controlPresenterCursor(&m_controlPresenters);
|
||||
@@ -174,8 +178,9 @@ void LegoWorld::Destroy(MxBool p_fromDestructor)
|
||||
while (cursor.First(entity)) {
|
||||
cursor.Detach();
|
||||
|
||||
if (!(entity->GetFlags() & LegoEntity::c_bit2))
|
||||
if (!(entity->GetFlags() & LegoEntity::c_bit2)) {
|
||||
delete entity;
|
||||
}
|
||||
}
|
||||
|
||||
delete m_entityList;
|
||||
@@ -201,8 +206,9 @@ void LegoWorld::Destroy(MxBool p_fromDestructor)
|
||||
delete roi;
|
||||
}
|
||||
|
||||
if (!p_fromDestructor)
|
||||
if (!p_fromDestructor) {
|
||||
LegoEntity::Destroy(FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x1001f5e0
|
||||
@@ -284,42 +290,48 @@ void LegoWorld::Add(MxCore* p_object)
|
||||
if (p_object->IsA("MxControlPresenter")) {
|
||||
MxPresenterListCursor cursor(&m_controlPresenters);
|
||||
|
||||
if (cursor.Find((MxPresenter*) p_object))
|
||||
if (cursor.Find((MxPresenter*) p_object)) {
|
||||
return;
|
||||
}
|
||||
|
||||
m_controlPresenters.Append((MxPresenter*) p_object);
|
||||
}
|
||||
else if (p_object->IsA("MxEntity")) {
|
||||
LegoEntityListCursor cursor(m_entityList);
|
||||
|
||||
if (cursor.Find((LegoEntity*) p_object))
|
||||
if (cursor.Find((LegoEntity*) p_object)) {
|
||||
return;
|
||||
}
|
||||
|
||||
m_entityList->Append((LegoEntity*) p_object);
|
||||
}
|
||||
else if (p_object->IsA("LegoLocomotionAnimPresenter") || p_object->IsA("LegoHideAnimPresenter") || p_object->IsA("LegoLoopingAnimPresenter")) {
|
||||
MxPresenterListCursor cursor(&m_animPresenters);
|
||||
|
||||
if (cursor.Find((MxPresenter*) p_object))
|
||||
if (cursor.Find((MxPresenter*) p_object)) {
|
||||
return;
|
||||
}
|
||||
|
||||
((MxPresenter*) p_object)->SendToCompositePresenter(Lego());
|
||||
m_animPresenters.Append(((MxPresenter*) p_object));
|
||||
|
||||
if (p_object->IsA("LegoHideAnimPresenter"))
|
||||
if (p_object->IsA("LegoHideAnimPresenter")) {
|
||||
m_hideAnimPresenter = (LegoHideAnimPresenter*) p_object;
|
||||
}
|
||||
}
|
||||
else if (p_object->IsA("LegoCacheSound")) {
|
||||
LegoCacheSoundListCursor cursor(m_cacheSoundList);
|
||||
|
||||
if (cursor.Find((LegoCacheSound*) p_object))
|
||||
if (cursor.Find((LegoCacheSound*) p_object)) {
|
||||
return;
|
||||
}
|
||||
|
||||
m_cacheSoundList->Append((LegoCacheSound*) p_object);
|
||||
}
|
||||
else {
|
||||
if (m_set0xa8.find(p_object) == m_set0xa8.end())
|
||||
if (m_set0xa8.find(p_object) == m_set0xa8.end()) {
|
||||
m_set0xa8.insert(p_object);
|
||||
}
|
||||
}
|
||||
|
||||
if (!m_set0xd0.empty() && p_object->IsA("MxPresenter")) {
|
||||
@@ -349,38 +361,45 @@ void LegoWorld::Remove(MxCore* p_object)
|
||||
else if (p_object->IsA("LegoLocomotionAnimPresenter") || p_object->IsA("LegoHideAnimPresenter") || p_object->IsA("LegoLoopingAnimPresenter")) {
|
||||
MxPresenterListCursor cursor(&m_animPresenters);
|
||||
|
||||
if (cursor.Find((MxPresenter*) p_object))
|
||||
if (cursor.Find((MxPresenter*) p_object)) {
|
||||
cursor.Detach();
|
||||
}
|
||||
|
||||
if (p_object->IsA("LegoHideAnimPresenter"))
|
||||
if (p_object->IsA("LegoHideAnimPresenter")) {
|
||||
m_hideAnimPresenter = NULL;
|
||||
}
|
||||
}
|
||||
else if (p_object->IsA("MxEntity")) {
|
||||
if (p_object->IsA("LegoPathActor"))
|
||||
if (p_object->IsA("LegoPathActor")) {
|
||||
FUN_1001fc80((IslePathActor*) p_object);
|
||||
}
|
||||
|
||||
if (m_entityList) {
|
||||
LegoEntityListCursor cursor(m_entityList);
|
||||
|
||||
if (cursor.Find((LegoEntity*) p_object))
|
||||
if (cursor.Find((LegoEntity*) p_object)) {
|
||||
cursor.Detach();
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (p_object->IsA("LegoCacheSound")) {
|
||||
LegoCacheSoundListCursor cursor(m_cacheSoundList);
|
||||
|
||||
if (cursor.Find((LegoCacheSound*) p_object))
|
||||
if (cursor.Find((LegoCacheSound*) p_object)) {
|
||||
cursor.Detach();
|
||||
}
|
||||
}
|
||||
else {
|
||||
it = m_set0xa8.find(p_object);
|
||||
if (it != m_set0xa8.end())
|
||||
if (it != m_set0xa8.end()) {
|
||||
m_set0xa8.erase(it);
|
||||
}
|
||||
}
|
||||
|
||||
it = m_set0xd0.find(p_object);
|
||||
if (it != m_set0xd0.end())
|
||||
if (it != m_set0xd0.end()) {
|
||||
m_set0xd0.erase(it);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -393,8 +412,9 @@ MxCore* LegoWorld::Find(const char* p_class, const char* p_name)
|
||||
|
||||
while (cursor.Next(presenter)) {
|
||||
MxDSAction* action = presenter->GetAction();
|
||||
if (!strcmp(action->GetObjectName(), p_name))
|
||||
if (!strcmp(action->GetObjectName(), p_name)) {
|
||||
return presenter;
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
@@ -404,12 +424,14 @@ MxCore* LegoWorld::Find(const char* p_class, const char* p_name)
|
||||
LegoEntity* entity;
|
||||
|
||||
while (cursor.Next(entity)) {
|
||||
if (!p_name)
|
||||
if (!p_name) {
|
||||
return entity;
|
||||
}
|
||||
|
||||
LegoROI* roi = entity->GetROI();
|
||||
if (roi && !strcmpi(roi->GetUnknown0xe4(), p_name))
|
||||
if (roi && !strcmpi(roi->GetUnknown0xe4(), p_name)) {
|
||||
return entity;
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
@@ -419,8 +441,9 @@ MxCore* LegoWorld::Find(const char* p_class, const char* p_name)
|
||||
MxPresenter* presenter;
|
||||
|
||||
while (cursor.Next(presenter)) {
|
||||
if (!strcmpi(((LegoAnimPresenter*) presenter)->GetActionObjectName(), p_name))
|
||||
if (!strcmpi(((LegoAnimPresenter*) presenter)->GetActionObjectName(), p_name)) {
|
||||
return presenter;
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
@@ -431,8 +454,9 @@ MxCore* LegoWorld::Find(const char* p_class, const char* p_name)
|
||||
MxPresenter* presenter = (MxPresenter*) *it;
|
||||
MxDSAction* action = presenter->GetAction();
|
||||
|
||||
if (!strcmp(action->GetObjectName(), p_name))
|
||||
if (!strcmp(action->GetObjectName(), p_name)) {
|
||||
return *it;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -447,8 +471,9 @@ MxCore* LegoWorld::Find(const MxAtomId& p_atom, MxS32 p_entityId)
|
||||
LegoEntity* entity;
|
||||
|
||||
while (entityCursor.Next(entity)) {
|
||||
if (entity->GetAtom() == p_atom && entity->GetEntityId() == p_entityId)
|
||||
if (entity->GetAtom() == p_atom && entity->GetEntityId() == p_entityId) {
|
||||
return entity;
|
||||
}
|
||||
}
|
||||
|
||||
MxPresenterListCursor controlPresenterCursor(&m_controlPresenters);
|
||||
@@ -457,8 +482,9 @@ MxCore* LegoWorld::Find(const MxAtomId& p_atom, MxS32 p_entityId)
|
||||
while (controlPresenterCursor.Next(presenter)) {
|
||||
MxDSAction* action = presenter->GetAction();
|
||||
|
||||
if (action->GetAtomId() == p_atom && action->GetObjectId() == p_entityId)
|
||||
if (action->GetAtomId() == p_atom && action->GetObjectId() == p_entityId) {
|
||||
return presenter;
|
||||
}
|
||||
}
|
||||
|
||||
MxPresenterListCursor animPresenterCursor(&m_animPresenters);
|
||||
@@ -466,8 +492,9 @@ MxCore* LegoWorld::Find(const MxAtomId& p_atom, MxS32 p_entityId)
|
||||
while (animPresenterCursor.Next(presenter)) {
|
||||
MxDSAction* action = presenter->GetAction();
|
||||
|
||||
if (action && action->GetAtomId() == p_atom && action->GetObjectId() == p_entityId)
|
||||
if (action && action->GetAtomId() == p_atom && action->GetObjectId() == p_entityId) {
|
||||
return presenter;
|
||||
}
|
||||
}
|
||||
|
||||
for (MxCoreSet::iterator it = m_set0xa8.begin(); it != m_set0xa8.end(); it++) {
|
||||
@@ -477,8 +504,9 @@ MxCore* LegoWorld::Find(const MxAtomId& p_atom, MxS32 p_entityId)
|
||||
MxPresenter* presenter = (MxPresenter*) *it;
|
||||
MxDSAction* action = presenter->GetAction();
|
||||
|
||||
if (action->GetAtomId() == p_atom && action->GetObjectId() == p_entityId)
|
||||
if (action->GetAtomId() == p_atom && action->GetObjectId() == p_entityId) {
|
||||
return *it;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -502,8 +530,9 @@ MxResult LegoWorld::Tickle()
|
||||
ReadyWorld();
|
||||
return TRUE;
|
||||
case e_two:
|
||||
if (PresentersPending())
|
||||
if (PresentersPending()) {
|
||||
break;
|
||||
}
|
||||
default:
|
||||
m_startupTicks--;
|
||||
}
|
||||
@@ -519,8 +548,9 @@ MxBool LegoWorld::PresentersPending()
|
||||
MxPresenter* presenter;
|
||||
|
||||
while (controlPresenterCursor.Next(presenter)) {
|
||||
if (presenter->IsEnabled() && !presenter->HasTickleStatePassed(MxPresenter::e_starting))
|
||||
if (presenter->IsEnabled() && !presenter->HasTickleStatePassed(MxPresenter::e_starting)) {
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
MxPresenterListCursor animPresenterCursor(&m_animPresenters);
|
||||
@@ -528,12 +558,14 @@ MxBool LegoWorld::PresentersPending()
|
||||
while (animPresenterCursor.Next(presenter)) {
|
||||
if (presenter->IsEnabled()) {
|
||||
if (presenter->IsA("LegoLocomotionAnimPresenter")) {
|
||||
if (!presenter->HasTickleStatePassed(MxPresenter::e_ready))
|
||||
if (!presenter->HasTickleStatePassed(MxPresenter::e_ready)) {
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (!presenter->HasTickleStatePassed(MxPresenter::e_starting))
|
||||
if (!presenter->HasTickleStatePassed(MxPresenter::e_starting)) {
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -542,8 +574,9 @@ MxBool LegoWorld::PresentersPending()
|
||||
if ((*it)->IsA("MxPresenter")) {
|
||||
presenter = (MxPresenter*) *it;
|
||||
|
||||
if (presenter->IsEnabled() && !presenter->HasTickleStatePassed(MxPresenter::e_starting))
|
||||
if (presenter->IsEnabled() && !presenter->HasTickleStatePassed(MxPresenter::e_starting)) {
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user