finish PreDelete and CheckPreDeletion. now there is no problem when deleting object

This commit is contained in:
2023-09-20 15:25:43 +08:00
parent a06f6a58c9
commit 81872053f0
16 changed files with 100 additions and 28 deletions

View File

@ -33,6 +33,17 @@ namespace LibCmo::CK2::ObjImpls {
CKMaterial::~CKMaterial() {}
void CKMaterial::CheckPreDeletion() {
CKBeObject::CheckPreDeletion();
// check 4 textures
for (auto& tex : m_Textures) {
if (tex != nullptr && tex->IsToBeDeleted()) {
tex = nullptr;
}
}
}
bool CKMaterial::Save(CKStateChunk* chunk, CKFileVisitor* file, CKDWORD flags) {
bool suc = CKBeObject::Save(chunk, file, flags);
if (!suc) return false;