Research page - Unlocked buildings

* The research page now includes a list of buildings unlocked by each
technology when that technology is not in the "unknown" state.
This commit is contained in:
Emmanuel BENOîT 2012-04-09 13:08:08 +02:00
parent 96c296e9d5
commit ab04752169
7 changed files with 149 additions and 7 deletions
legacyworlds-server-data/db-structure/parts/040-functions

View file

@ -391,6 +391,29 @@ CREATE VIEW tech.buildings_view
ON b.name_id = bld.buildable_id;
/*
* Buildings / technology view
* ----------------------------
*
* This view generates a parseable list of buildings unlocked by a technology
* for each technology.
*
* Columns:
* technology_name_id The technology's name
* technology_buildings A list of comma-separated building identifiers
*/
DROP VIEW IF EXISTS defs.technology_buildings_view CASCADE;
CREATE VIEW defs.technology_buildings_view
AS SELECT technology_name_id ,
array_to_string( array_agg( _name.name ) , ',' ) AS technology_buildings
FROM defs.technologies _tech
LEFT OUTER JOIN tech.buildings_view _building
USING ( technology_name_id )
LEFT OUTER JOIN defs.strings _name
ON _name.id = _building.name_id
GROUP BY technology_name_id;
--
-- Ships view
--

View file

@ -447,6 +447,8 @@ CREATE VIEW emp.research_total_weights_view
* the technology is not supposed to be visible
* technology_dependencies The technology's dependencies from the
* dependencies view
* technology_buildings The buildings which are unlocked when the
* technology is implemented
*/
DROP VIEW IF EXISTS emp.technologies_v2_view CASCADE;
CREATE VIEW emp.technologies_v2_view
@ -488,7 +490,13 @@ CREATE VIEW emp.technologies_v2_view
ELSE
NULL::INT
END ) AS technology_price ,
technology_dependencies
technology_dependencies ,
( CASE
WHEN emptech_visible THEN
technology_buildings
ELSE
''
END ) AS technology_buildings
FROM emp.technologies_v2
INNER JOIN emp.technology_visibility_view
USING ( technology_name_id , empire_id )
@ -496,6 +504,8 @@ CREATE VIEW emp.technologies_v2_view
USING ( technology_name_id )
INNER JOIN defs.technology_dependencies_view
USING ( technology_name_id )
INNER JOIN defs.technology_buildings_view
USING ( technology_name_id )
INNER JOIN defs.strings _name_str
ON _name_str.id = _tech.technology_name_id
INNER JOIN defs.strings _cat_str