#4688: NullBot research choices
-------------------------------------------------+-------------------------
Reporter: darkling | Owner: NoQ
Type: patch (an actual patch, not | Status: new
a request for one) | Milestone: unspecified
Priority: normal | Version: 3.2.3
Component: NullBot (AI) |
Operating System: GNU/Linux 64bit |
-------------------------------------------------+-------------------------
I was digging into nullbot code and noticed some code which I don't think
is behaving as intended. There's a function whose roll is to identify
available research for different objectTypes (tank, template, vtol of
defence) however objectType isn't passed to it so the default option is
always called which is that the research is available.
Line numbers are for nullbot 3.06 on master, but the issue was noticed
using an older version
Line 75 of research.js calls several functions:
var list =
weaponStatsToResList(chooseAvailableWeaponPathByRoleRatings(personality.weaponPaths,
chooseWeaponRole()), objType);
the issue crops us with the call to chooseAvailableWeaponPathByRoleRatings
(located at line 134 in stats.js). The actual function asks for 4 (paths,
rating, objectType, defrole) values whereas 2 are given (paths, rating).
At line 137 of stats.js the chooseAvailableWeaponPathByRoleRatings
function calls the function weaponPathIsAvailable which asks for three
variables (path, objectType, defrole).
weaponPathIsAvailable uses objectType to pick between research options but
since that is not specified it always calls the default option (I think).
Fixing it looks a little bit more involved since just including objectType
in the initial function call looks like it will make switching weapon
research difficult since the function weaponPathIsAvailable tests using
componentAvailable.
I've attached a version of the function that I wrote for my mod of
nullbot. objectType is included in the initial call to
chooseAvailableWeaponPathByRoleRatings so that it is then passed to
weaponPathIsAvailable. It doesn't use defrole so you may need to make some
changes if you want to include that variable.
--
Ticket URL: <http://developer.wz2100.net/ticket/4688>
Warzone 2100 Trac <http://developer.wz2100.net/>
The Warzone 2100 Project
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Warzone2100-project mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/warzone2100-project