Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ Template for new versions:
## New Features

## Fixes
- ``Gui::makeAnnoucement``, ``Gui::showPopupAnnouncement`, and ``Gui::autoDFAnnouncement`` will no longer attempt to cull the DF announcement vector

## Misc Improvements

Expand Down
39 changes: 3 additions & 36 deletions library/modules/Gui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,9 @@ using std::string;
using std::vector;
using namespace DFHack;

const size_t MAX_REPORTS_SIZE = 3000; // DF clears old reports to maintain this vector size
const int32_t RECENT_REPORT_TICKS = 500; // used by UNIT_COMBAT_REPORT_ALL_ACTIVE
const int32_t ANNOUNCE_LINE_DURATION = 100; // time to display each line in announcement bar; 2 sec at 50 GFPS
const int16_t ANNOUNCE_DISPLAY_TIME = 2000; // DF uses this value for most announcements; 40 sec at 50 GFPS
static constexpr int32_t RECENT_REPORT_TICKS = 500; // used by UNIT_COMBAT_REPORT_ALL_ACTIVE
static constexpr int32_t ANNOUNCE_LINE_DURATION = 100; // time to display each line in announcement bar; 2 sec at 50 GFPS
static constexpr int16_t ANNOUNCE_DISPLAY_TIME = 2000; // DF uses this value for most announcements; 40 sec at 50 GFPS

namespace DFHack
{
Expand Down Expand Up @@ -1928,18 +1927,6 @@ DFHACK_EXPORT int Gui::makeAnnouncement(df::announcement_type type, df::announce
world->status.display_timer = ANNOUNCE_DISPLAY_TIME;
}

// Delete excess reports
while (reports.size() > MAX_REPORTS_SIZE)
{ // Report destructor
if (reports[0] != NULL)
{
if (reports[0]->flags.bits.announcement)
erase_from_vector(world->status.announcements, &df::report::id, reports[0]->id);
delete reports[0];
}
reports.erase(reports.begin());
}

return world->status.reports.size() - 1;
}

Expand Down Expand Up @@ -2032,14 +2019,6 @@ void Gui::showPopupAnnouncement(std::string message, int color, bool bright)
auto &popups = world->status.popups;
popups.push_back(popup);

// Delete excess popups
while (popups.size() > MAX_REPORTS_SIZE)
{
if (popups[0] != NULL)
delete popups[0];
popups.erase(popups.begin());
}

Gui::MTB_clean(&world->status.mega_text);
Gui::MTB_parse(&world->status.mega_text, popups[0]->text);
Gui::MTB_set_width(&world->status.mega_text);
Expand Down Expand Up @@ -2268,18 +2247,6 @@ bool Gui::autoDFAnnouncement(df::announcement_infost info, string message)
world->status.display_timer = info.display_timer;
}

// Delete excess reports
while (reports.size() > MAX_REPORTS_SIZE)
{ // Report destructor
if (reports[0] != NULL)
{
if (reports[0]->flags.bits.announcement)
erase_from_vector(world->status.announcements, &df::report::id, reports[0]->id);
delete reports[0];
}
reports.erase(reports.begin());
}

if (*gamemode == game_mode::DWARF || // Did dwarf announcement or UCR
(*gamemode == game_mode::ADVENTURE && a_flags.bits.A_DISPLAY) || // Did adventure announcement
(a_flags.bits.DO_MEGA && !adv_unconscious)) // Did popup
Expand Down
Loading