Author: sapient
Date: Mon Jul 21 06:49:12 2008
New Revision: 28116
URL: http://svn.gna.org/viewcvs/wesnoth?rev=28116&view=rev
Log:
eliminate two unnecessary copy operations when setting the location set of a
time_area
Modified:
trunk/src/gamestatus.cpp
Modified: trunk/src/gamestatus.cpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/gamestatus.cpp?rev=28116&r1=28115&r2=28116&view=diff
==============================================================================
--- trunk/src/gamestatus.cpp (original)
+++ trunk/src/gamestatus.cpp Mon Jul 21 06:49:12 2008
@@ -145,14 +145,14 @@
void gamestatus::add_time_area(const config& cfg)
{
- const std::vector<gamemap::location> locs =
parse_location_range(cfg["x"],cfg["y"]);
- area_time_of_day area;
+ areas_.push_back(area_time_of_day());
+ area_time_of_day &area = areas_.back();
+ area.id = cfg["id"];
area.xsrc = cfg["x"];
area.ysrc = cfg["y"];
- area.id = cfg["id"];
-
std::copy(locs.begin(),locs.end(),std::inserter(area.hexes,area.hexes.end()));
- time_of_day::parse_times(cfg,area.times);
- areas_.push_back(area);
+ std::vector<gamemap::location> const& locs =
parse_location_range(area.xsrc, area.ysrc);
+ std::copy(locs.begin(), locs.end(), std::inserter(area.hexes,
area.hexes.end()));
+ time_of_day::parse_times(cfg, area.times);
}
void gamestatus::remove_time_area(const std::string& area_id)
_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits