Patch for multiple group AIs in one DLL
Moderator: Moderators
Patch for multiple group AIs in one DLL
I've written a patch for spring to allow multiple AIs in a single DLL. I've tested it with the latest version from SVN. It includes an update to the interface version number, the changelog and the existing group AIs (the interface has changed slightly). This has been done to support group AIs that aren't written in C++ and are accessed through a proxy DLL.
http://www.jwhitham.org.uk/pyai/multi_ais_per_dll.diff
Here is a test AI for it - it's all five of the group AIs in SVN, rolled into a single DLL. The new DLL looks exactly the same as its five constituents from within Spring.
http://www.jwhitham.org.uk/pyai/allais.tar.gz
Details: The new code works by replacing GetAiName with GetAiNameList, which returns a list of the AIs present in the DLL: a list of length 1 for the existing group AIs. The index number of each AI within this list is used to identify each AI during calls to IsUnitSuited, GetNewAI, and ReleaseAI.
Any comments? Please post below. Thanks!
http://www.jwhitham.org.uk/pyai/multi_ais_per_dll.diff
Here is a test AI for it - it's all five of the group AIs in SVN, rolled into a single DLL. The new DLL looks exactly the same as its five constituents from within Spring.
http://www.jwhitham.org.uk/pyai/allais.tar.gz
Details: The new code works by replacing GetAiName with GetAiNameList, which returns a list of the AIs present in the DLL: a list of length 1 for the existing group AIs. The index number of each AI within this list is used to identify each AI during calls to IsUnitSuited, GetNewAI, and ReleaseAI.
Any comments? Please post below. Thanks!
Hi, sorry it didn't work. http://www.jwhitham.org.uk/pyai/multi_a ... dll_2.diff is a regular diff (just 'diff -r'). Hope that works better. If not, is there a particular way of doing this? Ijcnossen wrote:Ehm, can you change it back? :)
My tortoisesvn doesn't like it. It also doesn't have revision numbers which seems wrong. In theory it could check dates but it doesn't work at all anyway.
So a normal patch plz:)
Ah, I got it now. http://www.jwhitham.org.uk/pyai/multi_a ... l_svn.diff
I was using regular Unix diff, but I should have been using 'svn diff'. Thanks for your help.. hope it works now.
I was using regular Unix diff, but I should have been using 'svn diff'. Thanks for your help.. hope it works now.
Done - new patch at http://www.jwhitham.org.uk/pyai/multi_a ... l_svn.diffTobi wrote:Could you fix indentation? (use tabs instead of spaces, open patch in browser to easily see where)
The code itself looks fine, I didn't spot obvious problems.
Also I have noticed that 'svn diff' does not include new files created by the patch. This patch requires one new file, trunk/rts/ExternalAI/aikey.h. This file is at http://www.jwhitham.org.uk/pyai/aikey.h - its contents could be merged into another, e.g. aibase.h, but it seemed cleaner to create a new file.