… | |
… | |
5 | * the artifact could be created. |
5 | * the artifact could be created. |
6 | */ |
6 | */ |
7 | int |
7 | int |
8 | create_artifact (object *op, const char *artifactname) |
8 | create_artifact (object *op, const char *artifactname) |
9 | { |
9 | { |
10 | artifactlist *al; |
10 | if (artifactlist *al = find_artifactlist (op->type)) |
11 | artifact *art; |
11 | for (artifact *art = al->items; art; art = art->next) |
12 | char *temptitle; |
12 | { |
|
|
13 | char *temptitle = (char *)(malloc (strlen (art->item->name) + 5)); |
|
|
14 | strcpy (temptitle, " of "); |
|
|
15 | strcat (temptitle, art->item->name); |
13 | |
16 | |
14 | al = find_artifactlist (op->type); |
|
|
15 | if (al == NULL) |
|
|
16 | return 0; |
|
|
17 | for (art = al->items; art != NULL; art = art->next) |
|
|
18 | { |
|
|
19 | temptitle = (char *) (malloc (strlen (art->item->name) + 5)); |
|
|
20 | strcpy (temptitle, " of "); |
|
|
21 | strcat (temptitle, art->item->name); |
|
|
22 | if (!strcmp (temptitle, artifactname)) |
17 | if (!strcmp (temptitle, artifactname)) |
23 | { |
18 | { |
|
|
19 | free (temptitle); |
24 | give_artifact_abilities (op, art->item); |
20 | give_artifact_abilities (op, art->item); |
25 | free (temptitle); |
|
|
26 | return 1; |
21 | return 1; |
27 | } |
22 | } |
28 | |
23 | |
29 | free (temptitle); |
24 | free (temptitle); |
30 | }; |
25 | }; |
|
|
26 | |
31 | return 0; |
27 | return 0; |
32 | } |
28 | } |
33 | |
29 | |
34 | /* peterm: do_power_crystal |
30 | /* peterm: do_power_crystal |
35 | |
31 | |