mirror of
https://github.com/vcmi/vcmi.git
synced 2025-02-03 13:01:33 +02:00
Work with full file paths instead of partial ones.
This commit is contained in:
parent
1392df17dc
commit
668b203486
@ -428,7 +428,7 @@ void SelectionTab::getFiles(std::vector<FileInfo> &out, const std::string &dirna
|
||||
{
|
||||
out.resize(out.size()+1);
|
||||
out.back().date = fs::last_write_time(file->path());
|
||||
out.back().name = dirname+"/"+(file->path().leaf());
|
||||
out.back().name = file->path().string();
|
||||
}
|
||||
}
|
||||
|
||||
@ -549,7 +549,7 @@ SelectionTab::SelectionTab(EState Type, const boost::function<void(CMapInfo *)>
|
||||
switch(type)
|
||||
{
|
||||
case newGame:
|
||||
selectFName(DATA_DIR "Maps/Arrogance.h3m");
|
||||
selectFName(DATA_DIR "/Maps/Arrogance.h3m");
|
||||
break;
|
||||
case loadGame:
|
||||
select(0);
|
||||
@ -615,9 +615,6 @@ void SelectionTab::select( int position )
|
||||
else if(position >= positions)
|
||||
slider->moveTo(slider->value + position - positions + 1);
|
||||
|
||||
if(txt)
|
||||
txt->setText(curItems[py]->filename.substr(6,curItems[py]->filename.size()-12));
|
||||
|
||||
onSelect(curItems[py]);
|
||||
}
|
||||
|
||||
@ -708,17 +705,12 @@ void SelectionTab::printMaps(SDL_Surface *to)
|
||||
}
|
||||
blitAt(format->ourImages[temp].bitmap, POS(88, 117), to);
|
||||
|
||||
if (type == newGame)
|
||||
{
|
||||
if (!(curMap->name.length()))
|
||||
if (type == newGame) {
|
||||
if (!curMap->name.length())
|
||||
curMap->name = "Unnamed";
|
||||
CSDL_Ext::printAtMiddle(curMap->name, POS(213, 128), FONT_SMALL, nasz, to);
|
||||
}
|
||||
else
|
||||
{
|
||||
std::string &name = curMap->filename;
|
||||
CSDL_Ext::printAtMiddle(name.substr(6,name.size()-12), POS(213, 128), FONT_SMALL, nasz, to);
|
||||
}
|
||||
} else
|
||||
CSDL_Ext::printAtMiddle(fs::basename(curMap->filename), POS(213, 128), FONT_SMALL, nasz, to);
|
||||
|
||||
if (curMap->victoryCondition.condition == winStandard)
|
||||
temp = 11;
|
||||
|
@ -60,7 +60,7 @@ public:
|
||||
|
||||
struct FileInfo
|
||||
{
|
||||
std::string name;
|
||||
std::string name; // file name with full path and extension
|
||||
std::time_t date;
|
||||
};
|
||||
|
||||
|
@ -541,7 +541,7 @@ void YourTurn::applyCl( CClient *cl )
|
||||
|
||||
void SaveGame::applyCl(CClient *cl)
|
||||
{
|
||||
CSaveFile save("Games/" + fname + ".vcgm1");
|
||||
CSaveFile save(DATA_DIR "/Games/" + fname + ".vcgm1");
|
||||
save << *cl;
|
||||
}
|
||||
|
||||
|
@ -204,7 +204,7 @@ void CConnection::setGS( CGameState *state )
|
||||
}
|
||||
|
||||
CSaveFile::CSaveFile( const std::string &fname )
|
||||
:sfile(new std::ofstream((USER_DIR "/" + fname).c_str(),std::ios::binary))
|
||||
:sfile(new std::ofstream(fname.c_str(),std::ios::binary))
|
||||
{
|
||||
registerTypes(*this);
|
||||
if(!(*sfile))
|
||||
|
@ -1848,14 +1848,14 @@ void CGameHandler::save( const std::string &fname )
|
||||
|
||||
{
|
||||
tlog0 << "Serializing game info...\n";
|
||||
CSaveFile save(std::string("Games/") + fname + ".vlgm1");
|
||||
CSaveFile save(std::string(DATA_DIR "/Games/") + fname + ".vlgm1");
|
||||
char hlp[8] = "VCMISVG";
|
||||
save << hlp << static_cast<CMapHeader&>(*gs->map) << gs->scenarioOps->difficulty << *VLC << gs;
|
||||
}
|
||||
|
||||
{
|
||||
tlog0 << "Serializing server info...\n";
|
||||
CSaveFile save(std::string("Games/") + fname + ".vsgm1");
|
||||
CSaveFile save(std::string(DATA_DIR "/Games/") + fname + ".vsgm1");
|
||||
save << *this;
|
||||
}
|
||||
tlog0 << "Game has been succesfully saved!\n";
|
||||
|
Loading…
x
Reference in New Issue
Block a user