void BattleInfo::setMapImage(Battle const & battle) { Fl_Image * image = cache_.getMapImage(battle.mapName()); if (image) { mapImageBox_->label(0); mapImageBox_->image(image); currentMapImage_ = battle.mapName(); } else { mapImageBox_->image(0); mapImageBox_->label("map\nnot\nfound"); currentMapImage_.clear(); } }
void BattleInfo::battleChanged(const Battle & battle) { if (battle.id() == battleId_) { if (currentMapImage_ != battle.mapName()) { setMapImage(battle); } setHeaderText(battle); } }
void BattleInfo::setHeaderText(Battle const & battle) { std::ostringstream oss; oss << battle.title() << " / " << battle.founder() << " / " << battle.engineVersion() <<"\n" << battle.mapName() << "\n" << battle.modName() << "\n" << "Users:"; for (Battle::BattleUsers::value_type pair : battle.users()) { assert(pair.second); User const & u = *pair.second; oss << " " << u.name(); } headerText_->value(oss.str().c_str()); }