MCPcopy Create free account
hub / github.com/TurningWheel/Barony / getCalloutMessage

Method getCalloutMessage

src/interface/interface.cpp:27652–27743  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

27650}
27651
27652std::string CalloutRadialMenu::getCalloutMessage(const IconEntry::IconEntryText_t& text_map, const char* object, const int targetPlayer)
27653{
27654 if ( text_map.worldMsgEmote != "" )
27655 {
27656 char buf[512] = "";
27657 if ( object )
27658 {
27659 if ( targetPlayer >= 0 && getPlayer() == targetPlayer && text_map.worldMsgEmoteYou != "" )
27660 {
27661 // messaging the player that owns the callout "you gesture to"
27662 snprintf(buf, sizeof(buf), text_map.worldMsgEmoteYou.c_str(), object);
27663 }
27664 else
27665 {
27666 char shortname[32];
27667 stringCopy(shortname, stats[getPlayer()]->name, sizeof(shortname), 22);
27668 std::string nameStr = shortname;
27669 nameStr = messageSanitizePercentSign(nameStr, nullptr);
27670 snprintf(buf, sizeof(buf), text_map.worldMsgEmote.c_str(), nameStr.c_str(), object);
27671 }
27672 }
27673 else
27674 {
27675 if ( targetPlayer >= 0 && getPlayer() == targetPlayer && text_map.worldMsgEmoteYou != "" )
27676 {
27677 // messaging the player that owns the callout "you gesture to"
27678 snprintf(buf, sizeof(buf), text_map.worldMsgEmoteYou.c_str());
27679 }
27680 else
27681 {
27682 char shortname[32];
27683 stringCopy(shortname, stats[getPlayer()]->name, sizeof(shortname), 22);
27684 std::string nameStr = shortname;
27685 nameStr = messageSanitizePercentSign(nameStr, nullptr);
27686 snprintf(buf, sizeof(buf), text_map.worldMsgEmote.c_str(), nameStr.c_str());
27687 }
27688 }
27689 return buf;
27690 }
27691 else if ( text_map.worldMsgSays != "" )
27692 {
27693 char buf[512] = "";
27694 if ( object )
27695 {
27696 if ( targetPlayer >= 0 && getPlayer() == targetPlayer )
27697 {
27698 // messaging the player that owns the callout "you say:"
27699 snprintf(buf, sizeof(buf), text_map.worldMsgSays.c_str(), Language::get(739), object);
27700 }
27701 else
27702 {
27703 char shortname[32];
27704 stringCopy(shortname, stats[getPlayer()]->name, sizeof(shortname), 22);
27705 std::string playerSays = shortname;
27706 playerSays = messageSanitizePercentSign(playerSays, nullptr);
27707 playerSays += ": ";
27708 snprintf(buf, sizeof(buf), text_map.worldMsgSays.c_str(), playerSays.c_str(), object);
27709 }

Callers

nothing calls this directly

Calls 3

stringCopyFunction · 0.85
c_strMethod · 0.80

Tested by

no test coverage detected