1
0
Fork 0
mirror of https://github.com/jugeeya/UltimateTrainingModpack.git synced 2024-11-30 22:00:16 +00:00

Keep Crafting Table on state load (#448)

* Keep Crafting Table on state load

* Better Table Reference

* Use for..in loop for clearer code

* Remove Crafting Table jugeeya edition
This commit is contained in:
GradualSyrup 2022-12-18 15:43:40 -06:00 committed by GitHub
parent 01a2c60a29
commit c7457cf0fd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -261,17 +261,20 @@ pub unsafe fn save_states(module_accessor: &mut app::BattleObjectModuleAccessor)
PostureModule::set_pos(module_accessor, &pos);
// All articles have ID <= 0x25
(0..=0x25).for_each(|article_idx| {
if ArticleModule::is_exist(module_accessor, article_idx) {
let article: u64 = ArticleModule::get_article(module_accessor, article_idx);
let article_object_id =
Article::get_battle_object_id(article as *mut app::Article);
ArticleModule::remove_exist_object_id(
module_accessor,
article_object_id as u32,
);
}
});
(0..=0x25)
// Don't remove crafting table
.filter(|article_idx| !(fighter_kind == *FIGHTER_KIND_PICKEL && *article_idx == *FIGHTER_PICKEL_GENERATE_ARTICLE_TABLE))
.for_each(|article_idx| {
if ArticleModule::is_exist(module_accessor, article_idx) {
let article: u64 = ArticleModule::get_article(module_accessor, article_idx);
let article_object_id =
Article::get_battle_object_id(article as *mut app::Article);
ArticleModule::remove_exist_object_id(
module_accessor,
article_object_id as u32,
);
}
});
let item_mgr = *(ITEM_MANAGER_ADDR as *mut *mut app::ItemManager);
(0..ItemManager::get_num_of_active_item_all(item_mgr)).for_each(|item_idx| {
let item = ItemManager::get_active_item(item_mgr, item_idx);