Skip to content

Commit

Permalink
Command stuff
Browse files Browse the repository at this point in the history
Conflicts:
	rts/Game/UI/GuiHandler.cpp
	rts/Rendering/CommandDrawer.cpp
  • Loading branch information
rt committed Jul 16, 2018
1 parent b61144a commit acbc7c6
Show file tree
Hide file tree
Showing 30 changed files with 794 additions and 786 deletions.
6 changes: 3 additions & 3 deletions AI/Wrappers/LegacyCpp/AIAICallback.cpp
Expand Up @@ -289,16 +289,16 @@ const springLegacyAI::CCommandQueue* springLegacyAI::CAIAICallback::GetCurrentUn
const unsigned char cmd_opt = sAICallback->Unit_CurrentCommand_getOptions(skirmishAIId, unitId, c);

Command command(cmd_id, cmd_opt);
command.tag = sAICallback->Unit_CurrentCommand_getTag(skirmishAIId, unitId, c);
command.timeOut = sAICallback->Unit_CurrentCommand_getTimeOut(skirmishAIId, unitId, c);
command.SetTag(sAICallback->Unit_CurrentCommand_getTag(skirmishAIId, unitId, c));
command.SetTimeOut(sAICallback->Unit_CurrentCommand_getTimeOut(skirmishAIId, unitId, c));

std::vector<float> params(sAICallback->Unit_CurrentCommand_getParams(skirmishAIId, unitId, c, nullptr, 0));

if (!params.empty()) {
const int numParams = sAICallback->Unit_CurrentCommand_getParams(skirmishAIId, unitId, c, &params[0], params.size());

for (int p = 0; p < numParams; p++) {
command.params.push_back(params[p]);
command.PushParam(params[p]);
}
}

Expand Down
9 changes: 4 additions & 5 deletions AI/Wrappers/LegacyCpp/CommandQueue.h
Expand Up @@ -121,22 +121,21 @@ inline int springLegacyAI::CCommandQueue::GetNextTag()
inline void springLegacyAI::CCommandQueue::push_back(const Command& cmd)
{
queue.push_back(cmd);
queue.back().tag = GetNextTag();
queue.back().SetTag(GetNextTag());
}


inline void springLegacyAI::CCommandQueue::push_front(const Command& cmd)
{
queue.push_front(cmd);
queue.front().tag = GetNextTag();
queue.front().SetTag(GetNextTag());
}


inline springLegacyAI::CCommandQueue::iterator springLegacyAI::CCommandQueue::insert(
iterator pos, const Command& cmd)
inline springLegacyAI::CCommandQueue::iterator springLegacyAI::CCommandQueue::insert(iterator pos, const Command& cmd)
{
Command tmpCmd = cmd;
tmpCmd.tag = GetNextTag();
tmpCmd.SetTag(GetNextTag());
return queue.insert(pos, tmpCmd);
}

Expand Down
2 changes: 1 addition & 1 deletion rts/ExternalAI/AICallback.cpp
Expand Up @@ -372,7 +372,7 @@ int CAICallback::GiveOrder(int unitId, Command* c)
if (unit->team != team)
return -5;

clientNet->Send(CBaseNetProtocol::Get().SendAICommand(gu->myPlayerNum, skirmishAIHandler.GetCurrentAIID(), unitId, c->GetID(), c->aiCommandId, c->options, c->params));
clientNet->Send(CBaseNetProtocol::Get().SendAICommand(gu->myPlayerNum, skirmishAIHandler.GetCurrentAIID(), unitId, c->GetID(false), c->GetID(true), c->GetOpts(), c->GetNumParams(), c->GetParams()));
return 0;
}

Expand Down

0 comments on commit acbc7c6

Please sign in to comment.