Page 1 of 1
New C++ Wrapper Incomplete
Posted: 27 May 2011, 02:22
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.
Re: New C++ Wrapper Incomplete
Posted: 27 May 2011, 06:56
by hoijui
i will have a look at this mid next week.
Re: New C++ Wrapper Incomplete
Posted: 10 Jun 2011, 15:28
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.
Re: New C++ Wrapper Incomplete
Posted: 11 Jun 2011, 20:17
by slind
I will double check my code on monday or tuesday and get back to you.