New C++ Wrapper Incomplete

New C++ Wrapper Incomplete

Here is where ideas can be collected for the skirmish AI in development

Moderators: hoijui, Moderators

Post Reply
slind
Posts: 29
Joined: 26 May 2011, 01:01

New C++ Wrapper Incomplete

Post by slind »

The code generated for the SupportedCommand functions appear to be incomplete. In particular, the functions are not defined which prevents successful linking if they are used. I have successfully written a couple of them, but I have run into a problem. How do you know how many Commands a unit or group implements?

EDIT:

Fixed. The function is exported correctly, but the SupportedCommand files are still not implemented.
User avatar
hoijui
Former Engine Dev
Posts: 4344
Joined: 22 Sep 2007, 09:51

Re: New C++ Wrapper Incomplete

Post by hoijui »

i will have a look at this mid next week.
User avatar
hoijui
Former Engine Dev
Posts: 4344
Joined: 22 Sep 2007, 09:51

Re: New C++ Wrapper Incomplete

Post by hoijui »

works fine here, in spring master:

Code: Select all

#include "OOAICallback.h"
#include "Unit.h"
#include "CommandDescription.h"

// ...

std::string msgText = "SuportedCommands:";
const std::vector<springai::Unit*> friendlyUnits = callback->GetFriendlyUnits();
if (!friendlyUnits.empty()) {
	springai::Unit* unit = friendlyUnits[0];
	const std::vector<springai::CommandDescription*> supportedCommands = unit->GetSupportedCommands();
	std::vector<springai::CommandDescription*>::const_iterator sci;
	for (sci = supportedCommands.begin(); sci != supportedCommands.end(); ++sci) {
		msgText = msgText + "\n\t" + (*sci)->GetName();
	}
}
callback->GetGame()->SendTextMessage(msgText.c_str(), 0);
if you do not mean that, please give better info what you mean.
slind
Posts: 29
Joined: 26 May 2011, 01:01

Re: New C++ Wrapper Incomplete

Post by slind »

I will double check my code on monday or tuesday and get back to you.
Post Reply

Return to “AI”