Revision: 9238
http://sourceforge.net/p/vassalengine/svn/9238
Author: uckelman
Date: 2016-11-07 17:22:52 +0000 (Mon, 07 Nov 2016)
Log Message:
-----------
Merged Brent-3.2-Work@9230.
Fixed Bug 12533: Game Refresher fails if Extensions are loaded.
Modified Paths:
--------------
VASSAL-src/trunk/src/VASSAL/build/GpIdChecker.java
Modified: VASSAL-src/trunk/src/VASSAL/build/GpIdChecker.java
===================================================================
--- VASSAL-src/trunk/src/VASSAL/build/GpIdChecker.java 2016-11-07 17:21:40 UTC (rev 9237)
+++ VASSAL-src/trunk/src/VASSAL/build/GpIdChecker.java 2016-11-07 17:22:52 UTC (rev 9238)
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011-2013 by Brent Easton
+ * Copyright (c) 2011-2016 by Brent Easton
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@@ -39,6 +39,7 @@
protected GpIdSupport gpIdSupport;
protected int maxId;
protected boolean useName = false;
+ protected boolean extensionsLoaded = false;
final HashMap<String, SlotElement> goodSlots = new HashMap<String, SlotElement>();
final ArrayList<SlotElement> errorSlots = new ArrayList<SlotElement>();
@@ -51,9 +52,11 @@
maxId = -1;
}
+ // This constructor is used by the GameRefresher to refresh a game with extensions possibly loaded
public GpIdChecker(boolean useName) {
this();
this.useName = useName;
+ this.extensionsLoaded = true;
}
/**
@@ -105,10 +108,16 @@
protected void testGpId(String id, SlotElement element) {
/*
* If this has been called from a ModuleExtension, the GpId is prefixed with
- * the Extension Id. Remove the Extension Id and just process the numerid part.
+ * the Extension Id. Remove the Extension Id and just process the numeric part.
+ *
+ * NOTE: If GpIdChecker is being used by the GameRefesher, then there may be
+ * extensions loaded, so retain the extension prefix to ensure a correct
+ * unique slot id check.
*/
- if (id.contains(":")) {
- id = id.split(":")[1];
+ if (! extensionsLoaded) {
+ if (id.contains(":")) {
+ id = id.split(":")[1];
+ }
}
if (id == null || id.length() == 0) { // gpid not generated yet?
@@ -119,11 +128,17 @@
errorSlots.add(element);
}
try {
- final int iid = Integer.parseInt(id);
- goodSlots.put(id, element); // gpid is good.
- if (iid >= maxId) {
- maxId = iid+1;
+ if (extensionsLoaded) {
+ goodSlots.put(id, element);
+ System.out.println("Add Id "+id);
}
+ else {
+ final int iid = Integer.parseInt(id);
+ goodSlots.put(id, element); // gpid is good.
+ if (iid >= maxId) {
+ maxId = iid+1;
+ }
+ }
}
catch (Exception e) {
errorSlots.add(element); // non-numeric gpid?
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
------------------------------------------------------------------------------
Developer Access Program for Intel Xeon Phi Processors
Access to Intel Xeon Phi processor-based developer platforms.
With one year of Intel Parallel Studio XE.
Training and support from Colfax.
Order your platform today. http://sdm.link/xeonphi
_______________________________________________
vassalengine-svn mailing list
vas...@li...
https://lists.sourceforge.net/lists/listinfo/vassalengine-svn
|