Skip to content
Snippets Groups Projects
Commit cd72628a authored by Rob Swindell's avatar Rob Swindell :speech_balloon:
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
No related branches found
No related tags found
1 merge request!463MRC mods by Codefenix (2024-10-20)
Pipeline #2598 passed
......@@ -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);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment