CVS Commit Info

Programmers discuss here anything related to FreeOrion programming. Primarily for the developers to discuss.

Moderator: Committer

Message
Author
Tyreth
FreeOrion Lead Emeritus
Posts: 885
Joined: Thu Jun 26, 2003 6:23 am
Location: Australia

#61 Post by Tyreth »

Files Affected:
UI/About.cpp
UI/About.h
UI/GalaxySetupWnd.cpp
UI/GalaxySetupWnd.h
UI/InGameOptions.cpp
UI/InGameOptions.h
UI/IntroScreen.cpp
UI/IntroScreen.h
UI/MapWnd.h
UI/MultiplayerLobbyWnd.cpp
UI/ServerConnectWnd.cpp
UI/ServerConnectWnd.h

Purpose of change:
Added some key combinations to most of the windows except ServerConnectWnd which didn't recognise the behaviour. return will be the same as clicking ok, esc is the same as clicking cancel, and for windows with a "done" button return and esc act as if you pressed done.

tzlaine
Programming Lead Emeritus
Posts: 1092
Joined: Thu Jun 26, 2003 1:33 pm

#62 Post by tzlaine »

Files Affected:
Order.h
Order.cpp
Removed FleetSplitOrder, added NewFleetOrder, DeleteFleetOrder, and renamed FleetMergeOrder FleetTransferOrder. Also removed the code that deleted empty fleets at the end of FleetMergeOrder.

MapWnd.h
MapWnd.cpp
Changed the comments on and the naming of m_stars to reflect code change
s elsewhere.

Predicates.h
Moved inline functions to new implementation file, and added new functors to locate fleets of a certain empire that are stationary, moving, and ordered to move but still at a system.

System.h
Corrected an error in one of the templated find methods.

Fleet.h
Fleet.cpp
Made minor improvements to the Fleet interface, and suppressed the emission of StateChanged signals when a non-existent ship is removed from the fleet.

SystemIcon.h
SystemIcon.cpp
Rolled FleetButton out into its own independent class; changed the internal representation of the System the icon represents from an int ID number to a const reference.

SidePanel.cpp
Changed code to reflect the changes to GG::ListBox.

MultiplayerLobbyWnd.cpp
Changed code to reflect the changes to GG::ListBox nad CUI_Wnd.

IntroScreen.cpp
Made IntroScreen's menu non-resizable and non-minimizable.

FleetWindow.h
FleetWindow.cpp
Split FleetWindow into 3 cooperative classes, including two types of top-level windows.

ClientUI.cpp
Adjusted the CUI_Wnd title text size to be more readable.

config.xml
Adjusted the CUI_Wnd title text size to be more readable.

CUIControls.h
CUIControls.cpp
Added a triagular button class, possibly to be used later in the SidePanel.

CUI_Wnd.h
CUI_Wnd.cpp
Changed the names of the Close-button and minimize-button slots to be consistent with the rest of the project.

ServerConnectWnd.h
ServerConnectWnd.cpp
Changed code to reflect changes to GG::ListBox.

WindowsKit.zip
Updated GG.


Files Added:
Predicates.cpp
FleetButton.h
FleetButton.cpp


Purpose of change:
The fleet window(s) are now implemented. You can rename fleets by right-clicking on them, create new ones, and move ships between existing and new ones. Double-click on a fleet to view its details in a separate window, from which you can drag-and-drop ships between fleets. Closing an empty fleet window deletes the empty fleet. Highlighting one or more fleets in the main window and then clicking on a star system orders those fleets to move to that system; clicking on the original system "cancels" the move orders (really, it just re-orders them to move to where they already are).

Known issues:
When a fleet moves into interstellar space, it will be in completely the wrong place. Currently, the main map will not look for or place such fleets, and the fleet movement code doesn't remove a fleet from its old system when moving. I'll get to this fairly soon.

There is no line from a moving or ordered-to-move fleet to its destination. Again, I'll get to it soon.

Finally, hitting the turn button leaves all the fleet windows and the SidePanel, etc. open; this needs to be changed.

Note that these changes require you to use the latest GG code.

Almkaz
Space Floater
Posts: 31
Joined: Thu Sep 18, 2003 12:25 pm
Location: Ottawa, Canada

#63 Post by Almkaz »

Flushed out Production and Growth for the following:
tech research
building defence Basesing at turn update
building ships
building industry
Sitreps and also produced and displayed at the end of the turn update.

Changes were mainly made to sitreps, which use a syntax
which allows variable substitution at runtime.

Changed turn update on server to not have a minimum time.

Known Issues:

- The sitrep panel is very minimal - it's a start and not debug code, but lacks advanced features
- Tech needs to be flushed out as described in the forum
- The text for sitreps are probably programmer-talk and can be easily modified by a
game designer


util/SitRepEntry.cpp
The old sitrep was only a structure in a header file. Made it a class ( although with no
data hiding ).

util/VarText.cpp/h
The base class to implement text with substituted variables at runtime. The base
class can be used for other strings the server needs to send down that are not
sitreps

UI/SitRepPanel.cpp/h
The basic UI for sitreps which is just the starting point
ing at turn update

Empire/Empire.cpp/h
Added methods to handle processing of research

UI/ClientUI.cpp/h
SitRep support - namely just calls lowor level methods
Does, however contain LUT of SitRep string IDs

UI/MapWnd.cpp/h
Added SitRep panel

client/ClientApp.cpp/h
Added TechTree init and shutdown

client/human/HumanCLientApp.cpp/h
Added SitRep handling at turn update

server/ServerApp.cpp
Added more processing for P&G. Also added SitRep
handling which envolved changing the P&G/Movement methods of universe objects Removed min time for turn update

universe/Fleet.cpp.h
Updated P&G and movement methods to add sitreps to empire
instead of passing list down

universe/Planet.cpp/h
Updated P&G and movement methods to add sitreps to empire
instead of passing list. Also added P&G in the form of building and tech

universe/PopCenter.cpp/h
Updated P&G and movement methods to add sitreps to empire
instead of passing list down

universe/ProdCenter.cpp.h
Added P&G
Updated P&G and movement methods to add sitreps to empire
instead of passing list down

universe/Ship.cpp/h
Updated P&G and movement methods to add sitreps to empire
instead of passing list down

universe/System.cpp/h
Updated P&G and movement methods to add sitreps to empire
instead of passing list down

universe/Universe.cpp
Set inital pop and pax pop of Prodcenters on universe create

universe/UniverseObject.h
Updated P&G and movement methods to add sitreps to empire
instead of passing list down

util/Order.cpp
Renamed method of ProdCenter

util/SitRepEntry.h
Changed SitReps, see above

Next I'll look at some bugs - a crash and a method for removing
panels when turn update is hit. Then I'm off to v0.1 Tech ( I think )...

tzlaine
Programming Lead Emeritus
Posts: 1092
Joined: Thu Jun 26, 2003 1:33 pm

#64 Post by tzlaine »

Files Affected:
UI/ClientUI.cpp
UI/ClientUI.h
Added constants for SystemIcon and FleetButton sizes, and added a method that returns the MapWnd.

UI/FleetButton.cpp
UI/FleetButton.h
Added a ctor specifically for interstellar-moving fleets, and changed internal representation of fleets from IDs to pointers.

UI/FleetWindow.cpp
UI/FleetWindow.h
Changed FleetWnd to use Fleet*'s instead of int fleet IDs, to match changes in FleetButton.

UI/MapWnd.cpp
UI/MapWnd.h
Added support for interstellar-moving fleets, including dashed lines indicating their destinations.

UI/SystemIcon.cpp
UI/SystemIcon.h
Fixed resizing problems.

universe/Fleet.cpp
universe/Fleet.h
Implemented ETA(); implemented movement code, except for generation of SitReps; and added an accessor method that returns a pointer to the destination system, if the fleet is moving.

universe/Predicates.cpp
universe/Predicates.h
Corrected an error in the Is*FleetFunctor's.

universe/System.cpp
Corrected an error in Remove().

universe/Universe.cpp
Changed code to use new UniversObject::GetSystem() instead of making local dynamic_casts.

util/Order.cpp
Minor changes due to name changes elsewhere.

universe/UniverseObject.cpp
universe/UniverseObject.h
Added an accessor method that returns a pointer to the containing system, if there is one.

Purpose of Change:
This is essentially the second half of the movement code. Now fleets that are moving from orders issued in the FleetWnd will actually appear to leave their system, move, and arrive at the new system. A dashed line also now appears for each moving Fleet that indicates its destination.

In general, I have been finding that there are entirely too many dynamic_casts lying about, so I have attempted to put some of the ID lookup and conversion into appropriate classes. For instance, instead of getting the integer IDs of Fleets represented by a FleetButton, looking them up in the Universe, then dynamic_casting them, FleetButton now stores them directly as Fleet*'s. Also, a UniverseObject can give you a pointer to its System through GetSystem(), instead of making you look it up when you call SystemID(). Similarly, Fleet has a new Destination() method that returns a pointer to the Fleet's destination System, if any.

Almkaz
Space Floater
Posts: 31
Joined: Thu Sep 18, 2003 12:25 pm
Location: Ottawa, Canada

#65 Post by Almkaz »

Just a commit to fix a bug in submitting orders.Crash occured when processing a fleet transfer order. Details in the file descriptions. This, however still does not fix the crash - it's now producing an exception elsewhere, but Zach and I are on it....

Order.cpp
Fixed a bug in contructing fleet orders - wrong factory names being used

ServerApp.cpp
Added bullet-proofing on generating orders from a client turn update. If there was a problem with generating an order, it was stull adding a NULL to the orders list

tzlaine
Programming Lead Emeritus
Posts: 1092
Joined: Thu Jun 26, 2003 1:33 pm

#66 Post by tzlaine »

Files Affected:
ClientUI.cpp
Removed irritating logger-initialized and logger-shutdown log messages.

IntroScreen.cpp
Added command-line option to force the use of an external server to aid in debugging, even when starting a single-player game.

chmain.cpp
Added code to enable use of the new OptionsDB.

XParser.cpp
XParser.hpp
Changed code to use XMLDoc structure exclusively, removing all dependencies on libexpat.

Files Added:
OptionsDB.cpp
OptionsDB.h
OptionValidators.h

Reason For Change:
This change allows us to use a powerful configuration system for command line and/or XML configuration file options. Also, there should be no dependencies on libexpat any longer; we can remove it completely now.

tzlaine
Programming Lead Emeritus
Posts: 1092
Joined: Thu Jun 26, 2003 1:33 pm

#67 Post by tzlaine »

Files Affected:
ServerApp.dev
AIClient.dev
HumanClient.dev
Updated to use the latest code, and to remove libexpat dependencies.

WindowsKit.zip
Updated GG.

Purpose of Change:
If you were having expat problems in Windows builds before, this will fix it. Sorry for the problems.

Almkaz
Space Floater
Posts: 31
Joined: Thu Sep 18, 2003 12:25 pm
Location: Ottawa, Canada

#68 Post by Almkaz »

Fixed an issue with executing orders on the client which create new universe
objects and reference them in the same set of orders. A good example of this
is the new fleet/transfer fleet order combination. Essentially the client and server
would have different IDs for the newly created object. Changed it so that they
both agree on which ID to use. All the Order code is identical for client/server,
however some orders contain the new ID for the object. On the client, that
new ID is requested from the server via a synchronous message.
With this change, new fleet/transfer fleet orders now work without crashes in the game.

Removed min/max fleet IDs

Fixed a bug in ClientApp.cpp which did not reset orders from turn to turn


Empire/Empire.cpp
Empire/Empire.h
Removed min/max fleet IDs

UI/FleetWindow.cpp
Added call to retreive new ID. Added bullet proofing in case server cannot be contacted

client/ClientApp.cpp
client/ClientApp.h
Added method to get a new object ID ( via a message to server ). Reset orders on turn update

default/eng_stringtable.txt
Added error message

network/ClientNetworkCore.cpp
network/ClientNetworkCore.h
Added client-side synchronous message support

network/Message.cpp
network/Message.h
Added 2 new mesages to request/dispatch an object ID. Added new message type

network/NetworkCore.h
network/ServerNetworkCore.cpp
network/ServerNetworkCore.h
Minor change to SendMessage virtual function signature

server/ServerApp.cpp
Added support for new message to get an object ID

universe/Universe.cpp
universe/Universe.h
Removed min fleet IDs. Added support for new method, InsertID() which tells the universe which ID to
use when inserting

universe/UniverseObject.cpp
universe/UniverseObject.h
Removed min fleet IDs

util/Order.cpp
util/Order.h
Changed new fleet order to take the ID of the new fleet to create

That's it. Next I'll be removing windows when end turn is hit followed by adding xdiff to universe updating

Almkaz
Space Floater
Posts: 31
Joined: Thu Sep 18, 2003 12:25 pm
Location: Ottawa, Canada

#69 Post by Almkaz »

Added XDiff to turn update data. This changes dramatically much data
is sent over the network for each turn. It involved using the XDiff
code which works well but is not what I'd say production quality code yet.
It crashes if conditions are not perfect ( for example if it has a DEL
to do but the element does not exist in the old tree ) and at some
time probably needs some bullet proofing and exception handling in place.
I can add this but will fix some higher priority items first - but anybody else
can add the bullet proofing as well if they'd like.
The algorithm also requires unique tag names for all elements, so all the
encoding for universe and empire data was changed from <ship> to <shipXXX>
where XXX is the object ID number.

We could maybe improve this method at some time depending if profiling
shows that a lot of time is being spent encoding/decoding the data.
On the client instead of using XPatch to get a whole new XML tree and
then removing and creating a whle new universe/empire each turn, we could
add/remove items from the data directly. But I think time will tell if
this will be needed.


Empire/ClientEmpireManager.cpp
Empire/ClientEmpireManager.h
Added a method to encode the empire data on the client side

client/ClientApp.cpp
client/ClientApp.h
Moved the turn update data into here so eventually the AI client can
use it. Here is the logic for handling a XDiff turn update


client/human/HumanClientApp.cpp
Moved some turn updating code into ClientApp.cpp

server/ServerApp.cpp
Added server-side support for XDiff turn updates. Some trickiness envolded
in when to actually get a baseline for doing the diff. It needs to be done
after all orders are executed but before any turn processing.

universe/Fleet.cpp
Changed XML encoding/decoding

universe/Planet.cpp
Changed XML encoding/decoding

universe/Ship.cpp
Changed XML encoding/decoding

universe/System.cpp
Changed XML encoding/decoding

universe/Universe.cpp
universe/Universe.h
Added new object factory that creates numbered elements <shipXXX>

universe/UniverseObject.cpp
Changed XML encoding/decoding

Next I'll be fixing some design issues with prodution and then on
to hiding windows on turn update

Almkaz
Space Floater
Posts: 31
Joined: Thu Sep 18, 2003 12:25 pm
Location: Ottawa, Canada

#70 Post by Almkaz »

Made some minor design changes to Production Centers - moved most of the logic
that was in Planet to the ProdCenter. Also added data hiding to the VarText and
SitRep classes.

UI/ClientUI.cpp
Data hiding for SitReps

UI/SitRepPanel.cpp
Data hiding for SitReps

universe/Planet.cpp
universe/Planet.h
Moved code to ProdCenters

universe/ProdCenter.cpp
universe/ProdCenter.h
Added code from Planet and some data hiding

util/SitRepEntry.cpp
util/SitRepEntry.h
Added data hiding

