… | |
… | |
1169 | */ |
1169 | */ |
1170 | void |
1170 | void |
1171 | init_artifacts () |
1171 | init_artifacts () |
1172 | { |
1172 | { |
1173 | static int has_been_inited = 0; |
1173 | static int has_been_inited = 0; |
1174 | char filename[MAX_BUF]; |
|
|
1175 | artifact *art = NULL; |
1174 | artifact *art = NULL; |
1176 | artifactlist *al; |
1175 | artifactlist *al; |
1177 | |
1176 | |
1178 | if (has_been_inited) |
1177 | if (has_been_inited) |
1179 | return; |
1178 | return; |
1180 | else |
1179 | else |
1181 | has_been_inited = 1; |
1180 | has_been_inited = 1; |
1182 | |
1181 | |
1183 | sprintf (filename, "%s/artifacts", settings.datadir); |
1182 | object_thawer f (settings.datadir, "artifacts"); |
1184 | object_thawer f (filename); |
|
|
1185 | |
1183 | |
1186 | if (!f) |
1184 | if (!f) |
1187 | return; |
1185 | return; |
1188 | |
1186 | |
1189 | for (;;) |
1187 | for (;;) |
… | |
… | |
1274 | } |
1272 | } |
1275 | #if 0 |
1273 | #if 0 |
1276 | LOG (llevDebug, "Artifact list type %d has %d total chance\n", al->type, al->total_chance); |
1274 | LOG (llevDebug, "Artifact list type %d has %d total chance\n", al->type, al->total_chance); |
1277 | #endif |
1275 | #endif |
1278 | } |
1276 | } |
1279 | |
|
|
1280 | LOG (llevDebug, "done.\n"); |
|
|
1281 | } |
1277 | } |
1282 | |
1278 | |
1283 | /* |
1279 | /* |
1284 | * Used in artifact generation. The bonuses of the first object |
1280 | * Used in artifact generation. The bonuses of the first object |
1285 | * is modified by the bonuses of the second object. |
1281 | * is modified by the bonuses of the second object. |
1286 | */ |
1282 | */ |
1287 | void |
1283 | void |
1288 | add_abilities (object *op, object *change) |
1284 | add_abilities (object *op, object *change) |
1289 | { |
1285 | { |
1290 | if (change->face != blank_face) |
1286 | if (change->face != blank_face) |
1291 | { |
|
|
1292 | #ifdef TREASURE_VERBOSE |
|
|
1293 | LOG (llevDebug, "add_abilities change face: %d\n", change->face); |
|
|
1294 | #endif |
|
|
1295 | op->face = change->face; |
1287 | op->face = change->face; |
1296 | } |
|
|
1297 | |
1288 | |
1298 | for (int i = 0; i < NUM_STATS; i++) |
1289 | for (int i = 0; i < NUM_STATS; i++) |
1299 | change_attr_value (&(op->stats), i, change->stats.stat (i)); |
1290 | change_attr_value (&(op->stats), i, change->stats.stat (i)); |
1300 | |
1291 | |
1301 | op->attacktype |= change->attacktype; |
1292 | op->attacktype |= change->attacktype; |