Skip to content

Commit c66015c

Browse files
committed
Fix build
1 parent 6beef8e commit c66015c

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

Source/towners.cpp

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,18 @@ struct TownerData {
5353
*/
5454
const TownerData *TownerBehaviors[NUM_TOWNER_TYPES];
5555

56+
/**
57+
* @brief Default towner initialization using TSV data.
58+
*
59+
* Sets up animation, gossip texts, and other properties from the TSV entry.
60+
* Used for most towners; special cases (cows, cow farmer) have custom init functions.
61+
*/
62+
void InitTownerFromData(Towner &towner, const TownerDataEntry &entry);
63+
5664
/**
5765
* @brief Finds the towner data entry from TSV for a given type.
5866
*/
59-
const TownerDataEntry *FindTownerDataEntry(_talker_id type, Point position = {})
67+
[[maybe_unused]] const TownerDataEntry *FindTownerDataEntry(_talker_id type, Point position = {})
6068
{
6169
for (const auto &entry : TownersDataEntries) {
6270
if (entry.type == type) {
@@ -131,7 +139,8 @@ void InitTownerFromData(Towner &towner, const TownerDataEntry &entry)
131139

132140
// Set gossip from TSV data
133141
if (!entry.gossipTexts.empty()) {
134-
towner.gossip = PickRandomlyAmong(entry.gossipTexts);
142+
const auto index = std::max<int32_t>(GenerateRnd(static_cast<int32_t>(entry.gossipTexts.size())), 0);
143+
towner.gossip = entry.gossipTexts[index];
135144
}
136145
}
137146

0 commit comments

Comments
 (0)