| 1851 | } |
| 1852 | |
| 1853 | void |
| 1854 | deliver_obj_to_mon(struct monst *mtmp, int cnt, unsigned long deliverflags) |
| 1855 | { |
| 1856 | struct obj *otmp, *otmp2; |
| 1857 | int where, maxobj = 1; |
| 1858 | boolean at_crime_scene = In_mines(&u.uz); |
| 1859 | |
| 1860 | if ((deliverflags & DF_RANDOM) && cnt > 1) |
| 1861 | maxobj = rnd(cnt); |
| 1862 | else if (deliverflags & DF_ALL) |
| 1863 | maxobj = 0; |
| 1864 | else |
| 1865 | maxobj = 1; |
| 1866 | |
| 1867 | #define DELIVER_PM (M2_UNDEAD | M2_WERE | M2_HUMAN | M2_ELF | M2_DWARF \ |
| 1868 | | M2_GNOME | M2_ORC | M2_DEMON | M2_GIANT) |
| 1869 | |
| 1870 | cnt = 0; |
| 1871 | for (otmp = gm.migrating_objs; otmp; otmp = otmp2) { |
| 1872 | otmp2 = otmp->nobj; |
| 1873 | where = (int) (otmp->owornmask & 0x7fffL); /* destination code */ |
| 1874 | if ((where & MIGR_TO_SPECIES) == 0) |
| 1875 | continue; |
| 1876 | |
| 1877 | if (otmp->migr_species != NON_PM |
| 1878 | && ((mtmp->data->mflags2 & DELIVER_PM) |
| 1879 | == (unsigned) otmp->migr_species)) { |
| 1880 | obj_extract_self(otmp); |
| 1881 | otmp->owornmask = 0L; |
| 1882 | otmp->ox = otmp->oy = 0; |
| 1883 | |
| 1884 | /* special treatment for orcs and their kind */ |
| 1885 | if ((otmp->corpsenm & M2_ORC) != 0 && has_oname(otmp)) { |
| 1886 | if (!has_mgivenname(mtmp)) { |
| 1887 | if (at_crime_scene || !rn2(2)) |
| 1888 | mtmp = christen_orc(mtmp, |
| 1889 | at_crime_scene ? ONAME(otmp) |
| 1890 | : (char *) 0, |
| 1891 | /* bought the stolen goods */ |
| 1892 | " the Fence"); |
| 1893 | } |
| 1894 | free_oname(otmp); |
| 1895 | } |
| 1896 | otmp->migr_species = NON_PM; |
| 1897 | otmp->omigr_from_dnum = 0; |
| 1898 | otmp->omigr_from_dlevel = 0; |
| 1899 | (void) add_to_minv(mtmp, otmp); |
| 1900 | cnt++; |
| 1901 | if (maxobj && cnt >= maxobj) |
| 1902 | break; |
| 1903 | /* getting here implies DF_ALL */ |
| 1904 | } |
| 1905 | } |
| 1906 | } |
| 1907 | |
| 1908 | staticfn void |
| 1909 | otransit_msg(struct obj *otmp, boolean nodrop, boolean chainthere, long num) |
no test coverage detected