Script: Add method to get day length factor
This commit is contained in:
@@ -23,6 +23,7 @@ void SQAIDate_Register(Squirrel *engine)
|
|||||||
|
|
||||||
SQAIDate.DefSQStaticMethod(engine, &ScriptDate::IsValidDate, "IsValidDate", 2, ".i");
|
SQAIDate.DefSQStaticMethod(engine, &ScriptDate::IsValidDate, "IsValidDate", 2, ".i");
|
||||||
SQAIDate.DefSQStaticMethod(engine, &ScriptDate::GetCurrentDate, "GetCurrentDate", 1, ".");
|
SQAIDate.DefSQStaticMethod(engine, &ScriptDate::GetCurrentDate, "GetCurrentDate", 1, ".");
|
||||||
|
SQAIDate.DefSQStaticMethod(engine, &ScriptDate::GetDayLengthFactor, "GetDayLengthFactor", 1, ".");
|
||||||
SQAIDate.DefSQStaticMethod(engine, &ScriptDate::GetYear, "GetYear", 2, ".i");
|
SQAIDate.DefSQStaticMethod(engine, &ScriptDate::GetYear, "GetYear", 2, ".i");
|
||||||
SQAIDate.DefSQStaticMethod(engine, &ScriptDate::GetMonth, "GetMonth", 2, ".i");
|
SQAIDate.DefSQStaticMethod(engine, &ScriptDate::GetMonth, "GetMonth", 2, ".i");
|
||||||
SQAIDate.DefSQStaticMethod(engine, &ScriptDate::GetDayOfMonth, "GetDayOfMonth", 2, ".i");
|
SQAIDate.DefSQStaticMethod(engine, &ScriptDate::GetDayOfMonth, "GetDayOfMonth", 2, ".i");
|
||||||
|
@@ -23,6 +23,7 @@ void SQGSDate_Register(Squirrel *engine)
|
|||||||
|
|
||||||
SQGSDate.DefSQStaticMethod(engine, &ScriptDate::IsValidDate, "IsValidDate", 2, ".i");
|
SQGSDate.DefSQStaticMethod(engine, &ScriptDate::IsValidDate, "IsValidDate", 2, ".i");
|
||||||
SQGSDate.DefSQStaticMethod(engine, &ScriptDate::GetCurrentDate, "GetCurrentDate", 1, ".");
|
SQGSDate.DefSQStaticMethod(engine, &ScriptDate::GetCurrentDate, "GetCurrentDate", 1, ".");
|
||||||
|
SQGSDate.DefSQStaticMethod(engine, &ScriptDate::GetDayLengthFactor, "GetDayLengthFactor", 1, ".");
|
||||||
SQGSDate.DefSQStaticMethod(engine, &ScriptDate::GetYear, "GetYear", 2, ".i");
|
SQGSDate.DefSQStaticMethod(engine, &ScriptDate::GetYear, "GetYear", 2, ".i");
|
||||||
SQGSDate.DefSQStaticMethod(engine, &ScriptDate::GetMonth, "GetMonth", 2, ".i");
|
SQGSDate.DefSQStaticMethod(engine, &ScriptDate::GetMonth, "GetMonth", 2, ".i");
|
||||||
SQGSDate.DefSQStaticMethod(engine, &ScriptDate::GetDayOfMonth, "GetDayOfMonth", 2, ".i");
|
SQGSDate.DefSQStaticMethod(engine, &ScriptDate::GetDayOfMonth, "GetDayOfMonth", 2, ".i");
|
||||||
|
@@ -11,6 +11,7 @@
|
|||||||
#include "../../stdafx.h"
|
#include "../../stdafx.h"
|
||||||
#include "script_date.hpp"
|
#include "script_date.hpp"
|
||||||
#include "../../date_func.h"
|
#include "../../date_func.h"
|
||||||
|
#include "../../settings_type.h"
|
||||||
|
|
||||||
#include "../../safeguards.h"
|
#include "../../safeguards.h"
|
||||||
|
|
||||||
@@ -24,6 +25,11 @@
|
|||||||
return (ScriptDate::Date)_date;
|
return (ScriptDate::Date)_date;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* static */ int32 ScriptDate::GetDayLengthFactor()
|
||||||
|
{
|
||||||
|
return _settings_game.economy.day_length_factor;
|
||||||
|
}
|
||||||
|
|
||||||
/* static */ int32 ScriptDate::GetYear(ScriptDate::Date date)
|
/* static */ int32 ScriptDate::GetYear(ScriptDate::Date date)
|
||||||
{
|
{
|
||||||
if (date < 0) return DATE_INVALID;
|
if (date < 0) return DATE_INVALID;
|
||||||
|
@@ -50,6 +50,8 @@ public:
|
|||||||
*/
|
*/
|
||||||
static Date GetCurrentDate();
|
static Date GetCurrentDate();
|
||||||
|
|
||||||
|
static int32 GetDayLengthFactor();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the year of the given date.
|
* Get the year of the given date.
|
||||||
* @param date The date to get the year of.
|
* @param date The date to get the year of.
|
||||||
|
Reference in New Issue
Block a user