all: Enable warnings on virtual overload and variable shadowing (#938)

This commit is contained in:
Narr the Reg 2026-03-06 08:01:24 -06:00 committed by GitHub
parent c129faf216
commit 9a9eeefb89
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 44 additions and 53 deletions

View file

@ -31,6 +31,8 @@ target_compile_options(odyssey PRIVATE -Wall -Wextra -Wdeprecated)
target_compile_options(odyssey PRIVATE -Wno-unused-parameter -Wno-unused-private-field)
target_compile_options(odyssey PRIVATE -fno-strict-aliasing)
target_compile_options(odyssey PRIVATE -Wno-invalid-offsetof)
target_compile_options(odyssey PRIVATE -Wshadow)
target_compile_options(odyssey PRIVATE -Woverloaded-virtual)
set(NN_WARE 3.5.1)
set(NN_SDK 3.5.1)

View file

@ -54,8 +54,7 @@ void startPadRumblePos(const al::LiveActor* actor, const sead::Vector3f& positio
if (al::isPlayerDead(actor, i))
continue;
al::PadRumbleParam rumbleParam(near, far);
s32 port = al::getPlayerPort(actor, i);
startPadRumbleWithParam(director, position, name, rumbleParam, port);
startPadRumbleWithParam(director, position, name, rumbleParam, al::getPlayerPort(actor, i));
}
}
@ -92,8 +91,7 @@ void startPadRumbleNo3D(const al::LiveActor* actor, const char* name, s32 port)
if (al::isPlayerDead(actor, i))
continue;
al::PadRumbleParam rumbleParam;
s32 port = al::getPlayerPort(actor, i);
startPadRumbleNo3DWithParam(director, name, rumbleParam, port);
startPadRumbleNo3DWithParam(director, name, rumbleParam, al::getPlayerPort(actor, i));
}
}
@ -143,8 +141,7 @@ void startPadRumbleLoop(const al::LiveActor* actor, const char* name,
if (al::isPlayerDead(actor, i))
continue;
al::PadRumbleParam rumbleParam(near, far);
s32 port = al::getPlayerPort(actor, i);
director->startRumbleLoop(name, position, rumbleParam, port);
director->startRumbleLoop(name, position, rumbleParam, al::getPlayerPort(actor, i));
}
}
@ -178,8 +175,7 @@ void startPadRumbleLoopNo3D(const al::LiveActor* actor, const char* name,
if (al::isPlayerDead(actor, i))
continue;
al::PadRumbleParam rumbleParam;
s32 port = al::getPlayerPort(actor, i);
director->startRumbleLoopNo3D(name, position, rumbleParam, port);
director->startRumbleLoopNo3D(name, position, rumbleParam, al::getPlayerPort(actor, i));
}
}
@ -206,8 +202,7 @@ void stopPadRumbleLoop(const al::LiveActor* actor, const char* name, const sead:
for (s32 i = 0; i < playerNum; i++) {
if (al::isPlayerDead(actor, i))
continue;
s32 port = al::getPlayerPort(actor, i);
director->stopRumbleLoop(name, position, port);
director->stopRumbleLoop(name, position, al::getPlayerPort(actor, i));
}
}
@ -240,8 +235,8 @@ void changePadRumbleLoopVolmue(const al::LiveActor* actor, const char* name,
for (s32 i = 0; i < playerNum; i++) {
if (al::isPlayerDead(actor, i))
continue;
s32 port = al::getPlayerPort(actor, i);
director->changeRumbleLoopVolume(name, position, volumeLeft, volumeRight, port);
director->changeRumbleLoopVolume(name, position, volumeLeft, volumeRight,
al::getPlayerPort(actor, i));
}
}
@ -266,8 +261,8 @@ void changePadRumbleLoopPitch(const al::LiveActor* actor, const char* name,
for (s32 i = 0; i < playerNum; i++) {
if (al::isPlayerDead(actor, i))
continue;
s32 port = al::getPlayerPort(actor, i);
director->changeRumbleLoopPitch(name, position, pitchLeft, pitchRight, port);
director->changeRumbleLoopPitch(name, position, pitchLeft, pitchRight,
al::getPlayerPort(actor, i));
}
}
@ -284,8 +279,7 @@ void startPadRumbleDirectValue(const al::LiveActor* actor, f32 a, f32 b, f32 c,
for (s32 i = 0; i < playerNum; i++) {
if (al::isPlayerDead(actor, i))
continue;
s32 port = al::getPlayerPort(actor, i);
director->startRumbleDirectValue(a, b, c, d, e, f, port);
director->startRumbleDirectValue(a, b, c, d, e, f, al::getPlayerPort(actor, i));
}
}
@ -300,8 +294,7 @@ void stopPadRumbleDirectValue(const al::LiveActor* actor, s32 port) {
for (s32 i = 0; i < playerNum; i++) {
if (al::isPlayerDead(actor, i))
continue;
s32 port = al::getPlayerPort(actor, i);
director->stopRumbleDirectValue(port);
director->stopRumbleDirectValue(al::getPlayerPort(actor, i));
}
}
@ -317,8 +310,7 @@ void startPadRumbleWithVolume(const al::LiveActor* actor, const char* name, f32
for (s32 i = 0; i < playerNum; i++) {
if (al::isPlayerDead(actor, i))
continue;
s32 port = al::getPlayerPort(actor, i);
director->startRumbleWithVolume(name, volumeLeft, volumeRight, port);
director->startRumbleWithVolume(name, volumeLeft, volumeRight, al::getPlayerPort(actor, i));
}
}

