Primary tabs

Comments by User

Tuesday, March 12, 2013 - 02:15

I am debuging it with vs2008, and have same issue. Take a look of function void loadMiscSettings() at settings.cpp.

It seems like the std::ifstream is buffed(class FileParser's member). So if use FileParser to open more than once file at same function. The second call will failed at infile.next().

My temporary solution is defin a FileParser instance for every settings files. Like:

FileParser infile;
    // load miscellaneous settings from engine config
    // misc.txt
    if (infile.open(mods->locate("engine/misc.txt").c_str())) {
        while (infile.next()) {

.....

// resolutions.txt
    FileParser infile1;
    if (infile1.open(mods->locate("engine/resolutions.txt").c_str())) {
        while (infile1.next()) {

// gameplay.txt
    FileParser infile2;
    if (infile2.open(mods->locate("engine/gameplay.txt").c_str())) {
        while (infile2.next()) {

This issue be solved and the game could be playing. But I got the crash when created a character. at __thiscall _Lockit::~_Lockit() of the file "xlock.cpp". Any suggestions?

 

Monday, March 11, 2013 - 23:27

Hi manwesulimo2004,

Thanks for your guide. I got it work with the version 0.13 like your guide. But can not work with 0.17.

1) The std::ifstream is buffered in FileParser. If the var infile are used over once in one function, the second infile.next() will return false. So I have to add the instance of FileParser to read the second settings file like FileParser infile1; FileParser infile2;.

After some change, I got the game running. But when I clicked the "create" button to new a character, I got the crash at \Microsoft Visual Studio 9.0\VC\crt\src\xlock.cpp

__thiscall _Lockit::~_Lockit()
    {    // unlock the mutex
    if (_Locktype < MAX_LOCK)
        _Mtxunlock(&mtx[_Locktype]);
    }

Any suggestions? Thanks