Fix the treatment of non_economic in Materials/Items modules.

non_economic == !(is boulder && is inorganic && is economic)
develop
Alexander Gavrilov 2012-10-20 20:31:45 +04:00
parent 5388ad475f
commit 795961bfc4
2 changed files with 11 additions and 5 deletions

@ -256,11 +256,11 @@ bool ItemTypeInfo::matches(const df::job_item &item, MaterialInfo *mat)
return false;
df::job_item_flags1 ok1, mask1, item_ok1, item_mask1;
df::job_item_flags2 ok2, mask2, item_ok2, item_mask2;
df::job_item_flags2 ok2, mask2, item_ok2, item_mask2, xmask2;
df::job_item_flags3 ok3, mask3, item_ok3, item_mask3;
ok1.whole = mask1.whole = item_ok1.whole = item_mask1.whole = 0;
ok2.whole = mask2.whole = item_ok2.whole = item_mask2.whole = 0;
ok2.whole = mask2.whole = item_ok2.whole = item_mask2.whole = xmask2.whole = 0;
ok3.whole = mask3.whole = item_ok3.whole = item_mask3.whole = 0;
if (mat) {
@ -281,12 +281,16 @@ bool ItemTypeInfo::matches(const df::job_item &item, MaterialInfo *mat)
RQ(1,not_bin); RQ(1,lye_bearing);
RQ(2,dye); RQ(2,dyeable); RQ(2,dyed); RQ(2,glass_making); RQ(2,screw);
RQ(2,building_material); RQ(2,fire_safe); RQ(2,magma_safe); RQ(2,non_economic);
RQ(2,building_material); RQ(2,fire_safe); RQ(2,magma_safe);
RQ(2,totemable); RQ(2,plaster_containing); RQ(2,body_part); RQ(2,lye_milk_free);
RQ(2,blunt); RQ(2,unengraved); RQ(2,hair_wool);
RQ(3,any_raw_material); RQ(3,non_pressed); RQ(3,food_storage);
// only checked if boulder
xmask2.bits.non_economic = true;
// Compute the ok mask
OK(1,solid);
@ -306,7 +310,7 @@ bool ItemTypeInfo::matches(const df::job_item &item, MaterialInfo *mat)
case BOULDER:
OK(1,sharpenable);
OK(2,non_economic);
xmask2.bits.non_economic = false;
case BAR:
OK(3,any_raw_material);
case BLOCKS:
@ -432,6 +436,8 @@ bool ItemTypeInfo::matches(const df::job_item &item, MaterialInfo *mat)
#undef OK
#undef RQ
mask2.whole &= ~xmask2.whole;
return bits_match(item.flags1.whole, ok1.whole, mask1.whole) &&
bits_match(item.flags2.whole, ok2.whole, mask2.whole) &&
bits_match(item.flags3.whole, ok3.whole, mask3.whole) &&

@ -497,7 +497,7 @@ void MaterialInfo::getMatchBits(df::job_item_flags2 &ok, df::job_item_flags2 &ma
TEST(fire_safe, material->heat.melting_point > 11000);
TEST(magma_safe, material->heat.melting_point > 12000);
TEST(deep_material, FLAG(inorganic, inorganic_flags::SPECIAL));
TEST(non_economic, inorganic && !(ui && ui->economic_stone[index]));
TEST(non_economic, !inorganic || !(ui && vector_get(ui->economic_stone, index)));
TEST(plant, plant);
TEST(silk, MAT_FLAG(SILK));