athena/src/Athena/ALTTPFile.cpp

60 lines
1.6 KiB
C++

#ifndef ATHENA_NO_SAVES
// This file is part of libAthena.
//
// libAthena is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// libAthena is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with libAthena. If not, see <http://www.gnu.org/licenses/>
#include "Athena/ALTTPFile.hpp"
#include "Athena/ALTTPQuest.hpp"
#include "Athena/InvalidOperationException.hpp"
namespace Athena
{
ALTTPFile::ALTTPFile()
{}
ALTTPFile::ALTTPFile(std::vector<ALTTPQuest*> quests, std::vector<ALTTPQuest*> backup)
: m_quests(quests)
, m_backup(backup)
{
}
void ALTTPFile::setQuest(atUint32 id, ALTTPQuest* val)
{
if (id > m_quests.size())
THROW_INVALID_OPERATION_EXCEPTION("index out of range");
m_quests[id] = val;
}
std::vector<ALTTPQuest*> ALTTPFile::questList() const
{
return m_quests;
}
ALTTPQuest* ALTTPFile::quest(atUint32 id) const
{
if (id > m_quests.size())
THROW_INVALID_OPERATION_EXCEPTION_RETURN(nullptr, "index out of range");
return m_quests[id];
}
atUint32 ALTTPFile::questCount() const
{
return (atUint32)m_quests.size();
}
} // zelda
#endif // ATHENA_NO_SAVES