diff options
| author | Franklin Wei <git@fwei.tk> | 2015-05-29 21:59:22 -0400 |
|---|---|---|
| committer | Franklin Wei <git@fwei.tk> | 2015-05-29 21:59:22 -0400 |
| commit | 29875bfa308fc52b5faee794145839794b9ab096 (patch) | |
| tree | 780619158e7533b2935ae1468a14f123d1bfe8ad /src/util.c | |
| parent | e61bc0fe416326a2a9e4c70fb29893df0b4e4b4f (diff) | |
| download | market-sim-29875bfa308fc52b5faee794145839794b9ab096.zip market-sim-29875bfa308fc52b5faee794145839794b9ab096.tar.gz market-sim-29875bfa308fc52b5faee794145839794b9ab096.tar.bz2 market-sim-29875bfa308fc52b5faee794145839794b9ab096.tar.xz | |
support bold html output
Diffstat (limited to 'src/util.c')
| -rw-r--r-- | src/util.c | 23 |
1 files changed, 23 insertions, 0 deletions
@@ -225,10 +225,16 @@ void print_handler(struct player_t *player) else if(last_buy->price.cents > stock->current_price.cents) col = COL_RED; + if(ABS((signed)last_buy->price.cents - (signed)stock->current_price.cents) >= BOLD_THRESHOLD) + use_bold(); + use_color(col); output("%5llu.%02llu", stock->current_price.cents / 100, stock->current_price.cents % 100); stop_color(col); + if(ABS((signed)last_buy->price.cents - (signed)stock->current_price.cents) >= BOLD_THRESHOLD) + stop_bold(); + output(" = $%6llu.%02llu\n", total_value / 100, total_value % 100); portfolio_value += stock->current_price.cents * stock->count; @@ -603,3 +609,20 @@ void batch_init(void) { batch_mode = true; } + +void use_bold(void) +{ + /* curses mode always has A_BOLD set, so this only applies to HTML mode */ + if(html_out) + { + output("<b>"); + } +} + +void stop_bold(void) +{ + if(html_out) + { + output("</b>"); + } +} |