From c4cd091c43ade80033f41c1ceda5c9f51979dcbc Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Mon, 19 Mar 2012 21:03:47 +0000 Subject: Resolved a ModelView related segfault when opening the buy menu and a potental segfault in the inventory window. --- src/ui/modelview.cc | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) (limited to 'src/ui/modelview.cc') diff --git a/src/ui/modelview.cc b/src/ui/modelview.cc index 79544bb..033e4e3 100755 --- a/src/ui/modelview.cc +++ b/src/ui/modelview.cc @@ -47,33 +47,34 @@ void ModelView::print(const size_t indent) const con_print << aux::pad_left(marker, indent*2) << label() << " \"" << modelname() << "\"" << std::endl; } -void ModelView::set_globetexturename(const std::string & texturename, const bool bright, const std::string & coronaname) -{ - modelview_globetexturename.assign(texturename); - modelview_globecoronaname.assign(coronaname); - modelview_globebright = bright; - +void ModelView::clear() +{ set_background(false); + modelview_axis.clear(); modelview_axis.change_direction(180); modelview_axis.change_pitch(-15); modelview_zoom = 1.0f; + modelview_modelname.clear(); + modelview_globetexturename.clear(); + modelview_globecoronaname.clear(); + modelview_globebright = false; +} + +void ModelView::set_globetexturename(const std::string & texturename, const bool bright, const std::string & coronaname) +{ + clear(); + modelview_globetexturename.assign(texturename); + modelview_globecoronaname.assign(coronaname); + modelview_globebright = bright; } void ModelView::set_modelname(const std::string & modelname) { + clear(); modelview_modelname.assign(modelname); - - set_background(false); - modelview_axis.clear(); - modelview_axis.change_direction(180); - modelview_axis.change_pitch(-15); - modelview_zoom = 1.0f; - modelview_globetexturename.clear(); - modelview_globecoronaname.clear(); - modelview_globebright = false; } void ModelView::set_colors(const math::Color & color_primary, const math::Color & color_secondary) -- cgit v1.2.3