mirror of https://github.com/OpenTTD/OpenTTD.git
(svn r2441) -Feature: You can now give transfer order to set up feeder systems
This commit is contained in:
parent
85fae22fa8
commit
9b8cb17831
49
economy.c
49
economy.c
|
@ -1237,26 +1237,14 @@ static int32 DeliverGoods(int num_pieces, byte cargo_type, uint16 source, uint16
|
||||||
subsidised = CheckSubsidised(s_from, s_to, cargo_type);
|
subsidised = CheckSubsidised(s_from, s_to, cargo_type);
|
||||||
|
|
||||||
// Increase town's counter for some special goods types
|
// Increase town's counter for some special goods types
|
||||||
{
|
if (cargo_type == CT_FOOD) s_to->town->new_act_food += num_pieces;
|
||||||
Town *t = s_to->town;
|
if (cargo_type == CT_WATER) s_to->town->new_act_water += num_pieces;
|
||||||
if (cargo_type == CT_FOOD) t->new_act_food += num_pieces;
|
|
||||||
if (cargo_type == CT_WATER) t->new_act_water += num_pieces;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Give the goods to the industry.
|
// Give the goods to the industry.
|
||||||
DeliverGoodsToIndustry(s_to->xy, cargo_type, num_pieces);
|
DeliverGoodsToIndustry(s_to->xy, cargo_type, num_pieces);
|
||||||
|
|
||||||
// Determine profit
|
// Determine profit
|
||||||
{
|
profit = GetTransportedGoodsIncome(num_pieces, DistanceManhattan(s_from->xy, s_to->xy), days_in_transit, cargo_type);
|
||||||
int t = DistanceManhattan(s_from->xy, s_to->xy);
|
|
||||||
int r = num_pieces;
|
|
||||||
profit = 0;
|
|
||||||
do {
|
|
||||||
int u = min(r, 255);
|
|
||||||
r -= u;
|
|
||||||
profit += GetTransportedGoodsIncome(u, t, days_in_transit, cargo_type);
|
|
||||||
} while (r != 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Modify profit if a subsidy is in effect
|
// Modify profit if a subsidy is in effect
|
||||||
if (subsidised) {
|
if (subsidised) {
|
||||||
|
@ -1338,6 +1326,8 @@ static bool LoadWait(const Vehicle *v, const Vehicle *u) {
|
||||||
int LoadUnloadVehicle(Vehicle *v)
|
int LoadUnloadVehicle(Vehicle *v)
|
||||||
{
|
{
|
||||||
int profit = 0;
|
int profit = 0;
|
||||||
|
int v_profit; //virtual profit for feeder systems
|
||||||
|
int v_profit_total = 0;
|
||||||
int unloading_time = 20;
|
int unloading_time = 20;
|
||||||
Vehicle *u = v;
|
Vehicle *u = v;
|
||||||
int result = 0;
|
int result = 0;
|
||||||
|
@ -1365,7 +1355,7 @@ int LoadUnloadVehicle(Vehicle *v)
|
||||||
|
|
||||||
/* unload? */
|
/* unload? */
|
||||||
if (v->cargo_count != 0) {
|
if (v->cargo_count != 0) {
|
||||||
if (v->cargo_source != last_visited && ge->waiting_acceptance & 0x8000) {
|
if ( v->cargo_source != last_visited && ge->waiting_acceptance & 0x8000 && !(u->current_order.flags & OF_TRANSFER) ) {
|
||||||
// deliver goods to the station
|
// deliver goods to the station
|
||||||
st->time_since_unload = 0;
|
st->time_since_unload = 0;
|
||||||
|
|
||||||
|
@ -1373,10 +1363,20 @@ int LoadUnloadVehicle(Vehicle *v)
|
||||||
profit += DeliverGoods(v->cargo_count, v->cargo_type, v->cargo_source, last_visited, v->cargo_days);
|
profit += DeliverGoods(v->cargo_count, v->cargo_type, v->cargo_source, last_visited, v->cargo_days);
|
||||||
result |= 1;
|
result |= 1;
|
||||||
v->cargo_count = 0;
|
v->cargo_count = 0;
|
||||||
} else if (u->current_order.flags & OF_UNLOAD) {
|
} else if (u->current_order.flags & ( OF_UNLOAD | OF_TRANSFER) ) {
|
||||||
/* unload goods and let it wait at the station */
|
/* unload goods and let it wait at the station */
|
||||||
st->time_since_unload = 0;
|
st->time_since_unload = 0;
|
||||||
|
|
||||||
|
v_profit = GetTransportedGoodsIncome(
|
||||||
|
v->cargo_count,
|
||||||
|
DistanceManhattan(GetStation(v->cargo_source)->xy, GetStation(last_visited)->xy),
|
||||||
|
v->cargo_days,
|
||||||
|
v->cargo_type) * 3 / 2;
|
||||||
|
|
||||||
|
v_profit_total += v_profit;
|
||||||
|
|
||||||
|
|
||||||
|
unloading_time += v->cargo_count;
|
||||||
if ((t=ge->waiting_acceptance & 0xFFF) == 0) {
|
if ((t=ge->waiting_acceptance & 0xFFF) == 0) {
|
||||||
// No goods waiting at station
|
// No goods waiting at station
|
||||||
ge->enroute_time = v->cargo_days;
|
ge->enroute_time = v->cargo_days;
|
||||||
|
@ -1390,6 +1390,8 @@ int LoadUnloadVehicle(Vehicle *v)
|
||||||
}
|
}
|
||||||
// Update amount of waiting cargo
|
// Update amount of waiting cargo
|
||||||
ge->waiting_acceptance = (ge->waiting_acceptance &~0xFFF) | min(v->cargo_count + t, 0xFFF);
|
ge->waiting_acceptance = (ge->waiting_acceptance &~0xFFF) | min(v->cargo_count + t, 0xFFF);
|
||||||
|
ge->feeder_profit += v_profit;
|
||||||
|
u->profit_this_year += v_profit;
|
||||||
result |= 2;
|
result |= 2;
|
||||||
v->cargo_count = 0;
|
v->cargo_count = 0;
|
||||||
}
|
}
|
||||||
|
@ -1415,6 +1417,9 @@ int LoadUnloadVehicle(Vehicle *v)
|
||||||
// has capacity for it, load it on the vehicle.
|
// has capacity for it, load it on the vehicle.
|
||||||
if ((count=ge->waiting_acceptance & 0xFFF) != 0 &&
|
if ((count=ge->waiting_acceptance & 0xFFF) != 0 &&
|
||||||
(cap = v->cargo_cap - v->cargo_count) != 0) {
|
(cap = v->cargo_cap - v->cargo_count) != 0) {
|
||||||
|
int cargoshare;
|
||||||
|
int feeder_profit_share;
|
||||||
|
|
||||||
if (v->cargo_count == 0)
|
if (v->cargo_count == 0)
|
||||||
TriggerVehicle(v, VEHICLE_TRIGGER_NEW_CARGO);
|
TriggerVehicle(v, VEHICLE_TRIGGER_NEW_CARGO);
|
||||||
|
|
||||||
|
@ -1432,21 +1437,29 @@ int LoadUnloadVehicle(Vehicle *v)
|
||||||
completely_empty = false;
|
completely_empty = false;
|
||||||
|
|
||||||
if (cap > count) cap = count;
|
if (cap > count) cap = count;
|
||||||
|
cargoshare = cap * 10000 / ge->waiting_acceptance;
|
||||||
|
feeder_profit_share = ge->feeder_profit * cargoshare / 10000;
|
||||||
v->cargo_count += cap;
|
v->cargo_count += cap;
|
||||||
ge->waiting_acceptance -= cap;
|
ge->waiting_acceptance -= cap;
|
||||||
|
v->profit_this_year -= feeder_profit_share;
|
||||||
|
ge->feeder_profit -= feeder_profit_share;
|
||||||
unloading_time += cap;
|
unloading_time += cap;
|
||||||
st->time_since_load = 0;
|
st->time_since_load = 0;
|
||||||
|
|
||||||
// And record the source of the cargo, and the days in travel.
|
// And record the source of the cargo, and the days in travel.
|
||||||
v->cargo_source = ge->enroute_from;
|
v->cargo_source = st->index; //changed this for feeder systems
|
||||||
v->cargo_days = ge->enroute_time;
|
v->cargo_days = ge->enroute_time;
|
||||||
result |= 2;
|
result |= 2;
|
||||||
st->last_vehicle = v->index;
|
st->last_vehicle = v->index;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
v = u;
|
v = u;
|
||||||
|
|
||||||
|
if (v_profit_total > 0)
|
||||||
|
ShowFeederIncomeAnimation(v->x_pos, v->y_pos, v->z_pos, v_profit_total);
|
||||||
|
|
||||||
if (v->type == VEH_Train) {
|
if (v->type == VEH_Train) {
|
||||||
int num = - (int)GetStationPlatforms(st, v->tile) * 2;
|
int num = - (int)GetStationPlatforms(st, v->tile) * 2;
|
||||||
do num++; while ( (v=v->next) != NULL);
|
do num++; while ( (v=v->next) != NULL);
|
||||||
|
|
|
@ -193,6 +193,7 @@ bool EnsureNoVehicle(TileIndex tile);
|
||||||
bool EnsureNoVehicleZ(TileIndex tile, byte z);
|
bool EnsureNoVehicleZ(TileIndex tile, byte z);
|
||||||
void MarkAllViewportsDirty(int left, int top, int right, int bottom);
|
void MarkAllViewportsDirty(int left, int top, int right, int bottom);
|
||||||
void ShowCostOrIncomeAnimation(int x, int y, int z, int32 cost);
|
void ShowCostOrIncomeAnimation(int x, int y, int z, int32 cost);
|
||||||
|
void ShowFeederIncomeAnimation(int x, int y, int z, int32 cost);
|
||||||
|
|
||||||
void DrawFoundation(TileInfo *ti, uint f);
|
void DrawFoundation(TileInfo *ti, uint f);
|
||||||
|
|
||||||
|
|
|
@ -1425,6 +1425,8 @@ STR_0800_COST :{TINYFONT}{RED}
|
||||||
STR_0801_COST :{RED}Cost: {CURRENCY}
|
STR_0801_COST :{RED}Cost: {CURRENCY}
|
||||||
STR_0802_INCOME :{TINYFONT}{GREEN}Income: {CURRENCY}
|
STR_0802_INCOME :{TINYFONT}{GREEN}Income: {CURRENCY}
|
||||||
STR_0803_INCOME :{GREEN}Income: {CURRENCY}
|
STR_0803_INCOME :{GREEN}Income: {CURRENCY}
|
||||||
|
STR_FEEDER_TINY :{TINYFONT}{YELLOW}Transfer: {CURRENCY}
|
||||||
|
STR_FEEDER :{YELLOW}Transfer: {CURRENCY}
|
||||||
STR_0804_ESTIMATED_COST :{TINYFONT}{WHITE}Estimated Cost: {CURRENCY}
|
STR_0804_ESTIMATED_COST :{TINYFONT}{WHITE}Estimated Cost: {CURRENCY}
|
||||||
STR_0805_ESTIMATED_COST :{WHITE}Estimated Cost: {CURRENCY}
|
STR_0805_ESTIMATED_COST :{WHITE}Estimated Cost: {CURRENCY}
|
||||||
STR_0806_ESTIMATED_INCOME :{TINYFONT}{WHITE}Estimated Income: {CURRENCY}
|
STR_0806_ESTIMATED_INCOME :{TINYFONT}{WHITE}Estimated Income: {CURRENCY}
|
||||||
|
@ -2399,14 +2401,18 @@ STR_8803_TRAIN_IN_THE_WAY :{WHITE}Train in
|
||||||
STR_8804 :{SETX 10}{COMMA8}: {STRING}
|
STR_8804 :{SETX 10}{COMMA8}: {STRING}
|
||||||
STR_8805 :{RIGHTARROW}{SETX 10}{COMMA8}: {STRING}
|
STR_8805 :{RIGHTARROW}{SETX 10}{COMMA8}: {STRING}
|
||||||
STR_8806_GO_TO :Go to {STATION}
|
STR_8806_GO_TO :Go to {STATION}
|
||||||
STR_8807_GO_TO_UNLOAD :Go to {STATION} (Unload)
|
STR_8807_GO_TO_TRANSFER :Go to {STATION} (Transfer and take cargo)
|
||||||
STR_8808_GO_TO_LOAD :Go to {STATION} (Load)
|
STR_8808_GO_TO_UNLOAD :Go to {STATION} (Unload)
|
||||||
STR_8809 :
|
STR_8809_GO_TO_TRANSFER_UNLOAD :Go to {STATION} (Transfer and leave empty)
|
||||||
STR_880A_GO_NON_STOP_TO :Go non-stop to {STATION}
|
STR_880A_GO_TO_LOAD :Go to {STATION} (Load)
|
||||||
STR_880B_GO_NON_STOP_TO_UNLOAD :Go non-stop to {STATION} (Unload)
|
STR_880B_GO_TO_TRANSFER_LOAD :Go to {STATION} (Transfer and wait for full load)
|
||||||
STR_880C_GO_NON_STOP_TO_LOAD :Go non-stop to {STATION} (Load)
|
STR_880C_GO_NON_STOP_TO :Go non-stop to {STATION}
|
||||||
STR_880D :
|
STR_880D_GO_TO_NON_STOP_TRANSFER :Go non-stop to {STATION} (Transfer and take cargo)
|
||||||
STR_880E_GO_TO_TRAIN_DEPOT :Go to {TOWN} Train Depot
|
STR_880E_GO_NON_STOP_TO_UNLOAD :Go non-stop to {STATION} (Unload)
|
||||||
|
STR_880F_GO_TO_NON_STOP_TRANSFER_UNLOAD :Go non-stop to {STATION} (Transfer and leave empty)
|
||||||
|
STR_8810_GO_NON_STOP_TO_LOAD :Go non-stop to {STATION} (Load)
|
||||||
|
STR_8811_GO_TO_NON_STOP_TRANSFER_LOAD :Go non-stop to {STATION} (Transfer and wait for full load)
|
||||||
|
STR_GO_TO_TRAIN_DEPOT :Go to {TOWN} Train Depot
|
||||||
STR_SERVICE_AT_TRAIN_DEPOT :Service at {TOWN} Train Depot
|
STR_SERVICE_AT_TRAIN_DEPOT :Service at {TOWN} Train Depot
|
||||||
STR_880F_GO_NON_STOP_TO_TRAIN_DEPOT :Go non-stop to {TOWN} Train Depot
|
STR_880F_GO_NON_STOP_TO_TRAIN_DEPOT :Go non-stop to {TOWN} Train Depot
|
||||||
STR_SERVICE_NON_STOP_AT_TRAIN_DEPOT :Service non-stop at {TOWN} Train Depot
|
STR_SERVICE_NON_STOP_AT_TRAIN_DEPOT :Service non-stop at {TOWN} Train Depot
|
||||||
|
@ -2510,6 +2516,8 @@ STR_8868_TRAIN_CRASH_DIE_IN_FIREBALL :{BLACK}{BIGFONT
|
||||||
STR_8869_CAN_T_REVERSE_DIRECTION :{WHITE}Can't reverse direction of train...
|
STR_8869_CAN_T_REVERSE_DIRECTION :{WHITE}Can't reverse direction of train...
|
||||||
STR_886A_RENAME_TRAIN_VEHICLE_TYPE :{WHITE}Rename train vehicle type
|
STR_886A_RENAME_TRAIN_VEHICLE_TYPE :{WHITE}Rename train vehicle type
|
||||||
STR_886B_CAN_T_RENAME_TRAIN_VEHICLE :{WHITE}Can't rename train vehicle type...
|
STR_886B_CAN_T_RENAME_TRAIN_VEHICLE :{WHITE}Can't rename train vehicle type...
|
||||||
|
STR_886D_MAKE_THE_HIGHLIGHTED_ORDER :{BLACK}Make the highlighted order force the vehicle to dump cargo
|
||||||
|
STR_886F_TRANSFER :{BLACK}Transfer
|
||||||
|
|
||||||
STR_TRAIN_STOPPING :{RED}Stopping
|
STR_TRAIN_STOPPING :{RED}Stopping
|
||||||
STR_TRAIN_STOPPING_VEL :{RED}Stopping, {VELOCITY}
|
STR_TRAIN_STOPPING_VEL :{RED}Stopping, {VELOCITY}
|
||||||
|
|
|
@ -593,6 +593,14 @@ void ShowCostOrIncomeAnimation(int x, int y, int z, int32 cost)
|
||||||
AddTextEffect(msg, pt.x, pt.y, 0x250);
|
AddTextEffect(msg, pt.x, pt.y, 0x250);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ShowFeederIncomeAnimation(int x, int y, int z, int32 cost)
|
||||||
|
{
|
||||||
|
Point pt = RemapCoords(x,y,z);
|
||||||
|
|
||||||
|
SetDParam(0, cost);
|
||||||
|
AddTextEffect(STR_FEEDER, pt.x, pt.y, 0x250);
|
||||||
|
}
|
||||||
|
|
||||||
static Widget _tooltips_widgets[] = {
|
static Widget _tooltips_widgets[] = {
|
||||||
{ WWT_PANEL, RESIZE_NONE, 14, 0, 199, 0, 31, 0x0, STR_NULL},
|
{ WWT_PANEL, RESIZE_NONE, 14, 0, 199, 0, 31, 0x0, STR_NULL},
|
||||||
{ WIDGETS_END},
|
{ WIDGETS_END},
|
||||||
|
|
2
order.h
2
order.h
|
@ -19,6 +19,7 @@ enum {
|
||||||
/* Order flag masks - these are for direct bit operations */
|
/* Order flag masks - these are for direct bit operations */
|
||||||
enum {
|
enum {
|
||||||
//Flags for stations:
|
//Flags for stations:
|
||||||
|
OF_TRANSFER = 0x1,
|
||||||
OF_UNLOAD = 0x2,
|
OF_UNLOAD = 0x2,
|
||||||
OF_FULL_LOAD = 0x4, // Also used when to force an aircraft into a depot
|
OF_FULL_LOAD = 0x4, // Also used when to force an aircraft into a depot
|
||||||
|
|
||||||
|
@ -32,6 +33,7 @@ enum {
|
||||||
|
|
||||||
/* Order flags bits - these are for the *BIT macros */
|
/* Order flags bits - these are for the *BIT macros */
|
||||||
enum {
|
enum {
|
||||||
|
OFB_TRANSFER = 0,
|
||||||
OFB_UNLOAD = 1,
|
OFB_UNLOAD = 1,
|
||||||
OFB_FULL_LOAD = 2,
|
OFB_FULL_LOAD = 2,
|
||||||
OFB_PART_OF_ORDERS = 1,
|
OFB_PART_OF_ORDERS = 1,
|
||||||
|
|
|
@ -523,7 +523,7 @@ int32 CmdModifyOrder(int x, int y, uint32 flags, uint32 p1, uint32 p2)
|
||||||
VehicleID veh = p1 & 0xFFFF;
|
VehicleID veh = p1 & 0xFFFF;
|
||||||
|
|
||||||
if (!IsVehicleIndex(veh)) return CMD_ERROR;
|
if (!IsVehicleIndex(veh)) return CMD_ERROR;
|
||||||
if (p2 != OFB_FULL_LOAD && p2 != OFB_UNLOAD && p2 != OFB_NON_STOP) return CMD_ERROR;
|
if (p2 != OFB_FULL_LOAD && p2 != OFB_UNLOAD && p2 != OFB_NON_STOP && p2 != OFB_TRANSFER) return CMD_ERROR;
|
||||||
|
|
||||||
v = GetVehicle(veh);
|
v = GetVehicle(veh);
|
||||||
if (v->type == 0 || !CheckOwnership(v->owner)) return CMD_ERROR;
|
if (v->type == 0 || !CheckOwnership(v->owner)) return CMD_ERROR;
|
||||||
|
@ -551,6 +551,9 @@ int32 CmdModifyOrder(int x, int y, uint32 flags, uint32 p1, uint32 p2)
|
||||||
case OFB_NON_STOP:
|
case OFB_NON_STOP:
|
||||||
TOGGLEBIT(order->flags, OFB_NON_STOP);
|
TOGGLEBIT(order->flags, OFB_NON_STOP);
|
||||||
break;
|
break;
|
||||||
|
case OFB_TRANSFER:
|
||||||
|
TOGGLEBIT(order->flags, OFB_TRANSFER);
|
||||||
|
break;
|
||||||
default: NOT_REACHED();
|
default: NOT_REACHED();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
75
order_gui.c
75
order_gui.c
|
@ -26,6 +26,23 @@ static int OrderGetSel(Window *w)
|
||||||
return num;
|
return num;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static StringID StationOrderStrings[] = {
|
||||||
|
STR_8807_GO_TO_TRANSFER,
|
||||||
|
STR_8808_GO_TO_UNLOAD,
|
||||||
|
STR_8809_GO_TO_TRANSFER_UNLOAD,
|
||||||
|
STR_880A_GO_TO_LOAD,
|
||||||
|
STR_880B_GO_TO_TRANSFER_LOAD,
|
||||||
|
STR_NULL,
|
||||||
|
STR_NULL,
|
||||||
|
STR_880C_GO_NON_STOP_TO,
|
||||||
|
STR_880D_GO_TO_NON_STOP_TRANSFER,
|
||||||
|
STR_880E_GO_NON_STOP_TO_UNLOAD,
|
||||||
|
STR_880F_GO_TO_NON_STOP_TRANSFER_UNLOAD,
|
||||||
|
STR_8810_GO_NON_STOP_TO_LOAD,
|
||||||
|
STR_8811_GO_TO_NON_STOP_TRANSFER_LOAD,
|
||||||
|
STR_NULL
|
||||||
|
};
|
||||||
|
|
||||||
static void DrawOrdersWindow(Window *w)
|
static void DrawOrdersWindow(Window *w)
|
||||||
{
|
{
|
||||||
const Vehicle *v;
|
const Vehicle *v;
|
||||||
|
@ -44,7 +61,8 @@ static void DrawOrdersWindow(Window *w)
|
||||||
1 << 6 | //non-stop
|
1 << 6 | //non-stop
|
||||||
1 << 7 | //go-to
|
1 << 7 | //go-to
|
||||||
1 << 8 | //full load
|
1 << 8 | //full load
|
||||||
1 << 9 //unload
|
1 << 9 | //unload
|
||||||
|
1 << 10 //transfer
|
||||||
);
|
);
|
||||||
|
|
||||||
if (v->type != VEH_Train)
|
if (v->type != VEH_Train)
|
||||||
|
@ -71,12 +89,14 @@ static void DrawOrdersWindow(Window *w)
|
||||||
break;
|
break;
|
||||||
case OT_GOTO_DEPOT:
|
case OT_GOTO_DEPOT:
|
||||||
SETBIT(w->disabled_state, 9); /* unload */
|
SETBIT(w->disabled_state, 9); /* unload */
|
||||||
|
SETBIT(w->disabled_state, 10); /* transfer */
|
||||||
SetDParam(2,STR_SERVICE);
|
SetDParam(2,STR_SERVICE);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case OT_GOTO_WAYPOINT:
|
case OT_GOTO_WAYPOINT:
|
||||||
SETBIT(w->disabled_state, 8); /* full load */
|
SETBIT(w->disabled_state, 8); /* full load */
|
||||||
SETBIT(w->disabled_state, 9); /* unload */
|
SETBIT(w->disabled_state, 9); /* unload */
|
||||||
|
SETBIT(w->disabled_state, 10); /* transfer */
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -88,6 +108,8 @@ static void DrawOrdersWindow(Window *w)
|
||||||
SETBIT(w->disabled_state, 6); /* nonstop */
|
SETBIT(w->disabled_state, 6); /* nonstop */
|
||||||
SETBIT(w->disabled_state, 8); /* full load */
|
SETBIT(w->disabled_state, 8); /* full load */
|
||||||
SETBIT(w->disabled_state, 9); /* unload */
|
SETBIT(w->disabled_state, 9); /* unload */
|
||||||
|
SETBIT(w->disabled_state, 10); /* transfer */
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SetDParam(0, v->string_id);
|
SetDParam(0, v->string_id);
|
||||||
|
@ -105,28 +127,31 @@ static void DrawOrdersWindow(Window *w)
|
||||||
SetDParam(1, 6);
|
SetDParam(1, 6);
|
||||||
|
|
||||||
if (order->type == OT_GOTO_STATION) {
|
if (order->type == OT_GOTO_STATION) {
|
||||||
SetDParam(1, STR_8806_GO_TO + (order->flags >> 1));
|
SetDParam(1, StationOrderStrings[order->flags]);
|
||||||
SetDParam(2, order->station);
|
SetDParam(2, order->station);
|
||||||
} else if (order->type == OT_GOTO_DEPOT) {
|
} else if (order->type == OT_GOTO_DEPOT) {
|
||||||
StringID s = STR_NULL;
|
StringID s = STR_NULL;
|
||||||
|
|
||||||
if (v->type == VEH_Aircraft) {
|
if (v->type == VEH_Aircraft) {
|
||||||
s = STR_GO_TO_AIRPORT_HANGAR;
|
s = STR_GO_TO_AIRPORT_HANGAR;
|
||||||
SetDParam(2, order->station);
|
SetDParam(2, order->station);
|
||||||
} else {
|
} else {
|
||||||
SetDParam(2, GetDepot(order->station)->town_index);
|
SetDParam(2, GetDepot(order->station)->town_index);
|
||||||
|
|
||||||
switch (v->type) {
|
switch (v->type) {
|
||||||
case VEH_Train: s = STR_880E_GO_TO_TRAIN_DEPOT; break;
|
case VEH_Train: s = STR_GO_TO_TRAIN_DEPOT; break;
|
||||||
case VEH_Road: s = STR_9038_GO_TO_ROADVEH_DEPOT; break;
|
case VEH_Road: s = STR_9038_GO_TO_ROADVEH_DEPOT; break;
|
||||||
case VEH_Ship: s = STR_GO_TO_SHIP_DEPOT; break;
|
case VEH_Ship: s = STR_GO_TO_SHIP_DEPOT; break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (v->type == VEH_Train && order->flags & OF_NON_STOP) s += 2;
|
||||||
|
SetDParam(1, s);
|
||||||
}
|
}
|
||||||
if (v->type == VEH_Train && order->flags & OF_NON_STOP)
|
|
||||||
s += 2;
|
|
||||||
|
|
||||||
if (order->flags & OF_FULL_LOAD)
|
if (order->flags & OF_FULL_LOAD)
|
||||||
s++; /* XXX service */
|
s++; /* service at */
|
||||||
|
|
||||||
SetDParam(1, s);
|
SetDParam(1, s);
|
||||||
} else if (order->type == OT_GOTO_WAYPOINT) {
|
} else if (order->type == OT_GOTO_WAYPOINT) {
|
||||||
|
@ -322,6 +347,11 @@ static void OrderClick_Nonstop(Window *w, Vehicle *v)
|
||||||
DoCommandP(v->tile, v->index + (OrderGetSel(w) << 16), OFB_NON_STOP, NULL, CMD_MODIFY_ORDER | CMD_MSG(STR_8835_CAN_T_MODIFY_THIS_ORDER));
|
DoCommandP(v->tile, v->index + (OrderGetSel(w) << 16), OFB_NON_STOP, NULL, CMD_MODIFY_ORDER | CMD_MSG(STR_8835_CAN_T_MODIFY_THIS_ORDER));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void OrderClick_Transfer(Window *w, Vehicle *v)
|
||||||
|
{
|
||||||
|
DoCommandP(v->tile, v->index + (OrderGetSel(w) << 16), OFB_TRANSFER, NULL, CMD_MODIFY_ORDER | CMD_MSG(STR_8835_CAN_T_MODIFY_THIS_ORDER));
|
||||||
|
}
|
||||||
|
|
||||||
static void OrderClick_Skip(Window *w, Vehicle *v)
|
static void OrderClick_Skip(Window *w, Vehicle *v)
|
||||||
{
|
{
|
||||||
DoCommandP(v->tile, v->index, 0, NULL, CMD_SKIP_ORDER);
|
DoCommandP(v->tile, v->index, 0, NULL, CMD_SKIP_ORDER);
|
||||||
|
@ -340,7 +370,8 @@ static OnButtonClick * const _order_button_proc[] = {
|
||||||
OrderClick_Nonstop,
|
OrderClick_Nonstop,
|
||||||
OrderClick_Goto,
|
OrderClick_Goto,
|
||||||
OrderClick_FullLoad,
|
OrderClick_FullLoad,
|
||||||
OrderClick_Unload
|
OrderClick_Unload,
|
||||||
|
OrderClick_Transfer
|
||||||
};
|
};
|
||||||
|
|
||||||
static const uint16 _order_keycodes[] = {
|
static const uint16 _order_keycodes[] = {
|
||||||
|
@ -419,6 +450,9 @@ static void OrdersWndProc(Window *w, WindowEvent *e)
|
||||||
case 9: /* unload button */
|
case 9: /* unload button */
|
||||||
OrderClick_Unload(w, v);
|
OrderClick_Unload(w, v);
|
||||||
break;
|
break;
|
||||||
|
case 10: /* transfer button */
|
||||||
|
OrderClick_Transfer(w, v);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
|
@ -490,22 +524,23 @@ static void OrdersWndProc(Window *w, WindowEvent *e)
|
||||||
|
|
||||||
static const Widget _orders_train_widgets[] = {
|
static const Widget _orders_train_widgets[] = {
|
||||||
{ WWT_CLOSEBOX, RESIZE_NONE, 14, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW},
|
{ WWT_CLOSEBOX, RESIZE_NONE, 14, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW},
|
||||||
{ WWT_CAPTION, RESIZE_RIGHT, 14, 11, 331, 0, 13, STR_8829_ORDERS, STR_018C_WINDOW_TITLE_DRAG_THIS},
|
{ WWT_CAPTION, RESIZE_RIGHT, 14, 11, 384, 0, 13, STR_8829_ORDERS, STR_018C_WINDOW_TITLE_DRAG_THIS},
|
||||||
{ WWT_PANEL, RESIZE_RB, 14, 0, 319, 14, 75, 0x0, STR_8852_ORDERS_LIST_CLICK_ON_ORDER},
|
{ WWT_PANEL, RESIZE_RB, 14, 0, 372, 14, 75, 0x0, STR_8852_ORDERS_LIST_CLICK_ON_ORDER},
|
||||||
{ WWT_SCROLLBAR, RESIZE_LRB, 14, 320, 331, 14, 75, 0x0, STR_0190_SCROLL_BAR_SCROLLS_LIST},
|
{ WWT_SCROLLBAR, RESIZE_LRB, 14, 373, 384, 14, 75, 0x0, STR_0190_SCROLL_BAR_SCROLLS_LIST},
|
||||||
{ WWT_PUSHTXTBTN, RESIZE_TB, 14, 0, 52, 76, 87, STR_8823_SKIP, STR_8853_SKIP_THE_CURRENT_ORDER},
|
{ WWT_PUSHTXTBTN, RESIZE_TB, 14, 0, 52, 76, 87, STR_8823_SKIP, STR_8853_SKIP_THE_CURRENT_ORDER},
|
||||||
{ WWT_PUSHTXTBTN, RESIZE_TB, 14, 53, 105, 76, 87, STR_8824_DELETE, STR_8854_DELETE_THE_HIGHLIGHTED},
|
{ WWT_PUSHTXTBTN, RESIZE_TB, 14, 53, 105, 76, 87, STR_8824_DELETE, STR_8854_DELETE_THE_HIGHLIGHTED},
|
||||||
{ WWT_PUSHTXTBTN, RESIZE_TB, 14, 106, 158, 76, 87, STR_8825_NON_STOP, STR_8855_MAKE_THE_HIGHLIGHTED_ORDER},
|
{ WWT_PUSHTXTBTN, RESIZE_TB, 14, 106, 158, 76, 87, STR_8825_NON_STOP, STR_8855_MAKE_THE_HIGHLIGHTED_ORDER},
|
||||||
{WWT_NODISTXTBTN, RESIZE_TB, 14, 159, 211, 76, 87, STR_8826_GO_TO, STR_8856_INSERT_A_NEW_ORDER_BEFORE},
|
{WWT_NODISTXTBTN, RESIZE_TB, 14, 159, 211, 76, 87, STR_8826_GO_TO, STR_8856_INSERT_A_NEW_ORDER_BEFORE},
|
||||||
{ WWT_PUSHTXTBTN, RESIZE_TB, 14, 212, 264, 76, 87, STR_FULLLOAD_OR_SERVICE, STR_NULL},
|
{ WWT_PUSHTXTBTN, RESIZE_TB, 14, 212, 264, 76, 87, STR_FULLLOAD_OR_SERVICE, STR_NULL},
|
||||||
{ WWT_PUSHTXTBTN, RESIZE_TB, 14, 265, 319, 76, 87, STR_8828_UNLOAD, STR_8858_MAKE_THE_HIGHLIGHTED_ORDER},
|
{ WWT_PUSHTXTBTN, RESIZE_TB, 14, 265, 319, 76, 87, STR_8828_UNLOAD, STR_8858_MAKE_THE_HIGHLIGHTED_ORDER},
|
||||||
{ WWT_PANEL, RESIZE_RTB, 14, 320, 319, 76, 87, 0x0, STR_NULL},
|
{ WWT_PUSHTXTBTN, RESIZE_TB, 14, 320, 372, 76, 87, STR_886F_TRANSFER, STR_886D_MAKE_THE_HIGHLIGHTED_ORDER},
|
||||||
{ WWT_RESIZEBOX, RESIZE_LRTB, 14, 320, 331, 76, 87, 0x0, STR_RESIZE_BUTTON},
|
{ WWT_PANEL, RESIZE_RTB, 14, 373, 372, 76, 87, 0x0, STR_NULL},
|
||||||
|
{ WWT_RESIZEBOX, RESIZE_LRTB, 14, 373, 384, 76, 87, 0x0, STR_RESIZE_BUTTON},
|
||||||
{ WIDGETS_END},
|
{ WIDGETS_END},
|
||||||
};
|
};
|
||||||
|
|
||||||
static const WindowDesc _orders_train_desc = {
|
static const WindowDesc _orders_train_desc = {
|
||||||
-1,-1, 332, 88,
|
-1,-1, 385, 88,
|
||||||
WC_VEHICLE_ORDERS,WC_VEHICLE_VIEW,
|
WC_VEHICLE_ORDERS,WC_VEHICLE_VIEW,
|
||||||
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_RESTORE_DPARAM | WDF_RESIZABLE,
|
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_RESTORE_DPARAM | WDF_RESIZABLE,
|
||||||
_orders_train_widgets,
|
_orders_train_widgets,
|
||||||
|
@ -514,23 +549,23 @@ static const WindowDesc _orders_train_desc = {
|
||||||
|
|
||||||
static const Widget _orders_widgets[] = {
|
static const Widget _orders_widgets[] = {
|
||||||
{ WWT_CLOSEBOX, RESIZE_NONE, 14, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW},
|
{ WWT_CLOSEBOX, RESIZE_NONE, 14, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW},
|
||||||
{ WWT_CAPTION, RESIZE_RIGHT, 14, 11, 331, 0, 13, STR_8829_ORDERS, STR_018C_WINDOW_TITLE_DRAG_THIS},
|
{ WWT_CAPTION, RESIZE_RIGHT, 14, 11, 395, 0, 13, STR_8829_ORDERS, STR_018C_WINDOW_TITLE_DRAG_THIS},
|
||||||
{ WWT_PANEL, RESIZE_RB, 14, 0, 319, 14, 75, 0x0, STR_8852_ORDERS_LIST_CLICK_ON_ORDER},
|
{ WWT_PANEL, RESIZE_RB, 14, 0, 383, 14, 75, 0x0, STR_8852_ORDERS_LIST_CLICK_ON_ORDER},
|
||||||
{ WWT_SCROLLBAR, RESIZE_LRB, 14, 320, 331, 14, 75, 0x0, STR_0190_SCROLL_BAR_SCROLLS_LIST},
|
{ WWT_SCROLLBAR, RESIZE_LRB, 14, 384, 395, 14, 75, 0x0, STR_0190_SCROLL_BAR_SCROLLS_LIST},
|
||||||
|
|
||||||
{ WWT_PUSHTXTBTN, RESIZE_TB, 14, 0, 63, 76, 87, STR_8823_SKIP, STR_8853_SKIP_THE_CURRENT_ORDER},
|
{ WWT_PUSHTXTBTN, RESIZE_TB, 14, 0, 63, 76, 87, STR_8823_SKIP, STR_8853_SKIP_THE_CURRENT_ORDER},
|
||||||
{ WWT_PUSHTXTBTN, RESIZE_TB, 14, 64, 128, 76, 87, STR_8824_DELETE, STR_8854_DELETE_THE_HIGHLIGHTED},
|
{ WWT_PUSHTXTBTN, RESIZE_TB, 14, 64, 128, 76, 87, STR_8824_DELETE, STR_8854_DELETE_THE_HIGHLIGHTED},
|
||||||
{ WWT_EMPTY, RESIZE_TB, 14, 0, 0, 76, 87, 0x0, 0x0},
|
{ WWT_EMPTY, RESIZE_TB, 14, 0, 0, 76, 87, 0x0, 0x0},
|
||||||
{WWT_NODISTXTBTN, RESIZE_TB, 14, 129, 192, 76, 87, STR_8826_GO_TO, STR_8856_INSERT_A_NEW_ORDER_BEFORE},
|
{WWT_NODISTXTBTN, RESIZE_TB, 14, 129, 192, 76, 87, STR_8826_GO_TO, STR_8856_INSERT_A_NEW_ORDER_BEFORE},
|
||||||
{ WWT_PUSHTXTBTN, RESIZE_TB, 14, 193, 256, 76, 87, STR_FULLLOAD_OR_SERVICE, STR_NULL},
|
{ WWT_PUSHTXTBTN, RESIZE_TB, 14, 193, 256, 76, 87, STR_FULLLOAD_OR_SERVICE, STR_NULL},
|
||||||
{ WWT_PUSHTXTBTN, RESIZE_TB, 14, 257, 319, 76, 87, STR_8828_UNLOAD, STR_8858_MAKE_THE_HIGHLIGHTED_ORDER},
|
{ WWT_PUSHTXTBTN, RESIZE_TB, 14, 257, 319, 76, 87, STR_8828_UNLOAD, STR_8858_MAKE_THE_HIGHLIGHTED_ORDER},
|
||||||
{ WWT_PANEL, RESIZE_RTB, 14, 320, 319, 76, 87, 0x0, STR_NULL},
|
{ WWT_PUSHTXTBTN, RESIZE_TB, 14, 320, 383, 76, 87, STR_886F_TRANSFER, STR_886D_MAKE_THE_HIGHLIGHTED_ORDER},
|
||||||
{ WWT_RESIZEBOX, RESIZE_LRTB, 14, 320, 331, 76, 87, 0x0, STR_RESIZE_BUTTON},
|
{ WWT_PANEL, RESIZE_RTB, 14, 384, 383, 76, 87, 0x0, STR_NULL},
|
||||||
|
{ WWT_RESIZEBOX, RESIZE_LRTB, 14, 384, 395, 76, 87, 0x0, STR_RESIZE_BUTTON},
|
||||||
{ WIDGETS_END},
|
{ WIDGETS_END},
|
||||||
};
|
};
|
||||||
|
|
||||||
static const WindowDesc _orders_desc = {
|
static const WindowDesc _orders_desc = {
|
||||||
-1,-1, 332, 88,
|
-1,-1, 396, 88,
|
||||||
WC_VEHICLE_ORDERS,WC_VEHICLE_VIEW,
|
WC_VEHICLE_ORDERS,WC_VEHICLE_VIEW,
|
||||||
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_RESTORE_DPARAM | WDF_RESIZABLE,
|
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_RESTORE_DPARAM | WDF_RESIZABLE,
|
||||||
_orders_widgets,
|
_orders_widgets,
|
||||||
|
|
|
@ -1472,7 +1472,7 @@ again:
|
||||||
if (old_order.type == OT_GOTO_STATION &&
|
if (old_order.type == OT_GOTO_STATION &&
|
||||||
v->current_order.station == v->last_station_visited) {
|
v->current_order.station == v->last_station_visited) {
|
||||||
v->current_order.flags =
|
v->current_order.flags =
|
||||||
(old_order.flags & (OF_FULL_LOAD | OF_UNLOAD)) | OF_NON_STOP;
|
(old_order.flags & (OF_FULL_LOAD | OF_UNLOAD | OF_TRANSFER)) | OF_NON_STOP;
|
||||||
}
|
}
|
||||||
|
|
||||||
SET_EXPENSES_TYPE(EXPENSES_ROADVEH_INC);
|
SET_EXPENSES_TYPE(EXPENSES_ROADVEH_INC);
|
||||||
|
|
|
@ -23,8 +23,8 @@
|
||||||
#include "saveload.h"
|
#include "saveload.h"
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
SAVEGAME_MAJOR_VERSION = 13,
|
SAVEGAME_MAJOR_VERSION = 14,
|
||||||
SAVEGAME_MINOR_VERSION = 0x1,
|
SAVEGAME_MINOR_VERSION = 0,
|
||||||
|
|
||||||
SAVEGAME_LOADABLE_VERSION = (SAVEGAME_MAJOR_VERSION << 8) + SAVEGAME_MINOR_VERSION
|
SAVEGAME_LOADABLE_VERSION = (SAVEGAME_MAJOR_VERSION << 8) + SAVEGAME_MINOR_VERSION
|
||||||
};
|
};
|
||||||
|
|
|
@ -14,6 +14,7 @@ typedef struct GoodsEntry {
|
||||||
byte enroute_time;
|
byte enroute_time;
|
||||||
byte last_speed;
|
byte last_speed;
|
||||||
byte last_age;
|
byte last_age;
|
||||||
|
int32 feeder_profit;
|
||||||
} GoodsEntry;
|
} GoodsEntry;
|
||||||
|
|
||||||
typedef enum RoadStopType {
|
typedef enum RoadStopType {
|
||||||
|
|
|
@ -458,6 +458,7 @@ static void StationInitialize(Station *st, TileIndex tile)
|
||||||
ge->rating = 175;
|
ge->rating = 175;
|
||||||
ge->last_speed = 0;
|
ge->last_speed = 0;
|
||||||
ge->last_age = 0xFF;
|
ge->last_age = 0xFF;
|
||||||
|
ge->feeder_profit = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
_global_station_sort_dirty = true; // build a new station
|
_global_station_sort_dirty = true; // build a new station
|
||||||
|
@ -3044,6 +3045,7 @@ static const SaveLoad _goods_desc[] = {
|
||||||
SLE_VAR(GoodsEntry,enroute_time, SLE_UINT8),
|
SLE_VAR(GoodsEntry,enroute_time, SLE_UINT8),
|
||||||
SLE_VAR(GoodsEntry,last_speed, SLE_UINT8),
|
SLE_VAR(GoodsEntry,last_speed, SLE_UINT8),
|
||||||
SLE_VAR(GoodsEntry,last_age, SLE_UINT8),
|
SLE_VAR(GoodsEntry,last_age, SLE_UINT8),
|
||||||
|
SLE_CONDVAR(GoodsEntry,feeder_profit, SLE_INT32, 14, 255),
|
||||||
|
|
||||||
SLE_END()
|
SLE_END()
|
||||||
};
|
};
|
||||||
|
|
|
@ -2327,7 +2327,7 @@ static void TrainEnterStation(Vehicle *v, StationID station)
|
||||||
// Yeah, keep the load/unload flags
|
// Yeah, keep the load/unload flags
|
||||||
// Non Stop now means if the order should be increased.
|
// Non Stop now means if the order should be increased.
|
||||||
v->current_order.type = OT_LOADING;
|
v->current_order.type = OT_LOADING;
|
||||||
v->current_order.flags &= OF_FULL_LOAD | OF_UNLOAD;
|
v->current_order.flags &= OF_FULL_LOAD | OF_UNLOAD | OF_TRANSFER;
|
||||||
v->current_order.flags |= OF_NON_STOP;
|
v->current_order.flags |= OF_NON_STOP;
|
||||||
} else {
|
} else {
|
||||||
// No, just do a simple load
|
// No, just do a simple load
|
||||||
|
|
Loading…
Reference in New Issue