Minor refactoring of function names.

This commit is contained in:
Martin Haye 2017-04-25 07:30:45 -07:00
parent cc8fa3bb7d
commit 824d5aadbe

View File

@ -40,10 +40,10 @@ const STATS_COL_2 = 140
// Exported functions go here. First a predef for each one, then a table with function pointers // Exported functions go here. First a predef for each one, then a table with function pointers
// in the same order as the constants are defined in the header. // in the same order as the constants are defined in the header.
predef _party_doPlayerSheet, _party_benchPlayer, _party_unbenchPlayer predef _doPlayerSheet, _benchPlayer, _unbenchPlayer
predef _party_displayItemStats, _party_displayItemName predef _displayItemStats, _displayItemName
word[] funcTbl = @_party_doPlayerSheet, @_party_benchPlayer, @_party_unbenchPlayer word[] funcTbl = @_doPlayerSheet, @_benchPlayer, @_unbenchPlayer
word = @_party_displayItemStats, @_party_displayItemName word = @_displayItemStats, @_displayItemName
// Other global variables here // Other global variables here
@ -141,12 +141,7 @@ def showInventory(player, page, rows, select)
s_item++ s_item++
fin fin
rawDisplayf1("^T%D", CHAR_WND_INV_X) rawDisplayf1("^T%D", CHAR_WND_INV_X)
setPlural(FALSE) _displayItemName(item)
if item->t_type == TYPE_STUFF
displayf1("%d ", item=>w_count)
if item=>w_count > 1; setPlural(TRUE); fin
fin
displayf1("%s", item=>s_name) // use displayf to get proper plural processing
if item->t_type == TYPE_WEAPON or item->t_type == TYPE_ARMOR if item->t_type == TYPE_WEAPON or item->t_type == TYPE_ARMOR
if item->b_flags & ITEM_FLAG_EQUIP if item->b_flags & ITEM_FLAG_EQUIP
displayStr(" *") displayStr(" *")
@ -346,11 +341,14 @@ end
// Show player sheet and accept command. If using an item (not just for stats gain) // Show player sheet and accept command. If using an item (not just for stats gain)
// the item is returned; else NULL is returned. // the item is returned; else NULL is returned.
def _party_doPlayerSheet(num) def _doPlayerSheet(num)
word player, item word player, item
word hMap, vMap, i_rows word hMap, vMap, i_rows
byte i_page, redisplay byte i_page, redisplay
setOversizeWindow()
clearWindow()
// Get size of inventory pane in chars // Get size of inventory pane in chars
getMapWindow(@hMap, @vMap) getMapWindow(@hMap, @vMap)
i_rows = (vMap / 9) - 3 // 9 rows per line; minus 3 lines for header/footer i_rows = (vMap / 9) - 3 // 9 rows per line; minus 3 lines for header/footer
@ -468,7 +466,7 @@ end
/////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////
// Allow user to select an active player, and put them on the bench // Allow user to select an active player, and put them on the bench
def _party_benchPlayer() def _benchPlayer()
word player word player
player = selectPlayer(global=>p_players) player = selectPlayer(global=>p_players)
if player if player
@ -480,7 +478,7 @@ end
/////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////
// Allow user to select a benched player, and put them on the bench // Allow user to select a benched player, and put them on the bench
def _party_unbenchPlayer() def _unbenchPlayer()
word player word player
if countList(global=>p_players) == MAX_PARTY if countList(global=>p_players) == MAX_PARTY
displayStr("Party too large.") displayStr("Party too large.")
@ -586,7 +584,7 @@ def displayStuffStats(pItem1, pItem2)
end end
/////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////
def _party_displayItemStats(pItem1, pItem2) def _displayItemStats(pItem1, pItem2)
word pMod1, pMod2 word pMod1, pMod2
// First, show the item type and name // First, show the item type and name
@ -597,10 +595,10 @@ def _party_displayItemStats(pItem1, pItem2)
is TYPE_STUFF; rawDisplayStr("\nSupply"); break is TYPE_STUFF; rawDisplayStr("\nSupply"); break
otherwise fatal("tItem") otherwise fatal("tItem")
wend wend
tabTo(STATS_COL_1); _party_displayItemName(pItem1) tabTo(STATS_COL_1); _displayItemName(pItem1)
if pItem2 if pItem2
if pItem1->t_type <> pItem2->t_type; fatal("tMatch"); fin if pItem1->t_type <> pItem2->t_type; fatal("tMatch"); fin
tabTo(STATS_COL_2); _party_displayItemName(pItem2) tabTo(STATS_COL_2); _displayItemName(pItem2)
fin fin
// Type-specific attributes // Type-specific attributes
@ -630,11 +628,14 @@ def _party_displayItemStats(pItem1, pItem2)
end end
/////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////
def _party_displayItemName(pItem) // For non-countable items, display singular name.
setPlural(FALSE) // For countable "stuff" (e.g. ammo), display the count and appropriate singular or plural name.
if pItem->t_type == TYPE_STUFF; setPlural(pItem=>w_count <> 1); fin def _displayItemName(pItem)
if pItem=>w_count >= 1 if pItem->t_type == TYPE_STUFF
setPlural(pItem=>w_count <> 1)
rawDisplayf1("%d ", pItem=>w_count) rawDisplayf1("%d ", pItem=>w_count)
else
setPlural(FALSE)
fin fin
rawDisplayf1("%s", pItem=>s_name) // use displayf to get proper plural processing rawDisplayf1("%s", pItem=>s_name) // use displayf to get proper plural processing
end end