mirror of
https://github.com/SMGCommunity/Petari.git
synced 2024-11-28 07:50:51 +00:00
some progress on GameDataFlag and finish SwitchEventFunctorListener
This commit is contained in:
parent
12d26a00af
commit
f6cf215bb0
@ -2,7 +2,7 @@ Symbol Name, Object File, Library Archive, Matching
|
||||
__ct__25ActorAppearSwitchListenerFP9LiveActorbb,ActorAppearSwitchListener.o,Map.a,false
|
||||
listenSwitchOnEvent__25ActorAppearSwitchListenerFv,ActorAppearSwitchListener.o,Map.a,false
|
||||
listenSwitchOffEvent__25ActorAppearSwitchListenerFv,ActorAppearSwitchListener.o,Map.a,false
|
||||
refresh__19SwitchEventListenerFb,ActorAppearSwitchListener.o,Map.a,false
|
||||
refresh__19SwitchEventListenerFb,ActorAppearSwitchListener.o,Map.a,true
|
||||
__ct__3AirFPCc,Air.o,Map.a,true
|
||||
init__3AirFRC12JMapInfoIter,Air.o,Map.a,true
|
||||
appear__3AirFv,Air.o,Map.a,true
|
||||
|
|
@ -1151,15 +1151,15 @@ getAppearPowerStarObjName__20GalaxyStatusAccessorCFl,GalaxyStatusAccessor.o,Syst
|
||||
getActivePowerStarId__20GalaxyStatusAccessorCFl,GalaxyStatusAccessor.o,System.a,false
|
||||
isValidCoin100__20GalaxyStatusAccessorCFl,GalaxyStatusAccessor.o,System.a,false
|
||||
isHiddenStar__20GalaxyStatusAccessorCFl,GalaxyStatusAccessor.o,System.a,false
|
||||
getPowerStarNumToOpenGalaxy__13GameDataConstFPCc,GameDataConst.o,System.a,false
|
||||
isPowerStarGreen__13GameDataConstFPCcl,GameDataConst.o,System.a,false
|
||||
isPowerStarRed__13GameDataConstFPCcl,GameDataConst.o,System.a,false
|
||||
isPowerStarLuigiHas__13GameDataConstFPCcl,GameDataConst.o,System.a,false
|
||||
isGrandStar__13GameDataConstFPCcl,GameDataConst.o,System.a,false
|
||||
isGalaxyLuigiArrested__13GameDataConstFPCcl,GameDataConst.o,System.a,false
|
||||
getPowerStarNumToOpenGalaxy__13GameDataConstFPCc,GameDataConst.o,System.a,true
|
||||
isPowerStarGreen__13GameDataConstFPCcl,GameDataConst.o,System.a,true
|
||||
isPowerStarRed__13GameDataConstFPCcl,GameDataConst.o,System.a,true
|
||||
isPowerStarLuigiHas__13GameDataConstFPCcl,GameDataConst.o,System.a,true
|
||||
isGrandStar__13GameDataConstFPCcl,GameDataConst.o,System.a,true
|
||||
isGalaxyLuigiArrested__13GameDataConstFPCcl,GameDataConst.o,System.a,true
|
||||
isQuestionGalaxy__13GameDataConstFPCc,GameDataConst.o,System.a,false
|
||||
isGalaxyAppearGreenDriver__13GameDataConstFPCc,GameDataConst.o,System.a,false
|
||||
getIncludedGrandGalaxyId__13GameDataConstFPCc,GameDataConst.o,System.a,false
|
||||
isGalaxyAppearGreenDriver__13GameDataConstFPCc,GameDataConst.o,System.a,true
|
||||
getIncludedGrandGalaxyId__13GameDataConstFPCc,GameDataConst.o,System.a,true
|
||||
isPowerStarSpecial__13GameDataConstFPCclPCc,GameDataConst.o,System.a,false
|
||||
getSaveDataHandleSequence__30@unnamed@GameDataFunction_cpp@Fv,GameDataFunction.o,System.a,false
|
||||
getGameSequenceProgress__30@unnamed@GameDataFunction_cpp@Fv,GameDataFunction.o,System.a,false
|
||||
|
|
10
csv/Util.csv
10
csv/Util.csv
@ -3310,11 +3310,11 @@ scanf32__2MRFPCcPCcPf,StringUtil.o,Util.a,true
|
||||
scanu8x4__2MRFPCcPCcPUc,StringUtil.o,Util.a,true
|
||||
scans16x4__2MRFPCcPCcPs,StringUtil.o,Util.a,true
|
||||
scanf32x4__2MRFPCcPCcPf,StringUtil.o,Util.a,true
|
||||
__ct__26SwitchEventFunctorListenerFv,SwitchEventFunctorListener.o,Util.a,false
|
||||
setOnFunctor__26SwitchEventFunctorListenerFRCQ22MR11FunctorBase,SwitchEventFunctorListener.o,Util.a,false
|
||||
setOffFunctor__26SwitchEventFunctorListenerFRCQ22MR11FunctorBase,SwitchEventFunctorListener.o,Util.a,false
|
||||
listenSwitchOnEvent__26SwitchEventFunctorListenerFv,SwitchEventFunctorListener.o,Util.a,false
|
||||
listenSwitchOffEvent__26SwitchEventFunctorListenerFv,SwitchEventFunctorListener.o,Util.a,false
|
||||
__ct__26SwitchEventFunctorListenerFv,SwitchEventFunctorListener.o,Util.a,true
|
||||
setOnFunctor__26SwitchEventFunctorListenerFRCQ22MR11FunctorBase,SwitchEventFunctorListener.o,Util.a,true
|
||||
setOffFunctor__26SwitchEventFunctorListenerFRCQ22MR11FunctorBase,SwitchEventFunctorListener.o,Util.a,true
|
||||
listenSwitchOnEvent__26SwitchEventFunctorListenerFv,SwitchEventFunctorListener.o,Util.a,true
|
||||
listenSwitchOffEvent__26SwitchEventFunctorListenerFv,SwitchEventFunctorListener.o,Util.a,true
|
||||
getGameSystemObjHolder__2MRFv,SystemUtil.o,Util.a,false
|
||||
getFunctionAsyncExecutor__24@unnamed@SystemUtil_cpp@Fv,SystemUtil.o,Util.a,false
|
||||
getFontOnCurrentLanguage__2MRFv,SystemUtil.o,Util.a,false
|
||||
|
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"schemaVersion": 1,
|
||||
"label": "decompiled",
|
||||
"message": "4.880585732155527%",
|
||||
"message": "4.900982729253547%",
|
||||
"color": "blue"
|
||||
}
|
@ -11,7 +11,7 @@
|
||||
| [GameAudio](https://github.com/shibbo/Petari/blob/master/docs/lib/GameAudio.md) | 0.0% |
|
||||
| [Gravity](https://github.com/shibbo/Petari/blob/master/docs/lib/Gravity.md) | 56.286937028734464% |
|
||||
| [LiveActor](https://github.com/shibbo/Petari/blob/master/docs/lib/LiveActor.md) | 35.83679114799447% |
|
||||
| [Map](https://github.com/shibbo/Petari/blob/master/docs/lib/Map.md) | 11.739364566505115% |
|
||||
| [Map](https://github.com/shibbo/Petari/blob/master/docs/lib/Map.md) | 11.757933634152229% |
|
||||
| [MapObj](https://github.com/shibbo/Petari/blob/master/docs/lib/MapObj.md) | 3.201281344579767% |
|
||||
| [NameObj](https://github.com/shibbo/Petari/blob/master/docs/lib/NameObj.md) | 21.12676056338028% |
|
||||
| [NPC](https://github.com/shibbo/Petari/blob/master/docs/lib/NPC.md) | 0.7591369440774989% |
|
||||
@ -21,5 +21,5 @@
|
||||
| [Scene](https://github.com/shibbo/Petari/blob/master/docs/lib/Scene.md) | 5.900967982129561% |
|
||||
| [Screen](https://github.com/shibbo/Petari/blob/master/docs/lib/Screen.md) | 0.8324294656508502% |
|
||||
| [Speaker](https://github.com/shibbo/Petari/blob/master/docs/lib/Speaker.md) | 8.252703471826978% |
|
||||
| [System](https://github.com/shibbo/Petari/blob/master/docs/lib/System.md) | 4.815843320666472% |
|
||||
| [Util](https://github.com/shibbo/Petari/blob/master/docs/lib/Util.md) | 5.736815263302429% |
|
||||
| [System](https://github.com/shibbo/Petari/blob/master/docs/lib/System.md) | 5.16661794796843% |
|
||||
| [Util](https://github.com/shibbo/Petari/blob/master/docs/lib/Util.md) | 5.811353323482105% |
|
||||
|
@ -1,7 +1,7 @@
|
||||
# Map
|
||||
| Object | Percentage (of Bytes) | Functions Done / Total Functions | Percentage (Functions)
|
||||
| ------------- | ------------- | ------------- | ------------- |
|
||||
| ActorAppearSwitchListener.o | 0.0% | 0 / 4 | 0.0% |
|
||||
| ActorAppearSwitchListener.o | 16.39344262295082% | 1 / 4 | 25.0% |
|
||||
| Air.o | 53.06406685236769% | 12 / 33 | 36.36363636363637% |
|
||||
| BezierRail.o | 25.177935943060497% | 11 / 21 | 52.38095238095239% |
|
||||
| Butterfly.o | 0.0% | 0 / 37 | 0.0% |
|
||||
@ -91,7 +91,7 @@
|
||||
| __ct__25ActorAppearSwitchListenerFP9LiveActorbb | :x: |
|
||||
| listenSwitchOnEvent__25ActorAppearSwitchListenerFv | :x: |
|
||||
| listenSwitchOffEvent__25ActorAppearSwitchListenerFv | :x: |
|
||||
| refresh__19SwitchEventListenerFb | :x: |
|
||||
| refresh__19SwitchEventListenerFb | :white_check_mark: |
|
||||
|
||||
|
||||
# Air.o
|
||||
|
@ -71,7 +71,7 @@
|
||||
| GalaxyMoveArgument.o | 0.0% | 0 / 3 | 0.0% |
|
||||
| GalaxyNameSortTable.o | 0.0% | 0 / 1 | 0.0% |
|
||||
| GalaxyStatusAccessor.o | 64.6484375% | 20 / 26 | 76.92307692307693% |
|
||||
| GameDataConst.o | 0.0% | 0 / 10 | 0.0% |
|
||||
| GameDataConst.o | 59.75103734439834% | 8 / 10 | 80.0% |
|
||||
| GameDataFunction.o | 0.0% | 0 / 78 | 0.0% |
|
||||
| GameDataGalaxyStorage.o | 0.0% | 0 / 27 | 0.0% |
|
||||
| GameDataHolder.o | 0.0% | 0 / 46 | 0.0% |
|
||||
@ -1604,15 +1604,15 @@
|
||||
# GameDataConst.o
|
||||
| Symbol | Decompiled? |
|
||||
| ------------- | ------------- |
|
||||
| getPowerStarNumToOpenGalaxy__13GameDataConstFPCc | :x: |
|
||||
| isPowerStarGreen__13GameDataConstFPCcl | :x: |
|
||||
| isPowerStarRed__13GameDataConstFPCcl | :x: |
|
||||
| isPowerStarLuigiHas__13GameDataConstFPCcl | :x: |
|
||||
| isGrandStar__13GameDataConstFPCcl | :x: |
|
||||
| isGalaxyLuigiArrested__13GameDataConstFPCcl | :x: |
|
||||
| getPowerStarNumToOpenGalaxy__13GameDataConstFPCc | :white_check_mark: |
|
||||
| isPowerStarGreen__13GameDataConstFPCcl | :white_check_mark: |
|
||||
| isPowerStarRed__13GameDataConstFPCcl | :white_check_mark: |
|
||||
| isPowerStarLuigiHas__13GameDataConstFPCcl | :white_check_mark: |
|
||||
| isGrandStar__13GameDataConstFPCcl | :white_check_mark: |
|
||||
| isGalaxyLuigiArrested__13GameDataConstFPCcl | :white_check_mark: |
|
||||
| isQuestionGalaxy__13GameDataConstFPCc | :x: |
|
||||
| isGalaxyAppearGreenDriver__13GameDataConstFPCc | :x: |
|
||||
| getIncludedGrandGalaxyId__13GameDataConstFPCc | :x: |
|
||||
| isGalaxyAppearGreenDriver__13GameDataConstFPCc | :white_check_mark: |
|
||||
| getIncludedGrandGalaxyId__13GameDataConstFPCc | :white_check_mark: |
|
||||
| isPowerStarSpecial__13GameDataConstFPCclPCc | :x: |
|
||||
|
||||
|
||||
|
@ -51,7 +51,7 @@
|
||||
| SoundUtil.o | 0.0% | 0 / 86 | 0.0% |
|
||||
| StarPointerUtil.o | 0.0% | 0 / 108 | 0.0% |
|
||||
| StringUtil.o | 30.294530154277698% | 9 / 36 | 25.0% |
|
||||
| SwitchEventFunctorListener.o | 0.0% | 0 / 5 | 0.0% |
|
||||
| SwitchEventFunctorListener.o | 100.0% | 5 / 5 | 100.0% |
|
||||
| SystemUtil.o | 0.0% | 0 / 34 | 0.0% |
|
||||
| TalkUtil.o | 0.0% | 0 / 53 | 0.0% |
|
||||
| AreaObjUtil.o | 6.666666666666667% | 2 / 22 | 9.090909090909092% |
|
||||
@ -3642,11 +3642,11 @@
|
||||
# SwitchEventFunctorListener.o
|
||||
| Symbol | Decompiled? |
|
||||
| ------------- | ------------- |
|
||||
| __ct__26SwitchEventFunctorListenerFv | :x: |
|
||||
| setOnFunctor__26SwitchEventFunctorListenerFRCQ22MR11FunctorBase | :x: |
|
||||
| setOffFunctor__26SwitchEventFunctorListenerFRCQ22MR11FunctorBase | :x: |
|
||||
| listenSwitchOnEvent__26SwitchEventFunctorListenerFv | :x: |
|
||||
| listenSwitchOffEvent__26SwitchEventFunctorListenerFv | :x: |
|
||||
| __ct__26SwitchEventFunctorListenerFv | :white_check_mark: |
|
||||
| setOnFunctor__26SwitchEventFunctorListenerFRCQ22MR11FunctorBase | :white_check_mark: |
|
||||
| setOffFunctor__26SwitchEventFunctorListenerFRCQ22MR11FunctorBase | :white_check_mark: |
|
||||
| listenSwitchOnEvent__26SwitchEventFunctorListenerFv | :white_check_mark: |
|
||||
| listenSwitchOffEvent__26SwitchEventFunctorListenerFv | :white_check_mark: |
|
||||
|
||||
|
||||
# SystemUtil.o
|
||||
|
@ -1,9 +1,19 @@
|
||||
#pragma once
|
||||
|
||||
#include <revolution.h>
|
||||
#include "Game/Util/JMapInfo.h"
|
||||
|
||||
namespace GameDataConst {
|
||||
bool isGrandStar(const char *, s32);
|
||||
const JMapData GalaxyIDBCSV = { 0x0, 0x0, 0x0, 0x0 };
|
||||
|
||||
bool isPowerStarSpecial( const char *, s32, const char *);
|
||||
class GameDataConst {
|
||||
static u32 getPowerStarNumToOpenGalaxy(const char *);
|
||||
static bool isPowerStarGreen(const char *, s32);
|
||||
static bool isPowerStarRed(const char *, s32);
|
||||
static bool isPowerStarLuigiHas(const char *, s32);
|
||||
static bool isGrandStar(const char *, s32);
|
||||
static bool isGalaxyLuigiArrested(const char *, s32);
|
||||
static bool isQuestionGalaxy(const char *);
|
||||
static bool isGalaxyAppearGreenDriver(const char *);
|
||||
static u32 getIncludedGrandGalaxyId(const char *);
|
||||
static bool isPowerStarSpecial(const char *, s32, const char *);
|
||||
};
|
43
include/Game/System/GameEventFlag.h
Normal file
43
include/Game/System/GameEventFlag.h
Normal file
@ -0,0 +1,43 @@
|
||||
#pragma once
|
||||
|
||||
#include <revolution.h>
|
||||
|
||||
struct GameEventFlag {
|
||||
const char* mName; // _0
|
||||
u8 mType; // _4
|
||||
u8 _5;
|
||||
u8 mStarID; // _6
|
||||
u8 mStarPieceNum; // _7
|
||||
u8 _8;
|
||||
u8 _9;
|
||||
u8 _A;
|
||||
u8 _B;
|
||||
|
||||
// _C
|
||||
union {
|
||||
const char* mGalaxyName;
|
||||
const char* mEventValueName;
|
||||
};
|
||||
|
||||
u32 mRequirement; // _10
|
||||
};
|
||||
|
||||
class GameEventFlagAccessor {
|
||||
public:
|
||||
GameEventFlagAccessor(const GameEventFlag *);
|
||||
|
||||
const char* getName() const;
|
||||
bool isTypeGalaxyOpenStar() const;
|
||||
bool isTypeSpecialStar() const;
|
||||
bool isTypeStarPiece() const;
|
||||
bool isTypeEventValueIsZero() const;
|
||||
const char* getGalaxyName() const;
|
||||
s32 getStarId() const;
|
||||
u8 getStarPieceIndex() const;
|
||||
const char* getGalaxyNameWithStarPiece() const;
|
||||
u8 getNeedStarPieceNum() const;
|
||||
const char* getEventValueName() const;
|
||||
u32 getRequirement() const;
|
||||
|
||||
const GameEventFlag* mFlag; // _0
|
||||
};
|
45
include/Game/System/GameEventFlagTable.h
Normal file
45
include/Game/System/GameEventFlagTable.h
Normal file
@ -0,0 +1,45 @@
|
||||
#pragma once
|
||||
|
||||
#include "Game/System/GameEventFlag.h"
|
||||
|
||||
#include <revolution.h>
|
||||
|
||||
class GameEventFlagIter {
|
||||
public:
|
||||
bool isEnd() const;
|
||||
void goNext();
|
||||
const GameEventFlag* getFlag() const;
|
||||
bool isValid() const;
|
||||
|
||||
u32 mIter; // _0
|
||||
};
|
||||
|
||||
class GameEventFlagTableInstance {
|
||||
public:
|
||||
void initSortTable();
|
||||
|
||||
u32 _0;
|
||||
u32 _4;
|
||||
};
|
||||
|
||||
class GameEventFlagTable {
|
||||
public:
|
||||
static GameEventFlagIter getBeginIter();
|
||||
static GameEventFlagAccessor makeAccessor(const char *);
|
||||
s32 getTableSize();
|
||||
const GameEventFlag* getFlag(int);
|
||||
const GameEventFlag* findFlag(const char *);
|
||||
const char* getEventFlagNameSpecialPowerStar(const char *, s32);
|
||||
bool isPowerStarType(const char *, s32, const char *);
|
||||
s32 calcExclamationGalaxyNum();
|
||||
const char* getExclamationGalaxyNameFromIndex(int);
|
||||
static bool isExist(const char *);
|
||||
int getIndex(const GameEventFlag *);
|
||||
static bool isDependedAnother(const char *, const char *);
|
||||
int getIndexFromHashCode(u16);
|
||||
s32 calcSpecialPowerStarNum(const char *);
|
||||
u8 getStarPieceNumToOpenExclamationGalaxy(const char *);
|
||||
s32 calcGreenStarPowerNum();
|
||||
u32 getGalaxyDependFlags(const char **, int, const char *);
|
||||
|
||||
};
|
33
include/Game/Util/SwitchEventFunctorListener.h
Normal file
33
include/Game/Util/SwitchEventFunctorListener.h
Normal file
@ -0,0 +1,33 @@
|
||||
#pragma once
|
||||
|
||||
#include "Game/Util/Functor.h"
|
||||
#include <revolution.h>
|
||||
|
||||
class SwitchEventListener {
|
||||
public:
|
||||
virtual void refresh(bool listenOn) {
|
||||
if (listenOn) {
|
||||
listenSwitchOnEvent();
|
||||
}
|
||||
else {
|
||||
listenSwitchOffEvent();
|
||||
}
|
||||
}
|
||||
|
||||
virtual void listenSwitchOnEvent() = 0;
|
||||
virtual void listenSwitchOffEvent() = 0;
|
||||
};
|
||||
|
||||
class SwitchEventFunctorListener : public SwitchEventListener {
|
||||
public:
|
||||
SwitchEventFunctorListener();
|
||||
|
||||
virtual void listenSwitchOnEvent();
|
||||
virtual void listenSwitchOffEvent();
|
||||
|
||||
void setOnFunctor(const MR::FunctorBase &);
|
||||
void setOffFunctor(const MR::FunctorBase &);
|
||||
|
||||
MR::FunctorBase* mOnFunctor; // _4
|
||||
MR::FunctorBase* mOffFunctor; // _8
|
||||
};
|
59
source/Game/System/GameDataConst.cpp
Normal file
59
source/Game/System/GameDataConst.cpp
Normal file
@ -0,0 +1,59 @@
|
||||
#include "Game/System/GameDataConst.h"
|
||||
#include "Game/System/GameEventFlag.h"
|
||||
#include "Game/System/GameEventFlagTable.h"
|
||||
#include "Game/Util.h"
|
||||
#include <cstdio>
|
||||
|
||||
u32 GameDataConst::getPowerStarNumToOpenGalaxy(const char *pGalaxy) {
|
||||
JMapInfo info;
|
||||
info.attach(&GalaxyIDBCSV);
|
||||
JMapInfoIter element;
|
||||
element = info.findElement<const char *>("name", pGalaxy, 0);
|
||||
u32 powerStarNum = 0;
|
||||
element.getValue<u32>("PowerStarNum", &powerStarNum);
|
||||
return powerStarNum;
|
||||
}
|
||||
|
||||
bool GameDataConst::isPowerStarGreen(const char *pName, s32 a2) {
|
||||
return isPowerStarSpecial(pName, a2, "SpecialStarGreen");
|
||||
}
|
||||
|
||||
bool GameDataConst::isPowerStarRed(const char *pName, s32 a2) {
|
||||
return isPowerStarSpecial(pName, a2, "SpecialStarRed");
|
||||
}
|
||||
|
||||
bool GameDataConst::isPowerStarLuigiHas(const char *pName, s32 a2) {
|
||||
return isPowerStarSpecial(pName, a2, "SpecialStarFindingLuigi");
|
||||
}
|
||||
|
||||
bool GameDataConst::isGrandStar(const char *pName, s32 a2) {
|
||||
return isPowerStarSpecial(pName, a2, "SpecialStarGrand");
|
||||
}
|
||||
|
||||
bool GameDataConst::isGalaxyLuigiArrested(const char *pGalaxy, s32 starId) {
|
||||
GameEventFlagAccessor accessor = GameEventFlagTable::makeAccessor("SpecialStarLuigiRescued");
|
||||
bool ret = false;
|
||||
const char* galaxyName = accessor.getGalaxyName();
|
||||
|
||||
if (MR::isEqualString(galaxyName, pGalaxy) && ((starId == -1) || starId == accessor.getStarId())) {
|
||||
ret = true;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool GameDataConst::isGalaxyAppearGreenDriver(const char *pGalaxyName) {
|
||||
char buf[0x30];
|
||||
snprintf(buf, 0x30, "Appear%s", pGalaxyName);
|
||||
return !GameEventFlagTable::isExist(buf) ? false : GameEventFlagTable::isDependedAnother(buf, "SpecialStarGreenAll");
|
||||
}
|
||||
|
||||
u32 GameDataConst::getIncludedGrandGalaxyId(const char *pGalaxy) {
|
||||
JMapInfo info;
|
||||
info.attach(&GalaxyIDBCSV);
|
||||
JMapInfoIter element;
|
||||
element = info.findElement<const char *>("name", pGalaxy, 0);
|
||||
u32 grandGalaxyNo = 0;
|
||||
element.getValue<u32>("GrandGalaxyNo", &grandGalaxyNo);
|
||||
return grandGalaxyNo;
|
||||
}
|
5
source/Game/System/GameEventFlag.cpp
Normal file
5
source/Game/System/GameEventFlag.cpp
Normal file
@ -0,0 +1,5 @@
|
||||
#include "Game/System/GameEventFlag.h"
|
||||
|
||||
s32 GameEventFlagAccessor::getStarId() const {
|
||||
return mFlag->mStarID;
|
||||
}
|
26
source/Game/Util/SwitchEventFunctorListener.cpp
Normal file
26
source/Game/Util/SwitchEventFunctorListener.cpp
Normal file
@ -0,0 +1,26 @@
|
||||
#include "Game/Util/SwitchEventFunctorListener.h"
|
||||
|
||||
SwitchEventFunctorListener::SwitchEventFunctorListener() {
|
||||
mOnFunctor = 0;
|
||||
mOffFunctor = 0;
|
||||
}
|
||||
|
||||
void SwitchEventFunctorListener::setOnFunctor(const MR::FunctorBase &rFunctor) {
|
||||
mOnFunctor = rFunctor.clone(0);
|
||||
}
|
||||
|
||||
void SwitchEventFunctorListener::setOffFunctor(const MR::FunctorBase &rFunctor) {
|
||||
mOffFunctor = rFunctor.clone(0);
|
||||
}
|
||||
|
||||
void SwitchEventFunctorListener::listenSwitchOnEvent() {
|
||||
if (mOnFunctor) {
|
||||
(*mOnFunctor)();
|
||||
}
|
||||
}
|
||||
|
||||
void SwitchEventFunctorListener::listenSwitchOffEvent() {
|
||||
if (mOffFunctor) {
|
||||
(*mOffFunctor)();
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user