| 1802 | } |
| 1803 | |
| 1804 | static bool add_recent_reports(df::unit *unit, df::report *report, bool update_alert = false) |
| 1805 | { // Attempt to add report to all recent categories |
| 1806 | if (!unit || !report) |
| 1807 | return false; |
| 1808 | |
| 1809 | auto alert_type = announcement_alert_type::NONE; |
| 1810 | |
| 1811 | // These are ordered by priority for setting alert_type |
| 1812 | if (recent_report(unit, unit_report_type::Sparring)) |
| 1813 | { |
| 1814 | Gui::addCombatReport(unit, unit_report_type::Sparring, report, false); |
| 1815 | alert_type = announcement_alert_type::SPARRING; |
| 1816 | } |
| 1817 | |
| 1818 | if (recent_report(unit, unit_report_type::Hunting)) |
| 1819 | { |
| 1820 | Gui::addCombatReport(unit, unit_report_type::Hunting, report, false); |
| 1821 | alert_type = announcement_alert_type::HUNTING; |
| 1822 | } |
| 1823 | |
| 1824 | if (recent_report(unit, unit_report_type::Combat)) |
| 1825 | { |
| 1826 | Gui::addCombatReport(unit, unit_report_type::Combat, report, false); |
| 1827 | alert_type = announcement_alert_type::COMBAT; |
| 1828 | } |
| 1829 | |
| 1830 | if (update_alert) |
| 1831 | update_ucr_alert(unit, alert_type); |
| 1832 | |
| 1833 | return alert_type != announcement_alert_type::NONE; |
| 1834 | } |
| 1835 | // End of utility functions for reports |
| 1836 | |
| 1837 | DFHACK_EXPORT int Gui::makeAnnouncement(df::announcement_type type, df::announcement_flags flags, df::coord pos, std::string message, int color, bool bright) |
no test coverage detected