Make NotificationManager::Send take a const reference to notification (#836)

* Make NotificationManager::Send take a const reference to notification

* Fix virtual func
This commit is contained in:
Christian Semmler
2024-04-22 08:11:38 -04:00
committed by GitHub
parent 0e0d6890ad
commit f1688be263
22 changed files with 50 additions and 180 deletions

View File

@@ -124,7 +124,7 @@ void LegoAnimMMPresenter::EndAction()
MxType18NotificationParam param(c_notificationType18, NULL, m_animmanId);
if (m_animmanId != 0) {
NotificationManager()->Send(AnimationManager(), &param);
NotificationManager()->Send(AnimationManager(), param);
}
if (m_action != NULL) {

View File

@@ -775,14 +775,7 @@ inline void LoadIsle()
LegoWorld* world = FindWorld(*g_isleScript, 0);
if (world != NULL) {
if (!world->GetUnknown0xd0().empty()) {
#ifdef COMPAT_MODE
{
MxNotificationParam param(c_notificationType20, NULL);
NotificationManager()->Send(world, &param);
}
#else
NotificationManager()->Send(world, &MxNotificationParam(c_notificationType20, NULL));
#endif
NotificationManager()->Send(world, MxNotificationParam(c_notificationType20, NULL));
}
}
else {

View File

@@ -239,14 +239,7 @@ void NotifyEntity(const char* p_filename, MxS32 p_entityId, LegoEntity* p_sender
}
if (entity != NULL) {
#ifdef COMPAT_MODE
{
MxNotificationParam param(c_notificationType0, p_sender);
NotificationManager()->Send(entity, &param);
}
#else
NotificationManager()->Send(entity, &MxNotificationParam(c_notificationType0, p_sender));
#endif
NotificationManager()->Send(entity, MxNotificationParam(c_notificationType0, p_sender));
}
}

View File

@@ -66,14 +66,7 @@ LegoWorldPresenter::~LegoWorldPresenter()
}
if (m_entity) {
#ifdef COMPAT_MODE
{
MxNotificationParam param(c_notificationNewPresenter, NULL);
NotificationManager()->Send(m_entity, &param);
}
#else
NotificationManager()->Send(m_entity, &MxNotificationParam(c_notificationNewPresenter, NULL));
#endif
NotificationManager()->Send(m_entity, MxNotificationParam(c_notificationNewPresenter, NULL));
}
}

View File

@@ -678,7 +678,7 @@ MxEntity* LegoOmni::AddToWorld(const char* p_id, MxS32 p_entityId, MxPresenter*
}
// FUNCTION: LEGO1 0x1005b3a0
void LegoOmni::NotifyCurrentEntity(MxNotificationParam* p_param)
void LegoOmni::NotifyCurrentEntity(const MxNotificationParam& p_param)
{
if (m_currentWorld) {
NotificationManager()->Send(m_currentWorld, p_param);

View File

@@ -509,16 +509,7 @@ void Isle::Enable(MxBool p_enable)
switch (GameState()->m_currentArea) {
case LegoGameState::e_elevride:
m_destLocation = LegoGameState::e_elevride;
#ifdef COMPAT_MODE
{
MxNotificationParam param(c_notificationTransitioned, NULL);
NotificationManager()->Send(this, &param);
}
#else
NotificationManager()->Send(this, &MxNotificationParam(c_notificationTransitioned, NULL));
#endif
NotificationManager()->Send(this, MxNotificationParam(c_notificationTransitioned, NULL));
SetIsWorldActive(FALSE);
break;
case LegoGameState::e_jetrace2:
@@ -540,30 +531,12 @@ void Isle::Enable(MxBool p_enable)
break;
case LegoGameState::e_garadoor:
m_destLocation = LegoGameState::e_garadoor;
#ifdef COMPAT_MODE
{
MxNotificationParam param(c_notificationTransitioned, NULL);
NotificationManager()->Send(this, &param);
}
#else
NotificationManager()->Send(this, &MxNotificationParam(c_notificationTransitioned, NULL));
#endif
NotificationManager()->Send(this, MxNotificationParam(c_notificationTransitioned, NULL));
SetIsWorldActive(FALSE);
break;
case LegoGameState::e_polidoor:
m_destLocation = LegoGameState::e_polidoor;
#ifdef COMPAT_MODE
{
MxNotificationParam param(c_notificationTransitioned, NULL);
NotificationManager()->Send(this, &param);
}
#else
NotificationManager()->Send(this, &MxNotificationParam(c_notificationTransitioned, NULL));
#endif
NotificationManager()->Send(this, MxNotificationParam(c_notificationTransitioned, NULL));
SetIsWorldActive(FALSE);
break;
case LegoGameState::e_bike:
@@ -1012,29 +985,13 @@ void Isle::FUN_10032d30(
m_act1state->m_unk0x01f = FALSE;
}
else {
#ifdef COMPAT_MODE
{
MxNotificationParam param(c_notificationTransitioned, NULL);
NotificationManager()->Send(this, &param);
}
#else
NotificationManager()->Send(this, &MxNotificationParam(c_notificationTransitioned, NULL));
#endif
NotificationManager()->Send(this, MxNotificationParam(c_notificationTransitioned, NULL));
}
}
else {
GameState()->SwitchArea(m_destLocation);
GameState()->StopArea(LegoGameState::e_previousArea);
#ifdef COMPAT_MODE
{
MxNotificationParam param(c_notificationTransitioned, NULL);
NotificationManager()->Send(this, &param);
}
#else
NotificationManager()->Send(this, &MxNotificationParam(c_notificationTransitioned, NULL));
#endif
NotificationManager()->Send(this, MxNotificationParam(c_notificationTransitioned, NULL));
m_act1state->m_unk0x01f = TRUE;
}
}