[Widelands-cvs] SF.net SVN: widelands: [1635] trunk/src/building_statistics_menu.cc
Status: Beta
Brought to you by:
sirver
From: <si...@us...> - 2006-09-23 07:40:39
|
Revision: 1635 http://svn.sourceforge.net/widelands/?rev=1635&view=rev Author: sigra Date: 2006-09-23 00:40:30 -0700 (Sat, 23 Sep 2006) Log Message: ----------- Use reference instead of pointer. Modified Paths: -------------- trunk/src/building_statistics_menu.cc Modified: trunk/src/building_statistics_menu.cc =================================================================== --- trunk/src/building_statistics_menu.cc 2006-09-23 07:20:17 UTC (rev 1634) +++ trunk/src/building_statistics_menu.cc 2006-09-23 07:40:30 UTC (rev 1635) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-4 by the Widelands Development Team + * Copyright (C) 2002-2004, 2006 by the Widelands Development Team * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -304,9 +304,9 @@ m_selected = -1; // List all buildings - const Tribe_Descr* tribe = m_parent->get_player()->get_tribe(); - for (long i = 0; i < tribe->get_nrbuildings(); i++) { - const char* const name = tribe->get_building_descr(i)->get_name(); + const Tribe_Descr & tribe = *m_parent->get_player()->get_tribe(); + for (long i = 0; i < tribe.get_nrbuildings(); ++i) { + const char * const name = tribe.get_building_descr(i)->get_name(); if (strcmp(name, "constructionsite") == 0) continue; if (strcmp(name, "headquarters") == 0) continue; @@ -326,7 +326,10 @@ // enabled if(!te) { if(! m_parent->get_player()->is_building_allowed(i) ) continue; - te = new UITable_Entry(m_table, (void*)i, tribe->get_building_descr(i)->get_buildicon()); + te = new UITable_Entry + (m_table, + reinterpret_cast<void * const>(i), + tribe.get_building_descr(i)->get_buildicon()); } int nr_owned=0; @@ -350,7 +353,7 @@ bool is_selected = (m_table->get_selection_index() != -1 && (long)(m_table->get_selection()) == i); if(is_selected) { - m_anim = tribe->get_building_descr(i)->get_ui_anim(); + m_anim = tribe.get_building_descr(i)->get_ui_anim(); m_selected = i; if(nr_owned) for(uint i = 0; i < 2; i++) @@ -368,7 +371,7 @@ // Add new Table Entry char buffer[100]; - te->set_string(0, tribe->get_building_descr(i)->get_descname() ); + te->set_string(0, tribe.get_building_descr(i)->get_descname()); // Product if(is_productionsite && nr_owned) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |