Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: Warzone2100/warzone2100
base: 4beba1f
...
head fork: Warzone2100/warzone2100
compare: 9546393
Checking mergeability… Don't worry, you can still create the pull request.
  • 3 commits
  • 8 files changed
  • 0 commit comments
  • 2 contributors
Commits on Apr 27, 2012
@vexed vexed Fix typo for SuperTransport.
Fixes ticket:3426
146332a
@vexed vexed Try to fix the autogame hack by introducing a new bool to keep track of
when we should be using the AI's templates.

This only works in debug mode!

TODO: Move the actual setting of this bool script side, in case the user picks
a AI that doesn't support the 'autogame' command.

close ticket:3369
3bebe1a
automerge Merge branch 'bugfixes' into 3.1
9546393
View
2  data/mp/stats/templates.txt
@@ -364,6 +364,6 @@ SK-Mantis-VTOL-HBB,743,Body12SUP,ZNULLBRAIN,ZNULLCONSTRUCT,ZNULLECM,NO,V-Tol,ZNU
SK-Retre-VTOL-HBB,744,Body7ABT,ZNULLBRAIN,ZNULLCONSTRUCT,ZNULLECM,NO,V-Tol,ZNULLREPAIR,DROID,DefaultSensor1Mk1,1
SK-Retal-VTOL-Scourge,745,Body3MBT,ZNULLBRAIN,ZNULLCONSTRUCT,ZNULLECM,NO,V-Tol,ZNULLREPAIR,DROID,DefaultSensor1Mk1,1
SK-Retre-VTOL-Plasmite,746,Body7ABT,ZNULLBRAIN,ZNULLCONSTRUCT,ZNULLECM,NO,V-Tol,ZNULLREPAIR,DROID,DefaultSensor1Mk1,1
-SuperTransport,746,SuperTransportBody,ZNULLBRAIN,ZNULLCONSTRUCT,ZNULLECM,YES,V-Tol,ZNULLREPAIR,SUPERTRANSPORTER,DefaultSensor1Mk1,1
+SuperTransport,764,SuperTransportBody,ZNULLBRAIN,ZNULLCONSTRUCT,ZNULLECM,YES,V-Tol,ZNULLREPAIR,SUPERTRANSPORTER,DefaultSensor1Mk1,1
SK-Veng-Hover-Seraph,747,Body10MBT,ZNULLBRAIN,ZNULLCONSTRUCT,ZNULLECM,NO,hover01,ZNULLREPAIR,DROID,DefaultSensor1Mk1,1
Dragon-Hover-SeraphGauss,748,Body14SUP,ZNULLBRAIN,ZNULLCONSTRUCT,ZNULLECM,NO,hover01,ZNULLREPAIR,DROID,DefaultSensor1Mk1,2
View
1  lib/netplay/netplay.cpp
@@ -261,6 +261,7 @@ static size_t NET_fillBuffer(Socket **pSocket, SocketSet* socket_set, uint8_t *b
void NET_InitPlayer(int i, bool initPosition)
{
NetPlay.players[i].allocated = false;
+ NetPlay.players[i].autoGame = false;
NetPlay.players[i].heartattacktime = 0;
NetPlay.players[i].heartbeat = true; // we always start with a hearbeat
NetPlay.players[i].kick = false;
View
1  lib/netplay/netplay.h
@@ -240,6 +240,7 @@ struct PLAYER
bool ready; ///< player ready to start?
int8_t ai; ///< index into sorted list of AIs, zero is always default AI
int8_t difficulty; ///< difficulty level of AI
+ bool autoGame; // if we are running a autogame (AI controls us)
bool needFile; ///< if We need a file sent to us
WZFile wzFile; ///< for each player, we keep track of map progress
char IPtextAddress[40]; ///< IP of this player
View
5 src/cheat.cpp
@@ -79,6 +79,9 @@ static CHEAT_ENTRY cheatCodes[] =
{"reload me", kf_Reload}, // reload selected weapons immediately
{"desync me", kf_ForceDesync},
{"damage me", kf_DamageMe},
+ {"autogame on", kf_AutoGame},
+ {"autogame off", kf_AutoGame},
+
};
bool attemptCheatCode(const char* cheat_name)
@@ -118,7 +121,7 @@ bool attemptCheatCode(const char* cheat_name)
for (curCheat = cheatCodes; curCheat != EndCheat; ++curCheat)
{
- if (strcmp(cheat_name, curCheat->pName) == 0)
+ if (strcasecmp(cheat_name, curCheat->pName) == 0)
{
char buf[256];
View
1  src/frontend.cpp
@@ -282,6 +282,7 @@ static void SPinit(void)
game.type = CAMPAIGN;
NET_InitPlayers();
NetPlay.players[0].allocated = true;
+ NetPlay.players[0].autoGame = false;
game.skDiff[0] = UBYTE_MAX;
game.maxPlayers = MAX_PLAYERS;
// make sure we have a valid color choice for our SP game. Valid values are 0, 4-7
View
16 src/keybind.cpp
@@ -137,6 +137,22 @@ static void noMPCheatMsg(void)
}
// --------------------------------------------------------------------------
+void kf_AutoGame(void)
+{
+#ifndef DEBUG
+ // Bail out if we're running a _true_ multiplayer game (to prevent MP cheating)
+ if (runningMultiplayer())
+ {
+ noMPCheatMsg();
+ return;
+ }
+#endif
+ // obviously, this just sets a flag, the AI scripts still need to take care of the request
+ // FIXME: move to script side
+ NetPlay.players[selectedPlayer].autoGame = !NetPlay.players[selectedPlayer].autoGame;
+ CONPRINTF(ConsoleString, (ConsoleString, "autogame request is %s. AI script *must* support this command!", NetPlay.players[selectedPlayer].autoGame ? "Enabled" : "Disabled"));
+}
+
void kf_ToggleMissionTimer( void )
{
addConsoleMessage(_("Warning! This cheat is buggy. We recommend to NOT use it."), DEFAULT_JUSTIFY, SYSTEM_MESSAGE);
View
1  src/keybind.h
@@ -264,5 +264,6 @@ void kf_PowerInfo( void );
void kf_BuildNextPage( void );
void kf_BuildPrevPage( void );
extern void kf_DamageMe(void);
+extern void kf_AutoGame(void);
#endif // __INCLUDED_SRC_KEYBIND_H__
View
10 src/multistruct.cpp
@@ -308,7 +308,15 @@ void recvStructureInfo(NETQUEUE queue)
NETuint32_t(&templateId);
if (templateId != 0)
{
- psTempl = IdToTemplate(templateId, player);
+ // For autogames, where we want the AI to take us over, our templates are not setup... so let's use any AI's templates.
+ if (!NetPlay.players[player].autoGame)
+ {
+ psTempl = IdToTemplate(templateId, player);
+ }
+ else
+ {
+ psTempl = IdToTemplate(templateId, ANYPLAYER);
+ }
if (psTempl == NULL)
{
debug(LOG_SYNC, "Synch error, don't have tempate id %u, so can't change production of factory %u!", templateId, structId);

No commit comments for this range

Something went wrong with that request. Please try again.