Merge svn r27779
Conflicts: src/autoreplace_gui.cpp src/economy.cpp src/fios_gui.cpp src/lang/spanish_MX.txt src/network/network_gui.cpp src/rev.cpp.in src/road_gui.cpp src/toolbar_gui.cpp src/window.cpp
This commit is contained in:
@@ -15,19 +15,15 @@
|
||||
* functions may still be available if you return an older API version
|
||||
* in GetAPIVersion() in info.nut.
|
||||
*
|
||||
* \b 1.6.0
|
||||
* \b 1.7.0
|
||||
*
|
||||
* 1.6.0 is not yet released. The following changes are not set in stone yet.
|
||||
* 1.7.0 is not yet released. The following changes are not set in stone yet.
|
||||
*
|
||||
* \b 1.5.3
|
||||
* \b 1.6.1 - 1.6.0
|
||||
*
|
||||
* No changes
|
||||
*
|
||||
* \b 1.5.2
|
||||
*
|
||||
* No changes
|
||||
*
|
||||
* \b 1.5.1
|
||||
* \b 1.5.3 - 1.5.1
|
||||
*
|
||||
* No changes
|
||||
*
|
||||
@@ -49,20 +45,7 @@
|
||||
* \li AIStationList_CargoWaitingFromByVia
|
||||
* \li AIStationList_CargoWaitingViaByFrom
|
||||
*
|
||||
* \b 1.4.4
|
||||
*
|
||||
* No changes
|
||||
*
|
||||
* \b 1.4.3
|
||||
*
|
||||
* No changes
|
||||
*
|
||||
* \b 1.4.2
|
||||
*
|
||||
* No changes
|
||||
*
|
||||
* \b 1.4.1
|
||||
*
|
||||
* \b 1.4.4 - 1.4.1
|
||||
* No changes
|
||||
*
|
||||
* \b 1.4.0
|
||||
@@ -83,11 +66,7 @@
|
||||
* \li AIStation::GetCargoRating does return -1 for cargo-station combinations that
|
||||
* do not have a rating yet instead of returning 69.
|
||||
*
|
||||
* \b 1.3.3
|
||||
*
|
||||
* No changes
|
||||
*
|
||||
* \b 1.3.2
|
||||
* \b 1.3.3 - 1.3.2
|
||||
*
|
||||
* No changes
|
||||
*
|
||||
@@ -106,15 +85,7 @@
|
||||
* \li AIStation::OpenCloseAirport
|
||||
* \li AIController::Break
|
||||
*
|
||||
* \b 1.2.3
|
||||
*
|
||||
* No changes
|
||||
*
|
||||
* \b 1.2.2
|
||||
*
|
||||
* No changes
|
||||
*
|
||||
* \b 1.2.1
|
||||
* \b 1.2.3 - 1.2.1
|
||||
*
|
||||
* No changes
|
||||
*
|
||||
@@ -181,15 +152,7 @@
|
||||
* API additions:
|
||||
* \li AIVehicle::ERR_VEHICLE_TOO_LONG in case vehicle length limit is reached.
|
||||
*
|
||||
* \b 1.1.3
|
||||
*
|
||||
* No changes
|
||||
*
|
||||
* \b 1.1.2
|
||||
*
|
||||
* No changes
|
||||
*
|
||||
* \b 1.1.1
|
||||
* \b 1.1.3 - 1.1.1
|
||||
*
|
||||
* No changes
|
||||
*
|
||||
@@ -220,11 +183,7 @@
|
||||
* \li AIRoad::BuildDriveThroughRoadStation now allows overbuilding.
|
||||
* \li AIRoad::BuildRoadStation now allows overbuilding.
|
||||
*
|
||||
* \b 1.0.5
|
||||
*
|
||||
* No changes
|
||||
*
|
||||
* \b 1.0.4
|
||||
* \b 1.0.5 - 1.0.4
|
||||
*
|
||||
* No changes
|
||||
*
|
||||
@@ -338,11 +297,7 @@
|
||||
* station orders for buoys one has to use waypoint orders.
|
||||
* \li Autoreplaces can now also be set for the default group via AIGroup.
|
||||
*
|
||||
* \b 0.7.5
|
||||
*
|
||||
* No changes
|
||||
*
|
||||
* \b 0.7.4
|
||||
* \b 0.7.5 - 0.7.4
|
||||
*
|
||||
* No changes
|
||||
*
|
||||
|
||||
@@ -225,10 +225,8 @@ void SQGSWindow_Register(Squirrel *engine)
|
||||
SQGSWindow.DefSQConst(engine, ScriptWindow::WID_RV_START_REPLACE, "WID_RV_START_REPLACE");
|
||||
SQGSWindow.DefSQConst(engine, ScriptWindow::WID_RV_INFO_TAB, "WID_RV_INFO_TAB");
|
||||
SQGSWindow.DefSQConst(engine, ScriptWindow::WID_RV_STOP_REPLACE, "WID_RV_STOP_REPLACE");
|
||||
SQGSWindow.DefSQConst(engine, ScriptWindow::WID_RV_TRAIN_ENGINEWAGON_TOGGLE, "WID_RV_TRAIN_ENGINEWAGON_TOGGLE");
|
||||
SQGSWindow.DefSQConst(engine, ScriptWindow::WID_RV_TRAIN_FLUFF_LEFT, "WID_RV_TRAIN_FLUFF_LEFT");
|
||||
SQGSWindow.DefSQConst(engine, ScriptWindow::WID_RV_TRAIN_ENGINEWAGON_DROPDOWN, "WID_RV_TRAIN_ENGINEWAGON_DROPDOWN");
|
||||
SQGSWindow.DefSQConst(engine, ScriptWindow::WID_RV_TRAIN_RAILTYPE_DROPDOWN, "WID_RV_TRAIN_RAILTYPE_DROPDOWN");
|
||||
SQGSWindow.DefSQConst(engine, ScriptWindow::WID_RV_TRAIN_FLUFF_RIGHT, "WID_RV_TRAIN_FLUFF_RIGHT");
|
||||
SQGSWindow.DefSQConst(engine, ScriptWindow::WID_RV_TRAIN_WAGONREMOVE_TOGGLE, "WID_RV_TRAIN_WAGONREMOVE_TOGGLE");
|
||||
SQGSWindow.DefSQConst(engine, ScriptWindow::WID_BB_BACKGROUND, "WID_BB_BACKGROUND");
|
||||
SQGSWindow.DefSQConst(engine, ScriptWindow::WID_BAFD_QUESTION, "WID_BAFD_QUESTION");
|
||||
@@ -584,6 +582,8 @@ void SQGSWindow_Register(Squirrel *engine)
|
||||
SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SGI_ARCTIC_LANDSCAPE, "WID_SGI_ARCTIC_LANDSCAPE");
|
||||
SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SGI_TROPIC_LANDSCAPE, "WID_SGI_TROPIC_LANDSCAPE");
|
||||
SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SGI_TOYLAND_LANDSCAPE, "WID_SGI_TOYLAND_LANDSCAPE");
|
||||
SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SGI_BASESET_SELECTION, "WID_SGI_BASESET_SELECTION");
|
||||
SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SGI_BASESET, "WID_SGI_BASESET");
|
||||
SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SGI_TRANSLATION_SELECTION, "WID_SGI_TRANSLATION_SELECTION");
|
||||
SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SGI_TRANSLATION, "WID_SGI_TRANSLATION");
|
||||
SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SGI_OPTIONS, "WID_SGI_OPTIONS");
|
||||
@@ -1185,6 +1185,7 @@ void SQGSWindow_Register(Squirrel *engine)
|
||||
SQGSWindow.DefSQConst(engine, ScriptWindow::WID_TN_AIRCRAFTS, "WID_TN_AIRCRAFTS");
|
||||
SQGSWindow.DefSQConst(engine, ScriptWindow::WID_TN_ZOOM_IN, "WID_TN_ZOOM_IN");
|
||||
SQGSWindow.DefSQConst(engine, ScriptWindow::WID_TN_ZOOM_OUT, "WID_TN_ZOOM_OUT");
|
||||
SQGSWindow.DefSQConst(engine, ScriptWindow::WID_TN_BUILDING_TOOLS_START, "WID_TN_BUILDING_TOOLS_START");
|
||||
SQGSWindow.DefSQConst(engine, ScriptWindow::WID_TN_RAILS, "WID_TN_RAILS");
|
||||
SQGSWindow.DefSQConst(engine, ScriptWindow::WID_TN_ROADS, "WID_TN_ROADS");
|
||||
SQGSWindow.DefSQConst(engine, ScriptWindow::WID_TN_WATER, "WID_TN_WATER");
|
||||
|
||||
@@ -15,19 +15,15 @@
|
||||
* functions may still be available if you return an older API version
|
||||
* in GetAPIVersion() in info.nut.
|
||||
*
|
||||
* \b 1.6.0
|
||||
* \b 1.7.0
|
||||
*
|
||||
* 1.6.0 is not yet released. The following changes are not set in stone yet.
|
||||
* 1.7.0 is not yet released. The following changes are not set in stone yet.
|
||||
*
|
||||
* \b 1.5.3
|
||||
* \b 1.6.1 - 1.6.0
|
||||
*
|
||||
* No changes
|
||||
*
|
||||
* \b 1.5.2
|
||||
*
|
||||
* No changes
|
||||
*
|
||||
* \b 1.5.1
|
||||
* \b 1.5.3 - 1.5.1
|
||||
*
|
||||
* No changes
|
||||
*
|
||||
@@ -54,11 +50,7 @@
|
||||
* industry, or town. The user can click at the news message to jump to the
|
||||
* referred location.
|
||||
*
|
||||
* \b 1.4.4
|
||||
*
|
||||
* No changes
|
||||
*
|
||||
* \b 1.4.3
|
||||
* \b 1.4.4 - 1.4.3
|
||||
*
|
||||
* No changes
|
||||
*
|
||||
@@ -102,11 +94,7 @@
|
||||
* \li GSStation::GetCargoRating does return -1 for cargo-station combinations that
|
||||
* do not have a rating yet instead of returning 69.
|
||||
*
|
||||
* \b 1.3.3
|
||||
*
|
||||
* No changes
|
||||
*
|
||||
* \b 1.3.2
|
||||
* \b 1.3.3 - 1.3.2
|
||||
*
|
||||
* No changes
|
||||
*
|
||||
@@ -132,15 +120,7 @@
|
||||
* Other changes:
|
||||
* \li Company specific goals are now removed when a company goes bankrupt or is taken over.
|
||||
*
|
||||
* \b 1.2.3
|
||||
*
|
||||
* No changes
|
||||
*
|
||||
* \b 1.2.2
|
||||
*
|
||||
* No changes
|
||||
*
|
||||
* \b 1.2.1
|
||||
* \b 1.2.3 - 1.2.1
|
||||
*
|
||||
* No changes
|
||||
*
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#include "script_error.hpp"
|
||||
#include "../../core/bitmath_func.hpp"
|
||||
#include "../../string_func.h"
|
||||
#include "../../strings_func.h"
|
||||
|
||||
#include "../../safeguards.h"
|
||||
|
||||
@@ -31,17 +32,17 @@ ScriptError::ScriptErrorMapString ScriptError::error_map_string = ScriptError::S
|
||||
|
||||
/* static */ ScriptErrorType ScriptError::StringToError(StringID internal_string_id)
|
||||
{
|
||||
uint index = GB(internal_string_id, 11, 5);
|
||||
switch (GB(internal_string_id, 11, 5)) {
|
||||
case 26: case 28: case 29: case 30: // NewGRF strings.
|
||||
return ERR_NEWGRF_SUPPLIED_ERROR;
|
||||
uint index = GetStringIndex(internal_string_id);
|
||||
switch (GetStringTab(internal_string_id)) {
|
||||
case TEXT_TAB_NEWGRF_START:
|
||||
case TEXT_TAB_GAMESCRIPT_START:
|
||||
return ERR_NEWGRF_SUPPLIED_ERROR; // NewGRF strings.
|
||||
|
||||
/* DO NOT SWAP case 14 and 4 because that will break StringToError due
|
||||
* to the index dependency that relies on FALL THROUGHs. */
|
||||
case 14: if (index < 0xE4) break; // Player name
|
||||
case 4: if (index < 0xC0) break; // Town name
|
||||
case 15: // Custom name
|
||||
case 31: // Dynamic strings
|
||||
case TEXT_TAB_SPECIAL:
|
||||
if (index < 0xE4) break; // Player name
|
||||
/* FALL THROUGH */
|
||||
case TEXT_TAB_TOWN:
|
||||
if (index < 0xC0) break; // Town name
|
||||
/* These strings are 'random' and have no meaning.
|
||||
* They actually shouldn't even be returned as error messages. */
|
||||
return ERR_UNKNOWN;
|
||||
|
||||
@@ -47,6 +47,9 @@ public:
|
||||
*/
|
||||
~ScriptExecMode();
|
||||
|
||||
/**
|
||||
* @api -all
|
||||
*/
|
||||
virtual void FinalRelease();
|
||||
};
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
|
||||
#include "../../stdafx.h"
|
||||
#include "script_list.hpp"
|
||||
#include "script_controller.hpp"
|
||||
#include "../../debug.h"
|
||||
#include "../../script/squirrel.hpp"
|
||||
|
||||
@@ -905,6 +906,16 @@ SQInteger ScriptList::Valuate(HSQUIRRELVM vm)
|
||||
}
|
||||
}
|
||||
|
||||
/* Kill the script when the valuator call takes way too long.
|
||||
* Triggered by nesting valuators, which then take billions of iterations. */
|
||||
if (ScriptController::GetOpsTillSuspend() < -1000000) {
|
||||
/* See below for explanation. The extra pop is the return value. */
|
||||
sq_pop(vm, nparam + 4);
|
||||
|
||||
ScriptObject::SetAllowDoCommand(backup_allow);
|
||||
return sq_throwerror(vm, "excessive CPU usage in valuator function");
|
||||
}
|
||||
|
||||
/* Was something changed? */
|
||||
if (previous_modification_count != this->modifications) {
|
||||
/* See below for explanation. The extra pop is the return value. */
|
||||
|
||||
@@ -49,6 +49,9 @@ public:
|
||||
*/
|
||||
~ScriptTestMode();
|
||||
|
||||
/**
|
||||
* @api -all
|
||||
*/
|
||||
virtual void FinalRelease();
|
||||
};
|
||||
|
||||
|
||||
@@ -124,7 +124,10 @@ public:
|
||||
ScriptText *AddParam(Object value);
|
||||
#endif /* DOXYGEN_API */
|
||||
|
||||
/* virtual */ const char *GetEncodedText();
|
||||
/**
|
||||
* @api -all
|
||||
*/
|
||||
virtual const char *GetEncodedText();
|
||||
|
||||
private:
|
||||
StringID string;
|
||||
|
||||
@@ -98,7 +98,7 @@ typedef uint8 IndustryType; ///< The ID of an industry-type.
|
||||
typedef OverflowSafeInt64 Money; ///< Money, stored in a 32bit/64bit safe way. For scripts money is always in pounds.
|
||||
typedef uint16 SignID; ///< The ID of a sign.
|
||||
typedef uint16 StationID; ///< The ID of a station.
|
||||
typedef uint16 StringID; ///< The ID of a string.
|
||||
typedef uint32 StringID; ///< The ID of a string.
|
||||
typedef uint16 SubsidyID; ///< The ID of a subsidy.
|
||||
typedef uint16 StoryPageID; ///< The ID of a story page.
|
||||
typedef uint16 StoryPageElementID; ///< The ID of a story page element.
|
||||
|
||||
@@ -949,10 +949,8 @@ public:
|
||||
WID_RV_STOP_REPLACE = ::WID_RV_STOP_REPLACE, ///< Stop Replacing button.
|
||||
|
||||
/* Train only widgets. */
|
||||
WID_RV_TRAIN_ENGINEWAGON_TOGGLE = ::WID_RV_TRAIN_ENGINEWAGON_TOGGLE, ///< Button to toggle engines and/or wagons.
|
||||
WID_RV_TRAIN_FLUFF_LEFT = ::WID_RV_TRAIN_FLUFF_LEFT, ///< The fluff on the left.
|
||||
WID_RV_TRAIN_ENGINEWAGON_DROPDOWN = ::WID_RV_TRAIN_ENGINEWAGON_DROPDOWN, ///< Dropdown to select engines and/or wagons.
|
||||
WID_RV_TRAIN_RAILTYPE_DROPDOWN = ::WID_RV_TRAIN_RAILTYPE_DROPDOWN, ///< Dropdown menu about the railtype.
|
||||
WID_RV_TRAIN_FLUFF_RIGHT = ::WID_RV_TRAIN_FLUFF_RIGHT, ///< The fluff on the right.
|
||||
WID_RV_TRAIN_WAGONREMOVE_TOGGLE = ::WID_RV_TRAIN_WAGONREMOVE_TOGGLE, ///< Button to toggle removing wagons.
|
||||
};
|
||||
|
||||
@@ -1506,8 +1504,10 @@ public:
|
||||
WID_SGI_ARCTIC_LANDSCAPE = ::WID_SGI_ARCTIC_LANDSCAPE, ///< Select arctic landscape button.
|
||||
WID_SGI_TROPIC_LANDSCAPE = ::WID_SGI_TROPIC_LANDSCAPE, ///< Select tropic landscape button.
|
||||
WID_SGI_TOYLAND_LANDSCAPE = ::WID_SGI_TOYLAND_LANDSCAPE, ///< Select toyland landscape button.
|
||||
WID_SGI_BASESET_SELECTION = ::WID_SGI_BASESET_SELECTION, ///< Baseset selection.
|
||||
WID_SGI_BASESET = ::WID_SGI_BASESET, ///< Baseset errors.
|
||||
WID_SGI_TRANSLATION_SELECTION = ::WID_SGI_TRANSLATION_SELECTION, ///< Translation selection.
|
||||
WID_SGI_TRANSLATION = ::WID_SGI_TRANSLATION, ///< Translation.
|
||||
WID_SGI_TRANSLATION = ::WID_SGI_TRANSLATION, ///< Translation errors.
|
||||
WID_SGI_OPTIONS = ::WID_SGI_OPTIONS, ///< Options button.
|
||||
WID_SGI_HIGHSCORE = ::WID_SGI_HIGHSCORE, ///< Highscore button.
|
||||
WID_SGI_SETTINGS_OPTIONS = ::WID_SGI_SETTINGS_OPTIONS, ///< Settings button.
|
||||
@@ -2393,6 +2393,7 @@ public:
|
||||
WID_TN_AIRCRAFTS = ::WID_TN_AIRCRAFTS, ///< Aircraft menu.
|
||||
WID_TN_ZOOM_IN = ::WID_TN_ZOOM_IN, ///< Zoom in the main viewport.
|
||||
WID_TN_ZOOM_OUT = ::WID_TN_ZOOM_OUT, ///< Zoom out the main viewport.
|
||||
WID_TN_BUILDING_TOOLS_START = ::WID_TN_BUILDING_TOOLS_START, ///< Helper for the offset of the building tools
|
||||
WID_TN_RAILS = ::WID_TN_RAILS, ///< Rail building menu.
|
||||
WID_TN_ROADS = ::WID_TN_ROADS, ///< Road building menu.
|
||||
WID_TN_WATER = ::WID_TN_WATER, ///< Water building toolbar.
|
||||
|
||||
@@ -81,7 +81,6 @@ function reset_reader()
|
||||
struct_size = 0
|
||||
method_size = 0
|
||||
static_method_size = 0
|
||||
virtual_class = "false"
|
||||
cls = ""
|
||||
start_squirrel_define_on_next_line = "false"
|
||||
cls_level = 0
|
||||
@@ -97,7 +96,6 @@ BEGIN {
|
||||
struct_size = 0
|
||||
method_size = 0
|
||||
static_method_size = 0
|
||||
virtual_class = "false"
|
||||
super_cls = ""
|
||||
cls = ""
|
||||
api_selected = ""
|
||||
@@ -340,7 +338,7 @@ BEGIN {
|
||||
} else {
|
||||
print " SQ" api_cls ".PreRegister(engine, \"" api_super_cls "\");"
|
||||
}
|
||||
if (virtual_class == "false" && super_cls != "ScriptEvent") {
|
||||
if (super_cls != "ScriptEvent") {
|
||||
if (cls_param[2] == "v") {
|
||||
print " SQ" api_cls ".AddSQAdvancedConstructor(engine);"
|
||||
} else {
|
||||
@@ -409,22 +407,21 @@ BEGIN {
|
||||
}
|
||||
if (static_method_size != 0) print ""
|
||||
|
||||
if (virtual_class == "false") {
|
||||
# Non-static methods
|
||||
mlen = 0
|
||||
for (i = 1; i <= method_size; i++) {
|
||||
if (mlen <= length(methods[i, 0])) mlen = length(methods[i, 0])
|
||||
}
|
||||
for (i = 1; i <= method_size; i++) {
|
||||
if (methods[i, 2] == "v") {
|
||||
print " SQ" api_cls ".DefSQAdvancedMethod(engine, &" cls "::" methods[i, 0] ", " substr(spaces, 1, mlen - length(methods[i, 0]) - 8) "\"" methods[i, 0] "\");"
|
||||
} else {
|
||||
print " SQ" api_cls ".DefSQMethod(engine, &" cls "::" methods[i, 0] ", " substr(spaces, 1, mlen - length(methods[i, 0])) "\"" methods[i, 0] "\", " substr(spaces, 1, mlen - length(methods[i, 0])) "" methods[i, 1] ", \"" methods[i, 2] "\");"
|
||||
}
|
||||
delete methods[i]
|
||||
}
|
||||
if (method_size != 0) print ""
|
||||
# Non-static methods
|
||||
mlen = 0
|
||||
for (i = 1; i <= method_size; i++) {
|
||||
if (mlen <= length(methods[i, 0])) mlen = length(methods[i, 0])
|
||||
}
|
||||
for (i = 1; i <= method_size; i++) {
|
||||
if (methods[i, 2] == "v") {
|
||||
print " SQ" api_cls ".DefSQAdvancedMethod(engine, &" cls "::" methods[i, 0] ", " substr(spaces, 1, mlen - length(methods[i, 0]) - 8) "\"" methods[i, 0] "\");"
|
||||
} else {
|
||||
print " SQ" api_cls ".DefSQMethod(engine, &" cls "::" methods[i, 0] ", " substr(spaces, 1, mlen - length(methods[i, 0])) "\"" methods[i, 0] "\", " substr(spaces, 1, mlen - length(methods[i, 0])) "" methods[i, 1] ", \"" methods[i, 2] "\");"
|
||||
}
|
||||
delete methods[i]
|
||||
}
|
||||
if (method_size != 0) print ""
|
||||
|
||||
print " SQ" api_cls ".PostRegister(engine);"
|
||||
print "}"
|
||||
|
||||
@@ -489,9 +486,6 @@ BEGIN {
|
||||
}
|
||||
|
||||
is_static = match($0, "static")
|
||||
if (match($0, "virtual")) {
|
||||
virtual_class = "true"
|
||||
}
|
||||
gsub("\\yvirtual\\y", "", $0)
|
||||
gsub("\\ystatic\\y", "", $0)
|
||||
gsub("\\yconst\\y", "", $0)
|
||||
|
||||
Reference in New Issue
Block a user