Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
{
struct mchrstr *mcp = &mchr[ship->shp_type];
coord newx, newy;
{
struct mchrstr *mcp = &mchr[ship->shp_type];
coord newx, newy;
newx = newy = 0;
switch (*key) {
newx = newy = 0;
switch (*key) {
- arg = LIMIT_TO(arg, 0, mcp->m_item[I_CIVIL]);
- ship->shp_item[I_CIVIL] = arg;
- break;
- arg = LIMIT_TO(arg, 0, mcp->m_item[I_MILIT]);
- ship->shp_item[I_MILIT] = arg;
- break;
- arg = LIMIT_TO(arg, 0, mcp->m_item[I_UW]);
- ship->shp_item[I_UW] = arg;
- break;
- arg = LIMIT_TO(arg, 0, mcp->m_item[I_FOOD]);
- ship->shp_item[I_FOOD] = arg;
- break;
- arg = LIMIT_TO(arg, 0, mcp->m_item[I_SHELL]);
- ship->shp_item[I_SHELL] = arg;
- break;
- arg = LIMIT_TO(arg, 0, mcp->m_item[I_GUN]);
- ship->shp_item[I_GUN] = arg;
- break;
- arg = LIMIT_TO(arg, 0, mcp->m_item[I_PETROL]);
- ship->shp_item[I_PETROL] = arg;
- break;
- arg = LIMIT_TO(arg, 0, mcp->m_item[I_IRON]);
- ship->shp_item[I_IRON] = arg;
- break;
- arg = LIMIT_TO(arg, 0, mcp->m_item[I_DUST]);
- ship->shp_item[I_DUST] = arg;
- break;
- arg = LIMIT_TO(arg, 0, mcp->m_item[I_OIL]);
- ship->shp_item[I_OIL] = arg;
- break;
- arg = LIMIT_TO(arg, 0, mcp->m_item[I_LCM]);
- ship->shp_item[I_LCM] = arg;
- break;
- arg = LIMIT_TO(arg, 0, mcp->m_item[I_HCM]);
- ship->shp_item[I_HCM] = arg;
- break;
- arg = LIMIT_TO(arg, 0, mcp->m_item[I_RAD]);
- ship->shp_item[I_RAD] = arg;
+ ip = item_by_name(key);
+ arg = LIMIT_TO(arg, 0, mchr[ship->shp_type].m_item[ip->i_uid]);
+ ship->shp_item[ip->i_uid] = arg;
break;
default:
pr("huh? (%s)\n", key);
break;
default:
pr("huh? (%s)\n", key);
{
struct lchrstr *lcp = &lchr[land->lnd_type];
coord newx, newy;
{
struct lchrstr *lcp = &lchr[land->lnd_type];
coord newx, newy;
newx = newy = 0;
switch (*key) {
newx = newy = 0;
switch (*key) {
land->lnd_rflags = arg;
break;
case 'c':
land->lnd_rflags = arg;
break;
case 'c':
- arg = LIMIT_TO(arg, 0, lcp->l_item[I_CIVIL]);
- land->lnd_item[I_CIVIL] = arg;
- break;
- arg = LIMIT_TO(arg, 0, lcp->l_item[I_MILIT]);
- land->lnd_item[I_MILIT] = arg;
- break;
- arg = LIMIT_TO(arg, 0, lcp->l_item[I_UW]);
- land->lnd_item[I_UW] = arg;
- break;
- arg = LIMIT_TO(arg, 0, lcp->l_item[I_FOOD]);
- land->lnd_item[I_FOOD] = arg;
- break;
- arg = LIMIT_TO(arg, 0, lcp->l_item[I_SHELL]);
- land->lnd_item[I_SHELL] = arg;
- break;
- arg = LIMIT_TO(arg, 0, lcp->l_item[I_GUN]);
- land->lnd_item[I_GUN] = arg;
- break;
- arg = LIMIT_TO(arg, 0, lcp->l_item[I_PETROL]);
- land->lnd_item[I_PETROL] = arg;
- break;
- arg = LIMIT_TO(arg, 0, lcp->l_item[I_IRON]);
- land->lnd_item[I_IRON] = arg;
- break;
- arg = LIMIT_TO(arg, 0, lcp->l_item[I_DUST]);
- land->lnd_item[I_DUST] = arg;
- break;
- arg = LIMIT_TO(arg, 0, lcp->l_item[I_OIL]);
- land->lnd_item[I_OIL] = arg;
- break;
- arg = LIMIT_TO(arg, 0, lcp->l_item[I_LCM]);
- land->lnd_item[I_LCM] = arg;
- break;
- arg = LIMIT_TO(arg, 0, lcp->l_item[I_HCM]);
- land->lnd_item[I_HCM] = arg;
- break;
- arg = LIMIT_TO(arg, 0, lcp->l_item[I_RAD]);
- land->lnd_item[I_RAD] = arg;
+ ip = item_by_name(key);
+ arg = LIMIT_TO(arg, 0, lchr[land->lnd_type].l_item[ip->i_uid]);
+ land->lnd_item[ip->i_uid] = arg;
break;
default:
pr("huh? (%s)\n", key);
break;
default:
pr("huh? (%s)\n", key);