Fix crash and confusing behavior in automaterial.

develop
Alexander Gavrilov 2012-12-08 09:51:35 +04:00 committed by Anuradha Dissanayake
parent 2a83d92290
commit 966deb4647
1 changed files with 4 additions and 4 deletions

@ -170,8 +170,8 @@ static MaterialDescriptor get_material_in_list(size_t i)
} }
else if (VIRTUAL_CAST_VAR(spec, df::build_req_choice_specst, ui_build_selector->choices[i])) else if (VIRTUAL_CAST_VAR(spec, df::build_req_choice_specst, ui_build_selector->choices[i]))
{ {
result.item_type = gen->item_type; result.item_type = spec->candidate->getType();
result.item_subtype = gen->item_subtype; result.item_subtype = spec->candidate->getSubtype();
result.type = spec->candidate->getActualMaterial(); result.type = spec->candidate->getActualMaterial();
result.index = spec->candidate->getActualMaterialIndex(); result.index = spec->candidate->getActualMaterialIndex();
result.valid = true; result.valid = true;
@ -316,7 +316,7 @@ struct jobutils_hook : public df::viewscreen_dwarfmodest
{ {
if (in_material_choice_stage()) if (in_material_choice_stage())
{ {
if (!last_used_moved) if (!last_used_moved && ui_build_selector->is_grouped)
{ {
if (auto_choose_materials && get_curr_constr_prefs().size() > 0) if (auto_choose_materials && get_curr_constr_prefs().size() > 0)
{ {
@ -326,7 +326,7 @@ struct jobutils_hook : public df::viewscreen_dwarfmodest
return; return;
} }
} }
else if (ui_build_selector->is_grouped) else
{ {
last_used_moved = true; last_used_moved = true;
move_material_to_top(get_last_used_material()); move_material_to_top(get_last_used_material());