MCPcopy Create free account
hub / github.com/TurningWheel/Barony / getLinesFromDataFile

Function getLinesFromDataFile

src/files.cpp:3694–3740  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3692}
3693
3694std::vector<std::string> getLinesFromDataFile(std::string filename)
3695{
3696 std::vector<std::string> lines;
3697#ifdef NINTENDO
3698 std::string filepath(filename);
3699#else
3700 std::string filepath(datadir);
3701 filepath += "/";
3702 filepath += filename;
3703#endif
3704 std::ifstream file(filepath);
3705 if ( !file )
3706 {
3707 std::ifstream file(filename); // check absolute path.
3708 if ( !file)
3709 {
3710 printlog("Error: Failed to open file \"%s\"", filename.c_str());
3711 return lines;
3712 }
3713 else
3714 {
3715 std::string line;
3716 while ( std::getline(file, line) )
3717 {
3718 if ( !line.empty() )
3719 {
3720 lines.push_back(line);
3721 }
3722 }
3723 file.close();
3724 }
3725 }
3726 else
3727 {
3728 std::string line;
3729 while ( std::getline(file, line) )
3730 {
3731 if ( !line.empty() )
3732 {
3733 lines.push_back(line);
3734 }
3735 }
3736 file.close();
3737 }
3738
3739 return lines;
3740}
3741
3742int physfsLoadMapFile(int levelToLoad, Uint32 seed, bool useRandSeed, int* checkMapHash)
3743{

Callers 5

physfsLoadMapFileFunction · 0.85
initGameDatafilesAsyncFunction · 0.85
initGameFunction · 0.85

Calls 4

printlogFunction · 0.85
c_strMethod · 0.80
emptyMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected