create the indicated number (num) of monster-players, * randomly chosen, and in randomly chosen (free) locations * on the level. If "special", the size of num should not * be bigger than the number of _non-repeated_ names in the * developers array, otherwise a bunch of Adams and Eves will * fill up the overflow. */
| 324 | * fill up the overflow. |
| 325 | */ |
| 326 | void |
| 327 | create_mplayers(int num, boolean special) |
| 328 | { |
| 329 | int pm, x, y; |
| 330 | struct monst fakemon; |
| 331 | |
| 332 | fakemon = cg.zeromonst; |
| 333 | while (num) { |
| 334 | int tryct = 0; |
| 335 | |
| 336 | /* roll for character class */ |
| 337 | pm = rn1(PM_WIZARD - PM_ARCHEOLOGIST + 1, PM_ARCHEOLOGIST); |
| 338 | set_mon_data(&fakemon, &mons[pm]); |
| 339 | |
| 340 | /* roll for an available location */ |
| 341 | do { |
| 342 | x = rn1(COLNO - 4, 2); |
| 343 | y = rnd(ROWNO - 2); |
| 344 | } while (!goodpos(x, y, &fakemon, 0) && tryct++ <= 50); |
| 345 | |
| 346 | /* if pos not found in 50 tries, don't bother to continue */ |
| 347 | if (tryct > 50) |
| 348 | return; |
| 349 | |
| 350 | (void) mk_mplayer(&mons[pm], (coordxy) x, (coordxy) y, special); |
| 351 | num--; |
| 352 | } |
| 353 | } |
| 354 | |
| 355 | void |
| 356 | mplayer_talk(struct monst *mtmp) |
no test coverage detected