2025-07-20 23:29 CEST

View Issue Details Jump to Notes ]
IDProjectCategoryView StatusLast Update
0004536Spring engineAIpublic2014-09-06 17:08
Reporterlamer 
Assigned Toabma 
PrioritynormalSeverityminorReproducibilityalways
StatusresolvedResolutionfixed 
Product Version97.0.1+git 
Target VersionFixed in Version 
Summary0004536: C++ AI. Game::SendStartPosition has no effect with cheats enabled
DescriptionWhen cheating is enabled Game::SendStartPosition has no effect.
Steps To ReproduceCheats* 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 InformationHint:
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.
TagsNo tags attached.
Checked infolog.txt for Errors
Attached Files

-Relationships
+Relationships

-Notes

~0013603

abma (administrator)

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 ?

~0013604

lamer (reporter)

Fall back sounds much better and easy to implement too.
And possibly should fix all similar issues with cheats.

~0013605

abma (administrator)

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).

~0013606

lamer (reporter)

Last edited: 2014-09-06 16:51

View 6 revisions

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;
 }

~0013607

abma (administrator)

ok, added both. please test! (i can't currently)
+Notes

-Issue History
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
+Issue History