1914 Offensive a Outrance

Anyone know how to remove the offending custom code? I tried but failed.

The error dialog should tell you what classes are the problem. What does it say?

It did, but I have no idea how to remove them. I tried editing the build file, but I must’ve messed something up as no images will tile.

Removed classes, methods, and fields in C:\personal\games\Offensive_a_outrance_v4.vmod
(used by => removed item, version when removed

net.cantab.hayward.george.OCS.MapOverride => VASSAL.build.module.PlayerRoster.addSideChangeListener(VASSAL.build.module.PlayerRoster$SideChangeListener), 3.6.0

Have you contacted the owner of the project about this problem?

Not yet. But it was over 7 years ago.

Maybe try that. If the project’s owner fixes the problem, then it will be fixed for everyone.

Information is hidden, so it doesn’t appear that I can.

Other threads about the same module are here:

Would you be more specific? Where are you seeing this?

This approach isn’t going to bear fruit. The user pdietrich–by his own admission at one point–modified an OCS module including all of George Hayward’s code without any underlying knowledge of the code itself or how to modify/support it going forward.

I’m guessing there’s a way to programmatically find all the references in a buildfile and strip them out, but at least viewed in the Editor you can see evidence of custom code like these circled items (there are likely many, many more). Anything you can double click and not see any properties or config. The map windows themselves seem to be custom as well, their configs don’t look like what’s standard.

Someone needs to rebuild this module if it’s ever going to work with the current version of Vassal…

1 Like

Some CSW conversations that included comments from pdietrich:

June 2022
December 2022

Actually, all hope is not lost.

First off, if you unpack the module, you will see that the Java sources custom modules is in the sub-directory source (kudo’s to @pdietrich2 for providing the sources). You can ignore the sub-directory source/com as that code isn’t used in the module (in fact, you should probably remove that sub-directory).

Secondly, the file source/net/cantab/hayward/george/OCS/edits.required shows you the translation from standard Vassal elements to the custom elements. The file contains sed regular expression substitutions, and the script source/net/cantab/hayward/george/OCS/exec.edits shows you have these are executed. If you reverse these regular expressions - e.g.,

s/VASSAL.build.module.BasicCommandEncoder/net.cantab.hayward.george.OCS.BasicCommandEncoderOverride/g

to

s/net.cantab.hayward.george.OCS.BasicCommandEncoderOverride/VASSAL.build.module.BasicCommandEncoder/g

and then execute source/net/cantab/hayward/george/OCS/exec.edits then that will revert the module to the standard Vassal elements.

Of course, that will mean a loss of functionality in the module.

So, a better way is to fix the custom code and recompile it (see also Simple Workflow). Assuming you have installed VASSAL in /opt/vassal/current (on Linux), do

cd source
javac -cp /opt/vassal/current/lib/Vengine.jar  --release 11 `find net -name "*,java"` 

and when that compiles cleanly, copy the generated .class files (with directory structure) to the root of the unpacked archive

tar -cf - `find . -name "*.class"` | tar -xf - -C ..

Of course, any errors in the custom code need to be fixed first:

net/cantab/hayward/george/OCS/RegionOverride.java:255: error: cannot find symbol
    Labeler.drawLabel(g, getLocalizedConfigureName(), posX, posY + labelOffset, f, Labeler.CENTER,
                                                                                          ^
  symbol:   variable CENTER
  location: class Labeler
net/cantab/hayward/george/OCS/RegionOverride.java:256: error: cannot find symbol
                      Labeler.TOP, fg, bg, fg);
                             ^
  symbol:   variable TOP
  location: class Labeler
net/cantab/hayward/george/OCS/RegionOverride.java:255: warning: [removal] drawLabel(Graphics,String,int,int,Font,int,int,Color,Color,Color) in Labeler has been deprecated and marked for removal
    Labeler.drawLabel(g, getLocalizedConfigureName(), posX, posY + labelOffset, f, Labeler.CENTER,
           ^
net/cantab/hayward/george/OCS/MapOverride.java:176: warning: [removal] mapCoordinates(Point) in Map has been deprecated and marked for removal
                    Point p = mapCoordinates(activeViewport.getRealViewPosition());
                              ^
net/cantab/hayward/george/OCS/MapOverride.java:192: warning: [removal] mapCoordinates(Point) in Map has been deprecated and marked for removal
                    Point p = mapCoordinates(activeViewport.getRealViewPosition());
                              ^
net/cantab/hayward/george/OCS/MapOverride.java:293: warning: [removal] mapCoordinates(Point) in Map has been deprecated and marked for removal
            Point p = mapCoordinates(e.getPoint());
                      ^
net/cantab/hayward/george/OCS/MapOverride.java:363: warning: [removal] componentCoordinates(Point) in Map has been deprecated and marked for removal
            p = componentCoordinates(p);
                ^
net/cantab/hayward/george/OCS/MapOverride.java:992: warning: [removal] launchButton in Map has been deprecated and marked for removal
        GameModule.getGameModule().getToolBar().add(launchButton);
                                                    ^
net/cantab/hayward/george/OCS/MapOverride.java:995: error: cannot find symbol
                    new IntConfigurer(MAIN_WINDOW_HEIGHT, null, new Integer(-1));
                                      ^
  symbol:   variable MAIN_WINDOW_HEIGHT
  location: class MapOverride
net/cantab/hayward/george/OCS/MapOverride.java:997: warning: [removal] ComponentSplitter in VASSAL.tools has been deprecated and marked for removal
            final ComponentSplitter splitter = new ComponentSplitter();
                  ^
net/cantab/hayward/george/OCS/MapOverride.java:997: warning: [removal] ComponentSplitter in VASSAL.tools has been deprecated and marked for removal
            final ComponentSplitter splitter = new ComponentSplitter();
                                                   ^
net/cantab/hayward/george/OCS/MapOverride.java:1006: warning: [removal] mainWindowDock in Map has been deprecated and marked for removal
            mainWindowDock = splitter.splitBottom(
            ^
net/cantab/hayward/george/OCS/MapOverride.java:1032: error: cannot find symbol
        PlayerRoster.addSideChangeListener(this);
                    ^
  symbol:   method addSideChangeListener(MapOverride)
  location: class PlayerRoster
net/cantab/hayward/george/OCS/Parsing/ScenarioBuilder.java:53: warning: [removal] isMacOSX() in Info has been deprecated and marked for removal
        return Info.isMacOSX() ? new MacOSXMenuManager() : new MyMenuManager();
                   ^
net/cantab/hayward/george/OCS/Parsing/ScenarioBuilder.java:59: error: no suitable constructor found for ArchiveWriter(ZipFile)
        final ArchiveWriter archive = new ArchiveWriter(new ZipFile(
                                      ^
    constructor ArchiveWriter.ArchiveWriter(String) is not applicable
      (argument mismatch; ZipFile cannot be converted to String)
    constructor ArchiveWriter.ArchiveWriter(FileArchive) is not applicable
      (argument mismatch; ZipFile cannot be converted to FileArchive)
net/cantab/hayward/george/OCS/Parsing/ScenarioBuilder.java:61: warning: [removal] BasicModule in VASSAL.launch has been deprecated and marked for removal
        GameModule.init(new BasicModule(archive));
                            ^
net/cantab/hayward/george/OCS/Parsing/ScenarioBuilder.java:61: warning: [removal] BasicModule(DataArchive) in BasicModule has been deprecated and marked for removal
        GameModule.init(new BasicModule(archive));
                        ^
net/cantab/hayward/george/OCS/DragHandlerReplace.java:273: warning: [removal] makeDragCursor(double) in DragHandlerNoImage has been deprecated and marked for removal
        protected void makeDragCursor(double zoom) {
                       ^
net/cantab/hayward/george/OCS/DragHandlerReplace.java:274: warning: [removal] makeDragCursor(double) in DragHandlerNoImage has been deprecated and marked for removal
            super.makeDragCursor(zoom);
                 ^
net/cantab/hayward/george/OCS/DragHandlerReplace.java:308: warning: [removal] mapCoordinates(Point) in Map has been deprecated and marked for removal
                    updateRange(baseMap.mapCoordinates(p));
                                       ^
net/cantab/hayward/george/OCS/HexGridNumberingOverride.java:155: error: cannot find symbol
    int alignment = Labeler.TOP;
                           ^
  symbol:   variable TOP
  location: class Labeler
net/cantab/hayward/george/OCS/HexGridNumberingOverride.java:158: error: cannot find symbol
      alignment = Labeler.CENTER;
                         ^
  symbol:   variable CENTER
  location: class Labeler
net/cantab/hayward/george/OCS/HexGridNumberingOverride.java:189: error: cannot find symbol
                          Labeler.CENTER,
                                 ^
  symbol:   variable CENTER
  location: class Labeler
net/cantab/hayward/george/OCS/HexGridNumberingOverride.java:185: warning: [removal] drawLabel(Graphics,String,int,int,Font,int,int,Color,Color,Color) in Labeler has been deprecated and marked for removal
        Labeler.drawLabel(g2d, getName(getRow(gridp), getColumn(gridp)),
               ^
net/cantab/hayward/george/OCS/HexGridNumberingOverride.java:207: error: cannot find symbol
                          Labeler.CENTER,
                                 ^
  symbol:   variable CENTER
  location: class Labeler
net/cantab/hayward/george/OCS/HexGridNumberingOverride.java:203: warning: [removal] drawLabel(Graphics,String,int,int,Font,int,int,Color,Color,Color) in Labeler has been deprecated and marked for removal
        Labeler.drawLabel(g2d, getName(getRow(gridp), getColumn(gridp)),
               ^
net/cantab/hayward/george/OCS/HexGridNumberingOverride.java:331: error: getRawRow(Point) in HexGridNumberingOverride cannot override getRawRow(Point) in HexGridNumbering
  protected int getRawRow(Point p) {
                ^
  attempting to assign weaker access privileges; was public
net/cantab/hayward/george/OCS/HexGridNumberingOverride.java:382: warning: [removal] Logger in VASSAL.tools.logging has been deprecated and marked for removal
              Logger.log(e1);
              ^
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output
10 errors
18 warnings

Most of these seem relatively simple to fix, e.g., Labeler.CENTER is now 'c', and PlayerRoster.addSideChangeListener seems now to be PlayerRoster.getInstance().addSideChangeListenerToInstance. Other issues may take a bit more thought. Note, warnings can be ignored for now, although deprecation warnings will be needed to be addressed for the module to work with future Vassal releases.

Yours,
Christian