Revision: 2588
http://freeorion.svn.sourceforge.net/freeorion/revision/?rev=2588&view=rev
Author: geoffthemedio
Date: 2008-06-15 09:56:15 -0700 (Sun, 15 Jun 2008)
Log Message:
-----------
-Added "at X System" to FleetWnd title
-Changed "At X System" to "Holding at X System" when describing fleet activity on FleetWnd
-Added Tree View and List View buttons to switch between the two. This seems to have made filtering either very slow, however, and in doing so, I've made the default view show no techs, instead of a full tree and I'm not sure why...
-Reorganized fleet move lines and projected fleet move lines and the functions that create and remove them. There can now be multiple fleet move lines and projected move lines emanating from a single fleet icon, if there is more than one fleet within the icon.
-Added an initial draft of a FleetETAMapIndicator that's not yet used
-Fixed Tortanick's name in credits (was a typo)
-Added some commented-out debug output in AI code
-misc. minors tweaks in various files
Modified Paths:
--------------
trunk/FreeOrion/AI/PythonAI.cpp
trunk/FreeOrion/UI/FleetWnd.cpp
trunk/FreeOrion/UI/MapWnd.cpp
trunk/FreeOrion/UI/MapWnd.h
trunk/FreeOrion/UI/SystemIcon.cpp
trunk/FreeOrion/UI/SystemIcon.h
trunk/FreeOrion/UI/TechTreeWnd.cpp
trunk/FreeOrion/UI/TechTreeWnd.h
trunk/FreeOrion/client/AI/AIClientApp.cpp
trunk/FreeOrion/default/credits.xml
trunk/FreeOrion/default/eng_stringtable.txt
trunk/FreeOrion/util/Order.cpp
Modified: trunk/FreeOrion/AI/PythonAI.cpp
===================================================================
--- trunk/FreeOrion/AI/PythonAI.cpp 2008-06-12 02:51:44 UTC (rev 2587)
+++ trunk/FreeOrion/AI/PythonAI.cpp 2008-06-15 16:56:15 UTC (rev 2588)
@@ -234,15 +234,21 @@
}
void PythonAI::GenerateOrders() {
+ Logger().debugStream() << "PythonAI::GenerateOrders : initializing turn";
AIInterface::InitTurn();
try {
// call Python function that generates orders for current turn
+ //Logger().debugStream() << "PythonAI::GenerateOrders : getting generate orders object";
object generateOrdersPythonFunction = s_ai_module.attr("generateOrders");
+ //Logger().debugStream() << "PythonAI::GenerateOrders : generating orders";
generateOrdersPythonFunction();
} catch (error_already_set err) {
PyErr_Print();
+ //Logger().debugStream() << "PythonAI::GenerateOrders : python error caught and printed";
AIInterface::DoneTurn();
+ //Logger().debugStream() << "PythonAI::GenerateOrders : done with error";
}
+ //Logger().debugStream() << "PythonAI::GenerateOrders : done successfully";
}
void PythonAI::HandleChatMessage(int sender_id, const std::string& msg) {
Modified: trunk/FreeOrion/UI/FleetWnd.cpp
===================================================================
--- trunk/FreeOrion/UI/FleetWnd.cpp 2008-06-12 02:51:44 UTC (rev 2587)
+++ trunk/FreeOrion/UI/FleetWnd.cpp 2008-06-15 16:56:15 UTC (rev 2588)
@@ -98,7 +98,7 @@
}
FleetWnd* FleetUIManager::NewFleetWnd(std::vector<Fleet*> fleets, int selected_fleet, bool read_only,
- GG::Flags<GG::WndFlag> flags/* = GG::CLICKABLE | GG::DRAGABLE | GG::ONTOP | CLOSABLE*/)
+ GG::Flags<GG::WndFlag> flags/* = GG::CLICKABLE | GG::DRAGABLE | GG::ONTOP | CLOSABLE*/)
{
if (!GetOptionsDB().Get<bool>("UI.multiple-fleet-windows"))
CloseAll();
@@ -110,7 +110,7 @@
}
FleetDetailWnd* FleetUIManager::NewFleetDetailWnd(FleetWnd* fleet_wnd, Fleet* fleet, bool read_only,
- GG::Flags<GG::WndFlag> flags/* = GG::CLICKABLE | GG::DRAGABLE | GG::RESIZABLE | GG::ONTOP | CLOSABLE*/)
+ GG::Flags<GG::WndFlag> flags/* = GG::CLICKABLE | GG::DRAGABLE | GG::RESIZABLE | GG::ONTOP | CLOSABLE*/)
{
assert(fleet_wnd);
assert(m_fleet_wnds.find(fleet_wnd) != m_fleet_wnds.end());
@@ -533,9 +533,7 @@
Select(false);
}
-void FleetDataPanel::DropsAcceptable(DropsAcceptableIter first,
- DropsAcceptableIter last,
- const GG::Pt& pt) const
+void FleetDataPanel::DropsAcceptable(DropsAcceptableIter first, DropsAcceptableIter last, const GG::Pt& pt) const
{
for (DropsAcceptableIter it = first; it != last; ++it) {
if (it->first->DragDropDataType() == SHIP_DROP_TYPE_STRING) {
@@ -1091,7 +1089,7 @@
dest_name % final_eta_text % next_eta_text);
} else if (current) {
- retval = boost::io::str(FlexibleFormat(UserString("FW_FLEET_AT")) % current->Name());
+ retval = boost::io::str(FlexibleFormat(UserString("FW_FLEET_HOLDING_AT")) % current->Name());
}
return retval;
}
@@ -1208,7 +1206,7 @@
FleetWnd::~FleetWnd()
{
- ClientUI::GetClientUI()->GetMapWnd()->SetProjectedFleetMovement(0, std::list<System*>());
+ ClientUI::GetClientUI()->GetMapWnd()->ClearProjectedFleetMovementLines();
ClosingSignal(this);
}
@@ -1391,7 +1389,19 @@
std::string FleetWnd::TitleText() const
{
Fleet* existing_fleet = FleetInRow(0);
- return boost::io::str(boost::format(UserString("FW_EMPIRE_FLEETS")) % Empires().Lookup(*existing_fleet->Owners().begin())->Name());
+
+ if (!existing_fleet)
+ return UserString("FW_NO_FLEET");
+
+ const System* system = GetUniverse().Object<System>(m_system_id);
+
+ if (system)
+ return boost::io::str(FlexibleFormat(UserString("FW_EMPIRE_FLEETS_AT_SYSTEM")) %
+ Empires().Lookup(*existing_fleet->Owners().begin())->Name() %
+ system->Name());
+ else
+ return boost::io::str(FlexibleFormat(UserString("FW_EMPIRE_FLEETS")) %
+ Empires().Lookup(*existing_fleet->Owners().begin())->Name());
}
void FleetWnd::CreateNewFleetFromDrops(Ship* first_ship, const std::vector<int>& ship_ids)
Modified: trunk/FreeOrion/UI/MapWnd.cpp
===================================================================
--- trunk/FreeOrion/UI/MapWnd.cpp 2008-06-12 02:51:44 UTC (rev 2587)
+++ trunk/FreeOrion/UI/MapWnd.cpp 2008-06-15 16:56:15 UTC (rev 2588)
@@ -194,6 +194,46 @@
}
}
+// MapWnd::FleetETAMapIndicator
+class MapWnd::FleetETAMapIndicator : public GG::Wnd
+{
+public:
+ FleetETAMapIndicator(double x, double y, int eta);
+ virtual void Render();
+private:
+ double m_x, m_y;
+ GG::TextControl* m_text;
+};
+
+MapWnd::FleetETAMapIndicator::FleetETAMapIndicator(double x, double y, int eta) :
+ GG::Wnd(0, 0, 1, 1, GG::Flags<GG::WndFlag>()),
+ m_x(x),
+ m_y(y),
+ m_text(0)
+{
+ std::string eta_text;
+ if (eta == Fleet::ETA_UNKNOWN)
+ eta_text = UserString("FW_FLEET_ETA_UNKNOWN");
+ else if (eta == Fleet::ETA_NEVER)
+ eta_text = UserString("FW_FLEET_ETA_NEVER");
+ else if (eta == Fleet::ETA_OUT_OF_RANGE)
+ eta_text = UserString("FW_FLEET_ETA_OUT_OF_RANGE");
+ else
+ eta_text = boost::lexical_cast<std::string>(eta);
+
+ m_text = new GG::TextControl(0, 0, eta_text, GG::GUI::GetGUI()->GetFont(ClientUI::Font(), ClientUI::Pts()),
+ ClientUI::TextColor(), GG::FORMAT_CENTER | GG::FORMAT_VCENTER);
+ Resize(m_text->Size());
+ AttachChild(m_text);
+}
+
+void MapWnd::FleetETAMapIndicator::Render()
+{
+ GG::Pt ul = UpperLeft();
+ GG::Pt lr = LowerRight();
+ GG::FlatRectangle(ul.x, ul.y, lr.x, lr.y, GG::CLR_BLACK, ClientUI::WndInnerBorderColor(), 1);
+}
+
// MapWnd
// static(s)
double MapWnd::s_min_scale_factor = 0.35;
@@ -202,8 +242,8 @@
MapWnd::MapWnd() :
GG::Wnd(-GG::GUI::GetGUI()->AppWidth(), -GG::GUI::GetGUI()->AppHeight(),
- static_cast<int>(Universe::UniverseWidth() * s_max_scale_factor + GG::GUI::GetGUI()->AppWidth() * 1.5),
- static_cast<int>(Universe::UniverseWidth() * s_max_scale_factor + GG::GUI::GetGUI()->AppHeight() * 1.5),
+ static_cast<int>(Universe::UniverseWidth() * s_max_scale_factor + GG::GUI::GetGUI()->AppWidth() * 1.5),
+ static_cast<int>(Universe::UniverseWidth() * s_max_scale_factor + GG::GUI::GetGUI()->AppHeight() * 1.5),
GG::CLICKABLE | GG::DRAGABLE),
m_disabled_accels_list(),
m_backgrounds(),
@@ -712,7 +752,7 @@
// this gets cleared here instead of with the movement line stuff because that would clear some movement lines that come from the SystemIcons below
m_fleet_lines.clear();
- m_projected_fleet_line = MovementLineData();
+ ClearProjectedFleetMovementLines();
// systems and starlanes
for (std::map<int, SystemIcon*>::iterator it = m_system_icons.begin(); it != m_system_icons.end(); ++it)
@@ -774,12 +814,12 @@
m_system_icons[systems[i]->ID()] = icon;
icon->InstallEventFilter(this);
AttachChild(icon);
- GG::Connect(icon->LeftClickedSignal, &MapWnd::SystemLeftClicked, this);
- GG::Connect(icon->RightClickedSignal, &MapWnd::SystemRightClicked, this);
- GG::Connect(icon->LeftDoubleClickedSignal, &MapWnd::SystemDoubleClicked, this);
- GG::Connect(icon->MouseEnteringSignal, &MapWnd::MouseEnteringSystem, this);
- GG::Connect(icon->MouseLeavingSignal, &MapWnd::MouseLeavingSystem, this);
- GG::Connect(icon->FleetButtonClickedSignal, &MapWnd::FleetButtonLeftClicked, this);
+ GG::Connect(icon->LeftClickedSignal, &MapWnd::SystemLeftClicked, this);
+ GG::Connect(icon->RightClickedSignal, &MapWnd::SystemRightClicked, this);
+ GG::Connect(icon->LeftDoubleClickedSignal, &MapWnd::SystemDoubleClicked, this);
+ GG::Connect(icon->MouseEnteringSignal, &MapWnd::MouseEnteringSystem, this);
+ GG::Connect(icon->MouseLeavingSignal, &MapWnd::MouseLeavingSystem, this);
+ GG::Connect(icon->FleetButtonClickedSignal, &MapWnd::FleetButtonLeftClicked, this);
// gaseous substance around system
if (boost::shared_ptr<GG::Texture> gaseous_texture =
@@ -877,7 +917,7 @@
DoMovingFleetButtonsLayout();
// create movement lines (after positioning buttons, so lines will originate from button location)
for (std::vector<FleetButton*>::iterator it = m_moving_fleet_buttons.begin(); it != m_moving_fleet_buttons.end(); ++it)
- SetFleetMovement(*it);
+ SetFleetMovementLine(*it);
// update effect accounting and meter estimates
@@ -924,7 +964,8 @@
MoveChildUp(m_side_panel);
// set turn button to current turn
- m_turn_update->SetText( UserString("MAP_BTN_TURN_UPDATE") + boost::lexical_cast<std::string>(turn_number ) );
+ m_turn_update->SetText(boost::io::str(FlexibleFormat(UserString("MAP_BTN_TURN_UPDATE")) %
+ boost::lexical_cast<std::string>(turn_number)));
MoveChildUp(m_turn_update);
// are there any sitreps to show?
@@ -981,8 +1022,6 @@
GG::Connect(empire->GetProductionQueue().ProductionQueueChangedSignal, &SidePanel::Refresh);
- //GG::Connect(empire->GetFoodResPool().ChangedSignal, &SidePanel::Refresh);
- //GG::Connect(empire->GetPopulationPool().ChangedSignal, &SidePanel::Refresh);
m_toolbar->Show();
m_FPS->Show();
@@ -1383,7 +1422,7 @@
}
}
-void MapWnd::SetFleetMovement(FleetButton* fleet_button)
+void MapWnd::SetFleetMovementLine(const FleetButton* fleet_button)
{
assert(fleet_button);
for (std::vector<Fleet*>::const_iterator it = fleet_button->Fleets().begin(); it != fleet_button->Fleets().end(); ++it) {
@@ -1392,46 +1431,52 @@
}
}
-void MapWnd::SetFleetMovement(Fleet* fleet)
+void MapWnd::SetFleetMovementLine(const Fleet* fleet)
{
- assert(fleet);
+ if (!fleet) {
+ Logger().errorStream() << "MapWnd::SetFleetMovementLine was passed a null fleet pointer";
+ return;
+ }
- std::map<Fleet*, MovementLineData>::iterator it = m_fleet_lines.find(fleet);
- if (it != m_fleet_lines.end()) {
- const System* system = fleet->GetSystem();
- if (system) {
- // attempt draw line from fleet button location near system icon
- // get system icon
- std::map<int, SystemIcon*>::const_iterator it2 = m_system_icons.find(system->ID());
- if (it2 != m_system_icons.end()) {
- // get fleet button
- const FleetButton* fleet_button = it2->second->GetFleetButton(fleet);
- assert(fleet_button);
- m_fleet_lines[fleet] = MovementLineData(fleet_button, fleet->MovePath());
+ if (const System* system = fleet->GetSystem()) {
+ // if fleet is in a system, draw movement line from fleet button near system icon.
+
+ // get system icon
+ std::map<int, SystemIcon*>::const_iterator icon_it = m_system_icons.find(system->ID());
+ if (icon_it != m_system_icons.end()) {
+ const SystemIcon* icon = icon_it->second;
+ // get fleet button
+ const FleetButton* fleet_button = icon->GetFleetButton(fleet);
+
+ if (!fleet_button) {
+ Logger().errorStream() << "MapWnd::SetFleetMovement couldn't get a fleet button for a fleet in a system";
return;
}
+
+ m_fleet_lines[fleet] = MovementLineData(fleet_button, fleet->MovePath());
}
-
- // else if any of the above failed...
-
- // draw line from fleet's centre
+ } else {
+ // fleet is not in a system, so fleet button is located at fleet's actual location, so can just
+ // create movement line starting at fleet's actual universe position
m_fleet_lines[fleet] = MovementLineData(fleet->X(), fleet->Y(), fleet->MovePath());
}
}
-void MapWnd::SetProjectedFleetMovement(Fleet* fleet, const std::list<System*>& travel_route)
+void MapWnd::SetProjectedFleetMovementLine(const Fleet* fleet, const std::list<System*>& travel_route)
{
- if (!fleet || travel_route.empty()) {
- // no route to display - set projected line to default empty MovementLineData
- m_projected_fleet_line = MovementLineData();
+ if (!fleet)
return;
+
+ if (travel_route.empty()) {
+ RemoveProjectedFleetMovementLine(fleet);
+ return;
}
std::list<MovePathNode> path = fleet->MovePath(travel_route);
if (path.empty()) {
// no route to display
- m_projected_fleet_line = MovementLineData();
+ RemoveProjectedFleetMovementLine(fleet);
return;
}
@@ -1441,11 +1486,11 @@
std::pair<double, double> universe_position;
// check if this MapWnd already has MovementLineData for this fleet
- std::map<Fleet*, MovementLineData>::iterator it = m_fleet_lines.find(fleet);
+ std::map<const Fleet*, MovementLineData>::iterator it = m_fleet_lines.find(fleet);
if (it != m_fleet_lines.end()) {
// there is a fleet line already. Its x and y are useful for the projected line, so it can be copied and tweaked a bit
std::pair<double, double> start = it->second.Start();
- m_projected_fleet_line = MovementLineData(start.first, start.second, path, line_colour);
+ m_projected_fleet_lines[fleet] = MovementLineData(start.first, start.second, path, line_colour);
} else {
// there is no preexisting fleet line. need to make one from scratch
@@ -1457,14 +1502,39 @@
// get fleet button
const FleetButton* fleet_button = it->second->GetFleetButton(fleet);
assert(fleet_button);
- m_projected_fleet_line = MovementLineData(fleet_button, path, line_colour);
+ m_projected_fleet_lines[fleet] = MovementLineData(fleet_button, path, line_colour);
} else {
// couldn't get a fleet button, so instead use fleet's own position
- m_projected_fleet_line = MovementLineData(fleet->X(), fleet->Y(), path, line_colour);
+ m_projected_fleet_lines[fleet] = MovementLineData(fleet->X(), fleet->Y(), path, line_colour);
}
}
}
+void MapWnd::SetProjectedFleetMovementLines(const std::vector<const Fleet*>& fleets, const std::list<System*>& travel_route)
+{
+ for (std::vector<const Fleet*>::const_iterator it = fleets.begin(); it != fleets.end(); ++it)
+ SetProjectedFleetMovementLine(*it, travel_route);
+}
+
+void MapWnd::RemoveProjectedFleetMovementLine(const Fleet* fleet)
+{
+ std::map<const Fleet*, MovementLineData>::iterator it = m_projected_fleet_lines.find(fleet);
+ if (it != m_projected_fleet_lines.end())
+ m_projected_fleet_lines.erase(it);
+}
+
+void MapWnd::ClearProjectedFleetMovementLines()
+{
+ m_projected_fleet_lines.clear();
+ for (std::map<const Fleet*, std::vector<FleetETAMapIndicator*> >::iterator map_it = m_projected_fleet_eta_map_indicators.begin();
+ map_it != m_projected_fleet_eta_map_indicators.end(); ++map_it)
+ {
+ for (std::vector<FleetETAMapIndicator*>::iterator vec_it = map_it->second.begin(); vec_it != map_it->second.end(); ++vec_it)
+ DeleteChild(*vec_it);
+ }
+ m_projected_fleet_eta_map_indicators.clear();
+}
+
bool MapWnd::EventFilter(GG::Wnd* w, const GG::WndEvent& event)
{
if (event.Type() == GG::WndEvent::RClick && FleetUIManager::GetFleetUIManager().empty()) {
@@ -1797,7 +1867,7 @@
// render standard movement lines
glLineStipple(static_cast<int>(STARLANE_WIDTH), STIPPLE);
- for (std::map<Fleet*, MovementLineData>::iterator it = m_fleet_lines.begin(); it != m_fleet_lines.end(); ++it)
+ for (std::map<const Fleet*, MovementLineData>::const_iterator it = m_fleet_lines.begin(); it != m_fleet_lines.end(); ++it)
RenderMovementLine(it->second);
@@ -1808,9 +1878,10 @@
const unsigned int PROJECTED_PATH_STIPPLE =
(PATTERN << PROJECTED_PATH_SHIFT) | (PATTERN >> (GLUSHORT_BIT_LENGTH - PROJECTED_PATH_SHIFT));
- //// render projected move path
+ //// render projected move lines
glLineStipple(static_cast<int>(STARLANE_WIDTH), PROJECTED_PATH_STIPPLE);
- RenderMovementLine(m_projected_fleet_line);
+ for (std::map<const Fleet*, MovementLineData>::const_iterator it = m_projected_fleet_lines.begin(); it != m_projected_fleet_lines.end(); ++it)
+ RenderMovementLine(it->second);
}
void MapWnd::RenderMovementLine(const MapWnd::MovementLineData& move_line) {
@@ -1900,7 +1971,7 @@
{
if (!m_in_production_view_mode && FleetUIManager::GetFleetUIManager().ActiveFleetWnd()) {
if (system_id == UniverseObject::INVALID_OBJECT_ID)
- SetProjectedFleetMovement(0, std::list<System*>()) ;
+ ClearProjectedFleetMovementLines();
else
PlotFleetMovement(system_id, true);
}
@@ -1909,9 +1980,8 @@
void MapWnd::MouseEnteringSystem(int system_id)
{
- if (!m_in_production_view_mode && FleetUIManager::GetFleetUIManager().ActiveFleetWnd()) {
+ if (!m_in_production_view_mode && FleetUIManager::GetFleetUIManager().ActiveFleetWnd())
PlotFleetMovement(system_id, false);
- }
SystemBrowsedSignal(system_id);
}
@@ -1938,7 +2008,7 @@
// plot empty move pathes if destination is not a known system
if (system_id == UniverseObject::INVALID_OBJECT_ID) {
- SetProjectedFleetMovement(fleet, std::list<System*>()) ;
+ RemoveProjectedFleetMovementLine(fleet);
continue;
}
@@ -1962,8 +2032,8 @@
if (execute_move && !route.empty())
HumanClientApp::GetApp()->Orders().IssueOrder(OrderPtr(new FleetMoveOrder(empire_id, fleet->ID(), start_system, system_id)));
- // show route on map
- SetProjectedFleetMovement(fleet, route);
+ // display projected move line
+ SetProjectedFleetMovementLine(fleet, route);
}
}
@@ -2110,18 +2180,20 @@
{}
void MapWnd::UniverseObjectDeleted(const UniverseObject *obj)
-{ m_fleet_lines.erase(const_cast<Fleet*>(universe_object_cast<const Fleet*>(obj))); }
+{
+ m_fleet_lines.erase(universe_object_cast<const Fleet*>(obj));
+}
-void MapWnd::RegisterPopup( MapWndPopup* popup )
+void MapWnd::RegisterPopup(MapWndPopup* popup)
{
if (popup)
m_popups.push_back(popup);
}
-void MapWnd::RemovePopup( MapWndPopup* popup )
+void MapWnd::RemovePopup(MapWndPopup* popup)
{
if (popup) {
- std::list<MapWndPopup*>::iterator it = std::find( m_popups.begin(), m_popups.end(), popup );
+ std::list<MapWndPopup*>::iterator it = std::find(m_popups.begin(), m_popups.end(), popup);
if (it != m_popups.end())
m_popups.erase(it);
}
@@ -2205,7 +2277,7 @@
bool MapWnd::ToggleSitRep()
{
- m_projected_fleet_line = MovementLineData();
+ ClearProjectedFleetMovementLines();
if (m_sitrep_panel->Visible()) {
DetachChild(m_sitrep_panel);
m_sitrep_panel->Hide(); // necessary so it won't be visible when next toggled
@@ -2237,7 +2309,7 @@
bool MapWnd::ToggleResearch()
{
- m_projected_fleet_line = MovementLineData();
+ ClearProjectedFleetMovementLines();
if (m_research_wnd->Visible()) {
m_research_wnd->Hide();
} else {
@@ -2264,7 +2336,7 @@
bool MapWnd::ToggleProduction()
{
- m_projected_fleet_line = MovementLineData();
+ ClearProjectedFleetMovementLines();
if (m_production_wnd->Visible()) {
m_production_wnd->Hide();
m_in_production_view_mode = false;
@@ -2298,7 +2370,7 @@
bool MapWnd::ToggleDesign()
{
- m_projected_fleet_line = MovementLineData();
+ ClearProjectedFleetMovementLines();
if (m_design_wnd->Visible()) {
m_design_wnd->Hide();
EnableAlphaNumAccels();
@@ -2327,7 +2399,7 @@
bool MapWnd::ShowMenu()
{
if (!m_menu_showing) {
- m_projected_fleet_line = MovementLineData();
+ ClearProjectedFleetMovementLines();
m_menu_showing = true;
InGameMenu menu;
menu.Run();
Modified: trunk/FreeOrion/UI/MapWnd.h
===================================================================
--- trunk/FreeOrion/UI/MapWnd.h 2008-06-12 02:51:44 UTC (rev 2587)
+++ trunk/FreeOrion/UI/MapWnd.h 2008-06-15 16:56:15 UTC (rev 2588)
@@ -66,8 +66,10 @@
void GetSaveGameUIData(SaveGameUIData& data) const; //!< populates the relevant UI state that should be restored after a save-and-load cycle
bool InProductionViewMode() const; //!< returns true iff this MapWnd is visible and usable for interaction, but the allowed interactions are restricted to those appropriate to the production screen
- GG::Pt ScreenCoordsFromUniversePosition(double universe_x, double universe_y) const; //!< returns the position on the screen that corresponds to the specified universe X and Y coordinates
- std::pair<double, double> UniversePositionFromScreenCoords(GG::Pt screen_coords) const; //!< returns the universe position (X and Y in pair) that corresponds to the specified screen coordinates
+ /* returns the position on the screen that corresponds to the specified universe X and Y coordinates. */
+ GG::Pt ScreenCoordsFromUniversePosition(double universe_x, double universe_y) const;
+ /* returns the universe position (X and Y in pair) that corresponds to the specified screen coordinates. */
+ std::pair<double, double> UniversePositionFromScreenCoords(GG::Pt screen_coords) const;
//!@}
//! \name Mutators //!@{
@@ -100,10 +102,20 @@
void SelectFleet(int fleetID); //!< allows programmatic selection of fleets
void SelectFleet(Fleet* fleet); //!< allows programmatic selection of fleets
- void SetFleetMovement(FleetButton* fleet_button); //!< creates fleet movement lines for all fleets in the given FleetButton to indicate where (and whether) they are moving. Move lines originate from the FleetButton.
- void SetFleetMovement(Fleet* fleet); //!< creates fleet movement line for a single fleet. Move lines originate from the fleet's button location.
- void SetProjectedFleetMovement(Fleet* fleet, const std::list<System*>& travel_route); //!< creates specially-coloured projected fleet movement line for specified fleet following the specified route. Move line originates from the fleet's button location.
+ void SetFleetMovementLine(const FleetButton* fleet_button); //!< creates fleet movement lines for all fleets in the given FleetButton to indicate where (and whether) they are moving. Move lines originate from the FleetButton.
+ void SetFleetMovementLine(const Fleet* fleet); //!< creates fleet movement line for a single fleet. Move lines originate from the fleet's button location.
+ void SetFleetETAIndicators(const std::vector<const Fleet*>& fleets); //!< removes existing fleet move line ETA indicators, and adds indicators for the specified \a fleets move lines
+ /* creates specially-coloured projected fleet movement line for specified fleet following the specified
+ route. Move line originates from the fleet's button location. */
+ void SetProjectedFleetMovementLine(const Fleet* fleet, const std::list<System*>& travel_route);
+ /* creates specially-coloured projected fleet movement lines for specified fleets following the specified
+ route. Move lines originates from the fleets' button locations. */
+ void SetProjectedFleetMovementLines(const std::vector<const Fleet*>& fleets, const std::list<System*>& travel_route);
+ void RemoveProjectedFleetMovementLine(const Fleet* fleet); //!< removes projected fleet movement line for specified fleet.
+ void ClearProjectedFleetMovementLines(); //!< removes all projected fleet movement lines
+ void SetProjectedFleetETAIndicators(); //!< creates fleet move line ETA indicators for current projected fleet move lines
+
void RegisterPopup(MapWndPopup* popup); //!< registers a MapWndPopup, which can be cleaned up with a call to DeleteAllPopups( )
void RemovePopup(MapWndPopup* popup); //!< removes a MapWndPopup from the list cleaned up on a call to DeleteAllPopups( )
void Cleanup(); //!< cleans up the MapWnd at the end of a turn (ie, closes all windows and disables all keyboard accelerators)
@@ -150,6 +162,8 @@
double m_x, m_y; ///< universe x and y at which to originate line (start point isn't in the path) (if m_button is nonzero, its galaxy position should be used instead)
};
+ class FleetETAMapIndicator;
+
void Zoom(int delta); //!< changes the zoomlevel of the main map
void DoMovingFleetButtonsLayout(); //!< does layout of fleet buttons for moving fleets
void DoSystemIconsLayout(); //!< does layout of system icons
@@ -196,8 +210,7 @@
/** Disables keyboard accelerators that use an alphanumeric key without modifiers. This is useful if a
* keyboard input is required, so that the keys aren't interpreted as an accelerator.
* @note Repeated calls of DisableAlphaNumAccels have to be followed by the same number of calls to
- * EnableAlphaNumAccels to re-enable the accelerators.
- */
+ * EnableAlphaNumAccels to re-enable the accelerators. */
void DisableAlphaNumAccels();
void EnableAlphaNumAccels(); //!< Re-enable accelerators disabled by DisableAlphaNumAccels
@@ -210,10 +223,10 @@
std::set<GG::Key> m_disabled_accels_list; //!< the list of Accelerators disabled by \a DisableAlphaNumAccels
- std::vector<boost::shared_ptr<GG::Texture> > m_backgrounds; //!< starfield backgrounds
- std::vector<boost::shared_ptr<GG::Texture> > m_nebulae; //!< decorative nebula textures
- std::vector<GG::Pt> m_nebula_centers; //!< the centerpoints of each of the nebula textures
- std::vector<double> m_bg_scroll_rate; //!< array, the rates at which each background scrolls
+ std::vector<boost::shared_ptr<GG::Texture> > m_backgrounds; //!< starfield backgrounds
+ std::vector<boost::shared_ptr<GG::Texture> > m_nebulae; //!< decorative nebula textures
+ std::vector<GG::Pt> m_nebula_centers; //!< the centerpoints of each of the nebula textures
+ std::vector<double> m_bg_scroll_rate; //!< array, the rates at which each background scrolls
int m_previously_selected_system;
@@ -227,10 +240,16 @@
GG::MultiEdit* m_chat_display; //!< (read-only) MP-chat output multi-line edit box
CUIEdit* m_chat_edit; //!< MP-chat input edit box
- std::vector<FleetButton*> m_moving_fleet_buttons; //!< moving fleets in the main map (SystemIcons contain stationary fleet buttons)
- std::map<Fleet*, MovementLineData> m_fleet_lines; //!< lines used for moving fleets in the main map
- MovementLineData m_projected_fleet_line; //!< lines that show the projected path of the active fleet in the FleetWnd
+ std::vector<FleetButton*> m_moving_fleet_buttons; //!< moving fleets in the main map (SystemIcons contain stationary fleet buttons)
+ std::map<const Fleet*, MovementLineData> m_fleet_lines; //!< lines used for moving fleets in the main map
+ std::map<const Fleet*,
+ std::vector<FleetETAMapIndicator*> > m_fleet_eta_map_indicators; //!< indicators that appear adjacent to fleet move lines that indicate the eta for points on a move path
+
+ std::map<const Fleet*, MovementLineData> m_projected_fleet_lines; //!< lines that show the projected path of the active fleet in the FleetWnd
+ std::map<const Fleet*,
+ std::vector<FleetETAMapIndicator*> > m_projected_fleet_eta_map_indicators; //!< indicators that appear adjacent to projected fleet move lines that indicate the eta for points on a move path
+
// OpenGL buffers objects containing vertices, texture coordinates, etc.
struct GLBuffer
{
Modified: trunk/FreeOrion/UI/SystemIcon.cpp
===================================================================
--- trunk/FreeOrion/UI/SystemIcon.cpp 2008-06-12 02:51:44 UTC (rev 2587)
+++ trunk/FreeOrion/UI/SystemIcon.cpp 2008-06-15 16:56:15 UTC (rev 2588)
@@ -126,7 +126,7 @@
return m_system;
}
-const FleetButton* SystemIcon::GetFleetButton(Fleet* fleet) const
+const FleetButton* SystemIcon::GetFleetButton(const Fleet* fleet) const
{
std::map<int, FleetButton*>::const_iterator it = m_stationary_fleet_markers.find(*fleet->Owners().begin());
if (it != m_stationary_fleet_markers.end()) {
@@ -402,11 +402,11 @@
std::map<int, FleetButton*>::iterator button_it = m_stationary_fleet_markers.find(empire_id);
if (button_it != m_stationary_fleet_markers.end())
- map_wnd->SetFleetMovement(button_it->second);
-
+ map_wnd->SetFleetMovementLine(button_it->second);
+
button_it = m_moving_fleet_markers.find(empire_id);
if (button_it != m_moving_fleet_markers.end())
- map_wnd->SetFleetMovement(button_it->second);
+ map_wnd->SetFleetMovementLine(button_it->second);
}
}
Modified: trunk/FreeOrion/UI/SystemIcon.h
===================================================================
--- trunk/FreeOrion/UI/SystemIcon.h 2008-06-12 02:51:44 UTC (rev 2587)
+++ trunk/FreeOrion/UI/SystemIcon.h 2008-06-15 16:56:15 UTC (rev 2588)
@@ -47,7 +47,7 @@
//! \name Accessors //!@{
const System& GetSystem() const;
- const FleetButton* GetFleetButton(Fleet* fleet) const;
+ const FleetButton* GetFleetButton(const Fleet* fleet) const;
GG::Pt FleetButtonCentre(int empire_id, bool moving) const; //!< returns centre of fleetbutton owned by empire with id \a empire_id, or GG::Pt(INVALID_POSITION, INVALID_POSITION) if there is no such FleetButton for the specified empire.
const boost::shared_ptr<GG::Texture>& DiscTexture() const; //!< returns the solid star disc texture
Modified: trunk/FreeOrion/UI/TechTreeWnd.cpp
===================================================================
--- trunk/FreeOrion/UI/TechTreeWnd.cpp 2008-06-12 02:51:44 UTC (rev 2587)
+++ trunk/FreeOrion/UI/TechTreeWnd.cpp 2008-06-15 16:56:15 UTC (rev 2588)
@@ -374,12 +374,14 @@
std::vector<CUIButton*> m_category_buttons;
std::map<TechType, CUIButton*> m_tech_type_buttons;
std::map<TechStatus, CUIButton*> m_tech_status_buttons;
+ CUIButton* m_list_view_button;
+ CUIButton* m_tree_view_button;
friend class TechTreeWnd; // so TechTreeWnd can access buttons
};
TechTreeWnd::TechTreeControls::TechTreeControls(int x, int y, int w) :
-CUIWnd(UserString("TECH_DISPLAY"), x, y, w, 10, GG::CLICKABLE | GG::DRAGABLE | GG::RESIZABLE | GG::ONTOP)
+ CUIWnd(UserString("TECH_DISPLAY"), x, y, w, 10, GG::CLICKABLE | GG::DRAGABLE | GG::RESIZABLE | GG::ONTOP)
{
// create a button for each tech category...
const std::vector<std::string>& cats = GetTechManager().CategoryNames();
@@ -415,6 +417,14 @@
for (std::map<TechStatus, CUIButton*>::iterator it = m_tech_status_buttons.begin(); it != m_tech_status_buttons.end(); ++it)
it->second->MarkSelectedGray();
+ // create buttons to switch between tree and list views
+ m_list_view_button = new CUIButton(0, 0, 80, UserString("TECH_WND_LIST_VIEW"));
+ m_list_view_button->MarkNotSelected();
+ AttachChild(m_list_view_button);
+ m_tree_view_button = new CUIButton(0, 30, 80, UserString("TECH_WND_TREE_VIEW"));
+ m_tree_view_button->MarkSelectedGray();
+ AttachChild(m_tree_view_button);
+
EnableChildClipping(true);
DoButtonLayout();
Resize(GG::Pt(Width(), MinSize().y));
@@ -439,6 +449,7 @@
m_col_offset = BUTTON_WIDTH + BUTTON_SEPARATION; // horizontal distance between each column of buttons
m_row_offset = BUTTON_HEIGHT + BUTTON_SEPARATION; // vertical distance between each row of buttons
+ // place category buttons: fill each row completely before starting next row
int row = 0, col = -1;
for (std::vector<CUIButton*>::iterator it = m_category_buttons.begin(); it != m_category_buttons.end(); ++it) {
++col;
@@ -446,13 +457,16 @@
++row;
col = 0;
}
- GG::Pt ul(UPPER_LEFT_PAD + col*m_col_offset, UPPER_LEFT_PAD+ row*m_row_offset);
+ GG::Pt ul(UPPER_LEFT_PAD + col*m_col_offset, UPPER_LEFT_PAD + row*m_row_offset);
GG::Pt lr = ul + GG::Pt(BUTTON_WIDTH, BUTTON_HEIGHT);
(*it)->SizeMove(ul, lr);
}
+ // rowbreak after category buttons, before type and status buttons
col = -1;
- m_category_button_rows = ++row; // rowbreak after category buttons, before type and status buttons
+ m_category_button_rows = ++row;
+
+ // place type buttons: fill each row completely before starting next row
for (std::map<TechType, CUIButton*>::iterator it = m_tech_type_buttons.begin(); it != m_tech_type_buttons.end(); ++it) {
++col;
if (col >= m_buttons_per_row) {
@@ -465,10 +479,12 @@
}
// if all six status + type buttons can't fit on one row put an extra row break between them
- if (m_buttons_per_row < 6) {
+ if (m_buttons_per_row < static_cast<int>(m_tech_type_buttons.size() + m_tech_status_buttons.size())) {
col = -1;
++row;
}
+
+ // place status buttons: fill each row completely before starting next row
for (std::map<TechStatus, CUIButton*>::iterator it = m_tech_status_buttons.begin(); it != m_tech_status_buttons.end(); ++it) {
++col;
if (col >= m_buttons_per_row) {
@@ -480,6 +496,24 @@
it->second->SizeMove(ul, lr);
}
+ // rowbreak after status buttons, before view toggles
+ col = 0;
+ ++row;
+
+ // place view type buttons buttons
+ GG::Pt ul(UPPER_LEFT_PAD + col*m_col_offset, UPPER_LEFT_PAD + row*m_row_offset);
+ GG::Pt lr = ul + GG::Pt(BUTTON_WIDTH, BUTTON_HEIGHT);
+ m_list_view_button->SizeMove(ul, lr);
+ ++col;
+ if (col >= m_buttons_per_row) {
+ ++row;
+ col = 0;
+ }
+ ul = GG::Pt(UPPER_LEFT_PAD + col*m_col_offset, UPPER_LEFT_PAD + row*m_row_offset);
+ lr = ul + GG::Pt(BUTTON_WIDTH, BUTTON_HEIGHT);
+ m_tree_view_button->SizeMove(ul, lr);
+
+ // keep track of layout. Used to draw lines between groups of buttons when rendering
if (m_buttons_per_row == 1)
m_status_or_type_button_rows = 3; // three rows, one button per row
else if (m_buttons_per_row == 2)
@@ -1681,6 +1715,10 @@
void TechTreeWnd::LayoutPanel::Reset()
{
Layout(true);
+ TechManager& manager = GetTechManager();
+ TechManager::iterator it = manager.begin();
+ if (it != manager.end())
+ CenterOnTech(*it);
}
void TechTreeWnd::LayoutPanel::SetScale(double scale)
@@ -2293,13 +2331,12 @@
GG::Connect(m_layout_panel->TechBrowsedSignal, &TechTreeWnd::TechBrowsedSlot, this);
GG::Connect(m_layout_panel->TechClickedSignal, &TechTreeWnd::TechClickedSlot, this);
GG::Connect(m_layout_panel->TechDoubleClickedSignal, &TechTreeWnd::TechDoubleClickedSlot, this);
- //AttachChild(m_layout_panel);
+ AttachChild(m_layout_panel);
m_tech_list = new TechListBox(0, 0, w, h);
GG::Connect(m_tech_list->TechBrowsedSignal, &TechTreeWnd::TechBrowsedSlot, this);
GG::Connect(m_tech_list->TechClickedSignal, &TechTreeWnd::TechClickedSlot, this);
GG::Connect(m_tech_list->TechDoubleClickedSignal, &TechTreeWnd::TechDoubleClickedSlot, this);
- AttachChild(m_tech_list);
m_tech_detail_panel = new TechDetailPanel(m_layout_panel->ClientWidth() - NAVIGATOR_WIDTH, NAVIGATOR_AND_DETAIL_HEIGHT);
AttachChild(m_tech_detail_panel);
@@ -2324,6 +2361,10 @@
for (std::map<TechType, CUIButton*>::iterator it = m_tech_tree_controls->m_tech_type_buttons.begin();
it != m_tech_tree_controls->m_tech_type_buttons.end(); ++it)
GG::Connect(it->second->ClickedSignal, ToggleTechTypeFunctor(this, it->first));
+ // connect view type selectors
+ GG::Connect(m_tech_tree_controls->m_tree_view_button->ClickedSignal, &TechTreeWnd::ShowTreeView, this);
+ GG::Connect(m_tech_tree_controls->m_list_view_button->ClickedSignal, &TechTreeWnd::ShowListView, this);
+
AttachChild(m_tech_tree_controls);
}
@@ -2502,6 +2543,24 @@
}
}
+void TechTreeWnd::ShowTreeView()
+{
+ AttachChild(m_layout_panel);
+ MoveChildDown(m_layout_panel);
+ DetachChild(m_tech_list);
+ m_tech_tree_controls->m_list_view_button->MarkNotSelected();
+ m_tech_tree_controls->m_tree_view_button->MarkSelectedGray();
+}
+
+void TechTreeWnd::ShowListView()
+{
+ AttachChild(m_tech_list);
+ MoveChildDown(m_tech_list);
+ DetachChild(m_layout_panel);
+ m_tech_tree_controls->m_list_view_button->MarkSelectedGray();
+ m_tech_tree_controls->m_tree_view_button->MarkNotSelected();
+}
+
void TechTreeWnd::SetScale(double scale)
{
m_layout_panel->SetScale(scale);
Modified: trunk/FreeOrion/UI/TechTreeWnd.h
===================================================================
--- trunk/FreeOrion/UI/TechTreeWnd.h 2008-06-12 02:51:44 UTC (rev 2587)
+++ trunk/FreeOrion/UI/TechTreeWnd.h 2008-06-15 16:56:15 UTC (rev 2588)
@@ -50,6 +50,9 @@
void HideType(const TechType type);
void ToggleType(const TechType type);
+ void ShowTreeView();
+ void ShowListView();
+
void CenterOnTech(const Tech* tech);
//@}
Modified: trunk/FreeOrion/client/AI/AIClientApp.cpp
===================================================================
--- trunk/FreeOrion/client/AI/AIClientApp.cpp 2008-06-12 02:51:44 UTC (rev 2587)
+++ trunk/FreeOrion/client/AI/AIClientApp.cpp 2008-06-15 16:56:15 UTC (rev 2588)
@@ -40,7 +40,7 @@
Logger().fatal("The AI client should not be executed directly!");
Exit(1);
}
-
+
// read command line args
SetPlayerName(argv[1]);
@@ -119,6 +119,7 @@
void AIClientApp::HandleMessage(const Message& msg)
{
+ //Logger().debugStream() << "AIClientApp::HandleMessage " << msg.Type();
switch (msg.Type()) {
case Message::JOIN_GAME: {
if (msg.SendingPlayer() == -1) {
@@ -158,22 +159,26 @@
}
case Message::SAVE_GAME: {
- Logger().debugStream() << "AIClientApp::HandleMessage Message::SAVE_GAME";
+ //Logger().debugStream() << "AIClientApp::HandleMessage Message::SAVE_GAME";
Networking().SendMessage(ClientSaveDataMessage(PlayerID(), Orders(), m_AI->GetSaveStateString()));
+ //Logger().debugStream() << "AIClientApp::HandleMessage sent save data message";
break;
}
case Message::TURN_UPDATE: {
if (msg.SendingPlayer() == -1) {
+ //Logger().debugStream() << "AIClientApp::HandleMessage : extracting turn update message data";
ExtractMessageData(msg, EmpireIDRef(), CurrentTurnRef(), Empires(), GetUniverse(), m_player_info);
+ //Logger().debugStream() << "AIClientApp::HandleMessage : generating orders";
m_AI->GenerateOrders();
+ //Logger().debugStream() << "AIClientApp::HandleMessage : done handling turn update message";
}
break;
}
- case Message::TURN_PROGRESS:
+ case Message::TURN_PROGRESS:
break;
-
+
case Message::END_GAME: {
Exit(0);
break;
@@ -181,12 +186,13 @@
case Message::HUMAN_PLAYER_CHAT:
break;
-
+
default: {
Logger().errorStream() << "AIClientApp::HandleMessage : Received unknown Message type code " << msg.Type();
break;
}
}
+ //Logger().debugStream() << "AIClientApp::HandleMessage done";
}
void AIClientApp::StartTurn()
Modified: trunk/FreeOrion/default/credits.xml
===================================================================
--- trunk/FreeOrion/default/credits.xml 2008-06-12 02:51:44 UTC (rev 2587)
+++ trunk/FreeOrion/default/credits.xml 2008-06-15 16:56:15 UTC (rev 2588)
@@ -34,7 +34,7 @@
<PERSON name="Teal Ablaze" nick="" task="Game Design"/>
<PERSON name="Bryan Patterson" nick="PowerCrazy" task="Game Design"/>
<PERSON name="Andrew Hull" nick="moxy" task="Game Design"/>
- <PERSON name="Benjamin Corfino" nick="Tortanick" task="Game Design"/>
+ <PERSON name="Benjamin Confino" nick="Tortanick" task="Game Design"/>
</GROUP>
<GROUP name ="GRAPHICS">
<PERSON name="Jonathan Hill" nick="Obiwan" task="Graphics"/>
Modified: trunk/FreeOrion/default/eng_stringtable.txt
===================================================================
--- trunk/FreeOrion/default/eng_stringtable.txt 2008-06-12 02:51:44 UTC (rev 2587)
+++ trunk/FreeOrion/default/eng_stringtable.txt 2008-06-15 16:56:15 UTC (rev 2588)
@@ -1064,7 +1064,7 @@
#################
MAP_BTN_TURN_UPDATE
-Turn
+Turn %1%
MAP_INDICATOR_FPS
%1% FPS
@@ -1225,8 +1225,8 @@
# Fleet Window #
#################
-FW_FLEET_AT
-At %1% System
+FW_FLEET_HOLDING_AT
+Holding at %1% System
FW_FLEET_MOVING_TO
Moving to %1%, ETA %2% (%3%)
@@ -1254,6 +1254,9 @@
FW_NEW_FLEET_LABEL
New Fleet
+FW_EMPIRE_FLEETS_AT_SYSTEM
+%1% Fleets At %2% System
+
FW_EMPIRE_FLEETS
%1% Fleets
@@ -1271,6 +1274,9 @@
FW_FOREIGN_SHIP
Foreign ship
+FW_NO_FLEET
+No Fleet
+
###############
# TechTreeWnd #
###############
@@ -1335,6 +1341,12 @@
TECH_WND_STATUS_UNRESEARCHABLE
Unresearchable
+TECH_WND_LIST_VIEW
+List View
+
+TECH_WND_TREE_VIEW
+Tree View
+
TECH_WND_REQUIRES
Requires
Modified: trunk/FreeOrion/util/Order.cpp
===================================================================
--- trunk/FreeOrion/util/Order.cpp 2008-06-12 02:51:44 UTC (rev 2587)
+++ trunk/FreeOrion/util/Order.cpp 2008-06-15 16:56:15 UTC (rev 2588)
@@ -215,10 +215,10 @@
ValidateEmpireID();
Universe& universe = GetUniverse();
-
+
Fleet* fleet = universe.Object<Fleet>(FleetID());
System* system = universe.Object<System>(DestinationSystemID());
-
+
// perform sanity checks
if (!fleet) throw std::runtime_error("Non-fleet object ID specified in fleet move order.");
if (!system) throw std::runtime_error("Non-system destination ID specified in fleet move order.");
|