Commit cd72628a authored by Rob Swindell's avatar Rob Swindell 💬
Browse files

Don't display progress() updates more than twice a second

To send less text over slow (e.g. 4800bps) modems. For Nelgin.

This makes the interval argument unnecessary I think.
parent c94fbb2b
Pipeline #2598 passed with stage
in 9 minutes and 22 seconds
......@@ -1400,11 +1400,15 @@ void sbbs_t::progress(const char* text, int count, int total, int interval)
return; // Don't output this for events
if((count%interval) != 0)
return;
clock_t now = msclock();
if(now - last_progress < 500)
return;
if(text == NULL) text = "";
float pct = total ? ((float)count/total)*100.0F : 100.0F;
SAFEPRINTF2(str, "[ %-8s %4.1f%% ]", text, pct);
cond_newline();
cursor_left(backfill(str, pct, cfg.color[clr_progress_full], cfg.color[clr_progress_empty]));
last_progress = now;
}
struct savedline {
......
......@@ -848,6 +848,7 @@ public:
bool update_nodeterm(void);
int backfill(const char* str, float pct, int full_attr, int empty_attr);
void progress(const char* str, int count, int total, int interval=1);
clock_t last_progress = 0;
bool saveline(void);
bool restoreline(void);
int petscii_to_ansibbs(unsigned char);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment