(C++) Class for reading Windows-INI-like files
Obviously, I renamed a few things... but this is what broke it:
Code: Select all
CINIFileReader* tSettingsFile = new CINIFileReader("Goalygon.ini",false);
if (!tSettingsFile->load()) return initialize();
SGameInitParameters parameters;
parameters.Title = tSettingsFile->getValue("game","title");
parameters.WindowWidth = tSettingsFile->getValueInt("game","screen-x");
parameters.WindowHeight = tSettingsFile->getValueInt("game","screen-y");
parameters.BitsPerPixel = tSettingsFile->getValueInt("game","bits");
parameters.Fullscreen = tSettingsFile->getValueBool("game","fullscreen");
mKeymap.Up = tSettingsFile->getValueKey("keys","up");
mKeymap.Down = tSettingsFile->getValueKey("keys","down");
mKeymap.Right = tSettingsFile->getValueKey("keys","right");
mKeymap.Left = tSettingsFile->getValueKey("keys","left");
tSettingsFile->drop();
Hm... strange... i got the same error here... it breakes on
hm... i don't know why, but i created a work around.
I've updated the code in my first post, but basicly it just replaces the char array fullfile with an irr::core::string<char>
You have to modify following things:
change the defenition of fullfile to
and replace the 2nd constructor, the destructor, and the save method with my updated ones.
Code: Select all
if(fullfile)
delete [] fullfile;
I've updated the code in my first post, but basicly it just replaces the char array fullfile with an irr::core::string<char>
You have to modify following things:
change the defenition of fullfile to
Code: Select all
core::stringc fullfilename
Software documentation is like sex. If it's good you want more. If it's bad it's better than nothing.
-
Masterhawk
- Posts: 299
- Joined: Mon Nov 27, 2006 6:52 pm
- Location: GERMANY
- Contact:
hey sylence,can you tell me why this piece of code doesn't work as it's suppose to do?
The getValueK-function return not the correct value.
Ini file
Code: Select all
void IUserControls::loadConfigFromINIFile(c8* iniFile)
{
CfgFile* IniRdr = new CfgFile(iniFile,false);
IniRdr->load();
controltable[0] = IniRdr->getValueK("controls","hit");
changeListBoxItem(0,controltable[0]);
controltable[1] = IniRdr->getValueK("controls","incpower");
changeListBoxItem(1,controltable[1]);
controltable[2] = IniRdr->getValueK("controls","decpower");
changeListBoxItem(2,controltable[2]);
IniRdr->drop();
}Ini file
Code: Select all
[controls]
hit=mouse_l
incpower=q
decpower=y-
Masterhawk
- Posts: 299
- Joined: Mon Nov 27, 2006 6:52 pm
- Location: GERMANY
- Contact:
-
Masterhawk
- Posts: 299
- Joined: Mon Nov 27, 2006 6:52 pm
- Location: GERMANY
- Contact:
-
Masterhawk
- Posts: 299
- Joined: Mon Nov 27, 2006 6:52 pm
- Location: GERMANY
- Contact:
Here I am
The return value of getValueK("controls","hit") is 0 as a decimal value....
I didn't change the IrrCon class, so I really don't know what might be the mistake....
EDIT: "getValue();" returns a string which contains one or two (non visible) extra signs at the end. Is this right? For this reason "getKey(stringc str)" returns the wrong value. Is this a bug or did I miss anything important?
The return value of getValueK("controls","hit") is 0 as a decimal value....
I didn't change the IrrCon class, so I really don't know what might be the mistake....
EDIT: "getValue();" returns a string which contains one or two (non visible) extra signs at the end. Is this right? For this reason "getKey(stringc str)" returns the wrong value. Is this a bug or did I miss anything important?
