Extracted quantities update as soon as possible

* The quantities of resources extracted from mines will now be updated
as soon as they have a reason to. This includes planet assignment,
abandonment, ownership changes, and updates to mining priorities.

* The mining update will now remove the current resource income from the
providers, and only then re-compute all extracted quantities. This is
more logical and corresponds to the way the other game updates work.

* Fixed bug in extraction computation where the size of the planet's
happy population was used instead of the happy/total ratio when
adjusting the mining production for riots.

* The following SQL scripts must be re-executed to upgrade a database:
  -> 040-functions/040-empire.sql
  -> 040-functions/145-resource-providers.sql
  -> 040-functions/147-empire-mining.sql
  -> 050-updates/120-planet-mining.sql
This commit is contained in:
Emmanuel BENOîT 2012-02-09 10:54:00 +01:00
parent f3aa563758
commit bf6bea5a79
35 changed files with 863 additions and 372 deletions

View file

@ -0,0 +1,11 @@
/*
* Test privileges on emp.scaled_mining_weights_view
*/
BEGIN;
SELECT plan( 1 );
SELECT diag_test_name( 'emp.scaled_mining_weights_view - No SELECT privilege' );
SELECT throws_ok( 'SELECT * FROM emp.scaled_mining_weights_view' , 42501 );
SELECT * FROM finish( );
ROLLBACK;

View file

@ -0,0 +1,11 @@
/*
* Test privileges on emp.total_mining_weights_view
*/
BEGIN;
SELECT plan( 1 );
SELECT diag_test_name( 'emp.total_mining_weights_view - No SELECT privilege' );
SELECT throws_ok( 'SELECT * FROM emp.total_mining_weights_view' , 42501 );
SELECT * FROM finish( );
ROLLBACK;

View file

@ -0,0 +1,13 @@
/*
* Test privileges on emp.mining_compute_extraction()
*/
BEGIN;
SELECT plan( 1 );
SELECT diag_test_name( 'emp.mining_compute_extraction() - No EXECUTE privilege' );
SELECT throws_ok( $$
SELECT emp.mining_compute_extraction( ROW( 1 , 2 , 3 , 4 , 5 , NULL , NULL , NULL , NULL ) )
$$ , 42501 );
SELECT * FROM finish( );
ROLLBACK;

View file

@ -0,0 +1,13 @@
/*
* Test privileges on verse.mining_get_input()
*/
BEGIN;
SELECT plan( 1 );
SELECT diag_test_name( 'verse.mining_get_input() - No EXECUTE privilege' );
SELECT throws_ok( $$
SELECT verse.mining_get_input( 1 )
$$ , 42501 );
SELECT * FROM finish( );
ROLLBACK;

View file

@ -0,0 +1,13 @@
/*
* Test privileges on emp.mining_get_input()
*/
BEGIN;
SELECT plan( 1 );
SELECT diag_test_name( 'emp.mining_get_input() - No EXECUTE privilege' );
SELECT throws_ok( $$
SELECT emp.mining_get_input( 1 )
$$ , 42501 );
SELECT * FROM finish( );
ROLLBACK;