I try read UnitDef param and look any mod specification. I using next code, but my Spring engine crash by Segmentation fault (version 94.1, 96.0) where I call function def.getCustomParams():
Code: Select all
public void showUnitDefInfoDebug(UnitDef unit){
sendTextMsg("Unit info: " + unit.getName()+" humanName: "+unit.getHumanName()+" techLevel: "+unit.getTechLevel()+" defID: "+unit.getUnitDefId(), MSG_DBG_SHORT);
sendTextMsg("Unit is: AbleToAssist " + unit.isAbleToAssist()+" AbleToMove "+unit.isAbleToMove()+" Assistable "+unit.isAssistable(), MSG_DBG_SHORT);
sendTextMsg("build: BuildDistance " + unit.getBuildDistance()+", BuildSpeed "+unit.getBuildSpeed()+"; moving speed="+unit.getSpeed(), MSG_DBG_SHORT);
for (Resource res:clb.getResources())
sendTextMsg("For resource "+res.getName()+" info: "+
" def.getResourceMake(r)" + unit.getResourceMake(res) +
" def.getMakesResource(r)" + unit.getMakesResource(res) +
" def.getExtractsResource(r): " + unit.getExtractsResource(res) +
" def.getTidalResourceGenerator(r): " + unit.getTidalResourceGenerator(res) +
" def.getWindResourceGenerator(r): " + unit.getWindResourceGenerator(res) +
" def.getResourceExtractorRange(r): " + unit.getResourceExtractorRange(res) +
" def.getUpkeep(r): " + unit.getUpkeep(res) +
" def.getCost(r): " + unit.getCost(res) +
" def.getStorage(r): " + unit.getStorage(res) +
"ResourceSumm(+map&mod specific)="+getUnitResoureProduct(unit, res) , MSG_DBG_ALL);
List<UnitDef> buildOptions = unit.getBuildOptions();
for (UnitDef unitDef : buildOptions) {
sendTextMsg(" build: " + unitDef.getName() + "\t" + unitDef.getHumanName() + "\t" + unitDef.toString() + "\t" + unitDef.hashCode(), MSG_DBG_ALL);
}
}
...
sendTextMsg("---- UnitDef list (ALL "+modSpecific.allUnitDefs.size()+") ----", FieldBOT.MSG_DBG_ALL);
for (UnitDef def:modSpecific.allUnitDefs) {
sendTextMsg("ID="+def.getUnitDefId()+" "+def.getName()+" ("+def.getHumanName()+") level "+def.getTechLevel()+" isBuilder="+def.isBuilder(), FieldBOT.MSG_DBG_ALL);
showUnitDefInfoDebug(def); // some other shows
sendTextMsg("",FieldBOT.MSG_DBG_ALL);
if (def.getCustomParams()!=null && !def.getCustomParams().isEmpty()) { // <====SEGMENTATION FAULED in Spring 96, 94.1
sendTextMsg(" CustomParams:", FieldBOT.MSG_DBG_ALL);
for (Map.Entry<String, String> params :def.getCustomParams().entrySet()) {
sendTextMsg(" K:"+params.getKey()+" V:"+params.getValue(), FieldBOT.MSG_DBG_ALL);
}
}
}
sendTextMsg("---- ----", FieldBOT.MSG_DBG_ALL);
...
Code: Select all
[f=0000001] Error: Segmentation fault (SIGSEGV) in spring 94.1 (ASIM GML OMP)
[f=0000001] Error: Stacktrace:
[f=0000001] Error: This stack trace indicates a problem with an AI Interface library.
[f=0000001] Error: <0> ??:?
[f=0000001] Error: <1> ??:?
[f=0000001] Error: <2> /lib/x86_64-linux-gnu/libpthread.so.0(+0x10340) [0x7fe13f8c0340]
[f=0000001] Error: <3> ??:?
[f=0000001] Error: <4> ??:?
[f=0000001] Error: <5> [0x7fe0d9011790]
[f=0000001] MetalMakers widget disabled for spectators
[f=0000001] Error: Releasing AI Interface Library from file "/home/user/.spring/engines/94.1/AI/Interfaces/Java/0.1/libAIInterface.so". The call to releaseStatic() returned unsuccessfuly.
[f=0000001] [CCollisionHandler] dis-/continuous tests: 0/106965
[f=0000001] Path cache hits 0 0%
Code: Select all
[f=0000000] Initializing PathCache
[f=0000000] Finalizing
[f=0000000] Loaded DecalsDrawer: Legacy
[f=0000000] Connection attempt from ME
[f=0000000] -> Version: 96.0
[f=0000000] -> Connection established (given id 0)
[f=0000000] Player ME finished loading and is now ingame
[f=0000000] GameID: 06eaab530e06a468d0615d981cdf4421
[f=0000000] Error: Segmentation fault (SIGSEGV) in spring 96.0
[f=0000000] Error: Stacktrace for Spring 96.0:
[f=0000000] Error: This stack trace indicates a problem with an AI Interface library.
[f=0000000] Error: <0> ??:?
[f=0000000] Error: <1> ??:?
[f=0000000] Error: <2> /lib/x86_64-linux-gnu/libpthread.so.0(+0x10340) [0x7fd590508340]
[f=0000000] Error: <3> ??:?
[f=0000000] Error: <4> ??:?
[f=0000000] Error: <5> [0x7fd521011790]
[f=0000000] Error: [ErrorMessageBox][1] msg="Spring has crashed:
Segmentation fault (SIGSEGV).
A stacktrace has been written to:
/home/user/.config/spring/infolog.txt" IsMainThread()=1 fromMain=0
[f=0000000] Error: [ErrorMessageBox][2]
[f=0000000] [SpringApp::ShutDown][1]
[f=0000000] [ThreadPool::SetThreadCount][1] #wanted=0 #current=3
[f=0000000] [ThreadPool::SetThreadCount][2] #threads=0
[f=0000000] [SpringApp::ShutDown][2]
[f=0000000] [~CGame][1]
[f=0000000] [~CGame][2]
[f=0000000] [~CGame][3]
[f=0000000] [~CGame][4]
[f=0000000] [~CGame][5]
[f=0000000] Team0 (PeaceBOT) has been decommissioned
[f=0000000] Team1 (NullAI) lived up to their reputation
[f=0000000] Team2 () has been played out
[f=0000000] Team3 () couldn't resist pushing the red button
[f=0000000] Error: Releasing AI Interface Library from file "/home/user/.config/spring/AI/Interfaces/Java/0.1/libAIInterface.so". The call to releaseStatic() returned unsuccessfuly.
[f=0000000] [~CGame][6]
[f=0000000] Red_UI_Framework>> last processed widget was "Red Tooltip"
[f=0000000] Red_Drawing>> last processed widget was "Red Tooltip"
[f=0000000] [~CGame][7]
[f=0000000] [~CGame][8]
[f=0000000] [CCollisionHandler] dis-/continuous tests: 0/0
[f=0000000] [~CGame][9]
[f=0000000] [~CGame][10]
[f=0000000] [~CPathCache(32x32)] cacheHits=0 hitPercentage=0% numHashColls=0 maxCacheSize=0
[f=0000000] [~CPathCache(32x32)] cacheHits=0 hitPercentage=0% numHashColls=0 maxCacheSize=0
[f=0000000] [~CPathCache(128x128)] cacheHits=0 hitPercentage=0% numHashColls=0 maxCacheSize=0
[f=0000000] [~CPathCache(128x128)] cacheHits=0 hitPercentage=0% numHashColls=0 maxCacheSize=0
[f=0000000] Statistics for RectangleOptimizer: 0%
[f=0000000] Statistics for RectangleOptimizer: 0%
[f=0000000] [~CGame][11]
[f=0000000] [~CGame][12]
[f=0000000] [~CGame][13]
[f=0000000] [~CGame][14]
[f=0000000] [~CGame][15]
[f=0000000] [~CGameServer][1]
[f=0000000] [~CGameServer][2]
[f=0000000] [~CGame][16]
[f=0000000] [Sound] [~CSound][1] soundThread=0x21f4790
[f=0000000] [Sound] [~CSound][2]
[f=0000000] [Sound] [~CSound][3]
[f=0000000] [~CGame][17]
[f=0000000] [SpringApp::ShutDown][3]
[f=0000000] [SpringApp::ShutDown][4]
[f=0000000] Statistics for local connection: