refactor: Move PthFile and DlgFile into game namespace

This commit is contained in:
Vsevolod Kremianskii 2020-11-10 14:49:01 +07:00
parent 743d0ebfd5
commit ac0ad1b026
20 changed files with 122 additions and 120 deletions

View file

@ -90,14 +90,12 @@ set(RESOURCE_HEADERS
src/resource/2dafile.h
src/resource/biffile.h
src/resource/binfile.h
src/resource/dlgfile.h
src/resource/erffile.h
src/resource/folder.h
src/resource/gfffile.h
src/resource/keyfile.h
src/resource/lytfile.h
src/resource/pefile.h
src/resource/pthfile.h
src/resource/resources.h
src/resource/rimfile.h
src/resource/tlkfile.h
@ -109,14 +107,12 @@ set(RESOURCE_SOURCES
src/resource/2dafile.cpp
src/resource/biffile.cpp
src/resource/binfile.cpp
src/resource/dlgfile.cpp
src/resource/erffile.cpp
src/resource/folder.cpp
src/resource/gfffile.cpp
src/resource/keyfile.cpp
src/resource/lytfile.cpp
src/resource/pefile.cpp
src/resource/pthfile.cpp
src/resource/rimfile.cpp
src/resource/resources.cpp
src/resource/tlkfile.cpp
@ -366,6 +362,7 @@ set(GAME_HEADERS
src/game/collisiondetect.h
src/game/console.h
src/game/cursors.h
src/game/dialog.h
src/game/game.h
src/game/gui/chargen/chargen.h
src/game/gui/chargen/classselect.h
@ -407,13 +404,14 @@ set(GAME_HEADERS
src/game/object/waypoint.h
src/game/objectselect.h
src/game/party.h
src/game/path.h
src/game/pathfinder.h
src/game/player.h
src/game/portraits.h
src/game/room.h
src/game/rp/classes.h
src/game/rp/types.h
src/game/savfile.h
src/game/savedgame.h
src/game/script/routines.h
src/game/script/util.h
src/game/types.h)
@ -445,6 +443,7 @@ set(GAME_SOURCES
src/game/collisiondetect.cpp
src/game/console.cpp
src/game/cursors.cpp
src/game/dialog.cpp
src/game/game.cpp
src/game/gui/chargen/chargen.cpp
src/game/gui/chargen/classselect.cpp
@ -485,12 +484,13 @@ set(GAME_SOURCES
src/game/object/waypoint.cpp
src/game/objectselect.cpp
src/game/party.cpp
src/game/path.cpp
src/game/pathfinder.cpp
src/game/player.cpp
src/game/portraits.cpp
src/game/room.cpp
src/game/rp/classes.cpp
src/game/savfile.cpp
src/game/savedgame.cpp
src/game/script/routines.cpp
src/game/script/routines_common.cpp
src/game/script/routines_kotor.cpp

View file

@ -15,26 +15,28 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include "dlgfile.h"
#include "dialog.h"
#include <boost/algorithm/string.hpp>
#include "resources.h"
#include "../resource/resources.h"
using namespace std;
using namespace reone::resource;
namespace reone {
namespace resource {
namespace game {
void DlgFile::reset() {
void Dialog::reset() {
_entries.clear();
_replies.clear();
_startEntries.clear();
_endScript.clear();
}
void DlgFile::load(const string &resRef, const GffStruct &dlg) {
void Dialog::load(const string &resRef, const GffStruct &dlg) {
_skippable = dlg.getInt("Skippable") != 0;
_cameraModel = dlg.getString("CameraModel");
_endScript = dlg.getString("EndConversation");
@ -50,7 +52,7 @@ void DlgFile::load(const string &resRef, const GffStruct &dlg) {
}
}
DlgFile::EntryReplyLink DlgFile::getEntryReplyLink(const GffStruct &gffs) const {
Dialog::EntryReplyLink Dialog::getEntryReplyLink(const GffStruct &gffs) const {
EntryReplyLink link;
link.index = gffs.getInt("Index");
link.active = gffs.getString("Active");
@ -58,7 +60,7 @@ DlgFile::EntryReplyLink DlgFile::getEntryReplyLink(const GffStruct &gffs) const
return move(link);
}
DlgFile::EntryReply DlgFile::getEntryReply(const GffStruct &gffs) const {
Dialog::EntryReply Dialog::getEntryReply(const GffStruct &gffs) const {
int strRef = gffs.getInt("Text");
EntryReply entry;
@ -93,27 +95,27 @@ DlgFile::EntryReply DlgFile::getEntryReply(const GffStruct &gffs) const {
return move(entry);
}
bool DlgFile::isSkippable() const {
bool Dialog::isSkippable() const {
return _skippable;
}
const string &DlgFile::cameraModel() const {
const string &Dialog::cameraModel() const {
return _cameraModel;
}
const vector<DlgFile::EntryReplyLink> &DlgFile::startEntries() const {
const vector<Dialog::EntryReplyLink> &Dialog::startEntries() const {
return _startEntries;
}
const DlgFile::EntryReply &DlgFile::getEntry(int index) const {
const Dialog::EntryReply &Dialog::getEntry(int index) const {
return _entries[index];
}
const DlgFile::EntryReply &DlgFile::getReply(int index) const {
const Dialog::EntryReply &Dialog::getReply(int index) const {
return _replies[index];
}
const string &DlgFile::endScript() const {
const string &Dialog::endScript() const {
return _endScript;
}

View file

@ -20,17 +20,17 @@
#include <string>
#include <vector>
#include "gfffile.h"
#include "../resource/gfffile.h"
namespace reone {
namespace resource {
namespace game {
enum DialogWaitFlags {
kDialogWaitAnimFinish = 1
};
class DlgFile {
class Dialog {
public:
struct EntryReplyLink {
int index { 0 };
@ -53,10 +53,10 @@ public:
std::vector<EntryReplyLink> entries;
};
DlgFile() = default;
Dialog() = default;
void reset();
void load(const std::string &resRef, const GffStruct &dlg);
void load(const std::string &resRef, const resource::GffStruct &dlg);
bool isSkippable() const;
const std::string &cameraModel() const;
@ -74,13 +74,13 @@ private:
std::string _endScript;
int _entryIndex { -1 };
DlgFile(const DlgFile &) = delete;
DlgFile &operator=(const DlgFile &) = delete;
Dialog(const Dialog &) = delete;
Dialog &operator=(const Dialog &) = delete;
EntryReplyLink getEntryReplyLink(const GffStruct &gffs) const;
EntryReply getEntryReply(const GffStruct &gffs) const;
EntryReplyLink getEntryReplyLink(const resource::GffStruct &gffs) const;
EntryReply getEntryReply(const resource::GffStruct &gffs) const;
};
} // namespace resource
} // namespace game
} // namespace reone

View file

@ -317,7 +317,7 @@ void Game::loadHUD() {
}
void Game::loadDialog() {
_dialog.reset(new Dialog(this));
_dialog.reset(new DialogGUI(this));
_dialog->load();
}

View file

@ -178,7 +178,7 @@ private:
std::unique_ptr<CharacterGeneration> _charGen;
std::unique_ptr<HUD> _hud;
std::unique_ptr<InGameMenu> _inGame;
std::unique_ptr<Dialog> _dialog;
std::unique_ptr<DialogGUI> _dialog;
std::unique_ptr<Container> _container;
std::unique_ptr<PartySelection> _partySelect;
std::unique_ptr<SaveLoad> _saveLoad;

View file

@ -23,11 +23,11 @@
#include "../../audio/files.h"
#include "../../audio/player.h"
#include "../../common/random.h"
#include "../../gui/control/listbox.h"
#include "../../gui/control/panel.h"
#include "../../resource/resources.h"
#include "../../script/execution.h"
#include "../../common/random.h"
#include "../game.h"
#include "../script/routines.h"
@ -54,7 +54,7 @@ enum EndEntryFlags {
kEndEntryOnAudioStop = 2
};
Dialog::Dialog(Game *game) :
DialogGUI::DialogGUI(Game *game) :
GUI(game->version(), game->options().graphics),
_game(game) {
@ -65,7 +65,7 @@ Dialog::Dialog(Game *game) :
_scaling = ScalingMode::Stretch;
}
void Dialog::load() {
void DialogGUI::load() {
GUI::load();
configureMessage();
@ -74,11 +74,11 @@ void Dialog::load() {
loadBottomFrame();
}
void Dialog::loadTopFrame() {
void DialogGUI::loadTopFrame() {
addFrame(-_rootControl->extent().top, getControl("LBL_MESSAGE").extent().height);
}
void Dialog::addFrame(int top, int height) {
void DialogGUI::addFrame(int top, int height) {
unique_ptr<Panel> frame(new Panel(this));
Control::Extent extent;
@ -93,14 +93,14 @@ void Dialog::addFrame(int top, int height) {
_controls.insert(_controls.begin(), move(frame));
}
void Dialog::loadBottomFrame() {
void DialogGUI::loadBottomFrame() {
int rootTop = _rootControl->extent().top;
int height = _gfxOpts.height - rootTop;
addFrame(_gfxOpts.height - rootTop - height, height);
}
void Dialog::configureMessage() {
void DialogGUI::configureMessage() {
Control &message = getControl("LBL_MESSAGE");
Control::Extent extent(message.extent());
@ -110,7 +110,7 @@ void Dialog::configureMessage() {
message.setTextColor(getBaseColor(_version));
}
void Dialog::configureReplies() {
void DialogGUI::configureReplies() {
ListBox &replies = static_cast<ListBox &>(getControl("LB_REPLIES"));
Control &protoItem = replies.protoItem();
@ -118,18 +118,18 @@ void Dialog::configureReplies() {
protoItem.setTextColor(getBaseColor(_version));
}
void Dialog::onReplyClicked(int index) {
void DialogGUI::onReplyClicked(int index) {
pickReply(index);
}
void Dialog::onListBoxItemClick(const string &control, const string &item) {
void DialogGUI::onListBoxItemClick(const string &control, const string &item) {
if (control != "LB_REPLIES") return;
int replyIdx = stoi(item);
onReplyClicked(replyIdx);
}
void Dialog::startDialog(SpatialObject &owner, const string &resRef) {
void DialogGUI::startDialog(SpatialObject &owner, const string &resRef) {
shared_ptr<GffStruct> dlg(Resources::instance().getGFF(resRef, ResourceType::Conversation));
if (!dlg) {
_game->openInGame();
@ -138,14 +138,14 @@ void Dialog::startDialog(SpatialObject &owner, const string &resRef) {
_owner = &owner;
_currentSpeaker = _owner;
_dialog.reset(new DlgFile());
_dialog.reset(new Dialog());
_dialog->load(resRef, *dlg);
loadAnimatedCamera();
loadStartEntry();
}
void Dialog::loadAnimatedCamera() {
void DialogGUI::loadAnimatedCamera() {
string modelResRef(_dialog->cameraModel());
if (modelResRef.empty()) return;
@ -153,7 +153,7 @@ void Dialog::loadAnimatedCamera() {
camera.setModel(modelResRef);
}
void Dialog::loadStartEntry() {
void DialogGUI::loadStartEntry() {
int entryIdx = -1;
for (auto &link : _dialog->startEntries()) {
if (link.active.empty()) {
@ -169,16 +169,16 @@ void Dialog::loadStartEntry() {
_game->openInGame();
return;
}
_currentEntry.reset(new DlgFile::EntryReply(_dialog->getEntry(entryIdx)));
_currentEntry.reset(new Dialog::EntryReply(_dialog->getEntry(entryIdx)));
loadCurrentEntry();
}
bool Dialog::checkCondition(const string &script) {
bool DialogGUI::checkCondition(const string &script) {
int result = runScript(script, _owner->id(), kObjectInvalid, -1);
return result == -1 || result == 1;
}
void Dialog::loadCurrentEntry() {
void DialogGUI::loadCurrentEntry() {
if (!_currentEntry->script.empty()) {
runScript(_currentEntry->script, _owner->id(), kObjectInvalid, -1);
}
@ -192,7 +192,7 @@ void Dialog::loadCurrentEntry() {
updateCamera();
}
void Dialog::loadReplies() {
void DialogGUI::loadReplies() {
ListBox &replies = static_cast<ListBox &>(getControl("LB_REPLIES"));
replies.clear();
@ -206,7 +206,7 @@ void Dialog::loadReplies() {
bool singleEmptyReply = false;
int replyNumber = 0;
for (auto &replyIdx : activeReplies) {
const DlgFile::EntryReply &reply = _dialog->getReply(replyIdx);
const Dialog::EntryReply &reply = _dialog->getReply(replyIdx);
string text(reply.text);
if (text.empty()) {
if (activeReplies.size() == 1) {
@ -229,7 +229,7 @@ void Dialog::loadReplies() {
}
}
void Dialog::finish() {
void DialogGUI::finish() {
if (!_dialog->endScript().empty()) {
runScript(_dialog->endScript(), _owner->id(), kObjectInvalid, -1);
}
@ -239,7 +239,7 @@ void Dialog::finish() {
_game->openInGame();
}
void Dialog::loadCurrentSpeaker() {
void DialogGUI::loadCurrentSpeaker() {
shared_ptr<Area> area(_game->module()->area());
SpatialObject *speaker = nullptr;
@ -265,7 +265,7 @@ void Dialog::loadCurrentSpeaker() {
speakerCreature.face(*partyLeader);
}
void Dialog::updateCamera() {
void DialogGUI::updateCamera() {
shared_ptr<Area> area(_game->module()->area());
shared_ptr<Creature> partyLeader(_game->party().leader());
glm::vec3 listenerPosition;
@ -294,7 +294,7 @@ void Dialog::updateCamera() {
}
}
DialogCamera::Variant Dialog::getRandomCameraVariant() const {
DialogCamera::Variant DialogGUI::getRandomCameraVariant() const {
int r = random(0, 2);
switch (r) {
case 0:
@ -306,7 +306,7 @@ DialogCamera::Variant Dialog::getRandomCameraVariant() const {
}
}
void Dialog::playVoiceOver() {
void DialogGUI::playVoiceOver() {
if (_currentVoice) {
_currentVoice->stop();
_currentVoice.reset();
@ -324,7 +324,7 @@ void Dialog::playVoiceOver() {
}
}
void Dialog::scheduleEndOfEntry() {
void DialogGUI::scheduleEndOfEntry() {
_entryEnded = false;
_endEntryFlags = 0;
@ -346,8 +346,8 @@ void Dialog::scheduleEndOfEntry() {
_endEntryTimestamp = now + kDefaultEntryDuration;
}
void Dialog::pickReply(uint32_t index) {
const DlgFile::EntryReply &reply = _dialog->getReply(index);
void DialogGUI::pickReply(uint32_t index) {
const Dialog::EntryReply &reply = _dialog->getReply(index);
if (!reply.script.empty()) {
runScript(reply.script, _owner->id(), kObjectInvalid, -1);
@ -370,12 +370,12 @@ void Dialog::pickReply(uint32_t index) {
}
if (entryIdx != -1) {
_currentEntry.reset(new DlgFile::EntryReply(_dialog->getEntry(entryIdx)));
_currentEntry.reset(new Dialog::EntryReply(_dialog->getEntry(entryIdx)));
loadCurrentEntry();
}
}
bool Dialog::handle(const SDL_Event &event) {
bool DialogGUI::handle(const SDL_Event &event) {
if (!_entryEnded &&
_dialog->isSkippable() &&
event.type == SDL_MOUSEBUTTONUP &&
@ -388,7 +388,7 @@ bool Dialog::handle(const SDL_Event &event) {
return GUI::handle(event);
}
void Dialog::endCurrentEntry() {
void DialogGUI::endCurrentEntry() {
_entryEnded = true;
if (_currentVoice) {
@ -404,11 +404,11 @@ void Dialog::endCurrentEntry() {
}
}
bool Dialog::handleKeyDown(SDL_Scancode key) {
bool DialogGUI::handleKeyDown(SDL_Scancode key) {
return false;
}
bool Dialog::handleKeyUp(SDL_Scancode key) {
bool DialogGUI::handleKeyUp(SDL_Scancode key) {
if (!_entryEnded) return false;
if (key >= SDL_SCANCODE_1 && key <= SDL_SCANCODE_9) {
@ -424,7 +424,7 @@ bool Dialog::handleKeyUp(SDL_Scancode key) {
return false;
}
void Dialog::update(float dt) {
void DialogGUI::update(float dt) {
GUI::update(dt);
if (!_entryEnded) {
@ -450,7 +450,7 @@ void Dialog::update(float dt) {
}
}
Camera &Dialog::camera() const {
Camera &DialogGUI::camera() const {
string cameraModel(_dialog->cameraModel());
shared_ptr<Area> area(_game->module()->area());

View file

@ -19,10 +19,10 @@
#include "../../audio/soundinstance.h"
#include "../../gui/gui.h"
#include "../../resource/dlgfile.h"
#include "../../resource/types.h"
#include "../camera/dialogcamera.h"
#include "../dialog.h"
#include "../object/spatial.h"
namespace reone {
@ -31,9 +31,9 @@ namespace game {
class Game;
class Dialog : public gui::GUI {
class DialogGUI : public gui::GUI {
public:
Dialog(Game *game);
DialogGUI(Game *game);
void load() override;
void startDialog(SpatialObject &owner, const std::string &resRef);
@ -47,8 +47,8 @@ public:
private:
Game *_game { nullptr };
SpatialObject *_owner { nullptr };
std::shared_ptr<resource::DlgFile> _dialog;
std::shared_ptr<resource::DlgFile::EntryReply> _currentEntry;
std::shared_ptr<Dialog> _dialog;
std::shared_ptr<Dialog::EntryReply> _currentEntry;
std::shared_ptr<audio::SoundInstance> _currentVoice;
SpatialObject *_currentSpeaker { nullptr };
int _autoPickReplyIdx { -1 };

View file

@ -19,12 +19,12 @@
#include <boost/filesystem.hpp>
#include "../../common/log.h"
#include "../../gui/control/listbox.h"
#include "../../resource/resources.h"
#include "../../common/log.h"
#include "../game.h"
#include "../savfile.h"
#include "../savedgame.h"
#include "colors.h"
@ -133,10 +133,10 @@ void SaveLoad::indexSavedGame(int index, const fs::path &path) {
warn("SaveLoad: SAV file not found");
return;
}
SavFile sav(savPath);
SavedGame sav(savPath);
sav.peek();
SavedGame save;
GameDescriptor save;
save.index = index;
save.path = savPath;
save.name = sav.name();
@ -216,7 +216,7 @@ void SaveLoad::saveGame(int index) {
fs::path savPath(saveDirPath);
savPath.append(kSaveFilename);
SavFile sav(savPath);
SavedGame sav(savPath);
sav.save(_game, getSaveName(index));
}
@ -231,15 +231,15 @@ string SaveLoad::getSaveName(int index) const {
}
void SaveLoad::loadGame(int index) {
auto maybeSave = find_if(_saves.begin(), _saves.end(), [&index](const SavedGame &save) { return save.index == index; });
auto maybeSave = find_if(_saves.begin(), _saves.end(), [&index](const GameDescriptor &save) { return save.index == index; });
if (maybeSave == _saves.end()) return;
SavFile sav(maybeSave->path);
SavedGame sav(maybeSave->path);
sav.load(_game);
}
void SaveLoad::deleteGame(int index) {
auto maybeSave = find_if(_saves.begin(), _saves.end(), [&index](const SavedGame &save) { return save.index == index; });
auto maybeSave = find_if(_saves.begin(), _saves.end(), [&index](const GameDescriptor &save) { return save.index == index; });
if (maybeSave == _saves.end()) return;
fs::path saveDirPath(getSaveDirPath(index));

View file

@ -44,7 +44,7 @@ public:
void setMode(Mode mode);
private:
struct SavedGame {
struct GameDescriptor {
int index { 0 };
std::string name;
boost::filesystem::path path;
@ -52,7 +52,7 @@ private:
Game *_game { nullptr };
Mode _mode { Mode::Save };
std::vector<SavedGame> _saves;
std::vector<GameDescriptor> _saves;
int _selectedSaveIdx { -1 };
void onClick(const std::string &control) override;

View file

@ -114,14 +114,14 @@ void Area::loadVIS() {
void Area::loadPTH() {
shared_ptr<GffStruct> pth(Resources::instance().getGFF(_name, ResourceType::Path));
PthFile path;
Path path;
path.load(*pth);
const vector<PthFile::Point> &points = path.points();
const vector<Path::Point> &points = path.points();
unordered_map<int, float> pointZ;
for (int i = 0; i < points.size(); ++i) {
const PthFile::Point &point = points[i];
const Path::Point &point = points[i];
Room *room = nullptr;
float z = 0.0f;

View file

@ -15,15 +15,17 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include "pthfile.h"
#include "path.h"
using namespace std;
using namespace reone::resource;
namespace reone {
namespace resource {
namespace game {
void PthFile::load(const GffStruct &pth) {
void Path::load(const GffStruct &pth) {
vector<int> connections;
for (auto &connection : pth.getList("Path_Conections")) {
@ -50,7 +52,7 @@ void PthFile::load(const GffStruct &pth) {
}
}
const vector<PthFile::Point> &PthFile::points() const {
const vector<Path::Point> &Path::points() const {
return _points;
}

View file

@ -21,13 +21,13 @@
#include <glm/vec2.hpp>
#include "gfffile.h"
#include "../resource/gfffile.h"
namespace reone {
namespace resource {
namespace game {
class PthFile {
class Path {
public:
struct Point {
float x { 0.0f };
@ -35,19 +35,19 @@ public:
std::vector<int> adjPoints;
};
PthFile() = default;
Path() = default;
void load(const GffStruct &pth);
void load(const resource::GffStruct &pth);
const std::vector<Point> &points() const;
private:
std::vector<Point> _points;
PthFile(const PthFile &) = delete;
PthFile &operator=(const PthFile &) = delete;
Path(const Path &) = delete;
Path &operator=(const Path &) = delete;
};
} // namespace resource
} // namespace game
} // namespace reone

View file

@ -30,15 +30,15 @@ namespace game {
Pathfinder::Edge::Edge(uint16_t toIndex, float length) : toIndex(toIndex), length(length) {
}
void Pathfinder::load(const vector<PthFile::Point> &points, const unordered_map<int, float> &pointZ) {
void Pathfinder::load(const vector<Path::Point> &points, const unordered_map<int, float> &pointZ) {
for (uint16_t i = 0; i < points.size(); ++i) {
const PthFile::Point &point = points[i];
const Path::Point &point = points[i];
glm::vec3 pointVec(point.x, point.y, pointZ.find(i)->second);
_vertices.push_back(pointVec);
glm::vec3 adjPointVec;
for (auto &adjPointIdx : point.adjPoints) {
const PthFile::Point &adjPoint = points[adjPointIdx];
const Path::Point &adjPoint = points[adjPointIdx];
adjPointVec = glm::vec3(adjPoint.x, adjPoint.y, pointZ.find(adjPointIdx)->second);
float distance = glm::distance2(pointVec, adjPointVec);

View file

@ -26,7 +26,7 @@
#include "glm/vec3.hpp"
#include "../resource/pthfile.h"
#include "path.h"
namespace reone {
@ -36,7 +36,7 @@ class Pathfinder {
public:
Pathfinder() = default;
void load(const std::vector<resource::PthFile::Point> &points, const std::unordered_map<int, float> &pointZ);
void load(const std::vector<Path::Point> &points, const std::unordered_map<int, float> &pointZ);
const std::vector<glm::vec3> findPath(const glm::vec3 &from, const glm::vec3 &to) const;

View file

@ -15,7 +15,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include "savfile.h"
#include "savedgame.h"
#include <chrono>
#include <memory>
@ -37,10 +37,10 @@ namespace game {
static const char kSignature[] = "SAV";
SavFile::SavFile(const fs::path &path) : _path(path) {
SavedGame::SavedGame(const fs::path &path) : _path(path) {
}
void SavFile::save(const Game *game, const string &name) {
void SavedGame::save(const Game *game, const string &name) {
shared_ptr<ofstream> stream(new fs::ofstream(_path, ios::binary));
StreamWriter writer(stream);
@ -50,7 +50,7 @@ void SavFile::save(const Game *game, const string &name) {
writer.putCString(game->module()->name());
}
void SavFile::peek() {
void SavedGame::peek() {
shared_ptr<ifstream> stream(new fs::ifstream(_path, ios::binary));
StreamReader reader(stream);
@ -63,7 +63,7 @@ void SavFile::peek() {
_name = reader.getCString();
}
void SavFile::load(Game *game) {
void SavedGame::load(Game *game) {
shared_ptr<ifstream> stream(new fs::ifstream(_path, ios::binary));
StreamReader reader(stream);
@ -80,7 +80,7 @@ void SavFile::load(Game *game) {
game->scheduleModuleTransition(moduleName, "");
}
const string &SavFile::name() const {
const string &SavedGame::name() const {
return _name;
}

View file

@ -27,9 +27,9 @@ namespace game {
class Game;
class SavFile {
class SavedGame {
public:
SavFile(const boost::filesystem::path &path);
SavedGame(const boost::filesystem::path &path);
void save(const Game *game, const std::string &name);
void peek();
@ -42,8 +42,8 @@ private:
uint64_t _timestamp { 0 };
std::string _name;
SavFile(const SavFile &) = delete;
SavFile &operator=(const SavFile &) = delete;
SavedGame(const SavedGame &) = delete;
SavedGame &operator=(const SavedGame &) = delete;
};
} // namespace game

View file

@ -24,14 +24,10 @@
namespace reone {
namespace resource {
namespace render {
class MdlFile;
}
namespace render {
/**
* Polygonal mesh, containing vertex and index data. Renders itself,
* but does not manage textures and shaders.
@ -76,7 +72,7 @@ private:
Mesh(const Mesh &) = delete;
Mesh &operator=(const Mesh &) = delete;
friend class resource::MdlFile;
friend class MdlFile;
};
} // namespace render

View file

@ -25,6 +25,8 @@ namespace reone {
namespace render {
class MdlFile;
class Animation {
public:
Animation(const std::string &name, float length, float transitionTime, const std::shared_ptr<ModelNode> &rootNode);
@ -46,7 +48,7 @@ private:
Animation(const Animation &) = delete;
Animation &operator=(const Animation &) = delete;
friend class resource::MdlFile;
friend class MdlFile;
};
} // namespace render

View file

@ -73,7 +73,7 @@ private:
void init(const std::shared_ptr<ModelNode> &node);
friend class resource::MdlFile;
friend class MdlFile;
};
} // namespace render

View file

@ -23,8 +23,8 @@
#include <boost/test/included/unit_test.hpp>
#include "../src/game/path.h"
#include "../src/game/pathfinder.h"
#include "../src/resource/pthfile.h"
using namespace std;
@ -32,7 +32,7 @@ using namespace reone::game;
using namespace reone::resource;
BOOST_AUTO_TEST_CASE(test_find_path) {
vector<PthFile::Point> points = {
vector<Path::Point> points = {
{ 1.0f, 1.0f, { 1, 2 } },
{ 1.0f, 2.0f, { 0, 2 } },
{ 2.0f, 2.0f, { 1, 3, 4 } },