diff --git a/lib/al/include/Library/Camera/CameraDirector.h b/lib/al/include/Library/Camera/CameraDirector.h index 11cefbe0..1bb2cfe0 100644 --- a/lib/al/include/Library/Camera/CameraDirector.h +++ b/lib/al/include/Library/Camera/CameraDirector.h @@ -33,7 +33,7 @@ class IUseAudioKeeper; class CameraRailHolder; class NameToCameraParamTransferFunc; -class CameraDirector : public HioNode, IUseExecutor { +class CameraDirector : public HioNode, public IUseExecutor { public: CameraDirector(s32 maxCameras); virtual ~CameraDirector(); diff --git a/lib/al/include/Library/LiveActor/LiveActorGroup.h b/lib/al/include/Library/LiveActor/LiveActorGroup.h index d06ef033..2cc0376f 100755 --- a/lib/al/include/Library/LiveActor/LiveActorGroup.h +++ b/lib/al/include/Library/LiveActor/LiveActorGroup.h @@ -37,7 +37,7 @@ private: }; template -class DeriveActorGroup : LiveActorGroup { +class DeriveActorGroup : public LiveActorGroup { public: s32 registerActor(T* actor) { LiveActorGroup::registerActor(actor); } void removeActor(const T* actor) { LiveActorGroup::removeActor(actor); } diff --git a/lib/al/include/Library/Scene/GameDataHolderBase.h b/lib/al/include/Library/Scene/GameDataHolderBase.h index be610fad..5d567723 100644 --- a/lib/al/include/Library/Scene/GameDataHolderBase.h +++ b/lib/al/include/Library/Scene/GameDataHolderBase.h @@ -5,5 +5,5 @@ #include "Library/Scene/ISceneObj.h" namespace al { -class GameDataHolderBase : public ISceneObj, HioNode, IUseMessageSystem {}; +class GameDataHolderBase : public ISceneObj, public HioNode, public IUseMessageSystem {}; } // namespace al diff --git a/lib/al/include/Library/Screen/ScreenFunction.h b/lib/al/include/Library/Screen/ScreenFunction.h index fdbe498f..52d99564 100644 --- a/lib/al/include/Library/Screen/ScreenFunction.h +++ b/lib/al/include/Library/Screen/ScreenFunction.h @@ -15,7 +15,7 @@ namespace al { class SceneCameraInfo; class ScreenCapture; -class ScreenCaptureExecutor : IUseHioNode { +class ScreenCaptureExecutor : public IUseHioNode { public: ScreenCaptureExecutor(s32); ~ScreenCaptureExecutor(); diff --git a/src/Layout/StageSceneLayout.h b/src/Layout/StageSceneLayout.h index 53edd603..183663b3 100644 --- a/src/Layout/StageSceneLayout.h +++ b/src/Layout/StageSceneLayout.h @@ -17,7 +17,7 @@ class PlayGuideCamera; class PlayGuideBgm; class MapMini; -class StageSceneLayout : al::NerveStateBase { +class StageSceneLayout : public al::NerveStateBase { public: StageSceneLayout(const char*, const al::LayoutInitInfo&, const al::PlayerHolder*, const al::SubCameraRenderer*); diff --git a/src/MapObj/WorldMapEarth.h b/src/MapObj/WorldMapEarth.h index 63ec205b..8b050906 100644 --- a/src/MapObj/WorldMapEarth.h +++ b/src/MapObj/WorldMapEarth.h @@ -2,7 +2,7 @@ #include "Library/LiveActor/LiveActor.h" -class WorldMapEarth : al::LiveActor { +class WorldMapEarth : public al::LiveActor { public: WorldMapEarth(const char* name); void init(const al::ActorInitInfo& initInfo) override; diff --git a/src/Player/PlayerConst.h b/src/Player/PlayerConst.h index 71b34b3c..ed1d0f03 100644 --- a/src/Player/PlayerConst.h +++ b/src/Player/PlayerConst.h @@ -3,7 +3,7 @@ #include "Library/HostIO/HioNode.h" #include "Library/Yaml/ByamlIter.h" -class PlayerConst : al::HioNode { +class PlayerConst : public al::HioNode { public: PlayerConst(); PlayerConst(const al::ByamlIter&); diff --git a/src/Player/PlayerModelChangerHakoniwa.h b/src/Player/PlayerModelChangerHakoniwa.h index 195825b1..9f954a14 100644 --- a/src/Player/PlayerModelChangerHakoniwa.h +++ b/src/Player/PlayerModelChangerHakoniwa.h @@ -12,7 +12,7 @@ class PlayerPainPartsKeeper; class PlayerCostumeInfo; class IUseDimension; -class PlayerModelChangerHakoniwa : IPlayerModelChanger, al::HioNode { +class PlayerModelChangerHakoniwa : public IPlayerModelChanger, public al::HioNode { public: PlayerModelChangerHakoniwa(const al::LiveActor*, PlayerModelHolder*, PlayerPainPartsKeeper*, PlayerCostumeInfo*, const IUseDimension*); diff --git a/tools/check-format.py b/tools/check-format.py index 91fdb8d0..75e1fe5c 100755 --- a/tools/check-format.py +++ b/tools/check-format.py @@ -192,11 +192,12 @@ def header_sorted_visibility(c, path): if line.endswith("\\"): line = line[0:-1] line = line.strip() if line not in visibilities_ordered: - header_check_line(line, path, nest_level[-1]) + header_check_line(line, path, nest_level[-1], should_start_class) if "{" in line and "}" in line: if CHECK(lambda a:a.count("{")==a.count("}") or (a.startswith("{") and a.endswith("}};")), line, "Unbalanced \"{\" and \"}\" in the same line! (exception: end of brace-initialized array)", path): return if line.startswith("{") and line.endswith("}};"): del nest_level[-1] + should_start_class = False continue if line.startswith("class ") and not line.endswith(";"): @@ -221,9 +222,22 @@ def header_sorted_visibility(c, path): print("nest_level", nest_level) exit(1) -def header_check_line(line, path, visibility): +def header_check_line(line, path, visibility, should_start_class): if visibility == -2: # outside of class/struct/... - pass + if (line.startswith("class") and (not line.endswith(";") or "{" in line)) or should_start_class: + if ": " in line and not ": public" in line and not ": virtual public" in line: + FAIL("All superclasses must be public!", line, path) + if should_start_class and not ": " in line and not line.startswith("public") and not line.startswith("virtual public"): + FAIL("All superclasses must be public!", line, path) + + if line.startswith("class") and "{" in line and ": " in line: + index = 0 + while index < len(line): + index = line.find(",", index+1) + if index == -1: break + if index < line.find(": "): continue + if index != line.find(", public", index) and index != line.find(", virtual public", index): + FAIL("All superclasses must be public!", line, path) elif visibility == -1: # inside class, but not in a visibility block allowed = line in ["", "};"] or line.startswith("SEAD_SINGLETON_DISPOSER") or line.startswith("SEAD_RTTI_BASE") or line.startswith("SEAD_RTTI_OVERRIDE") CHECK(lambda a:allowed, line, "Inside class, but not in a visibility block, only empty lines and closing brace allowed!", path)