Emmanuel BENOîT
e50775ec76
* The main loader script has been updated to generate the list of files it needs to load automatically. As a consequence, files that contained manually-maintained lists of scripts have been removed, and definition directories have been renamed accordingly. * PostgreSQL extension loading and configuration has been moved to a separate script to be loaded automatically in the main transaction. * Data and function definition scripts that had the -data or -functions suffix have been renamed (the suffix is unnecessary). * Unit tests have been reorganised to follow the definition's structure. * Documentation has been improved
47 lines
1.2 KiB
SQL
47 lines
1.2 KiB
SQL
-- LegacyWorlds Beta 6
|
|
-- PostgreSQL database scripts
|
|
--
|
|
-- Game updates - resource regeneration
|
|
--
|
|
-- Copyright(C) 2004-2012, DeepClone Development
|
|
-- --------------------------------------------------------
|
|
|
|
|
|
/*
|
|
* Resource provider regeneration update
|
|
*
|
|
* This function computes the regeneration of resource providers for the current batch
|
|
* of planets.
|
|
*
|
|
* Parameters:
|
|
* _tick The identifier of the game update
|
|
*/
|
|
CREATE OR REPLACE FUNCTION sys.process_planet_res_regen_updates( _tick BIGINT )
|
|
RETURNS VOID
|
|
STRICT VOLATILE
|
|
SECURITY INVOKER
|
|
AS $process_planet_res_regen_updates$
|
|
|
|
UPDATE verse.resource_providers _provider
|
|
|
|
SET resprov_quantity = verse.compute_provider_regeneration(
|
|
_provider.resprov_quantity ,
|
|
_provider.resprov_quantity_max ,
|
|
_provider.resprov_recovery
|
|
)
|
|
|
|
FROM sys.updates _upd_sys
|
|
INNER JOIN verse.updates _upd_verse
|
|
ON _upd_verse.update_id = _upd_sys.id
|
|
|
|
WHERE _upd_sys.last_tick = $1
|
|
AND _upd_sys.status = 'PROCESSING'
|
|
AND _upd_sys.gu_type = 'PLANET_RES_REGEN'
|
|
AND _provider.planet_id = _upd_verse.planet_id;
|
|
|
|
$process_planet_res_regen_updates$ LANGUAGE SQL;
|
|
|
|
|
|
REVOKE EXECUTE
|
|
ON FUNCTION sys.process_planet_res_regen_updates( BIGINT )
|
|
FROM PUBLIC;
|