Skip to content

Commit

Permalink
Merge pull request #1869 from Lizzie841/patch-98
Browse files Browse the repository at this point in the history
support loading from tradegoods.txt aswell
  • Loading branch information
schombert authored Jan 20, 2025
2 parents 69bfd2b + 98dc80f commit f2ea6ea
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/gamestate/system_state.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1906,14 +1906,18 @@ void state::load_scenario_data(parsers::error_handler& err, sys::year_month_day
assert(money_id.index() == 0);
}
auto goods = open_file(common, NATIVE("goods.txt"));
err.file_name = "goods.txt";
if(!goods) {
goods = open_file(common, NATIVE("tradegoods"));
err.file_name = "tradegoods.txt";
}
if(goods) {
auto content = view_contents(*goods);
err.file_name = "goods.txt";
parsers::token_generator gen(content.data, content.data + content.file_size);
parsers::parse_goods_file(gen, err, context);
} else {
err.fatal = true;
err.accumulated_errors += "File common/goods.txt could not be opened\n";
err.accumulated_errors += "File common/goods.txt nor common/tradegoods.txt could be opened\n";
}
}
// read buildings.text
Expand Down

0 comments on commit f2ea6ea

Please sign in to comment.