Project

General

Profile

Feature #585 ยป 0092-Rename-goods-priority-as-replace_priority.patch

Marko Lindqvist, 05/13/2024 03:23 AM

View differences:

ai/default/daiunit.c
|| (unit_data->task == AIUNIT_TRADE
&& !(can_cities_trade(homecity, city_dest)
&& can_establish_trade_route(homecity, city_dest,
pgood->priority)))
pgood->replace_priority)))
|| (unit_data->task == AIUNIT_WONDER
/* Helping the (new) production is illegal. */
&& !city_production_gets_caravan_shields(&city_dest->production))
client/gui-sdl2/menu.c
TRUE);
struct goods_type *pgood = unit_current_goods(punit, homecity);
if (can_establish_trade_route(homecity, pcity, pgood->priority)) {
if (can_establish_trade_route(homecity, pcity, pgood->replace_priority)) {
fc_snprintf(cbuf, sizeof(cbuf),
_("%s With %s ( %d one time bonus + %d trade ) (R)"),
action_id_name_translation(ACTION_TRADE_ROUTE),
client/gui-sdl3/menu.c
TRUE);
struct goods_type *pgood = unit_current_goods(punit, homecity);
if (can_establish_trade_route(homecity, pcity, pgood->priority)) {
if (can_establish_trade_route(homecity, pcity, pgood->replace_priority)) {
fc_snprintf(cbuf, sizeof(cbuf),
_("%s With %s ( %d one time bonus + %d trade ) (R)"),
action_id_name_translation(ACTION_TRADE_ROUTE),
client/packhand.c
pgood->to_pct = p->to_pct;
pgood->onetime_pct = p->onetime_pct;
pgood->select_priority = p->select_priority;
pgood->priority = p->replace_priority;
pgood->replace_priority = p->replace_priority;
pgood->flags = p->flags;
PACKET_STRVEC_EXTRACT(pgood->helptext, p->helptext);
client/text.c
&& can_cities_trade(hcity, pcity)
&& can_establish_trade_route(hcity, pcity,
unit_current_goods(pfocus_unit,
hcity)->priority)) {
hcity)->replace_priority)) {
/* TRANS: "Trade from Warsaw: 5" */
astr_add_line(&str, _("Trade from %s: %d"),
city_name_get(hcity),
common/actres.c
struct goods_type *pgood = unit_current_goods(actor->unit, homecity);
if (!can_establish_trade_route(homecity, target->city,
pgood->priority)) {
pgood->replace_priority)) {
return TRI_NO;
}
}
common/aicore/caravan.c
} else {
bool can_establish = (unit_can_do_action(caravan, ACTION_TRADE_ROUTE)
&& can_establish_trade_route(src, dest,
pgood->priority));
pgood->replace_priority));
int bonus = get_caravan_enter_city_trade_bonus(src, dest,
unit_type_get(caravan),
NULL, can_establish);
......
/* If the city can handle this route, we don't break any old routes */
losttrade = 0;
} else {
struct trade_route_list *would_remove = (countloser ? trade_route_list_new() : NULL);
int oldtrade = city_trade_removable(pcity, pgood->priority, would_remove);
struct trade_route_list *would_remove
= (countloser ? trade_route_list_new() : NULL);
int oldtrade = city_trade_removable(pcity, pgood->replace_priority,
would_remove);
/* If we own the city, the trade benefit is only by how much
better we are than the old trade route */
......
/* First, see if a new route is made. */
if (!can_cities_trade(src, dest)
|| !can_establish_trade_route(src, dest, pgood->priority)) {
|| !can_establish_trade_route(src, dest, pgood->replace_priority)) {
return 0;
}
if (max_trade_routes(src) <= 0 || max_trade_routes(dest) <= 0) {
common/traderoutes.c
/* Sort trade route values. */
num = 0;
trade_routes_iterate(pcity, proute) {
if (proute->goods->priority <= priority) {
for (j = num; j > 0 && proute->goods->priority > sorted[j - 1]->goods->priority; j--) ;
if (proute->goods->replace_priority <= priority) {
for (j = num;
j > 0 && proute->goods->replace_priority > sorted[j - 1]->goods->replace_priority;
j--) ;
/* Search place amoung same priority ones. */
for (; j > 0
&& (proute->value < sorted[j - 1]->value)
&& (proute->goods->priority == sorted[j - 1]->goods->priority) ;
&& (proute->goods->replace_priority == sorted[j - 1]->goods->replace_priority) ;
j--) {
sorted[j] = sorted[j - 1];
}
common/traderoutes.h
int onetime_pct;
int select_priority;
int priority;
int replace_priority;
bv_goods_flags flags;
data/alien/game.ruleset
; onetime_pct = Onetime bonuses when trade route gets established. Default is 100%
; select_priority = Available good with highest select_priority get selected for
; the traderoute, random among the same select_pririty.
; priority = Trade routes get replaced by higher priority goods, or higher
; replace_priority = Trade routes get replaced by higher priority goods, or higher
; trade value when priority is the same.
; flags
; - "Bidirectional" = Trade route carrying the goods does not have "from" and "to"
......
; */ <-- avoid gettext warnings
[goods_commodities]
name = _("Commodities")
priority = 1
name = _("Commodities")
replace_priority = 1
; /* <-- avoid gettext warnings
data/civ1/game.ruleset
; onetime_pct = Onetime bonuses when trade route gets established. Default is 100%
; select_priority = Available good with highest select_priority get selected for
; the traderoute, random among the same select_pririty.
; priority = Trade routes get replaced by higher priority goods, or higher
; replace_priority = Trade routes get replaced by higher priority goods, or higher
; trade value when priority is the same.
; flags
; - "Bidirectional" = Trade route carrying the goods does not have "from" and "to"
......
; */ <-- avoid gettext warnings
[goods_good]
name = _("Goods")
priority = 1
flags = "Bidirectional"
name = _("Goods")
replace_priority = 1
flags = "Bidirectional"
; /* <-- avoid gettext warnings
data/civ2/game.ruleset
; onetime_pct = Onetime bonuses when trade route gets established. Default is 100%
; select_priority = Available good with highest select_priority get selected for
; the traderoute, random among the same select_pririty.
; priority = Trade routes get replaced by higher priority goods, or higher
; replace_priority = Trade routes get replaced by higher priority goods, or higher
; trade value when priority is the same.
; flags
; - "Bidirectional" = Trade route carrying the goods does not have "from" and "to"
......
; */ <-- avoid gettext warnings
[goods_good]
name = _("Goods")
priority = 1
flags = "Bidirectional"
name = _("Goods")
replace_priority = 1
flags = "Bidirectional"
; /* <-- avoid gettext warnings
data/civ2civ3/game.ruleset
; onetime_pct = Onetime bonuses when trade route gets established. Default is 100%
; select_priority = Available good with highest select_priority get selected for
; the traderoute, random among the same select_pririty.
; priority = Trade routes get replaced by higher priority goods, or higher
; replace_priority = Trade routes get replaced by higher priority goods, or higher
; trade value when priority is the same.
; flags
; - "Bidirectional" = Trade route carrying the goods does not have "from" and "to"
......
; */ <-- avoid gettext warnings
[goods_good]
name = _("Goods")
priority = 1
name = _("Goods")
replace_priority = 1
; /* <-- avoid gettext warnings
;
data/classic/game.ruleset
; onetime_pct = Onetime bonuses when trade route gets established. Default is 100%
; select_priority = Available good with highest select_priority get selected for
; the traderoute, random among the same select_pririty.
; priority = Trade routes get replaced by higher priority goods, or higher
; replace_priority = Trade routes get replaced by higher priority goods, or higher
; trade value when priority is the same.
; flags
; - "Bidirectional" = Trade route carrying the goods does not have "from" and "to"
......
; */ <-- avoid gettext warnings
[goods_good]
name = _("Goods")
priority = 1
name = _("Goods")
replace_priority = 1
; /* <-- avoid gettext warnings
data/goldkeep/game.ruleset
; onetime_pct = Onetime bonuses when trade route gets established. Default is 100%
; select_priority = Available good with highest select_priority get selected for
; the traderoute, random among the same select_pririty.
; priority = Trade routes get replaced by higher priority goods, or higher
; replace_priority = Trade routes get replaced by higher priority goods, or higher
; trade value when priority is the same.
; flags
; - "Bidirectional" = Trade route carrying the goods does not have "from" and "to"
......
; */ <-- avoid gettext warnings
[goods_good]
name = _("Goods")
priority = 1
name = _("Goods")
replace_priority = 1
; /* <-- avoid gettext warnings
data/granularity/game.ruleset
; onetime_pct = Onetime bonuses when trade route gets established. Default is 100%
; select_priority = Available good with highest select_priority get selected for
; the traderoute, random among the same select_pririty.
; priority = Trade routes get replaced by higher priority goods, or higher
; replace_priority = Trade routes get replaced by higher priority goods, or higher
; trade value when priority is the same.
; flags
; - "Bidirectional" = Trade route carrying the goods does not have "from" and "to"
......
; */ <-- avoid gettext warnings
[goods_good]
name = _("Goods")
priority = 1
name = _("Goods")
replace_priority = 1
; /* <-- avoid gettext warnings
data/multiplayer/game.ruleset
; onetime_pct = Onetime bonuses when trade route gets established. Default is 100%
; select_priority = Available good with highest select_priority get selected for
; the traderoute, random among the same select_pririty.
; priority = Trade routes get replaced by higher priority goods, or higher
; replace_priority = Trade routes get replaced by higher priority goods, or higher
; trade value when priority is the same.
; flags
; - "Bidirectional" = Trade route carrying the goods does not have "from" and "to"
......
; */ <-- avoid gettext warnings
[goods_good]
name = _("Goods")
priority = 1
name = _("Goods")
replace_priority = 1
; /* <-- avoid gettext warnings
;
data/ruledit/comments-3.3.txt
; onetime_pct = Onetime bonuses when trade route gets established. Default is 100\%\n\
; select_priority = Available good with highest select_priority get selected for\n\
; the traderoute, random among the same select_pririty.\n\
; priority = Trade routes get replaced by higher priority goods, or higher\n\
; replace_priority = Trade routes get replaced by higher priority goods, or higher\n\
; trade value when priority is the same.\n\
; flags\n\
; - \"Bidirectional\" = Trade route carrying the goods does not have \"from\" and \"to\"\n\
data/sandbox/game.ruleset
; onetime_pct = Onetime bonuses when trade route gets established. Default is 100%
; select_priority = Available good with highest select_priority get selected for
; the traderoute, random among the same select_pririty.
; priority = Trade routes get replaced by higher priority goods, or higher
; replace_priority = Trade routes get replaced by higher priority goods, or higher
; trade value when priority is the same.
; flags
; - "Bidirectional" = Trade route carrying the goods does not have "from" and "to"
......
; */ <-- avoid gettext warnings
[goods_wares]
name = _("Wares")
priority = 1
flags = "Bidirectional"
name = _("Wares")
replace_priority = 1
flags = "Bidirectional"
[goods_spice]
name = _("Spice")
priority = 1
name = _("Spice")
replace_priority = 1
reqs =
{ "type", "name", "range"
"Extra", "Spice", "City"
}
from_pct = 135
to_pct = 100
flags = "Depletes"
from_pct = 135
to_pct = 100
flags = "Depletes"
[goods_gems]
name = _("Gems")
priority = 1
name = _("Gems")
replace_priority = 1
reqs =
{ "type", "name", "range"
"Extra", "Gems", "City"
}
from_pct = 135
to_pct = 100
flags = "Depletes"
from_pct = 135
to_pct = 100
flags = "Depletes"
[goods_jewelry]
name = _("Jewelry")
priority = 1
name = _("Jewelry")
replace_priority = 1
reqs =
{ "type", "name", "range"
"Good", "Gems", "City"
}
from_pct = 250
to_pct = 150
flags = "Depletes"
from_pct = 250
to_pct = 150
flags = "Depletes"
[goods_ore]
name = _("Ore")
priority = 1
name = _("Ore")
replace_priority = 1
reqs =
{ "type", "name", "range"
"Extra", "Mine", "City"
}
flags = "Depletes"
flags = "Depletes"
[goods_metal]
name = _("Metal")
priority = 1
name = _("Metal")
replace_priority = 1
reqs =
{ "type", "name", "range"
"Good", "Ore", "City"
}
from_pct = 135
to_pct = 100
flags = "Depletes"
from_pct = 135
to_pct = 100
flags = "Depletes"
[goods_good]
name = _("Goods")
priority = 1
name = _("Goods")
replace_priority = 1
reqs =
{ "type", "name", "range", "present"
"Good", "Metal", "City", TRUE
"Tech", "Electronics", "Player", FALSE
}
from_pct = 150
to_pct = 135
flags = "Depletes"
from_pct = 150
to_pct = 135
flags = "Depletes"
[goods_equipment]
name = _("Equipment")
priority = 1
name = _("Equipment")
replace_priority = 1
reqs =
{ "type", "name", "range"
"Good", "Metal", "City"
"Tech", "Electronics", "Player"
}
from_pct = 200
to_pct = 150
flags = "Depletes"
from_pct = 200
to_pct = 150
flags = "Depletes"
; /* <-- avoid gettext warnings
data/stub/game.ruleset
; onetime_pct = Onetime bonuses when trade route gets established. Default is 100%
; select_priority = Available good with highest select_priority get selected for
; the traderoute, random among the same select_pririty.
; priority = Trade routes get replaced by higher priority goods, or higher
; replace_priority = Trade routes get replaced by higher priority goods, or higher
; trade value when priority is the same.
; flags
; - "Bidirectional" = Trade route carrying the goods does not have "from" and "to"
......
; */ <-- avoid gettext warnings
[goods_good]
name = _("Goods")
priority = 1
name = _("Goods")
replace_priority = 1
; /* <-- avoid gettext warnings
data/webperimental/game.ruleset
; onetime_pct = Onetime bonuses when trade route gets established. Default is 100%
; select_priority = Available good with highest select_priority get selected for
; the traderoute, random among the same select_pririty.
; priority = Trade routes get replaced by higher priority goods, or higher
; replace_priority = Trade routes get replaced by higher priority goods, or higher
; trade value when priority is the same.
; flags
; - "Bidirectional" = Trade route carrying the goods does not have "from" and "to"
......
; */ <-- avoid gettext warnings
[goods_good]
name = _("Goods")
priority = 1
name = _("Goods")
replace_priority = 1
; /* <-- avoid gettext warnings
server/citytools.c
back = remove_trade_route(pcity, proute, FALSE, FALSE);
keep_route = can_cities_trade(pcity, partner)
&& can_establish_trade_route(pcity, partner, proute->goods->priority);
&& can_establish_trade_route(pcity, partner, proute->goods->replace_priority);
if (!keep_route) {
enum trade_route_type type = cities_trade_route_type(pcity, partner);
server/ruleset/ruleload.c
"%s.onetime_pct", sec_name);
pgood->select_priority = secfile_lookup_int_default(file, 1,
"%s.select_priority", sec_name);
pgood->priority = secfile_lookup_int_default(file, 1,
"%s.priority", sec_name);
pgood->replace_priority = secfile_lookup_int_default(file, 1,
"%s.replace_priority", sec_name);
slist = secfile_lookup_str_vec(file, &nval, "%s.flags", sec_name);
BV_CLR_ALL(pgood->flags);
......
packet.to_pct = g->to_pct;
packet.onetime_pct = g->onetime_pct;
packet.select_priority = g->select_priority;
packet.replace_priority = g->priority;
packet.replace_priority = g->replace_priority;
packet.flags = g->flags;
PACKET_STRVEC_INSERT(packet.helptext, g->helptext);
server/unithand.c
/* See if there's a trade route we can cancel at the home city. */
if (home_overbooked >= 0) {
if (home_max <= 0
|| (city_trade_removable(pcity_homecity, goods->priority, routes_out_of_home)
|| (city_trade_removable(pcity_homecity, goods->replace_priority,
routes_out_of_home)
>= trade)) {
notify_player(pplayer, city_tile(pcity_dest),
E_BAD_COMMAND, ftc_server,
......
/* See if there's a trade route we can cancel at the dest city. */
if (can_establish && dest_overbooked >= 0) {
if (dest_max <= 0
|| (city_trade_removable(pcity_dest, goods->priority, routes_out_of_dest)
|| (city_trade_removable(pcity_dest, goods->replace_priority,
routes_out_of_dest)
>= trade)) {
notify_player(pplayer, city_tile(pcity_dest),
E_BAD_COMMAND, ftc_server,
tools/ruleutil/rulesave.c
save_default_int(sfile, pgood->to_pct, 100, path, "to_pct");
save_default_int(sfile, pgood->onetime_pct, 100, path, "onetime_pct");
save_default_int(sfile, pgood->select_priority, 1, path, "select_priority");
save_default_int(sfile, pgood->priority, 1, path, "priority");
save_default_int(sfile, pgood->replace_priority, 1, path, "replace_priority");
set_count = 0;
for (flagi = 0; flagi < GF_COUNT; flagi++) {
    (1-1/1)