mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2024-11-22 12:05:11 +00:00
Prevent clearing permanent vanilla model slot
This commit is contained in:
parent
016c385d7f
commit
47a8e9d3f6
1 changed files with 6 additions and 1 deletions
|
@ -8,6 +8,8 @@ extern "C" {
|
||||||
#include "model_ids.h"
|
#include "model_ids.h"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define VANILLA_ID_END 255
|
||||||
|
|
||||||
enum ModelLoadType {
|
enum ModelLoadType {
|
||||||
MLT_GEO,
|
MLT_GEO,
|
||||||
MLT_DL,
|
MLT_DL,
|
||||||
|
@ -28,7 +30,7 @@ static std::map<u32, std::vector<struct ModelInfo>> sIdMap;
|
||||||
static std::map<u32, u32> sOverwriteMap;
|
static std::map<u32, u32> sOverwriteMap;
|
||||||
|
|
||||||
static u32 find_empty_id() {
|
static u32 find_empty_id() {
|
||||||
u32 id = 256;
|
u32 id = VANILLA_ID_END + 1;
|
||||||
while (true) {
|
while (true) {
|
||||||
if (id != 0) {
|
if (id != 0) {
|
||||||
if (sIdMap.count(id) == 0) { return id; }
|
if (sIdMap.count(id) == 0) { return id; }
|
||||||
|
@ -199,6 +201,9 @@ void DynOS_Model_ClearPool(enum ModelPool aModelPool) {
|
||||||
auto& info = asset.second;
|
auto& info = asset.second;
|
||||||
if (sIdMap.count(info.id) == 0) { continue; }
|
if (sIdMap.count(info.id) == 0) { continue; }
|
||||||
|
|
||||||
|
// preventing clearing permanent vanilla model slot
|
||||||
|
if (info.id <= VANILLA_ID_END && sIdMap.count(info.id) <= 1) { continue; }
|
||||||
|
|
||||||
// erase from id map
|
// erase from id map
|
||||||
auto& idMap = sIdMap[info.id];
|
auto& idMap = sIdMap[info.id];
|
||||||
for (auto info2 = idMap.begin(); info2 != idMap.end(); ) {
|
for (auto info2 = idMap.begin(); info2 != idMap.end(); ) {
|
||||||
|
|
Loading…
Reference in a new issue