Skip to content

Commit

Permalink
Remove PlayerNumber usage in some NoteField code
Browse files Browse the repository at this point in the history
  • Loading branch information
poco0317 committed Jan 28, 2021
1 parent 169ec52 commit 667d6d5
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 13 deletions.
19 changes: 8 additions & 11 deletions src/Etterna/Actor/Gameplay/NoteField.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,12 +98,12 @@ NoteField::Unload()
}

void
NoteField::CacheNoteSkin(const std::string& sNoteSkin_, PlayerNumber pn)
NoteField::CacheNoteSkin(const std::string& sNoteSkin_)
{
if (m_NoteDisplays.find(sNoteSkin_) != m_NoteDisplays.end())
return;

LockNoteSkin l(sNoteSkin_, pn);
LockNoteSkin l(sNoteSkin_);

if (PREFSMAN->m_verbose_log > 1)
Locator::getLogger()->trace("NoteField::CacheNoteSkin: cache {}", sNoteSkin_.c_str());
Expand Down Expand Up @@ -149,7 +149,7 @@ NoteField::CacheAllUsedNoteSkins()
}

for (auto& i : asSkinsLower) {
CacheNoteSkin(i, m_pPlayerState->m_PlayerNumber);
CacheNoteSkin(i);
}

/* If we're changing note skins in the editor, we can have old note skins
Expand Down Expand Up @@ -245,19 +245,16 @@ NoteField::ensure_note_displays_have_skin()
auto sNoteSkinLower =
m_pPlayerState->m_PlayerOptions.GetCurrent().m_sNoteSkin;

/* XXX: Combination of good idea and bad idea to ensure courses load
* regardless of noteskin content. This may take a while to fix. */
auto* badIdea = m_pCurDisplay;

// Guarantee a display is loaded if the selected Noteskin seems (doubly) empty
if (sNoteSkinLower.empty()) {
sNoteSkinLower =
m_pPlayerState->m_PlayerOptions.GetPreferred().m_sNoteSkin;
sNoteSkinLower = make_lower(
m_pPlayerState->m_PlayerOptions.GetPreferred().m_sNoteSkin);

if (sNoteSkinLower.empty()) {
sNoteSkinLower = "default";
}
m_NoteDisplays.insert(
std::pair<std::string, NoteDisplayCols*>(sNoteSkinLower, badIdea));

CacheNoteSkin(sNoteSkinLower);
}

sNoteSkinLower = make_lower(sNoteSkinLower);
Expand Down
2 changes: 1 addition & 1 deletion src/Etterna/Actor/Gameplay/NoteField.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class NoteField : public ActorFrame
std::vector<NoteColumnRenderer> m_ColumnRenderers;

protected:
void CacheNoteSkin(const std::string& sNoteSkin, PlayerNumber pn);
void CacheNoteSkin(const std::string& sNoteSkin);
void UncacheNoteSkin(const std::string& sNoteSkin);

void DrawBoard(int iDrawDistanceAfterTargetsPixels,
Expand Down
2 changes: 1 addition & 1 deletion src/Etterna/Singletons/NoteSkinManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ extern NoteSkinManager*
class LockNoteSkin
{
public:
LockNoteSkin(const std::string& sNoteSkin, PlayerNumber /*pn*/)
LockNoteSkin(const std::string& sNoteSkin)
{
NOTESKIN->SetCurrentNoteSkin(sNoteSkin);
}
Expand Down

0 comments on commit 667d6d5

Please sign in to comment.