Skip to content

Instantly share code, notes, and snippets.

@klusark
Created March 30, 2014 22:11
Show Gist options
  • Save klusark/9880735 to your computer and use it in GitHub Desktop.
Save klusark/9880735 to your computer and use it in GitHub Desktop.
diff --git a/engines/grim/model.cpp b/engines/grim/model.cpp
index a38ca52..54f0429 100644
--- a/engines/grim/model.cpp
+++ b/engines/grim/model.cpp
@@ -310,17 +310,6 @@ MeshFace::~MeshFace() {
delete[] _texVertices;
}
-void MeshFace::operator=(const MeshFace &other) {
- memcpy(this, &other, sizeof(MeshFace));
- _numVertices = other._numVertices;
- _vertices = new int[_numVertices];
- memcpy(_vertices, other._vertices, _numVertices * sizeof(int));
- if (_texVertices) {
- _texVertices = new int[_numVertices];
- memcpy(_texVertices, other._texVertices, _numVertices * sizeof(i
- }
-}
-
int MeshFace::loadBinary(Common::SeekableReadStream *data, Material *materials[
char v3[4 * 3], f[4];
data->seek(4, SEEK_CUR);
@@ -547,13 +536,15 @@ void Mesh::sortFaces() {
for (int other = cur; other < _numFaces; ++other) {
if (_faces[cur].getMaterial() == _faces[other].getMateri
copied[other] = true;
- newFaces[writeIdx] = _faces[other];
+ memcpy(&newFaces[writeIdx], &_faces[other], size
newMaterialid[writeIdx] = _materialid[other];
writeIdx++;
}
}
}
+ // Zero the current faces so the deconstructor doesn't destory the verti
+ memset(_faces, 0, _numFaces * sizeof(MeshFace));
delete[] _faces;
_faces = newFaces;
delete[] _materialid;
diff --git a/engines/grim/model.h b/engines/grim/model.h
index 5a06acc..5bc6edb 100644
--- a/engines/grim/model.h
+++ b/engines/grim/model.h
@@ -92,7 +92,6 @@ class MeshFace {
public:
MeshFace();
~MeshFace();
- void operator=(const MeshFace &other);
int loadBinary(Common::SeekableReadStream *data, Material *materials[]);
int loadText(TextSplitter *ts, Material *materials[], int offset);
void draw(const Mesh *mesh) const;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment