Mining settings

* Changed the way mining settings work: use a priority value (between 0
and 4) as the weight. Leaving them as they were before would have caused
numerous problems (and a lot of unnecessary code to work around them)

* Empire mining settings will be created along with the empire's own
record. By default all natural resources will have weight = 2.

* Added a set of four stored procedures which can be used to update an
empire's mining settings, including planet-specific settings. The
emp.mset_update_start() function can be used to start an update (on an
empire's settings if there is only one parameter, or on a planet's
settings if there are two parameters); the emp.mset_update_set() and
emp.mset_update_apply() functions are then used to modify the settings
and apply the changes, respectively.
This commit is contained in:
Emmanuel BENOîT 2012-01-10 10:17:47 +01:00
parent 3e109b13bc
commit afc66166e0
15 changed files with 745 additions and 55 deletions
legacyworlds-server-data/db-structure/tests/user/040-functions

View file

@ -0,0 +1,14 @@
/*
* Test privileges on emp.create_empire()
*/
BEGIN;
SELECT plan( 1 );
SELECT diag_test_name( 'emp.create_empire() - Privileges' );
SELECT throws_ok( $$
SELECT emp.create_empire( 1 , 1 , 200.0 )
$$ , 42501 );
SELECT * FROM finish( );
ROLLBACK;

View file

@ -0,0 +1,14 @@
/*
* Test privileges on emp.mset_update_start( INT )
*/
BEGIN;
SELECT plan( 1 );
SELECT diag_test_name( 'emp.mset_update_start( INT ) - Privileges' );
SELECT lives_ok( $$
SELECT emp.mset_update_start( 1 )
$$ );
SELECT * FROM finish( );
ROLLBACK;

View file

@ -0,0 +1,14 @@
/*
* Test privileges on emp.mset_update_start( INT , INT )
*/
BEGIN;
SELECT plan( 1 );
SELECT diag_test_name( 'emp.mset_update_start( INT , INT ) - Privileges' );
SELECT lives_ok( $$
SELECT emp.mset_update_start( 1 , 1 )
$$ );
SELECT * FROM finish( );
ROLLBACK;

View file

@ -0,0 +1,14 @@
/*
* Test privileges on emp.mset_update_set()
*/
BEGIN;
SELECT emp.mset_update_start( 1 );
SELECT plan( 1 );
SELECT diag_test_name( 'emp.mset_update_set() - Privileges' );
SELECT lives_ok( $$
SELECT emp.mset_update_set( 1 , -1 )
$$ );
SELECT * FROM finish( );
ROLLBACK;

View file

@ -0,0 +1,15 @@
/*
* Test privileges on emp.mset_update_set()
*/
BEGIN;
SELECT emp.mset_update_start( 1 );
SELECT plan( 1 );
SELECT diag_test_name( 'emp.mset_update_apply() - Privileges' );
SELECT lives_ok( $$
SELECT emp.mset_update_apply( )
$$ );
SELECT * FROM finish( );
ROLLBACK;