Planet mining settings interface

* Modified owned planet view to include a field which indicates whether
mining settings are specific to the planet or come from the empire;
modified "simple" game components accordingly

* Modified stored procedures to only allow planet-specific mining
settings updates when the planet actually uses planet-specific settings,
and added a stored procedure which toggles the source of a planet's
settings

* Added corresponding parts to mining settings DAO and resources
controller

* Added session commands and server command handlers that toggle the
source of the settings and that upload the settings

* Split planet page template into multiple files for clarity and added
the mining priorities form to the natural resources tab
This commit is contained in:
Emmanuel BENOîT 2012-02-07 17:03:55 +01:00
parent 51b529a09f
commit e64f847ec3
25 changed files with 1009 additions and 152 deletions
legacyworlds-server-interfaces/src/main/java/com/deepclone/lw/interfaces/game/resources

View file

@ -20,12 +20,30 @@ public interface MiningSettingsDAO
* Start an empire settings update by calling the <code>emp.mset_update_start(INT)</code> stored
* procedure.
*
* @param empireId
* @param empire
* the identifier of the empire whose settings will be updated
*
* @return <code>true</code> on success, <code>false</code> on failure
*/
public boolean startUpdate( int empireId );
public boolean startUpdate( int empire );
/**
* Start a planet settings update
*
* <p>
* Start a planet settings update by calling the <code>emp.mset_update_start(INT,INT)</code>
* stored procedure.
*
* @param empire
* the identifier of the empire who supposedly owns the planet
* @param planet
* the identifier of the planet whose settings will be changed
*
* @return <code>true</code> if the planet belongs to the specified empire and has specific
* mining settings
*/
public boolean startUpdate( int empire , int planet );
/**
@ -57,4 +75,19 @@ public interface MiningSettingsDAO
* invalid.
*/
public boolean applyUpdate( );
/**
* Toggle the source of a planet's mining settings
*
* <p>
* Call the <code>emp.mset_toggle_source(INT,INT)</code> stored procedure to toggle the source
* of a planet's mining priorities.
*
* @param empire
* the empire's identifier
* @param planet
* the planet's identifier
*/
public void togglePlanet( int empire , int planet );
}

View file

@ -27,4 +27,36 @@ public interface ResourcesController
*/
public void updateEmpireSettings( int empireId , Map< String , Integer > settings );
/**
* Toggle the source of a planet's mining priorities
*
* <p>
* If the planet is currently using specific priorities, it will revert to empire-wide settings,
* and vice-versa. The planet must belong to the specified empire.
*
* @param empire
* the empire's identifier
* @param planet
* the planet's identifier
*/
public void togglePlanet( int empire , int planet );
/**
* Update a planet's mining settings
*
* <p>
* If the planet is using specific mining priorities and belongs to the specified empire, update
* its mining priorities.
*
* @param empire
* the empire's identifier
* @param planet
* the planet's identifier
* @param settings
* the new priorities
*/
public void updatePlanetSettings( int empire , int planet , Map< String , Integer > settings );
}