View Issue Details [ Jump to Notes ] | [ Issue History ] [ Print ] | ||||||||
ID | Project | Category | View Status | Date Submitted | Last Update | ||||
---|---|---|---|---|---|---|---|---|---|
0004536 | Spring engine | AI | public | 2014-09-06 12:42 | 2014-09-06 17:08 | ||||
Reporter | lamer | ||||||||
Assigned To | abma | ||||||||
Priority | normal | Severity | minor | Reproducibility | always | ||||
Status | resolved | Resolution | fixed | ||||||
Product Version | 97.0.1+git | ||||||||
Target Version | Fixed in Version | ||||||||
Summary | 0004536: C++ AI. Game::SendStartPosition has no effect with cheats enabled | ||||||||
Description | When cheating is enabled Game::SendStartPosition has no effect. | ||||||||
Steps To Reproduce | Cheats* cheats = callback->GetCheats(); cheats->SetEnabled(true); delete cheats; ... springai::Game* game = callback->GetGame(); game->SendStartPosition(false, AIFloat3(x, map->GetElevationAt(x, z), z)); delete game; | ||||||||
Additional Information | Hint: https://github.com/spring/spring/blob/4f0a478d45430b58f1c1d7d4a7b3bbc41cd820c2/rts/ExternalAI/SSkirmishAICallbackImpl.cpp#L326 class CAICheats doesn't know about AIHCSendStartPosId command. Possible fix: https://github.com/spring/spring/blob/4f0a478d45430b58f1c1d7d4a7b3bbc41cd820c2/rts/ExternalAI/SSkirmishAICallbackImpl.cpp#L403 - wrapper_HandleCommand(clb, clbCheat, AIHCSendStartPosId, &data); + wrapper_HandleCommand(clb, NULL, AIHCSendStartPosId, &data); There maybe more same issues with other commands and cheats. | ||||||||
Tags | No tags attached. | ||||||||
Checked infolog.txt for Errors | |||||||||
Attached Files |
|
![]() |
|
abma (administrator) 2014-09-06 15:08 |
wouldn't a proper fix implement AIHCSendStartPosId in rts/ExternalAI/AICheats.cpp ? or as alternative if clbCheat->HandleCommand() fails fall back to clb->HandleCommand() in rts/ExternalAI/SSkirmishAICallbackImpl.cpp ? |
lamer (reporter) 2014-09-06 15:52 |
Fall back sounds much better and easy to implement too. And possibly should fix all similar issues with cheats. |
abma (administrator) 2014-09-06 16:27 |
hmm, after a bit thinking i would prefer the direct approach: diff --git a/rts/ExternalAI/SSkirmishAICallbackImpl.cpp b/rts/ExternalAI/SSkirmishAICallbackImpl.cpp index 37ded34..7f92310 100644 --- a/rts/ExternalAI/SSkirmishAICallbackImpl.cpp +++ b/rts/ExternalAI/SSkirmishAICallbackImpl.cpp @@ -399,8 +399,7 @@ EXPORT(int) skirmishAiCallback_Engine_handleCommand(int skirmishAIId, int toId, case COMMAND_SEND_START_POS: { const SSendStartPosCommand* cmd = static_cast<SSendStartPosCommand*>(commandData); - AIHCSendStartPos data = {cmd->ready, cmd->pos_posF3}; - wrapper_HandleCommand(clb, clbCheat, AIHCSendStartPosId, &data); + clb->SendStartPos(cmd->ready, cmd->pos_posF3); break; } why? it has fewer overhead, but idk how the AI interface works in general, atm it looks bloated with non-working stuff (IMO). |
lamer (reporter) 2014-09-06 16:42 Last edited: 2014-09-06 16:51 |
CAICheats doesn't know about AIHCAddMapPointId, AIHCAddMapLineId, AIHCRemoveMapPointId, AIHCPauseId, AIHCDebugDrawId either (thats present in CAICallback). Thus i'd suggest use a bit overhead (to make interface atleast work, not trying to optimise it). diff --git a/rts/ExternalAI/SSkirmishAICallbackImpl.cpp b/rts/ExternalAI/SSkirmishAICallbackImpl.cpp index 37ded34..2c2c2d9 100644 --- a/rts/ExternalAI/SSkirmishAICallbackImpl.cpp +++ b/rts/ExternalAI/SSkirmishAICallbackImpl.cpp @@ -324,9 +324,11 @@ static int wrapper_HandleCommand(CAICallback* clb, CAICheats* clbCheat, if (clbCheat != NULL) { ret = clbCheat->HandleCommand(cmdId, cmdData); - } else { - ret = clb->HandleCommand(cmdId, cmdData); + if (ret != 0) { + return ret; + } } + ret = clb->HandleCommand(cmdId, cmdData); return ret; } |
abma (administrator) 2014-09-06 17:08 |
ok, added both. please test! (i can't currently) |
![]() |
|||
Date Modified | Username | Field | Change |
---|---|---|---|
2014-09-06 12:42 | lamer | New Issue | |
2014-09-06 15:08 | abma | Note Added: 0013603 | |
2014-09-06 15:52 | lamer | Note Added: 0013604 | |
2014-09-06 16:27 | abma | Note Added: 0013605 | |
2014-09-06 16:42 | lamer | Note Added: 0013606 | |
2014-09-06 16:43 | lamer | Note Edited: 0013606 | View Revisions |
2014-09-06 16:43 | lamer | Note Edited: 0013606 | View Revisions |
2014-09-06 16:44 | lamer | Note Edited: 0013606 | View Revisions |
2014-09-06 16:44 | lamer | Note Edited: 0013606 | View Revisions |
2014-09-06 16:51 | lamer | Note Edited: 0013606 | View Revisions |
2014-09-06 17:07 | abma | Changeset attached | => spring develop 41e3c42f |
2014-09-06 17:07 | abma | Assigned To | => abma |
2014-09-06 17:07 | abma | Status | new => resolved |
2014-09-06 17:07 | abma | Resolution | open => fixed |
2014-09-06 17:08 | abma | Note Added: 0013607 |