can have an option file line "$FOO := BAR", and then whenever you have a line "option = $FOO" it will get turned into "option = BAR". Doesn't undo variable settings from include files, so that we can theoretically have a settings/standard_colours.txt to define the default colours used in settings/food_colouring and settings/menu_colours, and then the user can override them.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@5473 c06c8d41-db1a-0410-9941-cceddc491573
A4PH3WRSY3DELMUKZGJQM3RQXDBB6QZKM7VNBGACYHKAYKVEMPXAC K2RYVNW6KNB7HLDF5QUGS363M3LC4NXY46D2YMNPCENSXEJNBN2QC T3V75V2CMAABSOXKSGCC6ZTI2WBKSVSGUEF2QAGM2BWLVRIL6SQQC K2CS6TCX2NDVL2ASEHGP4J4K4IJ6FP3ANNKTSIWVG43HPYSBX6ZQC 5RK245FAGZFCDDYG4AZAXSC7JPVIJG4DSAVAKHWWVBUNGICHYNJQC SDLKLUNFGVKDS55DDJZCBAVIB7NL3RRYPTACAY65SCUQKV6APFSAC ASLW3Z5PAVZSWJEMMMVZT226P44EKSAD47QS72JIFJESAI3RPN3AC C55G5JGGSVWMU7XVEJL6YZZLDXQZGRN7JQOAALS6WIKFPX3L2U6QC }#define IS_VAR_CHAR(c) (isalpha(c) || c == '_')std::string game_options::expand_vars(const std::string &field) const{std::string field_out = field;std::string::size_type curr_pos = 0;// Only try 100 times, so as to not get stuck in infinite recursion.for (int i = 0; i < 100; i++){std::string::size_type dollar_pos = field_out.find("$", curr_pos);if (dollar_pos == std::string::npos|| field_out.size() == (dollar_pos + 1)){break;}std::string::size_type start_pos = dollar_pos + 1;if (!IS_VAR_CHAR(field_out[start_pos]))continue;std::string::size_type end_pos;for (end_pos = start_pos; end_pos < field_out.size(); end_pos++){if (!IS_VAR_CHAR(field_out[end_pos + 1]))break;}std::string var_name = field_out.substr(start_pos,end_pos - start_pos + 1);string_map::const_iterator x = variables.find(var_name);if (x == aliases.end()){curr_pos = end_pos + 1;continue;}std::string dollar_plus_name = "$";dollar_plus_name += var_name;field_out = replace_all(field_out, dollar_plus_name, x->second);// Start over at beginingcurr_pos = 0;}return field_out;