diff options
Diffstat (limited to '')
-rw-r--r-- | src/BlockEntities/SignEntity.cpp | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/src/BlockEntities/SignEntity.cpp b/src/BlockEntities/SignEntity.cpp index a2609d234..fc96e06f5 100644 --- a/src/BlockEntities/SignEntity.cpp +++ b/src/BlockEntities/SignEntity.cpp @@ -27,10 +27,7 @@ void cSignEntity::CopyFrom(const cBlockEntity & a_Src) { Super::CopyFrom(a_Src); auto & src = static_cast<const cSignEntity &>(a_Src); - for (size_t i = 0; i < ARRAYCOUNT(m_Line); ++i) - { - m_Line[i] = src.m_Line[i]; - } + m_Line = src.m_Line; } @@ -59,13 +56,14 @@ void cSignEntity::SetLines(const AString & a_Line1, const AString & a_Line2, con -void cSignEntity::SetLine(int a_Index, const AString & a_Line) +void cSignEntity::SetLine(size_t a_Index, const AString & a_Line) { - if ((a_Index < 0) || (a_Index >= static_cast<int>(ARRAYCOUNT(m_Line)))) + if (a_Index >= m_Line.size()) { LOGWARNING("%s: setting a non-existent line %d (value \"%s\"", __FUNCTION__, a_Index, a_Line.c_str()); return; } + m_Line[a_Index] = a_Line; } @@ -73,13 +71,14 @@ void cSignEntity::SetLine(int a_Index, const AString & a_Line) -AString cSignEntity::GetLine(int a_Index) const +AString cSignEntity::GetLine(size_t a_Index) const { - if ((a_Index < 0) || (a_Index >= static_cast<int>(ARRAYCOUNT(m_Line)))) + if (a_Index >= m_Line.size()) { LOGWARNING("%s: requesting a non-existent line %d", __FUNCTION__, a_Index); return ""; } + return m_Line[a_Index]; } |