Learn a spell during creation of the initial inventory */
| 2337 | |
| 2338 | /* Learn a spell during creation of the initial inventory */ |
| 2339 | void |
| 2340 | initialspell(struct obj *obj) |
| 2341 | { |
| 2342 | int i, otyp = obj->otyp; |
| 2343 | |
| 2344 | for (i = 0; i < MAXSPELL; i++) |
| 2345 | if (spellid(i) == NO_SPELL || spellid(i) == otyp) |
| 2346 | break; |
| 2347 | |
| 2348 | if (i == MAXSPELL) { |
| 2349 | impossible("Too many spells memorized!"); |
| 2350 | } else if (spellid(i) != NO_SPELL) { |
| 2351 | /* initial inventory shouldn't contain duplicate spellbooks */ |
| 2352 | impossible("Spell %s already known.", OBJ_NAME(objects[otyp])); |
| 2353 | } else { |
| 2354 | svs.spl_book[i].sp_id = otyp; |
| 2355 | svs.spl_book[i].sp_lev = objects[otyp].oc_level; |
| 2356 | incrnknow(i, 0); |
| 2357 | } |
| 2358 | return; |
| 2359 | } |
| 2360 | |
| 2361 | /* returns one of spe_Unknown, spe_Fresh, spe_GoingStale, spe_Forgotten */ |
| 2362 | int |
no test coverage detected