Skip to content

Commit

Permalink
Clean code
Browse files Browse the repository at this point in the history
  • Loading branch information
VictorErik committed May 7, 2017
1 parent d88b64c commit 4967356
Showing 1 changed file with 6 additions and 13 deletions.
19 changes: 6 additions & 13 deletions gui/convoi_info_t.cc
Expand Up @@ -436,21 +436,21 @@ void convoi_info_t::draw(scr_coord pos, scr_size size)
COLOR_VAL speed_color = COL_BLACK;
const int pos_y = pos_y0; // line 1
char speed_text[256];
bool hide_speed = false;
switch (cnv->get_state())
{
case convoi_t::WAITING_FOR_CLEARANCE_ONE_MONTH || convoi_t::WAITING_FOR_CLEARANCE || convoi_t::CAN_START || convoi_t::CAN_START_ONE_MONTH:
case convoi_t::WAITING_FOR_CLEARANCE_ONE_MONTH:
case convoi_t::WAITING_FOR_CLEARANCE:
case convoi_t::CAN_START:
case convoi_t::CAN_START_ONE_MONTH:

sprintf(speed_text, translator::translate("waiting_for_clearance"));
speed_color = COL_ORANGE;
hide_speed = true;
sprintf(speed_text, translator::translate("Waiting for clearance!"));
speed_color = COL_YELLOW;
break;

case convoi_t::EMERGENCY_STOP:

sprintf(speed_text, translator::translate("emergency_stop"));
speed_color = COL_RED;
hide_speed = true;
break;

case convoi_t::LOADING:
Expand All @@ -477,7 +477,6 @@ void convoi_info_t::draw(scr_coord pos, scr_size size)
sprintf(speed_text, translator::translate("Loading. %s left!"), waiting_time);
}
speed_color = COL_YELLOW;
hide_speed = true;
break;

case convoi_t::REVERSING:
Expand All @@ -486,41 +485,35 @@ void convoi_info_t::draw(scr_coord pos, scr_size size)
cnv->snprintf_remaining_reversing_time(reversing_time, sizeof(reversing_time));
sprintf(speed_text, translator::translate("Reversing. %s left"), reversing_time);
speed_color = COL_YELLOW;
hide_speed = true;
break;

case convoi_t::CAN_START_TWO_MONTHS:
case convoi_t::WAITING_FOR_CLEARANCE_TWO_MONTHS:

sprintf(speed_text, translator::translate("clf_chk_stucked"));
speed_color = COL_ORANGE;
hide_speed = true;
break;

case convoi_t::NO_ROUTE:

sprintf(speed_text, translator::translate("clf_chk_noroute"));
speed_color = COL_RED;
hide_speed = true;
break;

case convoi_t::OUT_OF_RANGE:

sprintf(speed_text, translator::translate("out of range"));
speed_color = COL_RED;
hide_speed = true;
break;

default:
hide_speed = false;
speed_color = COL_BLACK;
const air_vehicle_t* air = (const air_vehicle_t*)this;

if (cnv->front()->get_waytype() == air_wt && air->runway_too_short)
{
sprintf(speed_text, translator::translate("Runway too short"), cnv->get_name());
speed_color = COL_RED;
hide_speed = true;
}
else
{
Expand Down

0 comments on commit 4967356

Please sign in to comment.