/* * get_item: * Pick something out of a pack for a purpose */ THING * get_item(char *purpose, int type) { THING *obj; char ch; if (pack == NULL) msg("you aren't carrying anything"); else if (again) if (last_pick) return last_pick; else msg("you ran out"); else { for (;;) { if (!terse) addmsg("which object do you want to "); addmsg(purpose); if (terse) addmsg(" what"); msg("? (* for list): "); ch = readchar(); mpos = 0; /* * Give the poor player a chance to abort the command */ if (ch == ESCAPE) { reset_last(); after = FALSE; msg(""); return NULL; } n_objs = 1; /* normal case: person types one char */ if (ch == '*') { mpos = 0; if (inventory(pack, type) == 0) { after = FALSE; return NULL; } continue; } for (obj = pack; obj != NULL; obj = next(obj)) if (obj->o_packch == ch) break; if (obj == NULL) { msg("'%s' is not a valid item",unctrl(ch)); continue; } else return obj; } } return NULL; }
/* * pack_room: * See if there's room in the pack. If not, print out an * appropriate message */ bool pack_room(bool from_floor, THING *obj) { if (++inpack > MAXPACK) { if (!terse) addmsg("there's "); addmsg("no room"); if (!terse) addmsg(" in your pack"); endmsg(); if (from_floor) move_msg(obj); inpack = MAXPACK; return FALSE; } if (from_floor) { detach(lvl_obj, obj); mvaddch(hero.y, hero.x, floor_ch()); chat(hero.y, hero.x) = (proom->r_flags & ISGONE) ? PASSAGE : FLOOR; } return TRUE; }
/* * wield: * Pull out a certain weapon */ void wield(void) { register struct linked_list *item ; register struct object *obj, *oweapon ; oweapon = cur_weapon ; if (!dropcheck(cur_weapon)) { cur_weapon = oweapon ; return ; } cur_weapon = oweapon ; if ((item = get_item("wield", WEAPON)) == NULL) { after = FALSE ; return ; } obj = (struct object *) ldata(item) ; if (obj->o_type != WEAPON) { msg ("You can't wield that!"); return; } if (is_current(obj)) { after = FALSE ; return ; } if (terse) { addmsg("W") ; } else { addmsg("You are now w") ; } msg("ielding %s.", inv_name(obj, TRUE)) ; cur_weapon = obj ; }
void show_floor(void) { struct linked_list *item; struct object *obj; item = find_obj(hero.y, hero.x); if (item != NULL) { addmsg("%s onto ", terse ? "Moved" : "You moved"); obj = OBJPTR(item); if (obj->next_obj != NULL) msg("a stack of things."); else if (obj->o_type == GOLD) msg("%d gold pieces.", obj->o_count); else { addmsg(inv_name(obj, TRUE)); addmsg("."); endmsg(); } } }
/* * wear: * The player wants to wear something, so let him/her put it on. */ void wear() { register THING *obj; register char *sp; if ((obj = get_item("wear", ARMOR)) == NULL) return; if (cur_armor != NULL) { addmsg("you are already wearing some"); if (!terse) addmsg(". You'll have to take it off first"); endmsg(); after = FALSE; return; } if (obj->o_type != ARMOR) { msg("you can't wear that"); return; } waste_time(); obj->o_flags |= ISKNOW; sp = inv_name(obj, TRUE); cur_armor = obj; if (!terse) addmsg("you are now "); msg("wearing %s", sp); }
/* * stomach: * Digest the hero's food */ stomach() { register int oldfood; //MDK_LOG("status: food_left=%d\n", food_left); if (food_left <= 0) { if (food_left-- < -STARVETIME) death('s'); /* * the hero is fainting */ if (no_command || rnd(5) != 0) return; no_command += rnd(8) + 4; player.t_flags &= ~ISRUN; running = FALSE; count = 0; hungry_state = 3; if (on(player, ISTrip)) { if (!terse) addmsg("the munchies overpower your motor capabilities. "); msg("You freak out"); } else { if (!terse) addmsg("you feel too weak from lack of food. "); msg("You faint"); } } else { oldfood = food_left; food_left -= ring_eat(LEFT) + ring_eat(RIGHT) + 1 - amulet; if (food_left < MORETIME && oldfood >= MORETIME) { hungry_state = 2; if (on(player, ISTrip)) msg("the munchies are interfering with your motor capabilites"); else msg("you are starting to feel weak"); } else if (food_left < 2 * MORETIME && oldfood >= 2 * MORETIME) { hungry_state = 1; if (on(player, ISTrip)) { if (!terse) addmsg("you are "); msg("getting the munchies"); } else if (!terse) msg("you are starting to get hungry"); else msg("getting hungry"); } } }
/* * get_item: * pick something out of a pack for a purpose */ struct linked_list * get_item(char *purpose, int type) { struct linked_list *obj; int ch, och; if (pack == NULL) msg("You aren't carrying anything."); else { for (;;) { if (!terse) addmsg("Which object do you want to "); addmsg(purpose); if (terse) addmsg(" what"); msg("? (* for list): "); ch = readchar(cw); mpos = 0; /* * Give the poor player a chance to abort the command */ if (ch == ESCAPE || ch == CTRL('G')) { after = FALSE; msg(""); return NULL; } if (ch == '*') { mpos = 0; if (inventory(pack, type) == 0) { after = FALSE; return NULL; } continue; } for (obj = pack, och = 'a'; obj != NULL; obj = next(obj), och++) if (ch == och) break; if (obj == NULL) { msg("Please specify a letter between 'a' and '%c'", och-1); continue; } else return obj; } } return NULL; }
/* * fall: * Drop an item someplace around here. */ int fall(struct linked_list *item, int pr) { register struct object *obj ; register struct room *rp ; static coord fpos ; int ret; obj = (struct object *) ldata(item) ; rp = roomin(&hero); if (obj->o_flags & CANRETURN) { add_pack(item, TRUE); return TRUE; } else if (fallpos(&obj->o_pos, &fpos, TRUE)) { if (obj->o_flags & CANBURN && ntraps + 1 < MAXTRAPS + MAXTRAPS) { mvaddch(fpos.y, fpos.x, FIRETRAP); traps[ntraps].tr_type = FIRETRAP; traps[ntraps].tr_flags = ISFOUND; traps[ntraps].tr_show = FIRETRAP; traps[ntraps].tr_pos.y = fpos.y; traps[ntraps++].tr_pos.x = fpos.x; if (rp != NULL) rp->r_flags &= ~ISDARK; discard(item); ret = FALSE; } else { mvaddch(fpos.y, fpos.x, obj->o_type) ; obj->o_pos = fpos ; attach(lvl_obj, item) ; ret = TRUE; } if (rp != NULL && (!(rp->r_flags & ISDARK) || (rp->r_flags & HASFIRE))) { light(&hero) ; mvwaddch(cw, hero.y, hero.x, PLAYER) ; } return ret; } if (pr) { if (obj->o_type == WEAPON) addmsg("The %s", weaps[obj->o_which]); else addmsg(inv_name(obj, TRUE)); msg(" vanishes as it hits the ground."); } discard(item) ; return FALSE; }
/* * cut: * Cut the deck and set turnover. Actually, we only ASK the * player what card to turn. We do a random one, anyway. */ int cut(bool mycrib, int pos) { int i; bool win; win = FALSE; if (mycrib) { if (!rflag) { /* random cut */ char *foo; /* This is silly, but we should parse user input, * even if we're not actually going to use it. */ do { msg(quiet ? "Cut the deck? " : "How many cards down do you wish to cut the deck? "); foo = get_line(); if (*foo != '\0' && ((i = atoi(foo)) < 4 || i > 36)) msg("Invalid cut"); else *foo = '\0'; } while (*foo != '\0'); } i = arc4random_uniform(CARDS - pos); turnover = deck[i + pos]; addmsg(quiet ? "You cut " : "You cut the "); msgcard(turnover, FALSE); endmsg(); prcrib(mycrib, FALSE); if (turnover.rank == JACK) { msg("I get two for his heels"); win = chkscr(&cscore, 2); } } else { i = arc4random_uniform(CARDS - pos) + pos; turnover = deck[i]; addmsg(quiet ? "I cut " : "I cut the "); msgcard(turnover, FALSE); endmsg(); prcrib(mycrib, FALSE); if (turnover.rank == JACK) { msg("You get two for his heels"); win = chkscr(&pscore, 2); } } makeknown(&turnover, 1); return (win); }
t_connect *get_other(char *buffer, t_connect **connect) { char *tmp; tmp = buffer; while (ft_strlen(buffer) + SIZE_HEADER > SIZE_TCP) { addmsg(connect, ft_strndup(buffer, SIZE_TCP - SIZE_HEADER), OTHER, SIZE_CONTENT); buffer = buffer + (SIZE_TCP - SIZE_HEADER); } addmsg(connect, ft_strdup(buffer), OTHER, SIZE_CONTENT); free(tmp); return (*connect); }
void move_msg(THING *obj) { if (!terse) addmsg("you "); msg("moved onto %s", inv_name(obj, TRUE)); }
void wield(void) { THING *obj, *oweapon; char *sp; oweapon = cur_weapon; if (!dropcheck(cur_weapon)) { cur_weapon = oweapon; return; } cur_weapon = oweapon; if ((obj = get_item("wield", WEAPON)) == NULL) { bad: after = FALSE; return; } if (obj->o_type == ARMOR) { msg("you can't wield armor"); goto bad; } if (is_current(obj)) goto bad; sp = inv_name(obj, TRUE); cur_weapon = obj; if (!terse) addmsg("you are now "); msg("wielding %s (%c)", sp, obj->o_packch); }
void pack_report(object *obj, int print_message, char *message) { /* Notify the user */ if (print_message) { if (!terse) addmsg(message); msg("(%c%c) %s.", obj->o_type, print_letters[get_ident(obj)], inv_name(obj, !terse)); } if (obj->o_type == ARTIFACT) { has_artifact |= (1 << obj->o_which); picked_artifact |= (1 << obj->o_which); if (!(obj->ar_flags & ISUSED)) { obj->ar_flags |= ISUSED; pstats.s_exp += arts[obj->o_which].ar_worth / 10; check_level(); } } updpack(); return; }
void taunt() { if(player1->state!=CS_ALIVE || player1->physstate<PHYS_SLOPE) return; if(lastmillis-player1->lasttaunt<1000) return; player1->lasttaunt = lastmillis; addmsg(N_TAUNT, "rc", player1); }
bool App::QuickImportProject(DPath folder) { // Quickly makes a project in a folder by importing all resource files and C++ sources. if (!BEntry(folder.GetFullPath()).Exists()) return false; BMessage settings; settings.AddString("name", folder.GetFileName()); settings.AddString("target", folder.GetFileName()); // skipping templatename field on purpose settings.AddInt32("type", PROJECT_GUI); settings.AddString("path", folder.GetFullPath()); settings.AddInt32("scmtype", gDefaultSCM); settings.AddBool("createfolder", false); DPath path(folder); BEntry entry(path.GetFullPath()); Project *proj = CreateNewProject(settings); if (!proj) return false; entry.SetTo(folder.GetFullPath()); entry_ref addref; entry.GetRef(&addref); BMessage addmsg(M_ADD_FILES); addmsg.AddRef("refs",&addref); PostToProjectWindow(&addmsg,NULL); return true; }
/* * msgcrd: * Print the value of a card in ascii */ int msgcrd(CARD c, bool brfrank, char *mid, bool brfsuit) { if (c.rank == EMPTY || c.suit == EMPTY) return (FALSE); if (brfrank) addmsg("%1.1s", rankchar[c.rank]); else addmsg("%s", rankname[c.rank]); if (mid != NULL) addmsg("%s", mid); if (brfsuit) addmsg("%1.1s", suitchar[c.suit]); else addmsg("%s", suitname[c.suit]); return (TRUE); }
void gunselect(int gun, fpsent *d) { if(gun!=d->gunselect) { addmsg(N_GUNSELECT, "rci", d, gun); playsound(S_WEAPLOAD, &d->o); } d->gunselect = gun; }
void money(int value) { purse += value; mvaddch(hero.y, hero.x, floor_ch()); chat(hero.y, hero.x) = (proom->r_flags & ISGONE) ? PASSAGE : FLOOR; if (value > 0) { if (!terse) addmsg("you found "); msg("%d gold pieces", value); } }
/* * take_off: * Get the armor off of the players back */ take_off() { register THING *obj; if ((obj = cur_armor) == NULL) { after = FALSE; if (terse) msg("not wearing armor"); else msg("you aren't wearing any armor"); return; } if (!dropcheck(cur_armor)) return; cur_armor = NULL; if (terse) addmsg("was"); else addmsg("you used to be "); msg(" wearing %c) %s", pack_char(obj), inv_name(obj, TRUE)); }
void wield() { struct linked_list *item; struct object *obj, *oweapon; oweapon = cur_weapon; if (!dropcheck(cur_weapon)) { cur_weapon = oweapon; return; } cur_weapon = oweapon; if ((item = get_item("wield", WEAPON)) == NULL) { bad: after = FALSE; return; } obj = (struct object *) ldata(item); if (obj->o_type == ARMOR) { msg("You can't wield armor"); goto bad; } if (is_current(obj)) goto bad; if (terse) addmsg("W"); else addmsg("You are now w"); msg("ielding %s", inv_name(obj, TRUE)); cur_weapon = obj; }
void checkweaponswitch() { if(!player1->weaponchanging) return; int timeprogress = lastmillis-player1->weaponchanging; if(timeprogress>weapon::weaponchangetime) { addmsg(SV_WEAPCHANGE, "ri", player1->weaponsel->type); player1->weaponchanging = 0; } else if(timeprogress>(weapon::weaponchangetime>>1) && player1->weaponsel != player1->nextweaponsel) { player1->prevweaponsel = player1->weaponsel; player1->weaponsel = player1->nextweaponsel; } }
void respawnself() { if(ispaused()) return; if(m_mp(gamemode)) { int seq = (player1->lifesequence<<16)|((lastmillis/1000)&0xFFFF); if(player1->respawned!=seq) { addmsg(N_TRYSPAWN, "rc", player1); player1->respawned = seq; } } else { spawnplayer(player1); showscores(false); lasthit = 0; if(cmode) cmode->respawned(player1); } }
void ReadKkit::readData( const string& line ) { vector< string > argv; chopLine( line, argv ); if ( argv[0] == "simundump" ) undump( argv ); else if ( argv[0] == "addmsg" ) addmsg( argv ); else if ( argv[0] == "call" ) call( argv ); else if ( argv[0] == "simobjdump" ) objdump( argv ); else if ( argv[0] == "xtextload" ) textload( argv ); else if ( argv[0] == "loadtab" ) loadTab( argv ); }
void respawnself() { if(paused || ispaused()) return; if(m_mp(gamemode)) { if(player1->respawned!=player1->lifesequence) { addmsg(N_TRYSPAWN, "rc", player1); player1->respawned = player1->lifesequence; } } else { spawnplayer(player1); showscores(false); lasthit = 0; if(cmode) cmode->respawned(player1); } }
/* * digest the hero's food */ stomach() { register int oldfood; if (food_left <= 0) { /* * the hero is fainting */ if (no_command || rnd(100) > 20) return; no_command = rnd(8)+4; if (!terse) addmsg("You feel too weak from lack of food. "); msg("You faint"); running = FALSE; count = 0; hungry_state = 3; } else { oldfood = food_left; food_left -= ring_eat(LEFT) + ring_eat(RIGHT) + 1 - amulet; if (food_left < MORETIME && oldfood >= MORETIME) { msg("You are starting to feel weak"); hungry_state = 2; } else if (food_left < 2 * MORETIME && oldfood >= 2 * MORETIME) { if (!terse) msg("You are starting to get hungry"); else msg("Getting hungry"); hungry_state = 1; } } }
void missile(int ydelta, int xdelta, struct linked_list *item, struct thing *tp) { struct object *obj; struct linked_list *nitem; if (item == NULL) /* Get which thing we are hurling */ return; obj = OBJPTR(item); if (!dropcheck(obj) || is_current(obj)) return; /* * Get rid of the thing. If it is a non-multiple item object, or if * it is the last thing, just drop it. Otherwise, create a new item * with a count of one. */ if (obj->o_count < 2) { if (tp->t_pack == pack) rem_pack(obj); else detach(tp->t_pack, item); } else { obj->o_count--; nitem = (struct linked_list *) new_item(sizeof *obj); obj = OBJPTR(nitem); *obj = *(OBJPTR(item)); obj->o_count = 1; item = nitem; } switch (obj->o_type) { case ARTIFACT: has_artifact &= ~(1 << obj->o_which); break; case SCROLL: if (obj->o_which == S_SCARE && obj->o_flags & ISBLESSED) obj->o_flags &= ~ISBLESSED; else obj->o_flags |= ISCURSED; } updpack(); obj->o_pos = do_motion(obj->o_type, ydelta, xdelta, tp); /* * AHA! Here it has hit something. If it is a wall or a door, or if * it misses (combat) the monster, put it on the floor */ if (!hit_monster(obj->o_pos.y, obj->o_pos.x, obj, tp)) { if (obj->o_type == WEAPON && obj->o_which == GRENADE) { hearmsg("BOOOM!"); aggravate(); if (ntraps + 1 < 2 * MAXTRAPS && fallpos(obj->o_pos, &traps[ntraps].tr_pos)) { mvaddch(traps[ntraps].tr_pos.y, traps[ntraps].tr_pos.x, TRAPDOOR); traps[ntraps].tr_type = TRAPDOOR; traps[ntraps].tr_flags = ISFOUND; traps[ntraps].tr_show = TRAPDOOR; ntraps++; light(&hero); } discard(item); } else if (obj->o_flags & ISLOST) { if (obj->o_type == WEAPON) addmsg("The %s", weaps[obj->o_which].w_name); else addmsg(inv_name(obj, LOWERCASE)); msg(" vanishes in a puff of greasy smoke."); discard(item); } else { fall(&player, item, TRUE, TRUE); if (obj->o_flags & CANRETURN) msg("You have %s.", inv_name(obj, LOWERCASE)); } } else if (obj->o_flags & ISOWNED) { add_pack(item, NOMESSAGE); msg("You have %s.", inv_name(obj, LOWERCASE)); } mvwaddch(cw, hero.y, hero.x, PLAYER); }
void fall(struct thing *tp, struct linked_list *item, int pr, int player_owned) { struct object *obj; struct room *rp; coord fpos; obj = OBJPTR(item); rp = roomin(tp->t_pos); if (player_owned && obj->o_flags & CANRETURN) { add_pack(item, NOMESSAGE); msg("You have %s.", inv_name(obj, LOWERCASE)); return; } else if (fallpos(obj->o_pos, &fpos)) { if (obj->o_flags & CANBURN && obj->o_type == WEAPON && obj->o_which == MOLOTOV && ntraps + 1 < 2 * MAXTRAPS) { mvaddch(fpos.y, fpos.x, FIRETRAP); traps[ntraps].tr_type = FIRETRAP; traps[ntraps].tr_flags = ISFOUND; traps[ntraps].tr_show = FIRETRAP; traps[ntraps].tr_pos = fpos; ntraps++; if (rp != NULL) rp->r_flags &= ~ISDARK; } else { obj->o_pos = fpos; add_obj(item, fpos.y, fpos.x); } if (rp != NULL && (!(rp->r_flags & ISDARK) || (rp->r_flags & HASFIRE))) { light(&hero); mvwaddch(cw, hero.y, hero.x, PLAYER); } return; } /* get here only if there isn't a place to put it */ if (pr) { if (cansee(obj->o_pos.y, obj->o_pos.x)) { if (obj->o_type == WEAPON) addmsg("The %s", weaps[obj->o_which].w_name); else addmsg(inv_name(obj, LOWERCASE)); msg(" vanishes as it hits the ground."); } } discard(item); }
int add_pack(struct linked_list *item, int print_message) { struct object *obj, *op; int from_floor; if (item == NULL) { from_floor = TRUE; if ((item = find_obj(hero.y, hero.x)) == NULL) { msg("Nothing to pick up."); return(FALSE); } } else from_floor = FALSE; if (from_floor) { item = get_stack(item); if (!item) return(FALSE); } obj = OBJPTR(item); /* If it is gold, just add its value to rogue's purse and get rid of */ if (obj->o_type == GOLD) { struct linked_list *mitem; struct thing *tp; if (print_message) { if (!terse) addmsg("You found "); msg("%d gold pieces.", obj->o_count); } /* * First make sure no greedy monster is after this gold. If * so, make the monster run after the rogue instead. */ for (mitem = mlist; mitem != NULL; mitem = next(mitem)) { tp = THINGPTR(mitem); if (tp->t_horde==obj) { tp->t_ischasing = TRUE; tp->t_chasee = &player; tp->t_horde = NULL; } } /* * This will cause problems if people are able to drop and * pick up gold, or when GOLDSTEAL monsters are killed. */ /* Thieves get EXP for gold they pick up */ if (player.t_ctype == C_THIEF) { pstats.s_exp += obj->o_count / 4; check_level(); } purse += obj->o_count; if (from_floor) rem_obj(item, TRUE); /* Remove object from the level */ return (TRUE); } /* see if he can carry any more weight */ if (itemweight(obj) + pstats.s_pack > pstats.s_carry) { msg("Too much for you to carry."); if (print_message) { msg("%s onto %s", terse ? "Moved" : "You moved", inv_name(obj, LOWERCASE)); } return(FALSE); } /* * Link it into the pack. If the item can be grouped, try to find its * neighbors and bump the count. A special case is food, which can't * be grouped, but an exact match allows the count to get * incremented. */ if ((op = apply_to_bag(pack, obj->o_type, bff_group, NULL, obj)) != NULL) { op->o_count += obj->o_count; /* add it to the rest */ if (from_floor) rem_obj(item, FALSE); pack_report(op, print_message, "You now have "); return(TRUE); } /* Check for and deal with scare monster scrolls */ if (obj->o_type == SCROLL && obj->o_which == S_SCARE) if (obj->o_flags & ISCURSED) { msg("The scroll turns to dust as you pick it up."); rem_obj(item, TRUE); return(TRUE); } /* Check if there is room */ if (count_bag(pack, obj->o_type, NULL) == max_print()) { msg("You have no room for more %s.", name_type(obj->o_type)); if (print_message) { obj = OBJPTR(item); msg("%s onto %s.", terse ? "Moved" : "You moved", inv_name(obj, LOWERCASE)); } return(FALSE); } /* * finally, add the new item to the bag, and free up the linked list * on top of it. */ if (from_floor) rem_obj(item, FALSE); push_bag(&pack, obj); pack_report(obj, print_message, "You now have "); ur_free(item); return(TRUE); /* signal success */ }
void mode(int n) { addmsg(1, 2, SV_GAMEMODE, nextmode = n); };
/* * add_pack: * Pick up an object and add it to the pack. If the argument is non-null * use it as the linked_list pointer instead of gettting it off the ground. */ void add_pack(struct linked_list *item, int silent) { struct linked_list *ip, *lp; struct object *obj, *op; int exact, from_floor; if (item == NULL) { from_floor = TRUE; if ((item = find_obj(hero.y, hero.x)) == NULL) return; } else from_floor = FALSE; obj = (struct object *) ldata(item); /* * Link it into the pack. Search the pack for a object of similar type * if there isn't one, stuff it at the beginning, if there is, look for one * that is exactly the same and just increment the count if there is. * it that. Food is always put at the beginning for ease of access, but * is not ordered so that you can't tell good food from bad. First check * to see if there is something in thr same group and if there is then * increment the count. */ if (obj->o_group) { for (ip = pack; ip != NULL; ip = next(ip)) { op = (struct object *) ldata(ip); if (op->o_group == obj->o_group) { /* * Put it in the pack and notify the user */ op->o_count++; if (from_floor) { detach(lvl_obj, item); mvaddch(hero.y, hero.x, (roomin(&hero) == NULL ? PASSAGE : FLOOR)); } discard(item); item = ip; goto picked_up; } } } /* * Check if there is room */ if (inpack == MAXPACK-1) { msg("You can't carry anything else."); return; } /* * Check for and deal with scare monster scrolls */ if (obj->o_type == SCROLL && obj->o_which == S_SCARE) if (obj->o_flags & ISFOUND) { msg("The scroll turns to dust as you pick it up."); detach(lvl_obj, item); mvaddch(hero.y, hero.x, FLOOR); return; } else obj->o_flags |= ISFOUND; inpack++; if (from_floor) { detach(lvl_obj, item); mvaddch(hero.y, hero.x, (roomin(&hero) == NULL ? PASSAGE : FLOOR)); } /* * Search for an object of the same type */ exact = FALSE; for (ip = pack; ip != NULL; ip = next(ip)) { op = (struct object *) ldata(ip); if (obj->o_type == op->o_type) break; } if (ip == NULL) { /* * Put it at the end of the pack since it is a new type */ for (ip = pack; ip != NULL; ip = next(ip)) { op = (struct object *) ldata(ip); if (op->o_type != FOOD) break; lp = ip; } } else { /* * Search for an object which is exactly the same */ while (ip != NULL && op->o_type == obj->o_type) { if (op->o_which == obj->o_which) { exact = TRUE; break; } lp = ip; if ((ip = next(ip)) == NULL) break; op = (struct object *) ldata(ip); } } if (ip == NULL) { /* * Didn't find an exact match, just stick it here */ if (pack == NULL) pack = item; else { lp->l_next = item; item->l_prev = lp; item->l_next = NULL; } } else { /* * If we found an exact match. If it is a potion, food, or a * scroll, increase the count, otherwise put it with its clones. */ if (exact && ISMULT(obj->o_type)) { op->o_count++; discard(item); item = ip; goto picked_up; } if ((item->l_prev = prev(ip)) != NULL) item->l_prev->l_next = item; else pack = item; item->l_next = ip; ip->l_prev = item; } picked_up: /* * Notify the user */ obj = (struct object *) ldata(item); if (notify && !silent) { if (!terse) addmsg("You now have "); msg("%s (%c)", inv_name(obj, !terse), pack_char(obj)); } if (obj->o_type == AMULET) amulet = TRUE; }