… | |
… | |
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 = object::create (); |
1277 | newBook = item->clone (); |
1278 | item->copy_to (newBook); |
|
|
1279 | decrease_ob (item); |
1278 | decrease_ob (item); |
1280 | esrv_send_item (pl, item); |
1279 | esrv_send_item (pl, item); |
1281 | newBook->nrof = 1; |
1280 | newBook->nrof = 1; |
1282 | newBook->msg = buf; |
1281 | newBook->msg = buf; |
1283 | newBook = insert_ob_in_ob (newBook, pl); |
1282 | newBook = insert_ob_in_ob (newBook, pl); |
… | |
… | |
1358 | |
1357 | |
1359 | if (random_roll (0, chosen_spell->level * 4 - 1, pl, PREFER_LOW) < skill->level) |
1358 | if (random_roll (0, chosen_spell->level * 4 - 1, pl, PREFER_LOW) < skill->level) |
1360 | { |
1359 | { |
1361 | if (scroll->nrof > 1) |
1360 | if (scroll->nrof > 1) |
1362 | { |
1361 | { |
1363 | newscroll = object::create (); |
1362 | newscroll = scroll->clone (); |
1364 | scroll->copy_to (newscroll); |
|
|
1365 | decrease_ob (scroll); |
1363 | decrease_ob (scroll); |
1366 | newscroll->nrof = 1; |
1364 | newscroll->nrof = 1; |
1367 | } |
1365 | } |
1368 | else |
1366 | else |
1369 | { |
1367 | { |
… | |
… | |
1386 | } |
1384 | } |
1387 | |
1385 | |
1388 | if (newscroll->inv) |
1386 | if (newscroll->inv) |
1389 | newscroll->inv->destroy (); |
1387 | newscroll->inv->destroy (); |
1390 | |
1388 | |
1391 | tmp = object::create (); |
|
|
1392 | chosen_spell->copy_to (tmp); |
1389 | tmp = chosen_spell->clone (); |
1393 | insert_ob_in_ob (tmp, newscroll); |
1390 | insert_ob_in_ob (tmp, newscroll); |
1394 | |
1391 | |
1395 | /* Same code as from treasure.c - so they can better merge. |
1392 | /* Same code as from treasure.c - so they can better merge. |
1396 | * if players want to sell them, so be it. |
1393 | * if players want to sell them, so be it. |
1397 | */ |
1394 | */ |
… | |
… | |
1593 | */ |
1590 | */ |
1594 | |
1591 | |
1595 | static object * |
1592 | static object * |
1596 | make_throw_ob (object *orig) |
1593 | make_throw_ob (object *orig) |
1597 | { |
1594 | { |
1598 | object *toss_item; |
|
|
1599 | |
|
|
1600 | if (!orig) |
1595 | if (!orig) |
1601 | return NULL; |
1596 | return NULL; |
1602 | |
1597 | |
1603 | toss_item = object::create (); |
|
|
1604 | if (QUERY_FLAG (orig, FLAG_APPLIED)) |
1598 | if (QUERY_FLAG (orig, FLAG_APPLIED)) |
1605 | { |
1599 | { |
1606 | LOG (llevError, "BUG: make_throw_ob(): ob is applied\n"); |
1600 | LOG (llevError, "BUG: make_throw_ob(): ob is applied\n"); |
1607 | /* insufficient workaround, but better than nothing */ |
1601 | /* insufficient workaround, but better than nothing */ |
1608 | CLEAR_FLAG (orig, FLAG_APPLIED); |
1602 | CLEAR_FLAG (orig, FLAG_APPLIED); |
1609 | } |
1603 | } |
1610 | orig->copy_to (toss_item); |
1604 | |
|
|
1605 | object *toss_item = orig->clone (); |
|
|
1606 | |
1611 | toss_item->type = THROWN_OBJ; |
1607 | toss_item->type = THROWN_OBJ; |
1612 | CLEAR_FLAG (toss_item, FLAG_CHANGING); |
1608 | CLEAR_FLAG (toss_item, FLAG_CHANGING); |
1613 | toss_item->stats.dam = 0; /* default damage */ |
1609 | toss_item->stats.dam = 0; /* default damage */ |
1614 | insert_ob_in_ob (orig, toss_item); |
1610 | insert_ob_in_ob (orig, toss_item); |
1615 | return toss_item; |
1611 | return toss_item; |