View file

@ -421,8 +421,7 @@ ALWAYS_INLINE void initActorClipping(LiveActor* actor, const ActorInitInfo& init
f32 maxXY = sead::Mathf::max(sead::Mathf::abs(scale.x), sead::Mathf::abs(scale.y));
f32 maxXYZ = sead::Mathf::max(maxXY, sead::Mathf::abs(scale.z));
f32 radius = calcModelBoundingSphereRadius(actor) * maxXYZ;
setClippingInfo(actor, radius, nullptr);
setClippingInfo(actor, calcModelBoundingSphereRadius(actor) * maxXYZ, nullptr);
}
sead::BoundBox3f obb;

View file

@ -749,13 +749,13 @@ void placementRailDivideForcePoint(const IUseRail* railHolder, f32 segmentLength
s32 index = 0;
for (s32 i = 0; i < railNum; i++) {
f32 length = getRailPartLength(railHolder, i);
s32 railNum = (s32)(length / segmentLength) + 1;
for (s32 e = 0; e < railNum; e++) {
s32 railSegments = (s32)(length / segmentLength) + 1;
for (s32 e = 0; e < railSegments; e++) {
sead::Vector3f vec = sead::Vector3f::zero;
calcRailPosAtCoord(&vec, railHolder, coord);
callback(vec, index, coord);
index++;
coord += length / railNum;
coord += length / railSegments;
}
}

View file

@ -20,8 +20,8 @@ void Graph::appendVertex(Vertex* vertex) {
void Graph::removeVertex(const Vertex* vertex) {
for (s32 i = 0; i < mVertices.size(); i++) {
if (mVertices[i] == vertex) {
for (s32 i = 0; i < vertex->getEdgeCount(); i++)
removeEdge(vertex->getEdge(i));
for (s32 j = 0; j < vertex->getEdgeCount(); j++)
removeEdge(vertex->getEdge(j));
mVertices.erase(i);
return;
}

View file

@ -34,18 +34,18 @@ const char* ByamlWriterStringTable::tryAdd(const char* string) {
if (result < 0) {
s32 length = (s64)((strlen(string) << 32) + 0x100000000LL) >> 32;
char* array = new char[length];
char* result = strncpy(array, string, length);
auto* node = new sead::TListNode<const char*>(result);
char* outString = strncpy(array, string, length);
auto* node = new sead::TListNode<const char*>(outString);
mList.insertBefore(&*it, node);
return result;
return outString;
}
}
s32 length = (s64)((strlen(string) << 32) + 0x100000000LL) >> 32;
char* array = new char[length];
char* result = strncpy(array, string, length);
auto* node = new sead::TListNode<const char*>(result);
char* outString = strncpy(array, string, length);
auto* node = new sead::TListNode<const char*>(outString);
mList.pushBack(node);
return result;
return outString;
}
u32 ByamlWriterStringTable::calcHeaderSize() const {

View file

@ -24,7 +24,7 @@ MemorySystem::MemorySystem(sead::Heap* heap)
{
sead::ScopedCurrentHeapSetter setter(mStationedHeap);
{
sead::ScopedCurrentHeapSetter setter(mStationedHeap);
sead::ScopedCurrentHeapSetter setter2(mStationedHeap);
mHeapList.allocBuffer(32, nullptr);
}

View file

@ -514,15 +514,15 @@ void Nokonoko::exeCaptureSpin() {
al::approachWaterSurfaceSpringDumper(this, mWaterSurfaceFinder, -5.0f, 12.0f, 1.0f, 0.05f,
0.9f);
sead::Vector3f frontDir;
al::calcFrontDir(&frontDir, this);
sead::Vector3f velocityDir;
al::calcFrontDir(&velocityDir, this);
if (mHackSwingCooldown)
mHackSwingCooldown--;
else if (rs::isTriggerHackSwing(mHackActor)) {
mHackSwingCooldown = 30;
al::startHitReaction(this, "振りで加速");
al::addVelocity(this, frontDir * 15.0f);
al::addVelocity(this, velocityDir * 15.0f);
}
if ((al::isOnGround(this, 0) || mWaterSurfaceFinder->isFoundSurface()) &&
@ -563,7 +563,7 @@ void Nokonoko::exeCaptureSpin() {
bool isFoundWater = mWaterSurfaceFinder->isFoundSurface();
f32 frontVel = (isOnGround || isFoundWater) ? 0.9f : 0.2f;
al::addVelocity(this, frontDir * frontVel);
al::addVelocity(this, velocityDir * frontVel);
if (al::isOnGround(this, 0) || al::isInWater(this) || mWaterSurfaceFinder->isFoundSurface()) {
f32 hackMoveStick = rs::getHackMoveStickRaw(mHackActor);

View file

@ -66,9 +66,9 @@ MenuSelectParts::MenuSelectParts(const char* name, al::LayoutActor* layoutActor,
for (s32 i = 0; i < mMax; i++) {
mLayoutArray[i] = new al::LayoutActor("選択肢パーツ");
al::StringTmp<32> name("%s%02d", "ParList", i);
al::StringTmp<32> partListName("%s%02d", "ParList", i);
al::initLayoutPartsActor(mLayoutArray[i], layoutActor, info, name.cstr());
al::initLayoutPartsActor(mLayoutArray[i], layoutActor, info, partListName.cstr());
al::startAction(mLayoutArray[i], "Active", "State");
}

View file

@ -36,10 +36,8 @@ void PlayerBindableSensorList::append(al::HitSensor* bindSensor, u32 type, f32 d
void PlayerBindableSensorList::remove(al::HitSensor* toRemove) {
s32 size = mActiveSensors.size();
for (s32 i = 0; i < size; i++) {
const SensorInfo* item = mActiveSensors[i];
if (item->bindSensor == toRemove) {
SensorInfo* item = mActiveSensors[i];
mPool.pushBack(item);
if (mActiveSensors[i]->bindSensor == toRemove) {
mPool.pushBack(mActiveSensors[i]);
mActiveSensors.erase(i);
return;
}

View file

@ -153,11 +153,11 @@ void PlayerStateHack::exeHackDemo() {
al::offCollide(player);
al::setVelocityZero(player);
sead::Matrix34f modelMtx = sead::Matrix34f::ident;
sead::Vector3f frontDir = {0.0f, 0.0f, 0.0f};
sead::Vector3f upDir = {0.0f, 0.0f, 0.0f};
al::calcFrontDir(&frontDir, player);
al::calcUpDir(&upDir, player);
al::makeMtxSideFrontPos(&modelMtx, -upDir, frontDir, mStartSensorTrans);
sead::Vector3f playerFrontDir = {0.0f, 0.0f, 0.0f};
sead::Vector3f playerUpDir = {0.0f, 0.0f, 0.0f};
al::calcFrontDir(&playerFrontDir, player);
al::calcUpDir(&playerUpDir, player);
al::makeMtxSideFrontPos(&modelMtx, -playerUpDir, playerFrontDir, mStartSensorTrans);
mHackKeeper->appearHackDemoModel(modelMtx, 0.02f);
} else if (al::isStep(this, 1)) {
mModelChanger->hideModel();

View file

@ -239,8 +239,8 @@ s32 getWorldNumForNewReleaseShop(GameDataHolderAccessor accessor) {
const char* world_name = getWorldDevelopName(accessor, world_id);
const sead::PtrArray<sead::FixedSafeString<64>>& list =
accessor->getWorldsForNewReleaseShop();
for (s32 i = 0; i < list.size(); i++) {
if (al::isEqualString(world_name, list[i]->cstr())) {
for (s32 j = 0; j < list.size(); j++) {
if (al::isEqualString(world_name, list[j]->cstr())) {
count++;
break;
}
@ -275,8 +275,8 @@ s32 getWorldIdForNewReleaseShop(GameDataHolderAccessor accessor, s32 index) {
const char* world_name = getWorldDevelopName(accessor, world_id);
const sead::PtrArray<sead::FixedSafeString<64>>& list =
accessor->getWorldsForNewReleaseShop();
for (s32 i = 0; i < list.size(); i++) {
if (al::isEqualString(world_name, list[i]->cstr())) {
for (s32 j = 0; j < list.size(); j++) {
if (al::isEqualString(world_name, list[j]->cstr())) {
if (index == 0) {
result = world_id;
return 1;