mirror of
https://github.com/glest/glest-source.git
synced 2025-08-11 19:04:00 +02:00
- bugfix for cell bad cell management in map preview
This commit is contained in:
@@ -2635,7 +2635,8 @@ void MenuStateCustomGame::cleanupFactionTexture() {
|
|||||||
MapPreview::MapPreview() {
|
MapPreview::MapPreview() {
|
||||||
altFactor = 3;
|
altFactor = 3;
|
||||||
waterLevel = 4;
|
waterLevel = 4;
|
||||||
cells = NULL;
|
//cells = NULL;
|
||||||
|
cells.clear();
|
||||||
startLocations = NULL;
|
startLocations = NULL;
|
||||||
reset(128, 128, 10.f, 1);
|
reset(128, 128, 10.f, 1);
|
||||||
resetFactions(8);
|
resetFactions(8);
|
||||||
@@ -2650,13 +2651,15 @@ MapPreview::~MapPreview() {
|
|||||||
startLocations = NULL;
|
startLocations = NULL;
|
||||||
|
|
||||||
if(hasFileLoaded() == true) {
|
if(hasFileLoaded() == true) {
|
||||||
for (int i = 0; i < h; i++) {
|
//for (int i = 0; i < h; i++) {
|
||||||
delete [] cells[i];
|
// delete [] cells[i];
|
||||||
}
|
//}
|
||||||
delete [] cells;
|
//delete [] cells;
|
||||||
|
|
||||||
fileLoaded = false;
|
fileLoaded = false;
|
||||||
}
|
}
|
||||||
cells = NULL;
|
//cells = NULL;
|
||||||
|
cells.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -2709,20 +2712,26 @@ void MapPreview::reset(int w, int h, float alt, int surf) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
if (cells != NULL) {
|
if (cells != NULL) {
|
||||||
for (int i = 0; i < this->w; i++) {
|
for (int i = 0; i < this->w; i++) {
|
||||||
delete [] cells[i];
|
delete [] cells[i];
|
||||||
}
|
}
|
||||||
delete [] cells;
|
delete [] cells;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
cells.clear();
|
||||||
|
|
||||||
this->w = w;
|
this->w = w;
|
||||||
this->h = h;
|
this->h = h;
|
||||||
this->maxFactions = maxFactions;
|
this->maxFactions = maxFactions;
|
||||||
|
|
||||||
cells = new Cell*[w];
|
cells.resize(w);
|
||||||
|
|
||||||
|
//cells = new Cell*[w];
|
||||||
for (int i = 0; i < w; i++) {
|
for (int i = 0; i < w; i++) {
|
||||||
cells[i] = new Cell[h];
|
//cells[i] = new Cell[h];
|
||||||
|
cells[i].resize(h);
|
||||||
for (int j = 0; j < h; j++) {
|
for (int j = 0; j < h; j++) {
|
||||||
cells[i][j].height = alt;
|
cells[i][j].height = alt;
|
||||||
cells[i][j].object = 0;
|
cells[i][j].object = 0;
|
||||||
@@ -2762,7 +2771,8 @@ int MapPreview::getWaterLevel() const {
|
|||||||
void MapPreview::loadFromFile(const string &path) {
|
void MapPreview::loadFromFile(const string &path) {
|
||||||
altFactor = 3;
|
altFactor = 3;
|
||||||
waterLevel = 4;
|
waterLevel = 4;
|
||||||
cells = NULL;
|
//cells = NULL;
|
||||||
|
cells.clear();
|
||||||
startLocations = NULL;
|
startLocations = NULL;
|
||||||
reset(128, 128, 10.f, 1);
|
reset(128, 128, 10.f, 1);
|
||||||
resetFactions(8);
|
resetFactions(8);
|
||||||
|
@@ -64,7 +64,8 @@ private:
|
|||||||
int w;
|
int w;
|
||||||
int altFactor;
|
int altFactor;
|
||||||
int waterLevel;
|
int waterLevel;
|
||||||
Cell **cells;
|
//Cell **cells;
|
||||||
|
std::vector<std::vector<Cell> > cells;
|
||||||
int maxFactions;
|
int maxFactions;
|
||||||
StartLocation *startLocations;
|
StartLocation *startLocations;
|
||||||
int refAlt;
|
int refAlt;
|
||||||
|
Reference in New Issue
Block a user