/*
This file is part of Universal Modding Engine.
Universal Modding Engine is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Universal Modding Engine is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Universal Modding Engine. If not, see .
*/
#include "uMod_Main.h"
uMod_GameInfo::uMod_GameInfo(void)
{
Checked = NULL;
NumberOfChecked = 0;
LengthOfChecked = 0;
Init();
}
uMod_GameInfo::~uMod_GameInfo(void)
{
if (Checked!=NULL) delete [] Checked;
}
void uMod_GameInfo::Init(void)
{
SaveSingleTexture = false;
SaveAllTextures = false;
KeyBack = -1;
KeySave = -1;
KeyNext = -1;
FontColour[0]=255;FontColour[1]=0;FontColour[2]=0;
TextureColour[0]=0;TextureColour[1]=255;TextureColour[2]=0;
NumberOfChecked = 0;
SavePath.Empty();
OpenPath.Empty();
Files.Empty();
}
int uMod_GameInfo::SaveToFile( const wxString &file_name)
{
wxFile file;
//if (!file.Access(name, wxFile::write)) return -1;
file.Open(file_name, wxFile::write);
if (!file.IsOpened()) {return -1;}
wxString content;
if (SavePath.Len()>0)
{
content.Printf( L"SavePath:%ls\n", SavePath.wc_str());
file.Write( content.char_str(), content.Len());
}
if (OpenPath.Len()>0)
{
content.Printf( L"OpenPath:%ls\n", OpenPath.wc_str());
file.Write( content.char_str(), content.Len());
}
content.Printf( L"SaveAllTextures:%d\nSaveSingleTexture:%d\n", SaveAllTextures, SaveSingleTexture);
file.Write( content.char_str(), content.Len());
if (KeyBack>=0)
{
content.Printf( L"KeyBack:%d\n", KeyBack);
file.Write( content.char_str(), content.Len());
}
if (KeySave>=0)
{
content.Printf( L"KeySave:%d\n", KeySave);
file.Write( content.char_str(), content.Len());
}
if (KeyNext>=0)
{
content.Printf( L"KeyNext:%d\n", KeyNext);
file.Write( content.char_str(), content.Len());
}
content.Printf( L"FontColour:%d,%d,%d\n", FontColour[0], FontColour[1], FontColour[2]);
file.Write( content.char_str(), content.Len());
content.Printf( L"TextureColour:%d,%d,%d\n", TextureColour[0], TextureColour[1], TextureColour[2]);
file.Write( content.char_str(), content.Len());
int num = Files.GetCount();
for (int i=0; i=LengthOfChecked)
{
bool *t_bool;
try {t_bool = new bool [LengthOfChecked+100];}
catch (...) {return -1;}
for (int i=0; iLengthOfChecked)
{
if (Checked!=NULL) delete [] Checked;
try {Checked = new bool [num+100];}
catch (...) {Checked=NULL; LengthOfChecked = 0; return -1;}
LengthOfChecked = num+100;
}
for (int i=0; i