Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
Dunbaratu committed Mar 8, 2016
2 parents ebeac99 + be2e3f8 commit 0d621af
Show file tree
Hide file tree
Showing 16 changed files with 122 additions and 73 deletions.
30 changes: 30 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,36 @@
kOS Mod Changelog
=================

# v0.19.2

This release is here primarily to fix a problem that made
the new v0.19.1 terminal unusable for users who have to
use low resolution texture settings in the Unity graphics
configuration panel.

### BREAKING
* Nothing new breaking in this version is known about.

### NEW FEATURES
* New alias KUNIVERSE:FORCEACTIVE() can be used instead of the longer name KUNIVERSE:FORCESETACTIVEVESSEL().
* More robust use of the font_sml.png file allows for replacement of font_sml.png by the end-user.
(However this may only be useful for a limited time, as Unity5 might make us implement the font differently
anyway.)

### BUG FIXES
* New terminal now works again at low texture resolution settings
(https://github.com/KSP-KOS/KOS/issues/1513).
* New terminal shows grey color on power-off again
(https://github.com/KSP-KOS/KOS/issues/1525).
* Terminal now shows a boot message that mentions the documentation URL
(https://github.com/KSP-KOS/KOS/issues/1527).
* Fixed a situation that could make KSP itself crash if a script
attempted to perform an equality comparison on types that hadn't
had a meaningful implementation of equality defined. (Instead
of a proper error message about it from kOS, kOS got stuck in
recursion.)


# v0.19.1

This release is a patch to v0.19.0, fixing some things
Expand Down
2 changes: 1 addition & 1 deletion Resources/GameData/kOS/kOS.version
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"VERSION": {
"MAJOR": 0,
"MINOR": 19,
"PATCH": 1
"PATCH": 2
},
"KSP_VERSION": {
"MAJOR": 1,
Expand Down
11 changes: 11 additions & 0 deletions doc/source/changes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,17 @@ release.

****

Changes in 0.19.2
-----------------

This was mostly a bug fix release. Not much changed in the documentation.

FORCEACTIVE
:::::::::::

New alias ``KUNIVERSE:FORCEACTIVE()`` can be used instead of the
longer name ``KUNIVERSE:FORCESETACTIVEVESSEL()``.

Changes in 0.19.1
-----------------

Expand Down
4 changes: 2 additions & 2 deletions doc/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@
# built documents.
#
# The short X.Y version.
version = '0.19.1'
version = '0.19.2'
# The full version, including alpha/beta/rc tags.
release = '0.19.1'
release = '0.19.2'

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down
35 changes: 23 additions & 12 deletions doc/source/structures/misc/kuniverse.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ KUniverse 4th wall methods

:struct:`KUniverse` is a special structure that allows your Kerboscript programs to access some of the functions that break the "4th Wall". It serves as a place to access object directly connected to the KSP game itself, rather than the interaction with the KSP world (vessels, planets, orbits, etc.).

.. list-table:: Members and Methods
.. list-table::
:header-rows: 1
:widths: 3 1 1 4

Expand All @@ -29,15 +29,15 @@ KUniverse 4th wall methods
- :ref:`boolean <boolean>`
- Get
- Is revert to editor possible?
* - :attr:`REVERTTOLAUNCH`
* - :meth:`REVERTTOLAUNCH`
- none
- Method
- Invoke revert to launch
* - :attr:`REVERTTOEDITOR`
* - :meth:`REVERTTOEDITOR`
- none
- Method
- Invoke revert to editor
* - :attr:`REVERTTO(name)`
* - :meth:`REVERTTO(name)`
- :ref:`string <string>`
- Method
- Invoke revert to the named editor
Expand All @@ -49,22 +49,26 @@ KUniverse 4th wall methods
- :ref:`scalar <scalar>`
- Get
- Number of hours per day (6 or 24) according to your game settings.
* - :attr:`DEBUGLOG(message)`
* - :meth:`DEBUGLOG(message)`
- none
- Method
- Causes a :ref:`string <string>` to append to the Unity debug log file.
* - :attr:`DEFAULTLOADDISTANCE`
- :struct:`LoadDistance`
- Get
- Returns the set of default load and pack distances for the game.
* - :attr:`ACTIVEVESEL`
* - :attr:`ACTIVEVESSEL`
- :struct:`Vessel`
- Get/Set
- Returns the active vessel, or lets you set the active vessel.
* - :attr:`FORCEACTIVE(vessel)`
* - :meth:`FORCESETACTIVEVESSEL(vessel)`
- n/a
- Set
- Method
- Lets you switch active vessels even when the game refuses to allow it.
* - :meth:`FORCEACTIVE(vessel)`
- n/a
- Method
- Same as :meth:`FORCESETACTIVEVESSEL`


.. attribute:: KUniverse:CANREVERT
Expand All @@ -90,14 +94,14 @@ KUniverse 4th wall methods
to be false after reloading from a saved game where the vessel was
already in existence in the saved file when you loaded the game.

.. attribute:: KUniverse:REVERTTOLAUNCH
.. method:: KUniverse:REVERTTOLAUNCH()

:access: Method
:type: None.

Initiate the KSP game's revert to launch function. All progress so far will be lost, and the vessel will be returned to the launch pad or runway at the time it was initially launched.

.. attribute:: KUniverse:REVERTTOEDITOR
.. method:: KUniverse:REVERTTOEDITOR()

:access: Method
:type: None.
Expand Down Expand Up @@ -146,13 +150,20 @@ KUniverse 4th wall methods

Returns the active vessel object and allows you to set the active vessel. Note: KSP will not allow you to change vessels by default when the current active vessel is in the atmosphere or under acceleration. Use :meth:`FORCEACTIVE` under those circumstances.

.. method:: KUniverse:FORCEACTIVE(vessel)
.. method:: KUniverse:FORCESETACTIVEVESSEL(vessel)

:parameter vessel: :struct:`Vessel` to switch to.
:return: none

Force KSP to change the active vessel to the one specified. Note: Switching the active vessel under conditions that KSP normally disallows may cause unexpected results on the initial vessel. It is possible that the vessel will be treated as if it is re-entering the atmosphere and deleted.

.. method:: KUniverse:FORCEACTIVE(vessel)

:parameter vessel: :struct:`Vessel` to switch to.
:return: none

Same as :meth:`FORCESETACTIVEVESSEL`.

.. attribute:: KUniverse:HOURSPERDAY

:access: Get
Expand Down Expand Up @@ -225,7 +236,7 @@ KUniverse 4th wall methods

- Windows 32-bit: [install_dir]\KSP_Data\output_log.txt
- Windows 64-bit: [install_dir]\KSP_x64_Data\output_log.txt (not officially supported)
- Mac OS X: ~/Library/Logs/Unity/Player.log
- Mac OS X: ~/Library/Logs/Unity/Player.log
- Linux: ~/.config/unity3d/Squad/"Kerbal Space Program"/Player.log

For an example of what it looks like in the log, this::
Expand Down
4 changes: 2 additions & 2 deletions src/kOS.Safe.Test/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.19.1.0")]
[assembly: AssemblyFileVersion("1.19.1.0")]
[assembly: AssemblyVersion("1.19.2.0")]
[assembly: AssemblyFileVersion("1.19.2.0")]
8 changes: 8 additions & 0 deletions src/kOS.Safe/Compilation/CalculatorStructure.cs
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,14 @@ private bool TryCoerceImplicit(OperandPair pair, out OperandPair resultPair)
bool couldCoerce = false;
object newLeft;
object newRight;
if (pair.LeftType == pair.RightType)
{
resultPair = null;
// Since the types are already the same, we can't coerce them to be the same.
// Otherwise, some types will act as if they have been coerced because of
// other implict conversions.
return false;
}
MethodInfo convert2 = pair.LeftType.GetMethod("op_Implicit", FLAGS | BindingFlags.ExactBinding, null, new[] { pair.RightType }, null);
if (convert2 != null)
{
Expand Down
51 changes: 15 additions & 36 deletions src/kOS.Safe/Compilation/KS/Compiler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1192,9 +1192,13 @@ private void VisitNode(ParseNode node)
case TokenType.varidentifier:
VisitVarIdentifier(node);
break;
case TokenType.suffixterm: // TODO: If the exception in VisitSuffixTerm never gets
VisitSuffixTerm(node); // thrown during our testing, we can then safely remove
break; // this clause from the switch.
// This never gets called anymore, but it's left here as
// a comment so future programmers who search for it will
// find this comment and realized that it's not an error
// for it to be missing. It's missing-ness is deliberate:
// case TokenType.suffixterm:
// VisitSuffixTerm(node);
// break;
case TokenType.IDENTIFIER:
VisitIdentifier(node);
break;
Expand Down Expand Up @@ -1846,40 +1850,15 @@ private string GetIdentifierText(ParseNode node)

return string.Empty;
}


private void VisitSuffixTerm(ParseNode node)
{
// TODO: DELETE THIS METHOD BEFORE RELEASE OF 0.19.0
//
// NOTE: I suspect this method never ever gets called anymore,
// having been superceeded by the work in VisitSuffix() quite a few
// months ago. But with the tree walk of the compiler and its frequent
// use of the open-ended VisitNode(), it's quite hard to prove by
// eyeball that this is never called.
//
// Therefore I added this exception to complain loudly if any test
// program happens to make the compiler walk a path that uses this
// method.

throw new KOSCompileException(node.Token,
"TESTING TESTING TESTING. TELL @dunbaratu IMMEDIATELY IF YOU SEE THIS ERROR. " +
"THIS MESSAGE IS A CHECK TO ENSURE THAT VisitSuffixTerm IS NEVER REALLY GETTING CALLED. " +
"IF NONE OF THE KOS DEVS EVER SEE THIS DURING OUR TESTS OF 0.19.0, THEN VisitSuffixTerm " +
"SHOULD BE DELETED BEFORE RELEASING 0.19.0" );
NodeStartHousekeeping(node);

if (node.Nodes.Count > 1 &&
node.Nodes[1].Token.Type == TokenType.function_trailer)
{
// if a bracket follows an identifier then its a function call
VisitActualFunction(node.Nodes[1], true, GetIdentifierText(node));
}
else
{
VisitNode(node.Nodes[0]); // I'm not really a function call after all - just a wrapper around another node type.
}
}
// The fact that there is no VisitSuffixTerm method is not an omission or mistake.
// All the logic of this node of the parse tree is now handled by the parent nodes
// that come above this one instead. I'm leaving this comment here so that future programmers
// searching this code don't attempt to fix this "mistake" by adding this method back in:
// private void VisitSuffixTerm(ParseNode node)
// {
// // nothing here anymore.
// }

private void VisitIdentifier(ParseNode node)
{
Expand Down
3 changes: 2 additions & 1 deletion src/kOS.Safe/Execution/CPU.cs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,8 @@ public void Boot()
if (shared.Screen != null)
{
shared.Screen.ClearScreen();
string bootMessage = string.Format("kOS Operating System\n" + "KerboScript v{0}\n \n" + "Proceed.\n", SafeHouse.Version);
string bootMessage = string.Format("kOS Operating System\n" + "KerboScript v{0}\n(manual at {1})\n \n" + "Proceed.\n",
SafeHouse.Version, SafeHouse.DocumentationURL);
List<string> nags = Debug.GetPendingNags();
if (nags.Count > 0)
{
Expand Down
4 changes: 2 additions & 2 deletions src/kOS.Safe/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.19.1.0")]
[assembly: AssemblyFileVersion("1.19.1.0")]
[assembly: AssemblyVersion("1.19.2.0")]
[assembly: AssemblyFileVersion("1.19.2.0")]
4 changes: 3 additions & 1 deletion src/kOS.Safe/Utilities/SafeHouse.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,15 @@ public static class SafeHouse
public static bool IsWindows { get; private set; }
public static string ArchiveFolder { get; private set; }
public static VersionInfo Version { get; private set; }
public static string DocumentationURL { get; private set; }

public static void Init(IConfig config, VersionInfo versionInfo, bool isWindows, string archiveFolder)
public static void Init(IConfig config, VersionInfo versionInfo, string docURL, bool isWindows, string archiveFolder)
{
Config = config;
IsWindows = isWindows;
ArchiveFolder = archiveFolder;
Version = versionInfo;
DocumentationURL = docURL;
}

public static ILogger Logger { get; set; }
Expand Down
1 change: 1 addition & 0 deletions src/kOS/Module/Bootstrapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ private void BuildEnvironment()
SafeHouse.Init(
Config.Instance,
Core.VersionInfo,
"http://ksp-kos.github.io/KOS_DOC/",
Application.platform == RuntimePlatform.WindowsPlayer,
GameDatabase.Instance.PluginDataFolder + "/Ships/Script/"
);
Expand Down
4 changes: 2 additions & 2 deletions src/kOS/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,6 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyFileVersion("0.19.1.0")]
[assembly: AssemblyVersion("0.19.1.0")]
[assembly: AssemblyFileVersion("0.19.2.0")]
[assembly: AssemblyVersion("0.19.2.0")]
[assembly: KSPAssembly("kOS", 0, 19)]
1 change: 1 addition & 0 deletions src/kOS/Screen/KOSToolBarWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -413,6 +413,7 @@ public void DrawWindow(int windowID)
// Unity doesn't do hovering tooltips and you have to specify a zone for them to appear like this:
string whichMessage = (GUI.tooltip.Length > 0 ? GUI.tooltip : TelnetStatusMessage()); // when tooltip isn't showing, show telnet status instead.
GUILayout.Label(whichMessage, tooltipLabelStyle);

CountEndVertical();

EndHoverHousekeeping();
Expand Down
Loading

0 comments on commit 0d621af

Please sign in to comment.