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/parts/030-data

View file

@ -135,11 +135,12 @@ CREATE TABLE emp.mining_settings(
resource_name_id INT NOT NULL ,
/* Weight to give to this type of resource when there are no planet-
* specific settings.
* specific settings. The weight is a value between 0 (lowest priority)
* and 4 (highest priority)
*/
empmset_weight INT NOT NULL
DEFAULT 1
CHECK( empmset_weight >= 0 ) ,
DEFAULT 2
CHECK( empmset_weight BETWEEN 0 AND 4 ) ,
/* Primary key on (empire,resource type) pairs */
PRIMARY KEY( empire_id , resource_name_id )
@ -176,10 +177,12 @@ CREATE TABLE emp.planet_mining_settings(
/* Identifier of the type of resources */
resource_name_id INT NOT NULL ,
/* Weight to give to this type of resource */
/* Weight to give to this type of resource. Works in a manner similar to
* the empmset_weight column of emp.mining_settings.
*/
emppmset_weight INT NOT NULL
DEFAULT 1
CHECK( emppmset_weight >= 0 ) ,
DEFAULT 2
CHECK( emppmset_weight BETWEEN 0 AND 4 ) ,
/* Primary key on (empire,resource type) pairs */
PRIMARY KEY( empire_id , planet_id , resource_name_id )