Empire resources initialisation

* Empire resources will be initialised when an empire is created

* When a new resource is created through the appropriate defs.uoc_...
function, it will be added to all empires as well.
This commit is contained in:
Emmanuel BENOîT 2012-01-10 10:48:56 +01:00
parent afc66166e0
commit 37555841ce
7 changed files with 106 additions and 11 deletions
legacyworlds-server-data/db-structure/tests/admin/040-functions/040-empire

View file

@ -16,7 +16,7 @@ BEGIN;
SELECT _create_emp_names( 1 , 'testEmp' );
/***** TESTS BEGIN HERE *****/
SELECT plan( 7 );
SELECT plan( 8 );
SELECT emp.create_empire( _get_emp_name( 'testEmp1' ) ,
_get_map_name( 'testPlanet1' ) ,
@ -46,12 +46,16 @@ BEGIN;
USING ( resource_name_id )
WHERE empire_id = _get_emp_name( 'testEmp1' );
SELECT diag_test_name( 'emp.create_empire() - Empire mining settings are all set to the same value' );
SELECT is( COUNT( _temp.* )::INT , 1 )
FROM ( SELECT DISTINCT empmset_weight
FROM emp.mining_settings
WHERE empire_id = _get_emp_name( 'testEmp1' )
) AS _temp;
SELECT diag_test_name( 'emp.create_empire() - Empire mining settings are all set to 2' );
SELECT is( COUNT( * )::INT , 0 )
FROM emp.mining_settings
WHERE empire_id = _get_emp_name( 'testEmp1' )
AND empmset_weight <> 2;
SELECT diag_test_name( 'emp.create_empire() - Empire resources have been initialised' );
SELECT is( COUNT(*)::INT , 3 )
FROM emp.resources
WHERE empire_id = _get_emp_name( 'testEmp1' );
SELECT diag_test_name( 'emp.create_empire() - Empire update records' );
SELECT is( _eur.quantity , _utv.quantity)