… | |
… | |
1008 | CHK_PICK_PICKUP; |
1008 | CHK_PICK_PICKUP; |
1009 | |
1009 | |
1010 | continue; |
1010 | continue; |
1011 | } |
1011 | } |
1012 | |
1012 | |
1013 | /* high not bit set? We're using the old autopickup model */ |
1013 | /* NEW pickup handling */ |
|
|
1014 | if (op->contr->mode & PU_DEBUG) |
|
|
1015 | { |
|
|
1016 | /* some debugging code to figure out item information */ |
|
|
1017 | const char *str = tmp->name |
|
|
1018 | ? format ("item name: %s item type: %d weight/value: %d", |
|
|
1019 | &tmp->name, tmp->type, (int) (query_cost (tmp, op, F_TRUE) * 100 / (tmp->weight * MAX (tmp->nrof, 1)))) |
|
|
1020 | : format ("item name: %s item type: %d weight/value: %d", |
|
|
1021 | &tmp->arch->archname, tmp->type, (int) (query_cost (tmp, op, F_TRUE) * 100 / (tmp->weight * MAX (tmp->nrof, 1)))); |
|
|
1022 | |
|
|
1023 | new_draw_info (NDI_UNIQUE, 0, op, str); |
|
|
1024 | } |
|
|
1025 | |
|
|
1026 | /* philosophy: |
|
|
1027 | * It's easy to grab an item type from a pile, as long as it's |
|
|
1028 | * generic. This takes no game-time. For more detailed pickups |
|
|
1029 | * and selections, select-items should be used. This is a |
|
|
1030 | * grab-as-you-run type mode that's really useful for arrows for |
|
|
1031 | * example. |
|
|
1032 | * The drawback: right now it has no frontend, so you need to |
|
|
1033 | * stick the bits you want into a calculator in hex mode and then |
|
|
1034 | * convert to decimal and then 'pickup <#> |
|
|
1035 | */ |
|
|
1036 | |
|
|
1037 | /* the first two modes are exclusive: if NOTHING we return, if |
|
|
1038 | * STOP then we stop. All the rest are applied sequentially, |
|
|
1039 | * meaning if any test passes, the item gets picked up. */ |
|
|
1040 | |
|
|
1041 | /* if mode is set to pick nothing up, return */ |
|
|
1042 | if (op->contr->mode & PU_NOTHING) |
|
|
1043 | return 1; |
|
|
1044 | |
|
|
1045 | /* if mode is set to stop when encountering objects, return */ |
|
|
1046 | /* take STOP before INHIBIT since it doesn't actually pick |
|
|
1047 | * anything up */ |
|
|
1048 | if (op->contr->mode & PU_STOP) |
|
|
1049 | return 0; |
|
|
1050 | |
|
|
1051 | /* useful for going into stores and not losing your settings... */ |
|
|
1052 | /* and for battles wher you don't want to get loaded down while |
|
|
1053 | * fighting */ |
|
|
1054 | if (op->contr->mode & PU_INHIBIT) |
|
|
1055 | return 1; |
|
|
1056 | |
|
|
1057 | /* prevent us from turning into auto-thieves :) */ |
|
|
1058 | if (QUERY_FLAG (tmp, FLAG_UNPAID)) |
|
|
1059 | continue; |
|
|
1060 | |
|
|
1061 | /* ignore known cursed objects */ |
|
|
1062 | if (QUERY_FLAG (tmp, FLAG_KNOWN_CURSED) && op->contr->mode & PU_NOT_CURSED) |
|
|
1063 | continue; |
|
|
1064 | |
|
|
1065 | /* all food and drink if desired */ |
|
|
1066 | /* question: don't pick up known-poisonous stuff? */ |
1014 | if (!(op->contr->mode & PU_NEWMODE)) |
1067 | if (op->contr->mode & PU_FOOD) |
|
|
1068 | if (tmp->type == FOOD) |
1015 | { |
1069 | { |
1016 | switch (op->contr->mode) |
1070 | CHK_PICK_PICKUP; |
|
|
1071 | continue; |
|
|
1072 | } |
|
|
1073 | |
|
|
1074 | if (op->contr->mode & PU_DRINK) |
|
|
1075 | if (tmp->type == DRINK || (tmp->type == POISON && !QUERY_FLAG (tmp, FLAG_KNOWN_CURSED))) |
|
|
1076 | { |
|
|
1077 | CHK_PICK_PICKUP; |
|
|
1078 | continue; |
|
|
1079 | } |
|
|
1080 | |
|
|
1081 | if (op->contr->mode & PU_POTION) |
|
|
1082 | if (tmp->type == POTION) |
|
|
1083 | { |
|
|
1084 | CHK_PICK_PICKUP; |
|
|
1085 | continue; |
|
|
1086 | } |
|
|
1087 | |
|
|
1088 | /* spellbooks, skillscrolls and normal books/scrolls */ |
|
|
1089 | if (op->contr->mode & PU_SPELLBOOK) |
|
|
1090 | if (tmp->type == SPELLBOOK) |
|
|
1091 | { |
|
|
1092 | CHK_PICK_PICKUP; |
|
|
1093 | continue; |
|
|
1094 | } |
|
|
1095 | |
|
|
1096 | if (op->contr->mode & PU_SKILLSCROLL) |
|
|
1097 | if (tmp->type == SKILLSCROLL) |
|
|
1098 | { |
|
|
1099 | CHK_PICK_PICKUP; |
|
|
1100 | continue; |
|
|
1101 | } |
|
|
1102 | |
|
|
1103 | if (op->contr->mode & PU_READABLES) |
|
|
1104 | if (tmp->type == BOOK || tmp->type == SCROLL || tmp->type == INSCRIBABLE) |
|
|
1105 | { |
|
|
1106 | CHK_PICK_PICKUP; |
|
|
1107 | continue; |
|
|
1108 | } |
|
|
1109 | |
|
|
1110 | /* wands/staves/rods/horns */ |
|
|
1111 | if (op->contr->mode & PU_MAGIC_DEVICE) |
|
|
1112 | if (tmp->type == WAND || tmp->type == ROD || tmp->type == HORN) |
|
|
1113 | { |
|
|
1114 | CHK_PICK_PICKUP; |
|
|
1115 | continue; |
|
|
1116 | } |
|
|
1117 | |
|
|
1118 | /* pick up all magical items */ |
|
|
1119 | if (op->contr->mode & PU_MAGICAL) |
|
|
1120 | if (QUERY_FLAG (tmp, FLAG_KNOWN_MAGICAL) && !QUERY_FLAG (tmp, FLAG_KNOWN_CURSED)) |
|
|
1121 | { |
|
|
1122 | CHK_PICK_PICKUP; |
|
|
1123 | continue; |
|
|
1124 | } |
|
|
1125 | |
|
|
1126 | if (op->contr->mode & PU_VALUABLES) |
|
|
1127 | { |
|
|
1128 | if (tmp->type == MONEY || tmp->type == GEM) |
1017 | { |
1129 | { |
1018 | case 0: |
|
|
1019 | return 1; /* don't pick up */ |
|
|
1020 | case 1: |
|
|
1021 | CHK_PICK_PICKUP; |
1130 | CHK_PICK_PICKUP; |
1022 | return 1; |
1131 | continue; |
1023 | case 2: |
|
|
1024 | CHK_PICK_PICKUP; |
|
|
1025 | return 0; |
|
|
1026 | case 3: |
|
|
1027 | return 0; /* stop before pickup */ |
|
|
1028 | case 4: |
|
|
1029 | CHK_PICK_PICKUP; |
|
|
1030 | break; |
|
|
1031 | case 5: |
|
|
1032 | CHK_PICK_PICKUP; |
|
|
1033 | stop = 1; |
|
|
1034 | break; |
|
|
1035 | case 6: |
|
|
1036 | if (QUERY_FLAG (tmp, FLAG_KNOWN_MAGICAL) |
|
|
1037 | && !QUERY_FLAG (tmp, FLAG_KNOWN_CURSED)) |
|
|
1038 | CHK_PICK_PICKUP; |
|
|
1039 | break; |
|
|
1040 | |
|
|
1041 | case 7: |
|
|
1042 | if (tmp->type == MONEY || tmp->type == GEM) |
|
|
1043 | CHK_PICK_PICKUP; |
|
|
1044 | break; |
|
|
1045 | |
|
|
1046 | default: |
|
|
1047 | /* use value density */ |
|
|
1048 | if (!QUERY_FLAG (tmp, FLAG_UNPAID) |
|
|
1049 | && (query_cost (tmp, op, F_TRUE) * 100 / (tmp->weight * MAX (tmp->nrof, 1))) >= op->contr->mode) |
|
|
1050 | CHK_PICK_PICKUP; |
|
|
1051 | } |
1132 | } |
1052 | } |
1133 | } |
1053 | else |
1134 | |
1054 | { /* old model */ |
1135 | /* rings & amulets - talismans seems to be typed AMULET */ |
1055 | /* NEW pickup handling */ |
1136 | if (op->contr->mode & PU_JEWELS) |
|
|
1137 | if (tmp->type == RING || tmp->type == AMULET) |
|
|
1138 | { |
|
|
1139 | CHK_PICK_PICKUP; |
|
|
1140 | continue; |
|
|
1141 | } |
|
|
1142 | |
|
|
1143 | /* we don't forget dragon food */ |
|
|
1144 | if (op->contr->mode & PU_FLESH) |
|
|
1145 | if (tmp->type == FLESH) |
|
|
1146 | { |
|
|
1147 | CHK_PICK_PICKUP; |
|
|
1148 | continue; |
|
|
1149 | } |
|
|
1150 | |
|
|
1151 | /* bows and arrows. Bows are good for selling! */ |
1056 | if (op->contr->mode & PU_DEBUG) |
1152 | if (op->contr->mode & PU_BOW) |
|
|
1153 | if (tmp->type == BOW) |
|
|
1154 | { |
|
|
1155 | CHK_PICK_PICKUP; |
|
|
1156 | continue; |
|
|
1157 | } |
|
|
1158 | |
|
|
1159 | if (op->contr->mode & PU_ARROW) |
|
|
1160 | if (tmp->type == ARROW) |
|
|
1161 | { |
|
|
1162 | CHK_PICK_PICKUP; |
|
|
1163 | continue; |
|
|
1164 | } |
|
|
1165 | |
|
|
1166 | /* all kinds of armor etc. */ |
|
|
1167 | if (op->contr->mode & PU_ARMOUR) |
|
|
1168 | if (tmp->type == ARMOUR) |
|
|
1169 | { |
|
|
1170 | CHK_PICK_PICKUP; |
|
|
1171 | continue; |
|
|
1172 | } |
|
|
1173 | |
|
|
1174 | if (op->contr->mode & PU_HELMET) |
|
|
1175 | if (tmp->type == HELMET) |
|
|
1176 | { |
|
|
1177 | CHK_PICK_PICKUP; |
|
|
1178 | continue; |
|
|
1179 | } |
|
|
1180 | |
|
|
1181 | if (op->contr->mode & PU_SHIELD) |
|
|
1182 | if (tmp->type == SHIELD) |
|
|
1183 | { |
|
|
1184 | CHK_PICK_PICKUP; |
|
|
1185 | continue; |
|
|
1186 | } |
|
|
1187 | |
|
|
1188 | if (op->contr->mode & PU_BOOTS) |
|
|
1189 | if (tmp->type == BOOTS) |
|
|
1190 | { |
|
|
1191 | CHK_PICK_PICKUP; |
|
|
1192 | continue; |
|
|
1193 | } |
|
|
1194 | |
|
|
1195 | if (op->contr->mode & PU_GLOVES) |
|
|
1196 | if (tmp->type == GLOVES) |
|
|
1197 | { |
|
|
1198 | CHK_PICK_PICKUP; |
|
|
1199 | continue; |
|
|
1200 | } |
|
|
1201 | |
|
|
1202 | if (op->contr->mode & PU_CLOAK) |
|
|
1203 | if (tmp->type == CLOAK) |
|
|
1204 | { |
|
|
1205 | CHK_PICK_PICKUP; |
|
|
1206 | continue; |
|
|
1207 | } |
|
|
1208 | |
|
|
1209 | /* hoping to catch throwing daggers here */ |
|
|
1210 | if (op->contr->mode & PU_MISSILEWEAPON) |
|
|
1211 | if (tmp->type == WEAPON && QUERY_FLAG (tmp, FLAG_IS_THROWN)) |
|
|
1212 | { |
|
|
1213 | CHK_PICK_PICKUP; |
|
|
1214 | continue; |
|
|
1215 | } |
|
|
1216 | |
|
|
1217 | /* careful: chairs and tables are weapons! */ |
|
|
1218 | if (op->contr->mode & PU_ALLWEAPON) |
|
|
1219 | { |
|
|
1220 | if (tmp->type == WEAPON && tmp->name != NULL) |
1057 | { |
1221 | { |
1058 | /* some debugging code to figure out item information */ |
1222 | if (strstr (tmp->name, "table") == NULL && strstr (tmp->arch->archname, "table") == NULL && |
1059 | const char *str = tmp->name |
1223 | strstr (tmp->name, "chair") && strstr (tmp->arch->archname, "chair") == NULL) |
1060 | ? format ("item name: %s item type: %d weight/value: %d", |
|
|
1061 | &tmp->name, tmp->type, (int) (query_cost (tmp, op, F_TRUE) * 100 / (tmp->weight * MAX (tmp->nrof, 1)))) |
|
|
1062 | : format ("item name: %s item type: %d weight/value: %d", |
|
|
1063 | &tmp->arch->archname, tmp->type, (int) (query_cost (tmp, op, F_TRUE) * 100 / (tmp->weight * MAX (tmp->nrof, 1)))); |
|
|
1064 | |
|
|
1065 | new_draw_info (NDI_UNIQUE, 0, op, str); |
|
|
1066 | } |
|
|
1067 | |
|
|
1068 | /* philosophy: |
|
|
1069 | * It's easy to grab an item type from a pile, as long as it's |
|
|
1070 | * generic. This takes no game-time. For more detailed pickups |
|
|
1071 | * and selections, select-items should be used. This is a |
|
|
1072 | * grab-as-you-run type mode that's really useful for arrows for |
|
|
1073 | * example. |
|
|
1074 | * The drawback: right now it has no frontend, so you need to |
|
|
1075 | * stick the bits you want into a calculator in hex mode and then |
|
|
1076 | * convert to decimal and then 'pickup <#> |
|
|
1077 | */ |
|
|
1078 | |
|
|
1079 | /* the first two modes are exclusive: if NOTHING we return, if |
|
|
1080 | * STOP then we stop. All the rest are applied sequentially, |
|
|
1081 | * meaning if any test passes, the item gets picked up. */ |
|
|
1082 | |
|
|
1083 | /* if mode is set to pick nothing up, return */ |
|
|
1084 | |
|
|
1085 | if (op->contr->mode & PU_NOTHING) |
|
|
1086 | return 1; |
|
|
1087 | |
|
|
1088 | /* if mode is set to stop when encountering objects, return */ |
|
|
1089 | /* take STOP before INHIBIT since it doesn't actually pick |
|
|
1090 | * anything up */ |
|
|
1091 | |
|
|
1092 | if (op->contr->mode & PU_STOP) |
|
|
1093 | return 0; |
|
|
1094 | |
|
|
1095 | /* useful for going into stores and not losing your settings... */ |
|
|
1096 | /* and for battles wher you don't want to get loaded down while |
|
|
1097 | * fighting */ |
|
|
1098 | if (op->contr->mode & PU_INHIBIT) |
|
|
1099 | return 1; |
|
|
1100 | |
|
|
1101 | /* prevent us from turning into auto-thieves :) */ |
|
|
1102 | if (QUERY_FLAG (tmp, FLAG_UNPAID)) |
|
|
1103 | continue; |
|
|
1104 | |
|
|
1105 | /* ignore known cursed objects */ |
|
|
1106 | if (QUERY_FLAG (tmp, FLAG_KNOWN_CURSED) && op->contr->mode & PU_NOT_CURSED) |
|
|
1107 | continue; |
|
|
1108 | |
|
|
1109 | /* all food and drink if desired */ |
|
|
1110 | /* question: don't pick up known-poisonous stuff? */ |
|
|
1111 | if (op->contr->mode & PU_FOOD) |
|
|
1112 | if (tmp->type == FOOD) |
|
|
1113 | { |
|
|
1114 | CHK_PICK_PICKUP; |
|
|
1115 | continue; |
|
|
1116 | } |
|
|
1117 | |
|
|
1118 | if (op->contr->mode & PU_DRINK) |
|
|
1119 | if (tmp->type == DRINK || (tmp->type == POISON && !QUERY_FLAG (tmp, FLAG_KNOWN_CURSED))) |
|
|
1120 | { |
|
|
1121 | CHK_PICK_PICKUP; |
|
|
1122 | continue; |
|
|
1123 | } |
|
|
1124 | |
|
|
1125 | if (op->contr->mode & PU_POTION) |
|
|
1126 | if (tmp->type == POTION) |
|
|
1127 | { |
|
|
1128 | CHK_PICK_PICKUP; |
|
|
1129 | continue; |
|
|
1130 | } |
|
|
1131 | |
|
|
1132 | /* spellbooks, skillscrolls and normal books/scrolls */ |
|
|
1133 | if (op->contr->mode & PU_SPELLBOOK) |
|
|
1134 | if (tmp->type == SPELLBOOK) |
|
|
1135 | { |
|
|
1136 | CHK_PICK_PICKUP; |
|
|
1137 | continue; |
|
|
1138 | } |
|
|
1139 | |
|
|
1140 | if (op->contr->mode & PU_SKILLSCROLL) |
|
|
1141 | if (tmp->type == SKILLSCROLL) |
|
|
1142 | { |
|
|
1143 | CHK_PICK_PICKUP; |
|
|
1144 | continue; |
|
|
1145 | } |
|
|
1146 | |
|
|
1147 | if (op->contr->mode & PU_READABLES) |
|
|
1148 | if (tmp->type == BOOK || tmp->type == SCROLL || tmp->type == INSCRIBABLE) |
|
|
1149 | { |
|
|
1150 | CHK_PICK_PICKUP; |
|
|
1151 | continue; |
|
|
1152 | } |
|
|
1153 | |
|
|
1154 | /* wands/staves/rods/horns */ |
|
|
1155 | if (op->contr->mode & PU_MAGIC_DEVICE) |
|
|
1156 | if (tmp->type == WAND || tmp->type == ROD || tmp->type == HORN) |
|
|
1157 | { |
|
|
1158 | CHK_PICK_PICKUP; |
|
|
1159 | continue; |
|
|
1160 | } |
|
|
1161 | |
|
|
1162 | /* pick up all magical items */ |
|
|
1163 | if (op->contr->mode & PU_MAGICAL) |
|
|
1164 | if (QUERY_FLAG (tmp, FLAG_KNOWN_MAGICAL) && !QUERY_FLAG (tmp, FLAG_KNOWN_CURSED)) |
|
|
1165 | { |
|
|
1166 | CHK_PICK_PICKUP; |
|
|
1167 | continue; |
|
|
1168 | } |
|
|
1169 | |
|
|
1170 | if (op->contr->mode & PU_VALUABLES) |
|
|
1171 | { |
|
|
1172 | if (tmp->type == MONEY || tmp->type == GEM) |
|
|
1173 | { |
1224 | { |
1174 | CHK_PICK_PICKUP; |
1225 | CHK_PICK_PICKUP; |
1175 | continue; |
1226 | continue; |
1176 | } |
1227 | } |
1177 | } |
1228 | } |
1178 | |
1229 | |
1179 | /* rings & amulets - talismans seems to be typed AMULET */ |
|
|
1180 | if (op->contr->mode & PU_JEWELS) |
|
|
1181 | if (tmp->type == RING || tmp->type == AMULET) |
1230 | if (tmp->type == WEAPON && tmp->name == NULL) |
1182 | { |
|
|
1183 | CHK_PICK_PICKUP; |
|
|
1184 | continue; |
|
|
1185 | } |
|
|
1186 | |
|
|
1187 | /* we don't forget dragon food */ |
|
|
1188 | if (op->contr->mode & PU_FLESH) |
|
|
1189 | if (tmp->type == FLESH) |
|
|
1190 | { |
|
|
1191 | CHK_PICK_PICKUP; |
|
|
1192 | continue; |
|
|
1193 | } |
|
|
1194 | |
|
|
1195 | /* bows and arrows. Bows are good for selling! */ |
|
|
1196 | if (op->contr->mode & PU_BOW) |
|
|
1197 | if (tmp->type == BOW) |
|
|
1198 | { |
|
|
1199 | CHK_PICK_PICKUP; |
|
|
1200 | continue; |
|
|
1201 | } |
|
|
1202 | |
|
|
1203 | if (op->contr->mode & PU_ARROW) |
|
|
1204 | if (tmp->type == ARROW) |
|
|
1205 | { |
|
|
1206 | CHK_PICK_PICKUP; |
|
|
1207 | continue; |
|
|
1208 | } |
|
|
1209 | |
|
|
1210 | /* all kinds of armor etc. */ |
|
|
1211 | if (op->contr->mode & PU_ARMOUR) |
|
|
1212 | if (tmp->type == ARMOUR) |
|
|
1213 | { |
|
|
1214 | CHK_PICK_PICKUP; |
|
|
1215 | continue; |
|
|
1216 | } |
|
|
1217 | |
|
|
1218 | if (op->contr->mode & PU_HELMET) |
|
|
1219 | if (tmp->type == HELMET) |
|
|
1220 | { |
|
|
1221 | CHK_PICK_PICKUP; |
|
|
1222 | continue; |
|
|
1223 | } |
|
|
1224 | |
|
|
1225 | if (op->contr->mode & PU_SHIELD) |
|
|
1226 | if (tmp->type == SHIELD) |
|
|
1227 | { |
|
|
1228 | CHK_PICK_PICKUP; |
|
|
1229 | continue; |
|
|
1230 | } |
|
|
1231 | |
|
|
1232 | if (op->contr->mode & PU_BOOTS) |
|
|
1233 | if (tmp->type == BOOTS) |
|
|
1234 | { |
|
|
1235 | CHK_PICK_PICKUP; |
|
|
1236 | continue; |
|
|
1237 | } |
|
|
1238 | |
|
|
1239 | if (op->contr->mode & PU_GLOVES) |
|
|
1240 | if (tmp->type == GLOVES) |
|
|
1241 | { |
|
|
1242 | CHK_PICK_PICKUP; |
|
|
1243 | continue; |
|
|
1244 | } |
|
|
1245 | |
|
|
1246 | if (op->contr->mode & PU_CLOAK) |
|
|
1247 | if (tmp->type == CLOAK) |
|
|
1248 | { |
|
|
1249 | CHK_PICK_PICKUP; |
|
|
1250 | continue; |
|
|
1251 | } |
|
|
1252 | |
|
|
1253 | /* hoping to catch throwing daggers here */ |
|
|
1254 | if (op->contr->mode & PU_MISSILEWEAPON) |
|
|
1255 | if (tmp->type == WEAPON && QUERY_FLAG (tmp, FLAG_IS_THROWN)) |
|
|
1256 | { |
|
|
1257 | CHK_PICK_PICKUP; |
|
|
1258 | continue; |
|
|
1259 | } |
|
|
1260 | |
|
|
1261 | /* careful: chairs and tables are weapons! */ |
|
|
1262 | if (op->contr->mode & PU_ALLWEAPON) |
|
|
1263 | { |
1231 | { |
1264 | if (tmp->type == WEAPON && tmp->name != NULL) |
1232 | if (strstr (tmp->arch->archname, "table") == NULL && strstr (tmp->arch->archname, "chair") == NULL) |
1265 | { |
1233 | { |
1266 | if (strstr (tmp->name, "table") == NULL && strstr (tmp->arch->archname, "table") == NULL && |
|
|
1267 | strstr (tmp->name, "chair") && strstr (tmp->arch->archname, "chair") == NULL) |
|
|
1268 | { |
|
|
1269 | CHK_PICK_PICKUP; |
1234 | CHK_PICK_PICKUP; |
1270 | continue; |
1235 | continue; |
1271 | } |
|
|
1272 | } |
|
|
1273 | |
|
|
1274 | if (tmp->type == WEAPON && tmp->name == NULL) |
|
|
1275 | { |
|
|
1276 | if (strstr (tmp->arch->archname, "table") == NULL && strstr (tmp->arch->archname, "chair") == NULL) |
|
|
1277 | { |
|
|
1278 | CHK_PICK_PICKUP; |
|
|
1279 | continue; |
|
|
1280 | } |
|
|
1281 | } |
1236 | } |
1282 | } |
1237 | } |
|
|
1238 | } |
1283 | |
1239 | |
1284 | /* misc stuff that's useful */ |
1240 | /* misc stuff that's useful */ |
1285 | if (op->contr->mode & PU_KEY) |
1241 | if (op->contr->mode & PU_KEY) |
1286 | if (tmp->type == KEY || tmp->type == SPECIAL_KEY) |
1242 | if (tmp->type == KEY || tmp->type == SPECIAL_KEY) |
1287 | { |
1243 | { |
1288 | CHK_PICK_PICKUP; |
1244 | CHK_PICK_PICKUP; |
1289 | continue; |
1245 | continue; |
1290 | } |
1246 | } |
1291 | |
1247 | |
1292 | /* any of the last 4 bits set means we use the ratio for value |
1248 | /* any of the last 4 bits set means we use the ratio for value |
1293 | * pickups */ |
1249 | * pickups */ |
1294 | if (op->contr->mode & PU_RATIO) |
1250 | if (op->contr->mode & PU_RATIO) |
|
|
1251 | { |
|
|
1252 | /* use value density to decide what else to grab */ |
|
|
1253 | /* >=7 was >= op->contr->mode */ |
|
|
1254 | /* >=7 is the old standard setting. Now we take the last 4 bits |
|
|
1255 | */ |
|
|
1256 | wvratio = op->contr->mode & PU_RATIO; |
|
|
1257 | if (1000 * query_cost (tmp, op, F_TRUE) / tmp->total_weight () >= wvratio * 100) |
1295 | { |
1258 | { |
1296 | /* use value density to decide what else to grab */ |
1259 | #if 0 |
1297 | /* >=7 was >= op->contr->mode */ |
1260 | fprintf (stderr, "HIGH WEIGHT/VALUE ["); |
1298 | /* >=7 is the old standard setting. Now we take the last 4 bits |
1261 | if (tmp->name != NULL) |
1299 | */ |
|
|
1300 | wvratio = op->contr->mode & PU_RATIO; |
|
|
1301 | if (1000 * query_cost (tmp, op, F_TRUE) / tmp->total_weight () >= wvratio * 100) |
|
|
1302 | { |
1262 | { |
1303 | CHK_PICK_PICKUP; |
|
|
1304 | #if 0 |
|
|
1305 | fprintf (stderr, "HIGH WEIGHT/VALUE ["); |
|
|
1306 | if (tmp->name != NULL) |
|
|
1307 | { |
|
|
1308 | fprintf (stderr, "%s", tmp->name); |
1263 | fprintf (stderr, "%s", tmp->name); |
1309 | } |
1264 | } |
1310 | else |
1265 | else |
1311 | fprintf (stderr, "%s", tmp->arch->archname); |
1266 | fprintf (stderr, "%s", tmp->arch->archname); |
1312 | fprintf (stderr, ",%d] = ", tmp->type); |
1267 | fprintf (stderr, ",%d] = ", tmp->type); |
1313 | fprintf (stderr, "%d\n", (int) (query_cost (tmp, op, F_TRUE) * 100 / (tmp->weight * MAX (tmp->nrof, 1)))); |
1268 | fprintf (stderr, "%d\n", (int) (query_cost (tmp, op, F_TRUE) * 100 / (tmp->weight * MAX (tmp->nrof, 1)))); |
1314 | #endif |
1269 | #endif |
|
|
1270 | CHK_PICK_PICKUP; |
1315 | continue; |
1271 | continue; |
1316 | } |
|
|
1317 | } |
1272 | } |
1318 | } /* the new pickup model */ |
1273 | } /* the new pickup model */ |
1319 | } |
1274 | } |
1320 | |
1275 | |
1321 | return !stop; |
1276 | return !stop; |