… | |
… | |
1272 | |
1272 | |
1273 | strcat (buf, msg); |
1273 | strcat (buf, msg); |
1274 | strcat (buf, "\n"); /* new msg needs a LF */ |
1274 | strcat (buf, "\n"); /* new msg needs a LF */ |
1275 | if (item->nrof > 1) |
1275 | if (item->nrof > 1) |
1276 | { |
1276 | { |
1277 | newBook = get_object (); |
1277 | newBook = object::create (); |
1278 | copy_object (item, newBook); |
1278 | item->copy_to (newBook); |
1279 | decrease_ob (item); |
1279 | decrease_ob (item); |
1280 | esrv_send_item (pl, item); |
1280 | esrv_send_item (pl, item); |
1281 | newBook->nrof = 1; |
1281 | newBook->nrof = 1; |
1282 | newBook->msg = buf; |
1282 | newBook->msg = buf; |
1283 | newBook = insert_ob_in_ob (newBook, pl); |
1283 | newBook = insert_ob_in_ob (newBook, pl); |
… | |
… | |
1358 | |
1358 | |
1359 | if (random_roll (0, chosen_spell->level * 4 - 1, pl, PREFER_LOW) < skill->level) |
1359 | if (random_roll (0, chosen_spell->level * 4 - 1, pl, PREFER_LOW) < skill->level) |
1360 | { |
1360 | { |
1361 | if (scroll->nrof > 1) |
1361 | if (scroll->nrof > 1) |
1362 | { |
1362 | { |
1363 | newscroll = get_object (); |
1363 | newscroll = object::create (); |
1364 | copy_object (scroll, newscroll); |
1364 | scroll->copy_to (newscroll); |
1365 | decrease_ob (scroll); |
1365 | decrease_ob (scroll); |
1366 | newscroll->nrof = 1; |
1366 | newscroll->nrof = 1; |
1367 | } |
1367 | } |
1368 | else |
1368 | else |
1369 | { |
1369 | { |
… | |
… | |
1384 | newscroll->level = MAX (skill->level, chosen_spell->level); |
1384 | newscroll->level = MAX (skill->level, chosen_spell->level); |
1385 | new_draw_info (NDI_UNIQUE, 0, pl, "In your confused state, you write down some odd spell."); |
1385 | new_draw_info (NDI_UNIQUE, 0, pl, "In your confused state, you write down some odd spell."); |
1386 | } |
1386 | } |
1387 | |
1387 | |
1388 | if (newscroll->inv) |
1388 | if (newscroll->inv) |
1389 | { |
|
|
1390 | object *ninv; |
|
|
1391 | |
|
|
1392 | ninv = newscroll->inv; |
|
|
1393 | ninv->remove (); |
|
|
1394 | ninv->destroy (0); |
1389 | newscroll->inv->destroy (); |
1395 | } |
1390 | |
1396 | tmp = get_object (); |
1391 | tmp = object::create (); |
1397 | copy_object (chosen_spell, tmp); |
1392 | chosen_spell->copy_to (tmp); |
1398 | insert_ob_in_ob (tmp, newscroll); |
1393 | insert_ob_in_ob (tmp, newscroll); |
1399 | |
1394 | |
1400 | /* Same code as from treasure.c - so they can better merge. |
1395 | /* Same code as from treasure.c - so they can better merge. |
1401 | * if players want to sell them, so be it. |
1396 | * if players want to sell them, so be it. |
1402 | */ |
1397 | */ |
… | |
… | |
1603 | object *toss_item; |
1598 | object *toss_item; |
1604 | |
1599 | |
1605 | if (!orig) |
1600 | if (!orig) |
1606 | return NULL; |
1601 | return NULL; |
1607 | |
1602 | |
1608 | toss_item = get_object (); |
1603 | toss_item = object::create (); |
1609 | if (QUERY_FLAG (orig, FLAG_APPLIED)) |
1604 | if (QUERY_FLAG (orig, FLAG_APPLIED)) |
1610 | { |
1605 | { |
1611 | LOG (llevError, "BUG: make_throw_ob(): ob is applied\n"); |
1606 | LOG (llevError, "BUG: make_throw_ob(): ob is applied\n"); |
1612 | /* insufficient workaround, but better than nothing */ |
1607 | /* insufficient workaround, but better than nothing */ |
1613 | CLEAR_FLAG (orig, FLAG_APPLIED); |
1608 | CLEAR_FLAG (orig, FLAG_APPLIED); |
1614 | } |
1609 | } |
1615 | copy_object (orig, toss_item); |
1610 | orig->copy_to (toss_item); |
1616 | toss_item->type = THROWN_OBJ; |
1611 | toss_item->type = THROWN_OBJ; |
1617 | CLEAR_FLAG (toss_item, FLAG_CHANGING); |
1612 | CLEAR_FLAG (toss_item, FLAG_CHANGING); |
1618 | toss_item->stats.dam = 0; /* default damage */ |
1613 | toss_item->stats.dam = 0; /* default damage */ |
1619 | insert_ob_in_ob (orig, toss_item); |
1614 | insert_ob_in_ob (orig, toss_item); |
1620 | return toss_item; |
1615 | return toss_item; |