Update to 1.10.0-RC1
This commit is contained in:
@@ -9,8 +9,8 @@
|
||||
# Project related configuration options
|
||||
#---------------------------------------------------------------------------
|
||||
DOXYFILE_ENCODING = UTF-8
|
||||
PROJECT_NAME = "OpenTTD NoAI API"
|
||||
PROJECT_NUMBER =
|
||||
PROJECT_NAME = "OpenTTD AI API"
|
||||
PROJECT_NUMBER = $(VERSION)
|
||||
OUTPUT_DIRECTORY = ../../../docs/aidocs/
|
||||
CREATE_SUBDIRS = NO
|
||||
OUTPUT_LANGUAGE = English
|
||||
|
||||
@@ -9,8 +9,8 @@
|
||||
# Project related configuration options
|
||||
#---------------------------------------------------------------------------
|
||||
DOXYFILE_ENCODING = UTF-8
|
||||
PROJECT_NAME = "OpenTTD Game API"
|
||||
PROJECT_NUMBER =
|
||||
PROJECT_NAME = "OpenTTD GameScript API"
|
||||
PROJECT_NUMBER = $(VERSION)
|
||||
OUTPUT_DIRECTORY = ../../../docs/gamedocs/
|
||||
CREATE_SUBDIRS = NO
|
||||
OUTPUT_LANGUAGE = English
|
||||
|
||||
@@ -46,6 +46,8 @@ void SQGSEngine_Register(Squirrel *engine)
|
||||
SQGSEngine.DefSQStaticMethod(engine, &ScriptEngine::IsArticulated, "IsArticulated", 2, ".i");
|
||||
SQGSEngine.DefSQStaticMethod(engine, &ScriptEngine::GetPlaneType, "GetPlaneType", 2, ".i");
|
||||
SQGSEngine.DefSQStaticMethod(engine, &ScriptEngine::GetMaximumOrderDistance, "GetMaximumOrderDistance", 2, ".i");
|
||||
SQGSEngine.DefSQStaticMethod(engine, &ScriptEngine::EnableForCompany, "EnableForCompany", 3, ".ii");
|
||||
SQGSEngine.DefSQStaticMethod(engine, &ScriptEngine::DisableForCompany, "DisableForCompany", 3, ".ii");
|
||||
|
||||
SQGSEngine.PostRegister(engine);
|
||||
}
|
||||
|
||||
@@ -79,6 +79,8 @@ void SQGSTown_Register(Squirrel *engine)
|
||||
SQGSTown.DefSQStaticMethod(engine, &ScriptTown::ExpandTown, "ExpandTown", 3, ".ii");
|
||||
SQGSTown.DefSQStaticMethod(engine, &ScriptTown::FoundTown, "FoundTown", 6, ".iibi.");
|
||||
SQGSTown.DefSQStaticMethod(engine, &ScriptTown::GetRating, "GetRating", 3, ".ii");
|
||||
SQGSTown.DefSQStaticMethod(engine, &ScriptTown::GetDetailedRating, "GetDetailedRating", 3, ".ii");
|
||||
SQGSTown.DefSQStaticMethod(engine, &ScriptTown::ChangeRating, "ChangeRating", 4, ".iii");
|
||||
SQGSTown.DefSQStaticMethod(engine, &ScriptTown::GetAllowedNoise, "GetAllowedNoise", 2, ".i");
|
||||
SQGSTown.DefSQStaticMethod(engine, &ScriptTown::GetRoadLayout, "GetRoadLayout", 2, ".i");
|
||||
|
||||
|
||||
@@ -138,6 +138,7 @@ void SQGSWindow_Register(Squirrel *engine)
|
||||
SQGSWindow.DefSQConst(engine, ScriptWindow::WC_SAVE_PRESET, "WC_SAVE_PRESET");
|
||||
SQGSWindow.DefSQConst(engine, ScriptWindow::WC_FRAMERATE_DISPLAY, "WC_FRAMERATE_DISPLAY");
|
||||
SQGSWindow.DefSQConst(engine, ScriptWindow::WC_FRAMETIME_GRAPH, "WC_FRAMETIME_GRAPH");
|
||||
SQGSWindow.DefSQConst(engine, ScriptWindow::WC_SCREENSHOT, "WC_SCREENSHOT");
|
||||
SQGSWindow.DefSQConst(engine, ScriptWindow::WC_INVALID, "WC_INVALID");
|
||||
SQGSWindow.DefSQConst(engine, ScriptWindow::TC_BLUE, "TC_BLUE");
|
||||
SQGSWindow.DefSQConst(engine, ScriptWindow::TC_SILVER, "TC_SILVER");
|
||||
@@ -588,6 +589,8 @@ void SQGSWindow_Register(Squirrel *engine)
|
||||
SQGSWindow.DefSQConst(engine, ScriptWindow::WID_IV_DISPLAY, "WID_IV_DISPLAY");
|
||||
SQGSWindow.DefSQConst(engine, ScriptWindow::WID_ID_DROPDOWN_ORDER, "WID_ID_DROPDOWN_ORDER");
|
||||
SQGSWindow.DefSQConst(engine, ScriptWindow::WID_ID_DROPDOWN_CRITERIA, "WID_ID_DROPDOWN_CRITERIA");
|
||||
SQGSWindow.DefSQConst(engine, ScriptWindow::WID_ID_FILTER_BY_ACC_CARGO, "WID_ID_FILTER_BY_ACC_CARGO");
|
||||
SQGSWindow.DefSQConst(engine, ScriptWindow::WID_ID_FILTER_BY_PROD_CARGO, "WID_ID_FILTER_BY_PROD_CARGO");
|
||||
SQGSWindow.DefSQConst(engine, ScriptWindow::WID_ID_INDUSTRY_LIST, "WID_ID_INDUSTRY_LIST");
|
||||
SQGSWindow.DefSQConst(engine, ScriptWindow::WID_ID_SCROLLBAR, "WID_ID_SCROLLBAR");
|
||||
SQGSWindow.DefSQConst(engine, ScriptWindow::WID_IC_CAPTION, "WID_IC_CAPTION");
|
||||
@@ -1028,6 +1031,12 @@ void SQGSWindow_Register(Squirrel *engine)
|
||||
SQGSWindow.DefSQConst(engine, ScriptWindow::WID_BROS_LT_OFF, "WID_BROS_LT_OFF");
|
||||
SQGSWindow.DefSQConst(engine, ScriptWindow::WID_BROS_LT_ON, "WID_BROS_LT_ON");
|
||||
SQGSWindow.DefSQConst(engine, ScriptWindow::WID_BROS_INFO, "WID_BROS_INFO");
|
||||
SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SC_TAKE, "WID_SC_TAKE");
|
||||
SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SC_TAKE_ZOOMIN, "WID_SC_TAKE_ZOOMIN");
|
||||
SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SC_TAKE_DEFAULTZOOM, "WID_SC_TAKE_DEFAULTZOOM");
|
||||
SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SC_TAKE_WORLD, "WID_SC_TAKE_WORLD");
|
||||
SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SC_TAKE_HEIGHTMAP, "WID_SC_TAKE_HEIGHTMAP");
|
||||
SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SC_TAKE_MINIMAP, "WID_SC_TAKE_MINIMAP");
|
||||
SQGSWindow.DefSQConst(engine, ScriptWindow::WID_GO_BACKGROUND, "WID_GO_BACKGROUND");
|
||||
SQGSWindow.DefSQConst(engine, ScriptWindow::WID_GO_CURRENCY_DROPDOWN, "WID_GO_CURRENCY_DROPDOWN");
|
||||
SQGSWindow.DefSQConst(engine, ScriptWindow::WID_GO_DISTANCE_DROPDOWN, "WID_GO_DISTANCE_DROPDOWN");
|
||||
|
||||
@@ -25,6 +25,8 @@
|
||||
* \li GSRoad::RoadVehHasPowerOnRoad
|
||||
* \li GSRoad::ConvertRoadType
|
||||
* \li GSRoad::GetMaxSpeed
|
||||
* \li GSEngine::EnableForCompany
|
||||
* \li GSEngine::DisableForCompany
|
||||
*
|
||||
* \b 1.9.0
|
||||
*
|
||||
|
||||
@@ -276,3 +276,25 @@
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* static */ bool ScriptEngine::EnableForCompany(EngineID engine_id, ScriptCompany::CompanyID company)
|
||||
{
|
||||
company = ScriptCompany::ResolveCompanyID(company);
|
||||
|
||||
EnforcePrecondition(false, ScriptObject::GetCompany() == OWNER_DEITY);
|
||||
EnforcePrecondition(false, IsValidEngine(engine_id));
|
||||
EnforcePrecondition(false, company != ScriptCompany::COMPANY_INVALID);
|
||||
|
||||
return ScriptObject::DoCommand(0, engine_id, (uint32)company | (1 << 31), CMD_ENGINE_CTRL);
|
||||
}
|
||||
|
||||
/* static */ bool ScriptEngine::DisableForCompany(EngineID engine_id, ScriptCompany::CompanyID company)
|
||||
{
|
||||
company = ScriptCompany::ResolveCompanyID(company);
|
||||
|
||||
EnforcePrecondition(false, ScriptObject::GetCompany() == OWNER_DEITY);
|
||||
EnforcePrecondition(false, IsValidEngine(engine_id));
|
||||
EnforcePrecondition(false, company != ScriptCompany::COMPANY_INVALID);
|
||||
|
||||
return ScriptObject::DoCommand(0, engine_id, company, CMD_ENGINE_CTRL);
|
||||
}
|
||||
|
||||
@@ -287,6 +287,29 @@ public:
|
||||
* @see ScriptOrder::GetOrderDistance
|
||||
*/
|
||||
static uint GetMaximumOrderDistance(EngineID engine_id);
|
||||
|
||||
/**
|
||||
* Allows a company to use an engine before its intro date or after retirement.
|
||||
* @param engine_id The engine to enable.
|
||||
* @param company_id The company to allow using the engine.
|
||||
* @pre IsValidEngine(engine_id).
|
||||
* @pre ScriptCompany.ResolveCompanyID(company_id) != ScriptCompany::COMPANY_INVALID.
|
||||
* @return True if the action succeeded.
|
||||
* @api -ai
|
||||
*/
|
||||
static bool EnableForCompany(EngineID engine_id, ScriptCompany::CompanyID company_id);
|
||||
|
||||
/**
|
||||
* Forbids a company to use an engine before its natural retirement.
|
||||
* @param engine_id The engine to disable.
|
||||
* @param company_id The company to forbid using the engine.
|
||||
* @pre IsValidEngine(engine_id).
|
||||
* @pre ScriptCompany.ResolveCompanyID(company_id) != ScriptCompany::COMPANY_INVALID.
|
||||
* @return True if the action succeeded.
|
||||
* @api -ai
|
||||
*/
|
||||
static bool DisableForCompany(EngineID engine_id, ScriptCompany::CompanyID company_id);
|
||||
|
||||
};
|
||||
|
||||
#endif /* SCRIPT_ENGINE_HPP */
|
||||
|
||||
@@ -336,6 +336,33 @@
|
||||
}
|
||||
}
|
||||
|
||||
/* static */ int ScriptTown::GetDetailedRating(TownID town_id, ScriptCompany::CompanyID company_id)
|
||||
{
|
||||
if (!IsValidTown(town_id)) return TOWN_RATING_INVALID;
|
||||
ScriptCompany::CompanyID company = ScriptCompany::ResolveCompanyID(company_id);
|
||||
if (company == ScriptCompany::COMPANY_INVALID) return TOWN_RATING_INVALID;
|
||||
|
||||
const Town *t = ::Town::Get(town_id);
|
||||
return t->ratings[company];
|
||||
}
|
||||
|
||||
/* static */ bool ScriptTown::ChangeRating(TownID town_id, ScriptCompany::CompanyID company_id, int delta)
|
||||
{
|
||||
EnforcePrecondition(false, ScriptObject::GetCompany() == OWNER_DEITY);
|
||||
EnforcePrecondition(false, IsValidTown(town_id));
|
||||
ScriptCompany::CompanyID company = ScriptCompany::ResolveCompanyID(company_id);
|
||||
EnforcePrecondition(false, company != ScriptCompany::COMPANY_INVALID);
|
||||
|
||||
const Town *t = ::Town::Get(town_id);
|
||||
int16 new_rating = Clamp(t->ratings[company] + delta, RATING_MINIMUM, RATING_MAXIMUM);
|
||||
if (new_rating == t->ratings[company]) return false;
|
||||
|
||||
uint16 p2 = 0;
|
||||
memcpy(&p2, &new_rating, sizeof(p2));
|
||||
|
||||
return ScriptObject::DoCommand(0, town_id | (company_id << 16), p2, CMD_TOWN_RATING);
|
||||
}
|
||||
|
||||
/* static */ int ScriptTown::GetAllowedNoise(TownID town_id)
|
||||
{
|
||||
if (!IsValidTown(town_id)) return -1;
|
||||
|
||||
@@ -423,6 +423,30 @@ public:
|
||||
*/
|
||||
static TownRating GetRating(TownID town_id, ScriptCompany::CompanyID company_id);
|
||||
|
||||
/**
|
||||
* Get the accurate rating of a company within a town.
|
||||
* @param town_id The town to get the rating for.
|
||||
* @param company_id The company to get the rating for.
|
||||
* @pre IsValidTown(town_id).
|
||||
* @pre ScriptCompany.ResolveCompanyID(company) != ScriptCompany::COMPANY_INVALID.
|
||||
* @return The rating as a number between -1000 (worst) and 1000 (best).
|
||||
* @api -ai
|
||||
*/
|
||||
static int GetDetailedRating(TownID town_id, ScriptCompany::CompanyID company_id);
|
||||
|
||||
/**
|
||||
* Change the rating of a company within a town.
|
||||
* @param town_id The town to change the rating in.
|
||||
* @param company_id The company to change the rating for.
|
||||
* @param delta How much to change rating by (range -1000 to +1000).
|
||||
* @return True if the rating was changed.
|
||||
* @pre IsValidTown(town_id).
|
||||
* @pre ScriptCompany.ResolveCompanyID(company) != ScriptCompany::COMPANY_INVALID.
|
||||
* @pre no company mode in scope
|
||||
* @api -ai
|
||||
*/
|
||||
static bool ChangeRating(TownID town_id, ScriptCompany::CompanyID company_id, int delta);
|
||||
|
||||
/**
|
||||
* Get the maximum level of noise that still can be added by airports
|
||||
* before the town start to refuse building a new airport.
|
||||
|
||||
@@ -52,6 +52,7 @@
|
||||
#include "../../widgets/osk_widget.h"
|
||||
#include "../../widgets/rail_widget.h"
|
||||
#include "../../widgets/road_widget.h"
|
||||
#include "../../widgets/screenshot_widget.h"
|
||||
#include "../../widgets/settings_widget.h"
|
||||
#include "../../widgets/sign_widget.h"
|
||||
#include "../../widgets/smallmap_widget.h"
|
||||
@@ -775,6 +776,12 @@ public:
|
||||
*/
|
||||
WC_FRAMETIME_GRAPH = ::WC_FRAMETIME_GRAPH,
|
||||
|
||||
/**
|
||||
* Screenshot window; %Window numbers:
|
||||
* - 0 = #ScreenshotWidgets
|
||||
*/
|
||||
WC_SCREENSHOT = ::WC_SCREENSHOT,
|
||||
|
||||
WC_INVALID = ::WC_INVALID, ///< Invalid window.
|
||||
};
|
||||
|
||||
@@ -1516,6 +1523,8 @@ public:
|
||||
enum IndustryDirectoryWidgets {
|
||||
WID_ID_DROPDOWN_ORDER = ::WID_ID_DROPDOWN_ORDER, ///< Dropdown for the order of the sort.
|
||||
WID_ID_DROPDOWN_CRITERIA = ::WID_ID_DROPDOWN_CRITERIA, ///< Dropdown for the criteria of the sort.
|
||||
WID_ID_FILTER_BY_ACC_CARGO = ::WID_ID_FILTER_BY_ACC_CARGO, ///< Accepted cargo filter dropdown list.
|
||||
WID_ID_FILTER_BY_PROD_CARGO = ::WID_ID_FILTER_BY_PROD_CARGO, ///< Produced cargo filter dropdown list.
|
||||
WID_ID_INDUSTRY_LIST = ::WID_ID_INDUSTRY_LIST, ///< Industry list.
|
||||
WID_ID_SCROLLBAR = ::WID_ID_SCROLLBAR, ///< Scrollbar of the list.
|
||||
};
|
||||
@@ -2171,6 +2180,17 @@ public:
|
||||
WID_BROS_INFO = ::WID_BROS_INFO, ///< Station acceptance info.
|
||||
};
|
||||
|
||||
/* automatically generated from ../../widgets/screenshot_widget.h */
|
||||
/** Widgets of the #ScreenshotWindow class. */
|
||||
enum ScreenshotWindowWidgets {
|
||||
WID_SC_TAKE = ::WID_SC_TAKE, ///< Button for taking a normal screenshot
|
||||
WID_SC_TAKE_ZOOMIN = ::WID_SC_TAKE_ZOOMIN, ///< Button for taking a zoomed in screenshot
|
||||
WID_SC_TAKE_DEFAULTZOOM = ::WID_SC_TAKE_DEFAULTZOOM, ///< Button for taking a screenshot at normal zoom
|
||||
WID_SC_TAKE_WORLD = ::WID_SC_TAKE_WORLD, ///< Button for taking a screenshot of the whole world
|
||||
WID_SC_TAKE_HEIGHTMAP = ::WID_SC_TAKE_HEIGHTMAP, ///< Button for taking a heightmap "screenshot"
|
||||
WID_SC_TAKE_MINIMAP = ::WID_SC_TAKE_MINIMAP, ///< Button for taking a minimap screenshot
|
||||
};
|
||||
|
||||
/* automatically generated from ../../widgets/settings_widget.h */
|
||||
/** Widgets of the #GameOptionsWindow class. */
|
||||
enum GameOptionsWidgets {
|
||||
|
||||
@@ -193,6 +193,8 @@ namespace SQConvert {
|
||||
template <> inline int Return<ScriptWindow::BuildRoadDepotWidgets>(HSQUIRRELVM vm, ScriptWindow::BuildRoadDepotWidgets res) { sq_pushinteger(vm, (int32)res); return 1; }
|
||||
template <> inline ScriptWindow::BuildRoadStationWidgets GetParam(ForceType<ScriptWindow::BuildRoadStationWidgets>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptWindow::BuildRoadStationWidgets)tmp; }
|
||||
template <> inline int Return<ScriptWindow::BuildRoadStationWidgets>(HSQUIRRELVM vm, ScriptWindow::BuildRoadStationWidgets res) { sq_pushinteger(vm, (int32)res); return 1; }
|
||||
template <> inline ScriptWindow::ScreenshotWindowWidgets GetParam(ForceType<ScriptWindow::ScreenshotWindowWidgets>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptWindow::ScreenshotWindowWidgets)tmp; }
|
||||
template <> inline int Return<ScriptWindow::ScreenshotWindowWidgets>(HSQUIRRELVM vm, ScriptWindow::ScreenshotWindowWidgets res) { sq_pushinteger(vm, (int32)res); return 1; }
|
||||
template <> inline ScriptWindow::GameOptionsWidgets GetParam(ForceType<ScriptWindow::GameOptionsWidgets>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptWindow::GameOptionsWidgets)tmp; }
|
||||
template <> inline int Return<ScriptWindow::GameOptionsWidgets>(HSQUIRRELVM vm, ScriptWindow::GameOptionsWidgets res) { sq_pushinteger(vm, (int32)res); return 1; }
|
||||
template <> inline ScriptWindow::GameSettingsWidgets GetParam(ForceType<ScriptWindow::GameSettingsWidgets>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptWindow::GameSettingsWidgets)tmp; }
|
||||
|
||||
Reference in New Issue
Block a user