edit: Implement editing bars on ships and land units
The edit command doesn't support editing bars on ships and land units. Has always been that way. The stock game's ships have always been unable to load bars. Not the case for land units. Unfortunately, the obvious key 'b' for bars was burned on plague time in 4.0.17. Use key 'B' instead. Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
This commit is contained in:
parent
647dc66a40
commit
16e565ed5f
4 changed files with 42 additions and 19 deletions
|
@ -267,9 +267,9 @@ print_plane(struct plnstr *plane)
|
|||
static void
|
||||
print_items(short item[])
|
||||
{
|
||||
pr(" civ mil uw food sh gun pet iron dust oil lcm hcm rad\n"
|
||||
" c m u f s g p i d o l h r\n"
|
||||
"%5d%5d%5d%5d%5d%5d%5d%5d%5d%5d%5d%5d%5d\n",
|
||||
pr(" civ mil uw food sh gun pet iron dust bar oil lcm hcm rad\n"
|
||||
" c m u f s g p i d B o l h r\n"
|
||||
"%5d%5d%5d%5d%5d%5d%5d%5d%5d%5d%5d%5d%5d%5d\n",
|
||||
item[I_CIVIL],
|
||||
item[I_MILIT],
|
||||
item[I_UW],
|
||||
|
@ -279,6 +279,7 @@ print_items(short item[])
|
|||
item[I_PETROL],
|
||||
item[I_IRON],
|
||||
item[I_DUST],
|
||||
item[I_BAR],
|
||||
item[I_OIL],
|
||||
item[I_LCM],
|
||||
item[I_HCM],
|
||||
|
@ -849,6 +850,17 @@ edit_item(struct empobj *unit, short item[], struct ichrstr *ip, int arg,
|
|||
item[ip->i_uid] = arg;
|
||||
}
|
||||
|
||||
static void
|
||||
edit_unit_item(struct empobj *unit, short item[], char *key, int arg,
|
||||
short lim[])
|
||||
{
|
||||
char lowkey[2];
|
||||
|
||||
lowkey[0] = tolower(*key);
|
||||
lowkey[1] = 0;
|
||||
edit_item(unit, item, item_by_name(lowkey), arg, lim);
|
||||
}
|
||||
|
||||
static void
|
||||
limit_item(struct empobj *unit, short item[], short lim[])
|
||||
{
|
||||
|
@ -934,12 +946,13 @@ edit_ship(struct shpstr *ship, char *key, char *p)
|
|||
case 'p':
|
||||
case 'i':
|
||||
case 'd':
|
||||
case 'B':
|
||||
case 'o':
|
||||
case 'l':
|
||||
case 'h':
|
||||
case 'r':
|
||||
edit_item((struct empobj *)ship, ship->shp_item, item_by_name(key),
|
||||
arg, mcp->m_item);
|
||||
edit_unit_item((struct empobj *)ship, ship->shp_item, key, arg,
|
||||
mcp->m_item);
|
||||
break;
|
||||
default:
|
||||
pr("huh? (%s)\n", key);
|
||||
|
@ -1065,12 +1078,13 @@ edit_land(struct lndstr *land, char *key, char *p)
|
|||
case 'p':
|
||||
case 'i':
|
||||
case 'd':
|
||||
case 'B':
|
||||
case 'o':
|
||||
case 'l':
|
||||
case 'h':
|
||||
case 'r':
|
||||
edit_item((struct empobj *)land, land->lnd_item, item_by_name(key),
|
||||
arg, lcp->l_item);
|
||||
edit_unit_item((struct empobj *)land, land->lnd_item, key, arg,
|
||||
lcp->l_item);
|
||||
break;
|
||||
default:
|
||||
pr("huh? (%s)\n", key);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue