Mining settings in XML dumps

* Empire mining settings have been included in the empire's resource
information records

* Planet-specific mining settings have been included in the resource
provider information records
This commit is contained in:
Emmanuel BENOîT 2012-01-19 10:28:12 +01:00
parent 9b346a80c2
commit 3637b6e1d1
11 changed files with 380 additions and 70 deletions
legacyworlds-server-data/db-structure/parts/040-functions

View file

@ -1217,12 +1217,19 @@ GRANT SELECT ON bugs.dump_research_view TO :dbuser;
* resource_name Text-based identifier of the resource type
* empres_possessed Amount of resources possessed by the empire
* empres_owed Amount of resources owed by the empire
* mining_priority Mining priority for this resource, or NULL if it
* is not a natural resource
*/
DROP VIEW IF EXISTS bugs.dump_emp_resources_view CASCADE;
CREATE VIEW bugs.dump_emp_resources_view
AS SELECT empire_id , name AS resource_name , empres_possessed , empres_owed
AS SELECT empire_id , name AS resource_name ,
empres_possessed , empres_owed ,
empmset_weight AS mining_priority
FROM emp.resources
INNER JOIN defs.strings ON id = resource_name_id;
INNER JOIN defs.strings
ON id = resource_name_id
LEFT OUTER JOIN emp.mining_settings
USING ( empire_id , resource_name_id );
GRANT SELECT
ON bugs.dump_emp_resources_view
@ -1271,6 +1278,10 @@ GRANT SELECT ON bugs.dump_planets_view TO :dbuser;
* resprov_recovery The resource provider's recovery rate, or NULL
* if there is no resource provider of that
* type on the planet
* mining_priority The planet-specific mining priority for the
* current resource type, or NULL if there
* are no planet-specific settings or no
* provider of this type.
*/
DROP VIEW IF EXISTS bugs.dump_planet_resources_view CASCADE;
CREATE VIEW bugs.dump_planet_resources_view
@ -1278,7 +1289,8 @@ CREATE VIEW bugs.dump_planet_resources_view
name AS resource_name ,
pres_income , pres_upkeep ,
resprov_quantity_max , resprov_quantity ,
resprov_difficulty , resprov_recovery
resprov_difficulty , resprov_recovery ,
emppmset_weight AS mining_priority
FROM emp.planets
INNER JOIN verse.planet_resources
USING ( planet_id )
@ -1286,6 +1298,8 @@ CREATE VIEW bugs.dump_planet_resources_view
ON resource_name_id = id
LEFT OUTER JOIN verse.resource_providers
USING ( planet_id , resource_name_id )
LEFT OUTER JOIN emp.planet_mining_settings
USING ( empire_id , planet_id , resource_name_id )
ORDER BY name;
GRANT SELECT