Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use ternaries for CourseMap constructor returns #226

Merged
merged 1 commit into from
Jan 26, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 7 additions & 49 deletions source/game/system/CourseMap.cc
Original file line number Diff line number Diff line change
Expand Up @@ -54,85 +54,43 @@ void CourseMap::init() {
/// @addr{0x80512FA4}
MapdataCannonPointAccessor *CourseMap::parseCannonPoint(u32 sectionName) const {
const MapSectionHeader *sectionPtr = m_course->findSection(sectionName);

MapdataCannonPointAccessor *accessor = nullptr;
if (sectionPtr) {
accessor = new MapdataCannonPointAccessor(sectionPtr);
}

return accessor;
return sectionPtr ? new MapdataCannonPointAccessor(sectionPtr) : nullptr;
}

/// @addr{0x8051377C}
MapdataCheckPathAccessor *CourseMap::parseCheckPath(u32 sectionName) const {
const MapSectionHeader *sectionPtr = m_course->findSection(sectionName);

MapdataCheckPathAccessor *accessor = nullptr;
if (sectionPtr) {
accessor = new MapdataCheckPathAccessor(sectionPtr);
}

return accessor;
return sectionPtr ? new MapdataCheckPathAccessor(sectionPtr) : nullptr;
}

/// @addr{0x80513640}
MapdataCheckPointAccessor *CourseMap::parseCheckPoint(u32 sectionName) const {
const MapSectionHeader *sectionPtr = m_course->findSection(sectionName);

MapdataCheckPointAccessor *accessor = nullptr;
if (sectionPtr) {
accessor = new MapdataCheckPointAccessor(sectionPtr);
}

return accessor;
return sectionPtr ? new MapdataCheckPointAccessor(sectionPtr) : nullptr;
}

/// @addr{0x805134C8}
MapdataGeoObjAccessor *CourseMap::parseGeoObj(u32 sectionName) const {
const MapSectionHeader *sectionPtr = m_course->findSection(sectionName);

MapdataGeoObjAccessor *accessor = nullptr;
if (sectionPtr) {
accessor = new MapdataGeoObjAccessor(sectionPtr);
}

return accessor;
return sectionPtr ? new MapdataGeoObjAccessor(sectionPtr) : nullptr;
}

/// @addr{0x805130C4}
MapdataJugemPointAccessor *CourseMap::parseJugemPoint(u32 sectionName) {
const MapSectionHeader *sectionPtr = m_course->findSection(sectionName);

MapdataJugemPointAccessor *accessor = nullptr;
if (sectionPtr) {
accessor = new MapdataJugemPointAccessor(sectionPtr);
}

return accessor;
return sectionPtr ? new MapdataJugemPointAccessor(sectionPtr) : nullptr;
}

/// @addr{0x80512D64}
MapdataStageInfoAccessor *CourseMap::parseStageInfo(u32 sectionName) const {
const MapSectionHeader *sectionPtr = m_course->findSection(sectionName);

MapdataStageInfoAccessor *accessor = nullptr;
if (sectionPtr) {
accessor = new MapdataStageInfoAccessor(sectionPtr);
}

return accessor;
return sectionPtr ? new MapdataStageInfoAccessor(sectionPtr) : nullptr;
}

/// @addr{0x80513F5C}
MapdataStartPointAccessor *CourseMap::parseStartPoint(u32 sectionName) const {
const MapSectionHeader *sectionPtr = m_course->findSection(sectionName);

MapdataStartPointAccessor *accessor = nullptr;
if (sectionPtr) {
accessor = new MapdataStartPointAccessor(sectionPtr);
}

return accessor;
return sectionPtr ? new MapdataStartPointAccessor(sectionPtr) : nullptr;
}

/// @addr{0x80511500}
Expand Down
Loading