fixed bug where shroud wasn't saved/loaded properly

This commit is contained in:
Dave White 2004-03-04 20:13:49 +00:00
parent 275738657e
commit 58c160af2a
3 changed files with 11 additions and 9 deletions

View file

@ -146,8 +146,8 @@ bool show_intro_part(display& screen, const config& part,
int xpos = textx, ypos = texty; int xpos = textx, ypos = texty;
//the maximum position that text can reach before wrapping //the maximum position that text can reach before wrapping
const int max_xpos = next_button.location().x - 10; const int max_xpos = next_button.location().x - 10;
size_t height = 0; size_t height = 0;
std::string buf; std::string buf;
for(;;) { for(;;) {

View file

@ -36,8 +36,6 @@ namespace {
typedef std::vector<std::vector<int> > height_map; typedef std::vector<std::vector<int> > height_map;
typedef std::vector<std::vector<char> > terrain_map; typedef std::vector<std::vector<char> > terrain_map;
//see http://216.239.39.104/search?q=cache:H2MSHn0AwBIJ:www.cosc.brocku.ca/Offerings/4V98/seminars/Terrain.ppt+height+map+algorithms&hl=en&ie=UTF-8 under
//'Hill Algorithm' for a description of this algorithm
//basically we generate alot of hills, each hill being centered at a certain point, with a certain radius - being a half sphere. //basically we generate alot of hills, each hill being centered at a certain point, with a certain radius - being a half sphere.
//Hills are combined additively to form a bumpy surface //Hills are combined additively to form a bumpy surface
//The size of each hill varies randomly from 1-hill_size. //The size of each hill varies randomly from 1-hill_size.

View file

@ -231,13 +231,15 @@ team::team(const config& cfg, int gold) : gold_(gold), info_(cfg)
const std::string& shroud_data = cfg["shroud_data"]; const std::string& shroud_data = cfg["shroud_data"];
for(std::string::const_iterator sh = shroud_data.begin(); sh != shroud_data.end(); ++sh) { for(std::string::const_iterator sh = shroud_data.begin(); sh != shroud_data.end(); ++sh) {
if(shroud_.empty() || *sh == '\n') if(*sh == '|')
shroud_.resize(shroud_.size()+1); shroud_.resize(shroud_.size()+1);
if(*sh == '1') if(shroud_.empty() == false) {
shroud_.back().push_back(true); if(*sh == '1')
else if(*sh == '0') shroud_.back().push_back(true);
shroud_.back().push_back(false); else if(*sh == '0')
shroud_.back().push_back(false);
}
} }
} }
@ -256,6 +258,8 @@ void team::write(config& cfg) const
std::stringstream shroud_str; std::stringstream shroud_str;
for(std::vector<std::vector<bool> >::const_iterator sh = shroud_.begin(); sh != shroud_.end(); ++sh) { for(std::vector<std::vector<bool> >::const_iterator sh = shroud_.begin(); sh != shroud_.end(); ++sh) {
shroud_str << '|';
for(std::vector<bool>::const_iterator i = sh->begin(); i != sh->end(); ++i) { for(std::vector<bool>::const_iterator i = sh->begin(); i != sh->end(); ++i) {
shroud_str << (*i ? '1' : '0'); shroud_str << (*i ? '1' : '0');
} }