Feature Monorail breakfast counter spoiler text

fredg1

Member
Made a patch that adds spoiler text to the breakfast counter (the one with the muffins).

Was not so straightforward, since the choice-value assignment on that encounter is dynamic...

In addition, I made a new property, "_muffinOrderedToday", which, as the name says, tells if you ordered (as in told them which muffin you'll want tomorrow).
This is useful to distinguish whether the value of "muffinOnOrder" is the muffin from yesterday or not.

IN ADDITION, I made it so that, when ascending, "muffinOnOrder" becomes "earthenware muffin tin".


In aDdItIoN, I noticed two properties in default.txt that were separated by 4 spaces rather than a tab. Took care of that.
 

fronobulax

Developer
D:\KoLmafia\src\net\sourceforge\kolmafia\RequestEditorKit.java:2162:
error: cannot find symbol
[javac] if ( !spoilerBuffer.isEmpty() )

You may fix or we can start conversations about the difference in environments, build procedures and KoLmafia versioning.

ProTip - I trust people to have done a clean local compile on their systems before they submit a patch. If you think you did then let's have the conversation about environments anyway ;-)

Edit: I reverted the patch and get different errors so this might not be on you. Stand by since I have an appointment in 10 minutes and don't expect to resolve this first.

Edit again: My revert left the Monorail Manager file behind which surprised me but was the obvious source of the errors. Back to you.
 
Last edited:

fredg1

Member
I'm open to hearing about those changes, since I can't seem to find what causes this issue. Doesn't seem to be a missing import...
 

fredg1

Member
No, I got the issue, too. I forgot to make a build (such a coincidence; it was the first time I managed to run mafia straight from my IDE without having to compile) 😓
 

fredg1

Member
My IDE seems to be saying that the function / symbol is accessible just fine, so if I could understand how the build process changed, I could help.
 

fronobulax

Developer
The build process changed by including jar files in src/jar in the class path when compiling and then packing them in the mafia jar.

The fact that it happens to you but not in the ide suggests a couple of things. Maybe the reference is not fully qualified? Maybe there are multiple definitions and the classpath order is picking them up in the wrong order? Maybe there really is a dreaded namespace collision?

I'm running

$ java -version
java version "13.0.2" 2020-01-14
Java(TM) SE Runtime Environment (build 13.0.2+8)
Java HotSpot(TM) 64-Bit Server VM (build 13.0.2+8, mixed mode, sharing)

Working on it now so might have something "soon".
 

MCroft

Developer
Fresh pull into a new directory, patch, ant daily fails.

So, stringBuffer doesn't have an isEmpty() property. it has length == 0. Maybe you have a stringBuffer from somewhere else, like commons? idk. But also, unless you need the string to be thread safe, why not use stringBuilder? You'll still need something like ==null || length = 0 or StringBuffer.toString().isEmpty() regardless.

Bash:
Michaels-MBProjects mcroft$ mkdir KM-clean
Michaels-MBProjects mcroft$ cd KM-clean/
Michaels-MBP:KM-clean mcroft$ svn co --username=madcarew svn+ssh://madcarew@svn.code.sf.net/p/kolmafia/code/ .
...
Checked out revision 20514.
Michaels-MBP:KM-clean mcroft$ svn patch ~/Downloads/monorail.patch .
U         src/data/defaults.txt
U         src/net/sourceforge/kolmafia/RequestEditorKit.java
U         src/net/sourceforge/kolmafia/session/ChoiceManager.java
A         src/net/sourceforge/kolmafia/session/MonorailManager.java
U         src/net/sourceforge/kolmafia/session/ValhallaManager.java
U         src/net/sourceforge/kolmafia/utilities/ChoiceUtilities.java
Michaels-MBP:KM-clean mcroft$ ant daily
Buildfile: /Users/mcroft/projects/KM-clean/build.xml
...

compile:
    [javac] Compiling 1579 source files to /Users/mcroft/projects/KM-clean/build
    [javac] ...
     [copy] Copying 150 files to /Users/mcroft/projects/KM-clean/build
     [copy] Copied 16 empty directories to 7 empty directories under /Users/mcroft/projects/KM-clean/build

svn-version:

gitsvn-version:

version:
     [echo] Current revision: 20514M

set.version:
    [javac] Compiling 966 source files to /Users/mcroft/projects/KM-clean/build
    [javac] Ignoring source, target and bootclasspath as release has been set
    [javac] /Users/mcroft/projects/KM-clean/src/net/sourceforge/kolmafia/RequestEditorKit.java:2162: error: cannot find symbol
    [javac]                 if ( !spoilerBuffer.isEmpty() )
    [javac]                                    ^
    [javac]   symbol:   method isEmpty()
 
Last edited:

fronobulax

Developer
StringBuffer isEmpty() doesn't actually seem to exist. See https://docs.oracle.com/en/java/javase/14/docs/api/java.base/java/lang/StringBuffer.html

This used to happen to me when I was working in an environment that used a lot of Apache Java libraries some of which used the same class name. Maybe something in your IDE is finding isEmpty() from something KoLmafia isn't otherwise using?

I step this forward by checking on length and continue the review.
 

fredg1

Member
My IDE is pulling that method out of java.lang.CharSequence. Maybe it mistakenly thinks stringBuffers are part of CharSequence? (though I... thought they were?)
 

Veracity

Developer
StringBuffer implements CharSequence.
So does StringBuilder, about which:

"A mutable sequence of characters. This class provides an API compatible with StringBuffer, but with no guarantee of synchronization. This class is designed for use as a drop-in replacement for StringBuffer in places where the string buffer was being used by a single thread (as is generally the case). Where possible, it is recommended that this class be used in preference to StringBuffer as it will be faster under most implementations."

Why not fix that?
 

MCroft

Developer
My IDE is pulling that method out of java.lang.CharSequence. Maybe it mistakenly thinks stringBuffers are part of CharSequence? (though I... thought they were?)

stringBuffer implements CharSequence. No Oracle java from 1.4-14 has that method on either. Do you have a funky java derivative installed that it's finding?
 

MCroft

Developer
CharSequence.isEmpty was introduced in JDK 15.
Well, at least I documented that I wasn't looking that far ahead. :/

In IntelliJ, we can set the project language level so that we have java 15 but it knows not to use java 15 features. You might want to check how to do that for vscode.
 

fronobulax

Developer
[16708] Train to Downtown
Encounter: On a Downtown Train
Unknown text Factory District Stop (2 Adventures)
Unknown text Just ride the rails (9 Adventures)
Unknown text Visit the Breakfast Counter
Unknown text Nevermind
Encounter: On a Downtown Train
Recognized text Back to the Platform!. Associated 1 null
Encounter: On a Downtown Train
Unknown text Factory District Stop (2 Adventures)
Unknown text Just ride the rails (9 Adventures)
Unknown text Visit the Breakfast Counter
Unknown text Nevermind

Is the Unknown text from you? If so, why? Not necessarily helpful for a regular user IMO. Character does not have a muffin tin or outstanding order in case that is not something you planned for.
 
Top