OSP Code SP (need more tests and optimizations) Improved caravans trade.

Users who are viewing this thread

caravan_type_general = BF|LF|RM|HWG|LG|Cloth
caravan_type_luxury = LF|LG
caravan_type_food = BF|LF

So we can set on item initialization :
(item_set_slot, itm_oil, slot_item_trading_type, LG|HWG),
(item_set_slot, itm_spice, slot_item_trading_type, LG),

[...]

(val_and, ":good_type", ":caravan_type"),  #
How do these operations work ? if I use slot_eq, will caravan_type_food return true if I compare with BF or LF ? (I don't know factions about | )
 
BF = 1  = 000001b (binary)
LF = 2  = 000010b

Cheese is LF
smoked fish is BF

So if caravan_type = caravan_type_food = 1|2 =  000011b = 3

then
(val_and, ":good_type", ":caravan_type"),  will be    000010b and 000011b for cheese        = 00010b > 0
                                                                                    000001b and 000011b for smoked fish  = 00001b > 0
                                                                                    000100b and 000011b for raw flax        = 00000b = 0

0 and 0 = 0
0 and 1 = 0
1 and 0 = 0
1 and 1 = 1
 
Back
Top Bottom