diff options
author | tron <tron@openttd.org> | 2005-10-23 13:04:44 +0000 |
---|---|---|
committer | tron <tron@openttd.org> | 2005-10-23 13:04:44 +0000 |
commit | 47137cefb72d3b3d3bc6fdefc7a4b103429f6d46 (patch) | |
tree | 7a8d1fbbe0d0d6ee2c8e981c57be6a9003505e97 /order_cmd.c | |
parent | 2cc2154ad26b96b032df2f4fca0ce1634e6330b2 (diff) | |
download | openttd-47137cefb72d3b3d3bc6fdefc7a4b103429f6d46.tar.xz |
(svn r3078) Some more stuff, which piled up:
- const, whitespace, indentation, bracing, GB/SB, pointless casts
- use the trinary operator where appropriate
- data types (uint[] -> AcceptedCargo, ...)
- if cascade -> switch
- if (ptr) -> if (ptr != NULL)
- DeMorgan's Law
- Fix some comments
- 0 -> '\0', change magic numbers to symbolic constants
Diffstat (limited to 'order_cmd.c')
-rw-r--r-- | order_cmd.c | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/order_cmd.c b/order_cmd.c index 882f119b1..227152cde 100644 --- a/order_cmd.c +++ b/order_cmd.c @@ -851,25 +851,23 @@ int32 CmdRestoreOrderIndex(int x, int y, uint32 flags, uint32 p1, uint32 p2) */ bool CheckOrders(uint data_a, uint data_b) { - Vehicle *v = GetVehicle(data_a); + const Vehicle* v = GetVehicle(data_a); + /* Does the user wants us to check things? */ - if (_patches.order_review_system == 0) - return false; + if (_patches.order_review_system == 0) return false; /* Do nothing for crashed vehicles */ - if(v->vehstatus & VS_CRASHED) - return false; + if (v->vehstatus & VS_CRASHED) return false; /* Do nothing for stopped vehicles if setting is '1' */ - if ( (_patches.order_review_system == 1) && (v->vehstatus & VS_STOPPED) ) + if (_patches.order_review_system == 1 && v->vehstatus & VS_STOPPED) return false; /* do nothing we we're not the first vehicle in a share-chain */ - if (v->next_shared != NULL) - return false; + if (v->next_shared != NULL) return false; /* Only check every 20 days, so that we don't flood the message log */ - if ( (v->owner == _local_player) && (v->day_counter % 20 == 0) ) { + if (v->owner == _local_player && v->day_counter % 20 == 0) { int n_st, problem_type = -1; const Order *order; const Station *st; @@ -930,7 +928,7 @@ bool CheckOrders(uint data_a, uint data_b) return true; } - message = (STR_TRAIN_HAS_TOO_FEW_ORDERS) + (((v->type) - VEH_Train) << 2) + problem_type; + message = STR_TRAIN_HAS_TOO_FEW_ORDERS + ((v->type - VEH_Train) << 2) + problem_type; /*DEBUG(misc, 3) ("Checkorder mode 0: Triggered News Item for %d", v->index);*/ SetDParam(0, v->unitnumber); |