- bug fixes for load saved game (now fixes loading on windows) and corrects memory bug for loading saved games on all platforms.
This commit is contained in:
parent
6c12bfbec8
commit
c1f617481e
|
@ -448,7 +448,7 @@ MainWindow::MainWindow( std::pair<string,vector<string> > unitToLoad,
|
||||||
std::auto_ptr<wchar_t> wstr(Ansi2WideString(appPath.c_str()));
|
std::auto_ptr<wchar_t> wstr(Ansi2WideString(appPath.c_str()));
|
||||||
|
|
||||||
wstring launchApp = wstring(wstr.get()) + L" \"%1\"";
|
wstring launchApp = wstring(wstr.get()) + L" \"%1\"";
|
||||||
DWORD len = launchApp.length() + 1;
|
DWORD len = (DWORD)launchApp.length() + 1;
|
||||||
RegSetValueEx(keyHandle, NULL, 0, REG_SZ, (PBYTE)launchApp.c_str(), len);
|
RegSetValueEx(keyHandle, NULL, 0, REG_SZ, (PBYTE)launchApp.c_str(), len);
|
||||||
RegCloseKey(keyHandle);
|
RegCloseKey(keyHandle);
|
||||||
|
|
||||||
|
@ -456,7 +456,7 @@ MainWindow::MainWindow( std::pair<string,vector<string> > unitToLoad,
|
||||||
RegCreateKeyEx(HKEY_CURRENT_USER,subKey.c_str(),0, NULL, 0, KEY_ALL_ACCESS, NULL, &keyHandle, &dwDisposition);
|
RegCreateKeyEx(HKEY_CURRENT_USER,subKey.c_str(),0, NULL, 0, KEY_ALL_ACCESS, NULL, &keyHandle, &dwDisposition);
|
||||||
//Set the value.
|
//Set the value.
|
||||||
launchApp = L"megaglest.g3d";
|
launchApp = L"megaglest.g3d";
|
||||||
len = launchApp.length() + 1;
|
len = (DWORD)launchApp.length() + 1;
|
||||||
RegSetValueEx(keyHandle, NULL, 0, REG_SZ, (PBYTE)launchApp.c_str(), len);
|
RegSetValueEx(keyHandle, NULL, 0, REG_SZ, (PBYTE)launchApp.c_str(), len);
|
||||||
RegCloseKey(keyHandle);
|
RegCloseKey(keyHandle);
|
||||||
|
|
||||||
|
|
|
@ -1663,9 +1663,22 @@ void PathFinder::loadGame(const XmlNode *rootNode) {
|
||||||
// Vec2i pos;
|
// Vec2i pos;
|
||||||
curNode->pos = Vec2i::strToVec2(nodePoolNode->getAttribute("pos")->getValue());
|
curNode->pos = Vec2i::strToVec2(nodePoolNode->getAttribute("pos")->getValue());
|
||||||
// Node *next;
|
// Node *next;
|
||||||
curNode->next = &factionState.nodePool[nodePoolNode->getAttribute("next")->getIntValue()];
|
int nextNode = nodePoolNode->getAttribute("next")->getIntValue();
|
||||||
|
if(nextNode >= 0) {
|
||||||
|
curNode->next = &factionState.nodePool[nextNode];
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
curNode->next = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
// Node *prev;
|
// Node *prev;
|
||||||
curNode->prev = &factionState.nodePool[nodePoolNode->getAttribute("prev")->getIntValue()];
|
int prevNode = nodePoolNode->getAttribute("prev")->getIntValue();
|
||||||
|
if(prevNode >= 0) {
|
||||||
|
curNode->prev = &factionState.nodePool[prevNode];
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
curNode->prev = NULL;
|
||||||
|
}
|
||||||
// float heuristic;
|
// float heuristic;
|
||||||
curNode->heuristic = nodePoolNode->getAttribute("heuristic")->getFloatValue();
|
curNode->heuristic = nodePoolNode->getAttribute("heuristic")->getFloatValue();
|
||||||
// bool exploredCell;
|
// bool exploredCell;
|
||||||
|
|
|
@ -260,7 +260,7 @@ void ParticleSystemType::load(const XmlNode *particleSystemNode, const string &d
|
||||||
if(particleSystemNode->hasChild("child-particles")) {
|
if(particleSystemNode->hasChild("child-particles")) {
|
||||||
const XmlNode *childrenNode= particleSystemNode->getChild("child-particles");
|
const XmlNode *childrenNode= particleSystemNode->getChild("child-particles");
|
||||||
if(childrenNode->getAttribute("value")->getBoolValue()) {
|
if(childrenNode->getAttribute("value")->getBoolValue()) {
|
||||||
for(int i = 0; i < childrenNode->getChildCount(); ++i) {
|
for(unsigned int i = 0; i < childrenNode->getChildCount(); ++i) {
|
||||||
const XmlNode *particleFileNode= childrenNode->getChild("particle-file",i);
|
const XmlNode *particleFileNode= childrenNode->getChild("particle-file",i);
|
||||||
string path= particleFileNode->getAttribute("path")->getRestrictedValue();
|
string path= particleFileNode->getAttribute("path")->getRestrictedValue();
|
||||||
UnitParticleSystemType *unitParticleSystemType= new UnitParticleSystemType();
|
UnitParticleSystemType *unitParticleSystemType= new UnitParticleSystemType();
|
||||||
|
|
|
@ -101,7 +101,7 @@ void UnitParticleSystemType::load(const XmlNode *particleSystemNode, const strin
|
||||||
minRadius = 0;
|
minRadius = 0;
|
||||||
}
|
}
|
||||||
if((minRadius == 0) && (shape == UnitParticleSystem::sConical)) {
|
if((minRadius == 0) && (shape == UnitParticleSystem::sConical)) {
|
||||||
minRadius = 0.001; // fudge it so we aren't generating particles that are exactly centred
|
minRadius = 0.001f; // fudge it so we aren't generating particles that are exactly centred
|
||||||
if(minRadius > radius)
|
if(minRadius > radius)
|
||||||
radius = minRadius;
|
radius = minRadius;
|
||||||
}
|
}
|
||||||
|
@ -175,7 +175,7 @@ void UnitParticleSystemType::load(const XmlNode *particleSystemNode, const strin
|
||||||
const float delay_secs = delayNode->getAttribute("value")->getFloatValue();
|
const float delay_secs = delayNode->getAttribute("value")->getFloatValue();
|
||||||
if(delay_secs < 0)
|
if(delay_secs < 0)
|
||||||
throw runtime_error("particle effect delay cannot be negative");
|
throw runtime_error("particle effect delay cannot be negative");
|
||||||
delay = delay_secs * GameConstants::updateFps;
|
delay = (int)delay_secs * GameConstants::updateFps;
|
||||||
} else{
|
} else{
|
||||||
delay= 0;
|
delay= 0;
|
||||||
}
|
}
|
||||||
|
@ -186,7 +186,7 @@ void UnitParticleSystemType::load(const XmlNode *particleSystemNode, const strin
|
||||||
const float lifetime_secs = lifetimeNode->getAttribute("value")->getFloatValue();
|
const float lifetime_secs = lifetimeNode->getAttribute("value")->getFloatValue();
|
||||||
if(lifetime_secs < 0 && lifetime_secs != -1)
|
if(lifetime_secs < 0 && lifetime_secs != -1)
|
||||||
throw runtime_error("particle effect lifetime cannot be negative (-1 means inherited from parent particle)");
|
throw runtime_error("particle effect lifetime cannot be negative (-1 means inherited from parent particle)");
|
||||||
lifetime = lifetime_secs * GameConstants::updateFps;
|
lifetime = (int)lifetime_secs * GameConstants::updateFps;
|
||||||
} else{
|
} else{
|
||||||
lifetime= -1; //default
|
lifetime= -1; //default
|
||||||
}
|
}
|
||||||
|
|
|
@ -1455,7 +1455,7 @@ bool SimpleDialog::show(const string &title, bool wide) {
|
||||||
|
|
||||||
vector<wxTextCtrl*> texts;
|
vector<wxTextCtrl*> texts;
|
||||||
for (Values::iterator it = values.begin(); it != values.end(); ++it) {
|
for (Values::iterator it = values.begin(); it != values.end(); ++it) {
|
||||||
int helptextpos = it->second.find_first_of('|');
|
size_t helptextpos = it->second.find_first_of('|');
|
||||||
sizer->Add(new wxStaticText(this, -1, ToUnicode(it->first)), 0, wxALL, 5);
|
sizer->Add(new wxStaticText(this, -1, ToUnicode(it->first)), 0, wxALL, 5);
|
||||||
wxTextCtrl *text = new wxTextCtrl(this, -1, ToUnicode(it->second.substr(0,helptextpos)));
|
wxTextCtrl *text = new wxTextCtrl(this, -1, ToUnicode(it->second.substr(0,helptextpos)));
|
||||||
if(wide) text->SetMinSize( wxSize((text->GetSize().GetWidth())*4, text->GetSize().GetHeight())); // 4 time as wide as default
|
if(wide) text->SetMinSize( wxSize((text->GetSize().GetWidth())*4, text->GetSize().GetHeight())); // 4 time as wide as default
|
||||||
|
|
|
@ -52,6 +52,12 @@ void checkGlExtension(const char *extensionName);
|
||||||
void inline _assertGl(const char *file, int line, GLenum *forceErrorNumber = NULL) {
|
void inline _assertGl(const char *file, int line, GLenum *forceErrorNumber = NULL) {
|
||||||
GLenum error = (forceErrorNumber != NULL ? *forceErrorNumber : glGetError());
|
GLenum error = (forceErrorNumber != NULL ? *forceErrorNumber : glGetError());
|
||||||
if(error != GL_NO_ERROR) {
|
if(error != GL_NO_ERROR) {
|
||||||
|
#ifdef _DEBUG
|
||||||
|
if(error == GL_INVALID_ENUM) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
//if(error != GL_INVALID_ENUM) {
|
//if(error != GL_INVALID_ENUM) {
|
||||||
const char *errorString= reinterpret_cast<const char*>(gluErrorString(error));
|
const char *errorString= reinterpret_cast<const char*>(gluErrorString(error));
|
||||||
char szBuf[4096]="";
|
char szBuf[4096]="";
|
||||||
|
|
|
@ -133,7 +133,7 @@ int g3d2xml(FILE *infile, FILE *outfile)
|
||||||
uint8 textureName[NAMESIZE];
|
uint8 textureName[NAMESIZE];
|
||||||
float32 *fdata;
|
float32 *fdata;
|
||||||
uint32 *idata;
|
uint32 *idata;
|
||||||
int ii, jj, kk;
|
unsigned int ii, jj, kk;
|
||||||
|
|
||||||
/* read in the FileHeader */
|
/* read in the FileHeader */
|
||||||
nBytes = sizeof(struct FileHeader);
|
nBytes = sizeof(struct FileHeader);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user