Index: util/VarText.h
Added data hiding

tzlaine
Programming Lead Emeritus
Posts: 1092
Joined: Thu Jun 26, 2003 1:33 pm

#71 Post by tzlaine »

Files Affected:
Empire.h
Empire.cpp
Publicized the Empire ctors, as required by other recent code changes.

EmpireManager.h
Publicized InsertEmpire(), RemoveEmpire(), and RemoveAllEmpires(), as required by other recent changes in the code.

TechLevel.h
TechLevel.cpp
Renamed TechLevel Tech, as discussed online.

TechManager.h
TechManager.cpp
Renamed TechLevel Tech, as discussed online, and removed superfluous comments.

ClientUI.h
ClientUI.cpp
Corrected some outdated comments and implemented many of the ZoomTo*() functions.

GalaxySetupWnd.cpp
Changed to use new GG::FileDlg ctor.

InGameOptions.h
InGameOptions.cpp
Implemented saving and loading (multiplayer loading is not available from this window).

IntroScreen.h
IntroScreen.cpp
Added load game button.

MapWnd.h
MapWnd.cp
Added CenterOn*() and Select*() functions to move the view to a certain place in the map, and to open a window on an item of interest, respectively. Also fixed the error in rendering fleet movement lines, and removed debugging text output.

MultiplayerLobbyWnd.cpp
Fixed odd appearance of text in chat window, and changed code to use the new GG::FileDlg ctor.

SitRepPanel.h
SitRepPanel.cpp
Implemented the core SitRep window functionality (zooming to places and items in the SitRep entries). Also, the SitRep can now be toggled open/closed with F2, though this only works when either the main map or the SitRepPanel have the input focus.

SystemIcon.h
SystemIcon.cpp
Added ClickFleetButton() function, which allows a single fleet in a system to be programmatically clicked.

ClientApp.h
ClientApp.cpp
Added TurnOrdersMessage(), which creates a message containing all the current turn's orders, for use both in end-turn messages and during game saves.

ServerApp.h
ServerApp.cpp
HumanClientApp.h
HumanClientApp.cpp
AIClientApp.cpp
Implemented saving and loading.

ClientNetworkCore.h
ClientNetworkCore.cpp
Changed SendSynchronousMessage() to return a Message instead of an int through its second parameter. Also reformatted.

Message.h
Message.cpp
Added save and load messages.

NetworkCore.h
NetworkCore.cpp
Added a static HOST_PLAYER_ID constant, and fixed an error in the way messages are reassembled on receipt.

Universe.h
Universe.cpp
Removed the boost.noncopyable inheritance from Universe, and added the missing ship techs.

VarText.h
VarText.cpp
Re-implemented parsing code using boost.spirit parser library, and altered some other code to make VarText more usable with SitReps.


Purpose of Change:
Numerous minor bugfixes are included in these changes, but mainly this commit includes saving and loading. Single player saves and loads, and multiplayer saves, work just fine. Multiplayer loads will come soon.

Edit: note that these changes require you to update your GG library as well. Linux users just need to do a cvs update, and Windows users need to get the new version from WindowsKit.zip tomorrow morning when I rebuild it. Now I must sleep.

Edit: I just committed the new version of WindowsKit.zip.

Almkaz
Space Floater
Posts: 31
Joined: Thu Sep 18, 2003 12:25 pm
Location: Ottawa, Canada

#72 Post by Almkaz »

This commit fixes a crashing issue with SitReps - basically NULL SitReps where
beiing added to the Empire's data when the client decoded the Empire XML data.
This is fixed.

Also this update adds the ability to automatically close/destroy windows in the MapWnd.
If a window is derived from MapWndPopup it will be destroyed by MapWnd when the turn
button is hit.


Empire/Empire.cpp
Fixed SitRep decoding

UI/FleetWindow.cpp
UI/FleetWindow.h
Made FleetWnd derive from MapWndChild so that it is managed by the map window

