Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into devbranch1
Browse files Browse the repository at this point in the history
  • Loading branch information
SneakBug8 committed Jan 24, 2025
2 parents 77be966 + 7164a0b commit 4fdcc12
Show file tree
Hide file tree
Showing 43 changed files with 14,094 additions and 2,477 deletions.
5 changes: 2 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ list(APPEND ALICE_INCREMENTAL_SOURCES_LIST
"src/gui/topbar_subwindows/gui_population_window.cpp"
"src/gui/topbar_subwindows/gui_production_window.cpp"
"src/gui/topbar_subwindows/gui_technology_window.cpp"
"src/gui/topbar_subwindows/gui_budget_window.cpp"
"src/gui/immediate_mode.cpp"
"src/gui/economy_viewer.cpp"
"src/gui/unit_tooltip.cpp"
Expand Down Expand Up @@ -134,12 +133,12 @@ if(WIN32)
if(OPTIMIZE_MODE STREQUAL "On")
message(STATUS "Optimizing with PGO data")
target_compile_options(AliceCommon INTERFACE
/bigobj /wd4100 /wd4189 /wd4065 /wd4201 /wd4324 /GR- /W4 /permissive- /WX /arch:AVX2 /GF /w34388 /w34389 -Wno-unused-macros -Wno-zero-length-array -Wno-switch-default -Wno-reserved-identifier -Wno-unused-parameter -Wno-unused-variable -Wno-unused-private-field /Z7 -Wno-invalid-offsetof -Wno-deprecated-volatile -Wno-missing-prototypes -Wno-reserved-identifier -Wno-implicit-int-float-conversion -Wno-unsafe-buffer-usage -Wno-float-equal -Wno-shadow-field-in-constructor -Wno-gnu-anonymous-struct -Wno-nested-anon-types -Wno-double-promotion -Wno-shadow-uncaptured-local -Wno-nonportable-system-include-path -Wno-format-nonliteral -Wno-shorten-64-to-32 -Wno-ctad-maybe-unsupported -Wno-implicit-int-conversion -Wno-disabled-macro-expansion -Wno-comma -Wno-cast-function-type-strict -Wno-cast-function-type -Wno-invalid-offsetof -Wno-microsoft-cast -Wno-reserved-identifier /DNDEBUG /wd4530 /MT /O2 /Oi /sdl- /GS- /Gy /Gw /Zc:inline -Wno-profile-instr-missing -Wno-profile-instr-out-of-date -fprofile-instr-use=code.profdata)
/bigobj /wd4100 /wd4189 /wd4065 /wd4201 /wd4324 /GR- /W4 /permissive- /WX -march=nehalem /GF /w34388 /w34389 -Wno-unused-macros -Wno-zero-length-array -Wno-switch-default -Wno-reserved-identifier -Wno-unused-parameter -Wno-unused-variable -Wno-unused-private-field /Z7 -Wno-invalid-offsetof -Wno-deprecated-volatile -Wno-missing-prototypes -Wno-reserved-identifier -Wno-implicit-int-float-conversion -Wno-unsafe-buffer-usage -Wno-float-equal -Wno-shadow-field-in-constructor -Wno-gnu-anonymous-struct -Wno-nested-anon-types -Wno-double-promotion -Wno-shadow-uncaptured-local -Wno-nonportable-system-include-path -Wno-format-nonliteral -Wno-shorten-64-to-32 -Wno-ctad-maybe-unsupported -Wno-implicit-int-conversion -Wno-disabled-macro-expansion -Wno-comma -Wno-cast-function-type-strict -Wno-cast-function-type -Wno-invalid-offsetof -Wno-microsoft-cast -Wno-reserved-identifier -Wno-unused-but-set-variable /DNDEBUG /wd4530 /MT /O2 /Oi /sdl- /GS- /Gy /Gw /Zc:inline -Wno-profile-instr-missing -Wno-profile-instr-out-of-date -fprofile-instr-use=code.profdata)
target_link_options(AliceCommon INTERFACE /OPT:REF /OPT:ICF /LTCG -fprofile-instr-use=code.profdata)
elseif(PROFILE_MODE STREQUAL "On")
message(STATUS "Compiling for PGO instrumentation")
target_compile_options(AliceCommon INTERFACE
/bigobj /wd4100 /wd4189 /wd4065 /wd4201 /wd4324 /GR- /W4 /permissive- /WX /arch:AVX2 /GF /w34388 /w34389 -Wno-unused-macros -Wno-zero-length-array -Wno-switch-default -Wno-reserved-identifier -Wno-unused-parameter -Wno-unused-variable -Wno-unused-private-field /Z7 -Wno-invalid-offsetof -Wno-deprecated-volatile -Wno-missing-prototypes -Wno-reserved-identifier -Wno-implicit-int-float-conversion -Wno-unsafe-buffer-usage -Wno-float-equal -Wno-shadow-field-in-constructor -Wno-gnu-anonymous-struct -Wno-nested-anon-types -Wno-double-promotion -Wno-shadow-uncaptured-local -Wno-nonportable-system-include-path -Wno-format-nonliteral -Wno-shorten-64-to-32 -Wno-ctad-maybe-unsupported -Wno-implicit-int-conversion -Wno-disabled-macro-expansion -Wno-comma -Wno-cast-function-type-strict -Wno-cast-function-type -Wno-invalid-offsetof -Wno-microsoft-cast -Wno-reserved-identifier /DNDEBUG /wd4530 /MT /O2 /Oi /sdl- /GS- /Gy /Gw /Zc:inline -fprofile-instr-generate)
/bigobj /wd4100 /wd4189 /wd4065 /wd4201 /wd4324 /GR- /W4 /permissive- /WX /arch:AVX2 /GF /w34388 /w34389 -Wno-unused-macros -Wno-zero-length-array -Wno-switch-default -Wno-reserved-identifier -Wno-unused-parameter -Wno-unused-variable -Wno-unused-private-field /Z7 -Wno-invalid-offsetof -Wno-deprecated-volatile -Wno-missing-prototypes -Wno-reserved-identifier -Wno-implicit-int-float-conversion -Wno-unsafe-buffer-usage -Wno-float-equal -Wno-shadow-field-in-constructor -Wno-gnu-anonymous-struct -Wno-nested-anon-types -Wno-double-promotion -Wno-shadow-uncaptured-local -Wno-nonportable-system-include-path -Wno-format-nonliteral -Wno-shorten-64-to-32 -Wno-ctad-maybe-unsupported -Wno-implicit-int-conversion -Wno-disabled-macro-expansion -Wno-comma -Wno-cast-function-type-strict -Wno-cast-function-type -Wno-invalid-offsetof -Wno-microsoft-cast -Wno-reserved-identifier -Wno-unused-but-set-variable /DNDEBUG /wd4530 /MT /O2 /Oi /sdl- /GS- /Gy /Gw /Zc:inline -fprofile-instr-generate)
target_link_options(AliceCommon INTERFACE /DEBUG:FULL /OPT:REF /OPT:ICF /LTCG -fprofile-instr-generate)
else()
target_compile_options(AliceCommon INTERFACE
Expand Down
Binary file added assets/24button120.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/24button184.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/24outline120.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/24outline184.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/demographicswindow.aui
Binary file not shown.
Binary file added assets/detail16_black.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
41 changes: 13 additions & 28 deletions assets/localisation/en-US/alice.csv
Original file line number Diff line number Diff line change
Expand Up @@ -860,7 +860,6 @@ ai_alliance_2;Your nation is close enough to assist in a war
ai_alliance_3;No conflicting ambitions
ai_alliance_4;Your nation's military is sufficiently strong
ai_alliance_5;Has shared mutual strategic interests
ai_alliance_6;Your nation doesn't have their cores
ai_access_1;The AI sees one of your wars as advantageous to them
col_start_title;Begin colonizing this state
col_start_1;No colonizers are present or colonization is still in the initial stage
Expand Down Expand Up @@ -932,7 +931,6 @@ chat_player_leaves;$playername$ left
chat_player_ban;$playername$ was banned
chat_player_kick;$playername$ was kicked
chat_player_switch;$playername$ has choosen $country$
chat_player_oos_source;Reporting OOS!
chat_player_oos;$playername$ has OOSed!
chat_player_reload;$playername$ has reloaded players
alice_status_stream;Save progress $value$
Expand Down Expand Up @@ -1005,7 +1003,6 @@ change_state_name_to;change state name to $text$
alice_join_crisis_offer;$ACTOR$ will give us the following if we join their side in the current crisis:
alice_unit_disable_rebel_hunt;Stop hunting rebels
alice_regiment_battle_info;$m$ $name$ ?Y$type$?!\nOrganisation: ?Y$organisation$?W\nStrength: ?Y$strength$?W
make_substate;Make a substate
understaffed_regiment;?RThis regiment is understaffed and will only have $value$ soldiers!?W
tech_queue_explain;Press ?YSHIFT?W to add to queue, ?YRight-click?W to remove
alice_province_building_build;?YSHIFT?W to build on the entire ?Gstate?W.\n?YSHIFT-Right-click?W to build on the entire ?Gcountry?W.
Expand All @@ -1020,31 +1017,6 @@ alice_trade_flow_piechart_workforce;Investors
alice_diplo_release_subject;Release subject
alice_diplo_release_subject_desc;Releases one of our subjects, making them no longer our subject, alliances need to be broken separatedly
alice_diplo_release_subject_0;Is our subject
ask_free_trade_agreement;Trade agreement
revoke_trade_rights;Revoke trade rights
msg_trade_rights_revoked;Nation ?Y$y$?W has revoked free trade rights of ?Y$x$?! in their country.
trade_rights_desc;Trade rights or unequal treaties give the other party preferential treatment in trade ignoring tariffs of our country. Once imposed, cannot be revoked for ?Y$x$ years.
revoke_trade_rights_explain_1;Enough time has passed since trade rights were imposed
free_trade_desc;If another party agrees, we'll enter into trade agreement removing all tariffs between our nations for ?Y$x$ years?W.
free_trade_explain_1;Our traders won't pay their tariffs until ?G$date$?!
free_trade_explain_2;Their traders won't pay our tariffs until ?R$date$?!
free_trade_explain_3;We are embargoeing them
free_trade_explain_4;They are embargoing us
issue_embargo;Issue Embargo
lift_embargo;Lift Embargo
embargo_desc;Embargo prevents all trade between our nations. Embargoes are applied automatically to enemies during war.
embargo_explain_1;?GWe embargo them.?!
embargo_explain_2;?RThey embargo us.?!
embargo_explain_3;We don't have trade rights in their country
embargo_explain_4;They don't have trade rights in our country
embargo_explain_5;We aren't in a sphere
embargo_explain_6;They aren't in a sphere
msg_embargo_issued_title;Embargo issued
msg_embargo_issued;Nation ?Y$y$?! has issued embargo to ban trade with ?Y$x$?!.
msg_embargo_lifted_title;Embargo lifted
msg_embargo_lifted;Nation ?Y$y$?! has lifted embargo on trade with ?Y$x$?!.
msg_free_trade_agreement_signed_title;Free trade agreement signed.
msg_free_trade_agreement_signed;Our nations $x$ and $y$ have signed a free trade agreement. It will remove all the tariffs from trade between our countries.
kill_leader;Kill leader
annex_null;becomes unowned
meets_the_conditions_of;meets the conditions of
Expand Down Expand Up @@ -1420,3 +1392,16 @@ aristocrat_savings;Aristocrats saving rate
capitalist_savings;Capitalists saving rate
middle_class_savings;Middle class saving rate
farmers_savings;Farmers saving rate
alice_filter_all;All
alice_filter_none;None
alice_filter_noncolonial;Non Colonial
alice_filter_colonial;Colonial
alice_open_filters;Open Filters
alice_reset_filters;Reset Filters
alice_only_show_pops;Only Pops
alice_job_filter_header;Type
alice_culture_filter_header;Culture
alice_religion_filter_header;Religion
alice_location_filter_header;Location
alice_pop_show_details;Individual Details
alice_demographics_window_header;Demographics
4 changes: 2 additions & 2 deletions assets/localisation/zh-CN/alice.csv
Original file line number Diff line number Diff line change
Expand Up @@ -1244,7 +1244,7 @@ market_stockpiles;库存;;;;;;;;;;;;x
national_stockpile;储备;;;;;;;;;;;;x
government_need;政府采购;;;;;;;;;;;;x
factory_need;工厂输入;;;;;;;;;;;;x
pop_need;人口需求;;;;;;;;;;;;x
pop_need;需求缺口;;;;;;;;;;;;x
rgo_production;原料产地输出;;;;;;;;;;;;x
artisan_production;手工业者输出;;;;;;;;;;;;x
factory_production;工厂输出;;;;;;;;;;;;x
Expand Down Expand Up @@ -1331,7 +1331,7 @@ alice_budget_gold;金矿;;;;;;;;;;;;x
alice_budget_construction;建设;;;;;;;;;;;;x
alice_budget_army_upkeep;陆军支出;;;;;;;;;;;;x
alice_budget_navy_upkeep;海军支出;;;;;;;;;;;;x
alice_budget_domestic_investment;公共工程;;;;;;;;;;;;x
alice_budget_domestic_investment;投资补贴;;;;;;;;;;;;x
alice_budget_debt_service;债务服务;;;;;;;;;;;;x
alice_budget_diplo_income;外交;;;;;;;;;;;;x
alice_budget_diplo_expenses;外交;;;;;;;;;;;;x
Expand Down
Binary file added assets/pop_frames_a.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/pop_frames_b.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/pops_bg.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/pops_filters_bg.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/pops_folder_closed.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/pops_folder_open.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/pops_only_checked.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/pops_only_unchecked.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/pops_row_bg_a.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/pops_row_bg_b.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/prov_border.dds
Binary file not shown.
1 change: 1 addition & 0 deletions src/common_types/native_types_nix.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ native_string to_native_string(T&& v) noexcept {
#define NATIVE(X) X
#define NATIVE_M(X) NATIVE(X)
#define NATIVE_DIR_SEPARATOR '/'
#define NATIVE_DIR_SEPARATORS "/"
1 change: 1 addition & 0 deletions src/common_types/native_types_win.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ native_string to_native_string(T&& v) noexcept {
#define NATIVE(X) L##X
#define NATIVE_M(X) NATIVE(X)
#define NATIVE_DIR_SEPARATOR L'\\'
#define NATIVE_DIR_SEPARATORS L"\\"
47 changes: 36 additions & 11 deletions src/economy/economy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,13 @@ float gdp_adjusted(sys::state& state, dcon::nation_id n) {
return total;
}

float full_spending_cost(sys::state& state, dcon::nation_id n);
struct spending_cost {
float construction;
float other;
float total;
};

spending_cost full_spending_cost(sys::state& state, dcon::nation_id n);
void populate_army_consumption(sys::state& state);
void populate_navy_consumption(sys::state& state);
void populate_construction_consumption(sys::state& state);
Expand Down Expand Up @@ -2893,7 +2899,7 @@ void populate_construction_consumption(sys::state& state) {
if(current_purchased.commodity_amounts[i] >
base_cost.commodity_amounts[i] * admin_cost_factor) continue;

auto can_purchase_budget = std::max(budget_limit, base_budget) / (price(state, market, cid) + 0.001f);
auto can_purchase_budget = std::min(budget_limit, base_budget) / (price(state, market, cid) + 0.001f);
auto can_purchase_construction = base_cost.commodity_amounts[i]
* admin_cost_factor
/ construction_time;
Expand Down Expand Up @@ -2940,7 +2946,7 @@ void populate_construction_consumption(sys::state& state) {
if(current_purchased.commodity_amounts[i] >
base_cost.commodity_amounts[i] * admin_cost_factor * factory_mod) continue;

auto can_purchase_budget = std::max(budget_limit, base_budget) / (price(state, market, cid) + 0.001f);
auto can_purchase_budget = std::min(budget_limit, base_budget) / (price(state, market, cid) + 0.001f);
auto can_purchase_construction = base_cost.commodity_amounts[i]
* admin_cost_factor
* factory_mod
Expand Down Expand Up @@ -3361,7 +3367,14 @@ void populate_private_construction_consumption(sys::state& state) {
}
}

float full_spending_cost(sys::state& state, dcon::nation_id n) {

spending_cost full_spending_cost(sys::state& state, dcon::nation_id n) {
spending_cost costs = {
.construction = 0.f,
.other = 0.f,
.total = 0.f,
};

float total = 0.0f;
float military_total = 0.f;
uint32_t total_commodities = state.world.commodity_size();
Expand Down Expand Up @@ -3413,7 +3426,8 @@ float full_spending_cost(sys::state& state, dcon::nation_id n) {
}
});

total += std::min(construction_budget, total_construction_costs);
costs.construction = std::min(construction_budget, total_construction_costs);
total += costs.construction;


auto capital_state = state.world.province_get_state_membership(state.world.nation_get_capital(n));
Expand Down Expand Up @@ -3544,7 +3558,10 @@ float full_spending_cost(sys::state& state, dcon::nation_id n) {

assert(std::isfinite(total) && total >= 0.0f);

return total;
costs.total = total;
costs.other = total - costs.construction;

return costs;
}

float estimate_stockpile_filling_spending(sys::state& state, dcon::nation_id n) {
Expand Down Expand Up @@ -4107,7 +4124,7 @@ void update_pop_consumption(
});
}

void advance_construction(sys::state& state, dcon::nation_id n) {
void advance_construction(sys::state& state, dcon::nation_id n, float total_spent_on_construction) {
uint32_t total_commodities = state.world.commodity_size();
float p_spending = state.world.nation_get_private_investment_effective_fraction(n);
float refund_amount = 0.0f;
Expand All @@ -4133,7 +4150,7 @@ void advance_construction(sys::state& state, dcon::nation_id n) {
});

assert(refund_amount >= 0.0f);
state.world.nation_get_stockpiles(n, economy::money) += refund_amount;
state.world.nation_get_stockpiles(n, economy::money) += std::min(refund_amount, total_spent_on_construction);

float admin_eff = state.world.nation_get_administrative_efficiency(n);
float admin_cost_factor = 2.0f - admin_eff;
Expand Down Expand Up @@ -5634,16 +5651,22 @@ void daily_update(sys::state& state, bool presimulation, float presimulation_sta

sanity_check(state);

static auto spent_on_construction_buffer = state.world.nation_make_vectorizable_float_buffer();

// STEP 4 national budget updates
for(auto n : state.nations_by_rank) {
spent_on_construction_buffer.set(n, 0.f);

auto cap_prov = state.world.nation_get_capital(n);
auto cap_continent = state.world.province_get_continent(cap_prov);
auto cap_region = state.world.province_get_connected_region_id(cap_prov);
{
// update national spending
//
// step 1: figure out total
float total = full_spending_cost(state, n);
auto costs = full_spending_cost(state, n);

float total = costs.total;

// step 2: limit to actual budget
float budget = 0.0f;
Expand Down Expand Up @@ -5717,6 +5740,8 @@ void daily_update(sys::state& state, bool presimulation, float presimulation_sta
state.world.nation_set_private_investment(n, std::max(0.0f, pi_budget - pi_total * pi_scale));

update_national_consumption(state, n, spending_scale, pi_scale);

spent_on_construction_buffer.set(n, spending_scale * costs.construction);
}
}

Expand Down Expand Up @@ -6918,7 +6943,7 @@ void daily_update(sys::state& state, bool presimulation, float presimulation_sta
}

/* advance construction */
advance_construction(state, n);
advance_construction(state, n, spent_on_construction_buffer.get(n));

if(presimulation) {
emulate_construction_demand(state, n);
Expand Down Expand Up @@ -8143,7 +8168,7 @@ float estimate_subject_payments_paid(sys::state& state, dcon::nation_id n) {
transferamt *= state.defines.alice_puppet_subject_money_transfer / 100.f;
}

return transferamt;
return std::max(0.f, std::min(state.world.nation_get_stockpiles(n, money), transferamt));
}

return 0;
Expand Down
4 changes: 4 additions & 0 deletions src/gamestate/commands.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5981,6 +5981,8 @@ bool can_perform_command(sys::state& state, payload& c) {
return true;
case command_type::console_command:
return true;
case command_type::grant_province:
return false;
}
return false;
}
Expand Down Expand Up @@ -6372,6 +6374,8 @@ void execute_command(sys::state& state, payload& c) {
case command_type::console_command:
execute_console_command(state);
break;
case command_type::grant_province:
break;
}
}

Expand Down
14 changes: 14 additions & 0 deletions src/graphics/opengl_wrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1273,6 +1273,20 @@ void set_gltex_parameters(GLuint texture_handle, GLuint texture_type, GLuint fil
glTexParameteri(texture_type, GL_TEXTURE_WRAP_T, wrap);
glBindTexture(texture_type, 0);
}
void set_gltex_parameters(GLuint texture_handle, GLuint texture_type, GLuint filter, GLuint wrap_a, GLuint wrap_b) {
glBindTexture(texture_type, texture_handle);
if(filter == GL_LINEAR_MIPMAP_NEAREST || filter == GL_LINEAR_MIPMAP_LINEAR) {
glTexParameteri(texture_type, GL_TEXTURE_MIN_FILTER, filter);
glTexParameteri(texture_type, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glGenerateMipmap(texture_type);
} else {
glTexParameteri(texture_type, GL_TEXTURE_MAG_FILTER, filter);
glTexParameteri(texture_type, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
}
glTexParameteri(texture_type, GL_TEXTURE_WRAP_S, wrap_a);
glTexParameteri(texture_type, GL_TEXTURE_WRAP_T, wrap_b);
glBindTexture(texture_type, 0);
}

GLuint load_texture_array_from_file(simple_fs::file& file, int32_t tiles_x, int32_t tiles_y) {
auto image = load_stb_image(file);
Expand Down
5 changes: 5 additions & 0 deletions src/graphics/opengl_wrapper.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ struct color3f {
float b = 0.0f;
};

inline color3f unpack_color(uint32_t v) {
return color3f{ sys::red_from_int(v), sys::green_from_int(v), sys::blue_from_int(v) };
}



struct image {
Expand Down Expand Up @@ -361,6 +365,7 @@ image load_stb_image(simple_fs::file& file);
GLuint make_gl_texture(uint8_t* data, uint32_t size_x, uint32_t size_y, uint32_t channels);
GLuint make_gl_texture(simple_fs::directory const& dir, native_string_view file_name);
void set_gltex_parameters(GLuint texture_handle, GLuint texture_type, GLuint filter, GLuint wrap);
void set_gltex_parameters(GLuint texture_handle, GLuint texture_type, GLuint filter, GLuint wrap_a, GLuint wrap_b);
GLuint load_texture_array_from_file(simple_fs::file& file, int32_t tiles_x, int32_t tiles_y);

class animation;
Expand Down
8 changes: 8 additions & 0 deletions src/graphics/texture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1046,6 +1046,14 @@ GLuint get_rebel_flag_handle(sys::state& state, dcon::rebel_faction_id faction)
}
}

GLuint get_rebel_flag_overlay(sys::state& state) {
static texture overlay;
if(overlay.loaded) {
return overlay.get_texture_handle();
}
return load_file_and_return_handle(NATIVE("assets") NATIVE_DIR_SEPARATORS NATIVE("flags") NATIVE_DIR_SEPARATORS NATIVE("REB_nationalist.png"), state.common_fs, overlay, false);
}

GLuint get_late_load_texture_handle(sys::state& state, dcon::texture_id& id, std::string_view asset_name) {
if(id && state.open_gl.asset_textures[id].loaded) {
return state.open_gl.asset_textures[id].texture_handle;
Expand Down
1 change: 1 addition & 0 deletions src/graphics/texture.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ GLuint get_texture_handle(sys::state& state, dcon::texture_id id, bool keep_data
native_string flag_type_to_name(sys::state& state, culture::flag_type type);
GLuint get_flag_handle(sys::state& state, dcon::national_identity_id nat_id, culture::flag_type type);
GLuint get_rebel_flag_handle(sys::state& state, dcon::rebel_faction_id faction);
GLuint get_rebel_flag_overlay(sys::state& state);
GLuint load_file_and_return_handle(native_string const& native_name, simple_fs::file_system const& fs, texture& asset_texture, bool keep_data);
GLuint get_late_load_texture_handle(sys::state& state, dcon::texture_id& id, std::string_view asset_name);

Expand Down
Loading

0 comments on commit 4fdcc12

Please sign in to comment.