Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 34 additions & 10 deletions C3X.h
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,18 @@ enum distribution_hub_yield_division_mode {
DHYDM_SCALE_BY_CITY_COUNT
};

enum distribution_hub_city_selection_mode {
DHCSM_ALL_CITIES = 0,
DHCSM_SPECIFIC_CITIES
};

enum right_click_menu_item_id {
NAMED_TILE_MENU_ID = 0x90,
DISTRIBUTION_HUB_MENU_ALL_ID = 0x53000000,
DISTRIBUTION_HUB_MENU_SPECIFIC_ID = 0x53000001,
DISTRIBUTION_HUB_MENU_CITY_ID_BASE = 0x53000010
};

enum ai_distribution_hub_build_strategy {
ADHBS_AUTO = 0,
ADHBS_BY_CITY_COUNT
Expand Down Expand Up @@ -495,10 +507,11 @@ struct c3x_config {
bool completed_wonder_districts_can_be_destroyed;
bool destroyed_wonders_can_be_built_again;

int distribution_hub_yield_division_mode;
int distribution_hub_food_yield_divisor;
int distribution_hub_shield_yield_divisor;
int ai_distribution_hub_build_strategy;
int distribution_hub_yield_division_mode;
bool enable_distribution_hub_city_selection;
int distribution_hub_food_yield_divisor;
int distribution_hub_shield_yield_divisor;
int ai_distribution_hub_build_strategy;
int ai_ideal_distribution_hub_count_per_100_cities;
int max_distribution_hub_count_per_100_cities;
int central_rail_hub_distribution_food_bonus_percent;
Expand Down Expand Up @@ -664,12 +677,16 @@ enum c3x_label {
CL_DISTRICTS_IN_SAVE_FILE,
CL_CURRENTLY_CONFIGURED_DISTRICTS,

// Tile naming
CL_NAME_TILE,
CL_RENAME_TILE,

// "Action" for passenger units
CL_TRANSPORTED,
// Tile naming
CL_NAME_TILE,
CL_RENAME_TILE,

// Distribution hub right-click menu
CL_DISTRIBUTE_TO_ALL_CITIES,
CL_DISTRIBUTE_TO_SPECIFIC_CITIES,

// "Action" for passenger units
CL_TRANSPORTED,

CL_IN_STATE_27,
CL_IN_STATE_28,
Expand Down Expand Up @@ -1340,6 +1357,8 @@ struct distribution_hub_record {
int tile_x;
int tile_y;
int civ_id;
int city_selection_mode;
struct table selected_city_ids;
int food_yield;
int shield_yield;
int raw_food_yield;
Expand Down Expand Up @@ -1597,6 +1616,10 @@ struct injected_state {
bool named_tile_menu_active;
int named_tile_menu_tile_x;
int named_tile_menu_tile_y;
bool distribution_hub_menu_active;
int distribution_hub_menu_tile_x;
int distribution_hub_menu_tile_y;
bool distribution_hub_menu_reopen_requested;

// List of temporary ints. Initializes to NULL/0/0, used with functions "memoize" and "clear_memo"
int * memo;
Expand Down Expand Up @@ -2241,6 +2264,7 @@ struct district_button_image_set {
Sprite distribution_hub_eaten_food_icon;
Sprite distribution_hub_shield_icon_small;
Sprite distribution_hub_food_icon_small;
Sprite distribution_hub_menu_icon_sentinel;
int non_district_shield_icons_remaining;
int corruption_shield_icons_remaining;
int district_shield_icons_remaining;
Expand Down
16 changes: 10 additions & 6 deletions Text/c3x-labels.txt
Original file line number Diff line number Diff line change
Expand Up @@ -140,12 +140,16 @@ There may be other errors as well.
Districts in save file
Currently configured districts from

; For naming tiles
Name Tile
Rename

; This appears instead of the above actions on units that have been loaded into another (except an army).
Transported
; For naming tiles
Name Tile
Rename

; Distribution hub right-click menu
Distribute to All Cities
Distribute to Specific Cities

; This appears instead of the above actions on units that have been loaded into another (except an army).
Transported

; Action labels for the four unknown unit states. These labels are placeholders that should never actually appear on the UI.
In State 27
Expand Down
2 changes: 1 addition & 1 deletion civ_prog_objects.csv
Original file line number Diff line number Diff line change
Expand Up @@ -972,4 +972,4 @@ ignore, 0x4BF660, 0x4C6C10, 0x4BF6F0, "City_draw_citizens", "void (__fastc
ignore, 0x4B9F60, 0x4C15D0, 0x4B9FF0, "City_add_population", "void (__fastcall *) (City * this, int edx, int num, int race_id)"
ignore, 0x670234, 0x68D2E0, 0x670234, "Tile_m27_Check_Shield_Bonus", "bool (__fastcall *) (Tile * this)"
ignore, 0x5f3448, 0x6032DF, 0x5F3378, "CHECK_SHIELD_BONUS_TO_CAN_SPAWN_RES_RETURN", "int"

inlead, 0x61B320, 0x0, 0x0, "Context_Menu_draw_item", "void (__fastcall *) (Context_Menu * this, int edx, int item_index, int redraw)"
26 changes: 15 additions & 11 deletions default.c3x_config.ini
Original file line number Diff line number Diff line change
Expand Up @@ -1107,22 +1107,26 @@ destroyed_wonders_can_be_built_again = true

; Distribution Hubs work as "breadbaskets" and mining areas far from urban centers, minimizing local city potential but benefiting the entire civilization.
; Distribution Hubs make surrounding tiles unworkable and instead distribute their raw food and shield yields to ALL connected cities in your civilization.
; "Divisors" for food and shields multiply the sqrt-based divisor in scale-by-city-count mode, and are a straight divider in flat mode. Yields are subject
; "Divisors" for food and shields multiply the quarter-step sqrt-based divisor in scale-by-city-count mode, and are a straight divider in flat mode. Yields are subject
; to corruption as with regular shields.
;
; ai_ideal_distribution_hub_count_per_100_cities controls how many hubs the AI tries to maintain per 100 cities if distribution_hub_yield_division_mode
; is set to "flat" (e.g., 25 means the AI aims for 1 hub per 4 cities).
;
; distribution_hub_yield_division_mode controls how a hub splits its collected food/shields across connected cities:
; flat: Divide raw yields by the configured divisors (distribution_hub_food_yield_divisor & distribution_hub_shield_yield_divisor)
; scale-by-city-count: Bonuses gradually reduce as more cities plug into the hub. Formula: floor(raw_yield / (sqrt(connected_city_count) * divisor))
;
; ai_distribution_hub_build_strategy controls how the AI decides to build distribution hubs:
; by-city-count: AI builds hubs based on its ideal hub count per 100 cities
; auto: AI dynamically assesses need based on city growth and food/shield deficits across civ
distribution_hub_yield_division_mode = scale-by-city-count
ai_distribution_hub_build_strategy = auto
distribution_hub_food_yield_divisor = 2
; distribution_hub_yield_division_mode controls how a hub splits its collected food/shields across connected cities:
; flat: Divide raw yields by the configured divisors (distribution_hub_food_yield_divisor & distribution_hub_shield_yield_divisor)
; scale-by-city-count: Bonuses gradually reduce as more cities plug into the hub. Formula: round(raw_yield / (round_sqrt_to_nearest_quarter(connected_city_count) * divisor))
;
; enable_distribution_hub_city_selection lets human players and AIs choose specific connected cities for hub distribution. If false, hubs always
; distribute to all connected cities.
;
; ai_distribution_hub_build_strategy controls how the AI decides to build distribution hubs:
; by-city-count: AI builds hubs based on its ideal hub count per 100 cities
; auto: AI dynamically assesses need based on city growth and food/shield deficits across civ
distribution_hub_yield_division_mode = scale-by-city-count
enable_distribution_hub_city_selection = true
ai_distribution_hub_build_strategy = auto
distribution_hub_food_yield_divisor = 2
distribution_hub_shield_yield_divisor = 2
ai_ideal_distribution_hub_count_per_100_cities = 50
max_distribution_hub_count_per_100_cities = 50
Expand Down
Loading