UI/MapWnd.cpp
UI/MapWnd.h
Added MapWndPopup class. Any window derived from this is automaticaly managed by the MapWnd

client/human/HumanClientApp.cpp
client/human/HumanClientApp.h
Added method to get the ClientUI pointer

server/ServerApp.cpp
Changed how SitReps are encoded for the turn update

Almkaz
Space Floater
Posts: 31
Joined: Thu Sep 18, 2003 12:25 pm
Location: Ottawa, Canada

#73 Post by Almkaz »

This commit implements the basic techs needed for v.01 by limiting what the
UI allows planets to build

UI/SidePanel.cpp
UI/SidePanel.h
Added support for techs - the UI only allows build orders for items that have been researched

jbarcz1
Creative Contributor
Posts: 226
Joined: Thu Jun 26, 2003 4:33 pm
Location: Baltimore, MD

#74 Post by jbarcz1 »

Files Added
Combat/CombatSystem.h
Combat/CombatSystem.cpp

Files Modified
Empire.cpp
ServerApp.cpp
ServerApp.dev
Planet.h
Planet.cpp
Ship.h
Ship.cpp
Fleet.h
Fleet.cpp


Details

Empire.cpp
Fixed some outdated comments.

ServerApp.cpp
Fixed an exception that was thrown during turn updates. There were invalid Empire IDs
being passed to CreateClientEmpireUpdate. The problem appears to be that the empire IDs
in the network core's player map did not match the IDs that were being assumed by ServerApp.
The line:
doc.root_node.AppendChild(m_empires.CreateClientEmpireUpdate(i));
was changed to:
doc.root_node.AppendChild(m_empires.CreateClientEmpireUpdate(itr->first));

ServerApp.dev
Added the combat folder with relevant files

Planet.h
Planet.cpp

Added a 'conquer' method which will be called by Combat code when a planet changes hands.
The 'conquer' method will cause planetary production to be skipped during the next production
phase, as per the 0.1 spec. It will also change the ownership of the planet.
For this to work, combat must occur prior to the production phase.

Ship.h
Ship.cpp

Added a 'IsArmed' method to the Ship. Returns true if the ship has offensive capability.
This is to facilitate combat.

Fleet.h
Fleet.cpp

Added a method to check a fleet for armed ships. This is to facilitate combat.

CombatSystem.h
CombatSystem.cpp

Stubbed out, but did not implement, the interface to the combat system.
Basically, the Server app will check for combat situations, organize each
combatant's assets into a structure, and pass it off to the combat module for
processing. It will be the app's job to detect and set up combats, and the
Combat module's job to determine the winner, generate sitrep entries,
and update the game state to reflect the results.
Empire Team Lead

noelte
Juggernaut
Posts: 872
Joined: Fri Dec 26, 2003 12:42 pm
Location: Germany, Berlin

#75 Post by noelte »

Files Affected:

default/config.xml
client/human/chmain.cpp
client/human/HumanClient.cpp
client/human/HumanClient.h
UI/ClientUI.cpp
UI/ClientUI.h
util/OptionsDB.cpp


Purpose of Change:
default/config.xml
- new option names applied

UI/ClientUI.cpp
UI/ClientUI.h
- now using OptionDB for all options.
- ClientUI(const GG::XMLElement& elem) and ClientUI::XMLEncode() removed.
- void AddOptions(OptionsDB& db) added

client/human/chmain.cpp
- OptionDB is set from config.xml and can be overwritten by command line options.

client/human/HumanClient.cpp
client/human/HumanClient.h
- options are now set from OptionDB
- void SetXMLDoc(const GG::XMLDoc& doc) removed
- ctor: SDLGGApp::SDLGGApp(...) changed to SDLGGApp(...)

util/OptionsDB.cpp
- SetFromXMLRecursive() take now also elem.Attribute("value") into account if
elem.Text() is empty.
- GetUsage() small bug fixed.

(This is my first checkin. I hope nothing went wrong! tzlaine: Thanks for giving me a hand.)

Ronald.

Locked