Game updates improvements
* Added a set of tables which define game updates and their targets. These definitions replace the old enumerate type. Added a set of triggers which automatically create specific update tables, insert missing entries, etc... when game update types are being manipulated. * Removed manual insertion of game updates from empire creation function and universe generator. * Added registration of core update targets (i.e. planets and empires), updated all existing game update processing functions and added type registrations * Created Maven project for game updates control components, moved existing components from the -simple project, rewritten most of what they contained, added new components for server-side update batch processing
This commit is contained in:
parent
ba6a1e2b41
commit
56eddcc4f0
93 changed files with 4004 additions and 578 deletions
legacyworlds-server-data/db-structure/tests/admin/050-updates/105-planet-resource-regeneration
|
@ -2,6 +2,11 @@
|
|||
* Test for the sys.process_planet_res_regen_updates() function
|
||||
*/
|
||||
BEGIN;
|
||||
/* Start by deleting all update types except for the one
|
||||
* we're interested in.
|
||||
*/
|
||||
DELETE FROM sys.update_types
|
||||
WHERE updtype_name <> 'ResourceRegeneration';
|
||||
|
||||
/* We need to create a natural resource and a pair of planets */
|
||||
\i utils/strings.sql
|
||||
|
@ -34,23 +39,19 @@ BEGIN;
|
|||
0.5 , 0.5
|
||||
);
|
||||
|
||||
/* Insert update records for the planets. Planets 1 and 2 will be processed,
|
||||
/* Modify update records for the planets. Planets 1 and 2 will be processed,
|
||||
* planet testPlanet3 will not.
|
||||
*/
|
||||
INSERT INTO sys.updates ( id , gu_type , status , last_tick )
|
||||
VALUES ( 1 , 'PLANET_RES_REGEN' , 'PROCESSING' , 0 );
|
||||
INSERT INTO verse.updates ( update_id , planet_id )
|
||||
VALUES ( 1 , _get_map_name( 'testPlanet1' ) );
|
||||
|
||||
INSERT INTO sys.updates ( id , gu_type , status , last_tick )
|
||||
VALUES ( 2 , 'PLANET_RES_REGEN' , 'PROCESSING' , 0 );
|
||||
INSERT INTO verse.updates ( update_id , planet_id )
|
||||
VALUES ( 2 , _get_map_name( 'testPlanet2' ) );
|
||||
|
||||
INSERT INTO sys.updates ( id , gu_type , status , last_tick )
|
||||
VALUES ( 3 , 'PLANET_RES_REGEN' , 'PROCESSED' , 0 );
|
||||
INSERT INTO verse.updates ( update_id , planet_id )
|
||||
VALUES ( 3 , _get_map_name( 'testPlanet3' ) );
|
||||
UPDATE sys.updates su
|
||||
SET update_state = 'PROCESSING' , update_last = 0
|
||||
FROM verse.planets_updates vu
|
||||
WHERE vu.update_id = su.update_id
|
||||
AND vu.name_id <> _get_map_name( 'testPlanet3' );
|
||||
UPDATE sys.updates su
|
||||
SET update_state = 'PROCESSED' , update_last = 0
|
||||
FROM verse.planets_updates vu
|
||||
WHERE vu.update_id = su.update_id
|
||||
AND vu.name_id = _get_map_name( 'testPlanet3' );
|
||||
|
||||
/* Helper function that gets a provider's current quantity */
|
||||
CREATE FUNCTION _get_quantity( _planet TEXT )
|
||||
|
@ -65,7 +66,7 @@ BEGIN;
|
|||
SELECT plan( 6 );
|
||||
|
||||
|
||||
SELECT sys.process_planet_res_regen_updates( 10 );
|
||||
SELECT sys.process_res_regen_updates( 10 );
|
||||
SELECT diag_test_name( 'PLANET_RES_REGEN update - Wrong update identifier (1/3)' );
|
||||
SELECT ok( _get_quantity( 'testPlanet1' ) = 50 );
|
||||
SELECT diag_test_name( 'PLANET_RES_REGEN update - Wrong update identifier (2/3)' );
|
||||
|
@ -74,7 +75,7 @@ BEGIN;
|
|||
SELECT ok( _get_quantity( 'testPlanet3' ) = 50 );
|
||||
|
||||
|
||||
SELECT sys.process_planet_res_regen_updates( 0 );
|
||||
SELECT sys.process_res_regen_updates( 0 );
|
||||
SELECT diag_test_name( 'PLANET_RES_REGEN update - Processed planet with quantity < max.' );
|
||||
SELECT ok( _get_quantity( 'testPlanet1' ) > 50 );
|
||||
SELECT diag_test_name( 'PLANET_RES_REGEN update - Processed planet with quantity = max.' );
|
||||
|
|
Reference in a new issue