File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -53,10 +53,18 @@ struct TownerData {
5353 */
5454const 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
You can’t perform that action at this time.
0 commit comments