Add: Setting for the number of goals of a company.

This commit is contained in:
Alberth
2015-01-01 20:25:13 +01:00
parent bdfe3acb66
commit 5e6c171e7d
3 changed files with 19 additions and 4 deletions

View File

@@ -210,7 +210,8 @@ class CompanyData {
this.active_goals = {};
this.comp_id = comp_id;
for (local num = 0; num < 5; num += 1) this.active_goals[num] <- null;
local num_goals = GSController.GetSetting("num_goals");
for (local num = 0; num < num_goals; num += 1) this.active_goals[num] <- null;
}
function FinalizeCompany();

View File

@@ -17,7 +17,7 @@
* Fifth Floor, Boston, MA 02110-1301 USA.
*/
class BusyBeeClass extends GSInfo {
class BusyBeeInfo extends GSInfo {
function GetAuthor() { return "alberth & andythenorth"; }
function GetName() { return "BusyBee"; }
function GetDescription() { return "Goal: Have fun"; }
@@ -27,6 +27,20 @@ class BusyBeeClass extends GSInfo {
function GetShortName() { return "BBEE"; }
function GetAPIVersion() { return "1.5"; }
function GetUrl() { return ""; }
function GetSettings();
}
RegisterGS(BusyBeeClass());
function BusyBeeInfo::GetSettings()
{
GSInfo.AddSetting({name="num_goals",
description="Number of goals for a company",
min_value=1,
max_value=10,
easy_value=5,
medium_value=5,
hard_value=5,
custom_value=5,
flags=GSInfo.CONFIG_NONE});
}
RegisterGS(BusyBeeInfo());

View File

@@ -376,7 +376,7 @@ function BusyBeeClass::Start()
// GSGoal.Question(1, GSCompany.COMPANY_INVALID, lake_news, GSGoal.QT_INFORMATION, GSGoal.BUTTON_GO);
// Sleep until the next event.
local delay_time = 5 * 74; // Check events every 2 days.
local delay_time = 5 * 74; // Check events every 5 days.
if (delay_time > new_goal_timeout) delay_time = new_goal_timeout;
if (delay_time > monitor_timeout) delay_time = monitor_timeout;
if (delay_time > finished_timeout) delay_time = finished_timeout;