Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
  • 3 commits
  • 8 files changed
  • 0 comments
  • 2 contributors
Apr 26, 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
Apr 27, 2012
automerge Merge branch 'bugfixes' into 3.1 9546393
2  data/mp/stats/templates.txt
@@ -364,6 +364,6 @@ SK-Mantis-VTOL-HBB,743,Body12SUP,ZNULLBRAIN,ZNULLCONSTRUCT,ZNULLECM,NO,V-Tol,ZNU
364 364 SK-Retre-VTOL-HBB,744,Body7ABT,ZNULLBRAIN,ZNULLCONSTRUCT,ZNULLECM,NO,V-Tol,ZNULLREPAIR,DROID,DefaultSensor1Mk1,1
365 365 SK-Retal-VTOL-Scourge,745,Body3MBT,ZNULLBRAIN,ZNULLCONSTRUCT,ZNULLECM,NO,V-Tol,ZNULLREPAIR,DROID,DefaultSensor1Mk1,1
366 366 SK-Retre-VTOL-Plasmite,746,Body7ABT,ZNULLBRAIN,ZNULLCONSTRUCT,ZNULLECM,NO,V-Tol,ZNULLREPAIR,DROID,DefaultSensor1Mk1,1
367   -SuperTransport,746,SuperTransportBody,ZNULLBRAIN,ZNULLCONSTRUCT,ZNULLECM,YES,V-Tol,ZNULLREPAIR,SUPERTRANSPORTER,DefaultSensor1Mk1,1
  367 +SuperTransport,764,SuperTransportBody,ZNULLBRAIN,ZNULLCONSTRUCT,ZNULLECM,YES,V-Tol,ZNULLREPAIR,SUPERTRANSPORTER,DefaultSensor1Mk1,1
368 368 SK-Veng-Hover-Seraph,747,Body10MBT,ZNULLBRAIN,ZNULLCONSTRUCT,ZNULLECM,NO,hover01,ZNULLREPAIR,DROID,DefaultSensor1Mk1,1
369 369 Dragon-Hover-SeraphGauss,748,Body14SUP,ZNULLBRAIN,ZNULLCONSTRUCT,ZNULLECM,NO,hover01,ZNULLREPAIR,DROID,DefaultSensor1Mk1,2
1  lib/netplay/netplay.cpp
@@ -261,6 +261,7 @@ static size_t NET_fillBuffer(Socket **pSocket, SocketSet* socket_set, uint8_t *b
261 261 void NET_InitPlayer(int i, bool initPosition)
262 262 {
263 263 NetPlay.players[i].allocated = false;
  264 + NetPlay.players[i].autoGame = false;
264 265 NetPlay.players[i].heartattacktime = 0;
265 266 NetPlay.players[i].heartbeat = true; // we always start with a hearbeat
266 267 NetPlay.players[i].kick = false;
1  lib/netplay/netplay.h
@@ -240,6 +240,7 @@ struct PLAYER
240 240 bool ready; ///< player ready to start?
241 241 int8_t ai; ///< index into sorted list of AIs, zero is always default AI
242 242 int8_t difficulty; ///< difficulty level of AI
  243 + bool autoGame; // if we are running a autogame (AI controls us)
243 244 bool needFile; ///< if We need a file sent to us
244 245 WZFile wzFile; ///< for each player, we keep track of map progress
245 246 char IPtextAddress[40]; ///< IP of this player
5 src/cheat.cpp
@@ -79,6 +79,9 @@ static CHEAT_ENTRY cheatCodes[] =
79 79 {"reload me", kf_Reload}, // reload selected weapons immediately
80 80 {"desync me", kf_ForceDesync},
81 81 {"damage me", kf_DamageMe},
  82 + {"autogame on", kf_AutoGame},
  83 + {"autogame off", kf_AutoGame},
  84 +
82 85 };
83 86
84 87 bool attemptCheatCode(const char* cheat_name)
@@ -118,7 +121,7 @@ bool attemptCheatCode(const char* cheat_name)
118 121
119 122 for (curCheat = cheatCodes; curCheat != EndCheat; ++curCheat)
120 123 {
121   - if (strcmp(cheat_name, curCheat->pName) == 0)
  124 + if (strcasecmp(cheat_name, curCheat->pName) == 0)
122 125 {
123 126 char buf[256];
124 127
1  src/frontend.cpp
@@ -282,6 +282,7 @@ static void SPinit(void)
282 282 game.type = CAMPAIGN;
283 283 NET_InitPlayers();
284 284 NetPlay.players[0].allocated = true;
  285 + NetPlay.players[0].autoGame = false;
285 286 game.skDiff[0] = UBYTE_MAX;
286 287 game.maxPlayers = MAX_PLAYERS;
287 288 // make sure we have a valid color choice for our SP game. Valid values are 0, 4-7
16 src/keybind.cpp
@@ -137,6 +137,22 @@ static void noMPCheatMsg(void)
137 137 }
138 138
139 139 // --------------------------------------------------------------------------
  140 +void kf_AutoGame(void)
  141 +{
  142 +#ifndef DEBUG
  143 + // Bail out if we're running a _true_ multiplayer game (to prevent MP cheating)
  144 + if (runningMultiplayer())
  145 + {
  146 + noMPCheatMsg();
  147 + return;
  148 + }
  149 +#endif
  150 + // obviously, this just sets a flag, the AI scripts still need to take care of the request
  151 + // FIXME: move to script side
  152 + NetPlay.players[selectedPlayer].autoGame = !NetPlay.players[selectedPlayer].autoGame;
  153 + CONPRINTF(ConsoleString, (ConsoleString, "autogame request is %s. AI script *must* support this command!", NetPlay.players[selectedPlayer].autoGame ? "Enabled" : "Disabled"));
  154 +}
  155 +
140 156 void kf_ToggleMissionTimer( void )
141 157 {
142 158 addConsoleMessage(_("Warning! This cheat is buggy. We recommend to NOT use it."), DEFAULT_JUSTIFY, SYSTEM_MESSAGE);
1  src/keybind.h
@@ -264,5 +264,6 @@ void kf_PowerInfo( void );
264 264 void kf_BuildNextPage( void );
265 265 void kf_BuildPrevPage( void );
266 266 extern void kf_DamageMe(void);
  267 +extern void kf_AutoGame(void);
267 268
268 269 #endif // __INCLUDED_SRC_KEYBIND_H__
10 src/multistruct.cpp
@@ -308,7 +308,15 @@ void recvStructureInfo(NETQUEUE queue)
308 308 NETuint32_t(&templateId);
309 309 if (templateId != 0)
310 310 {
311   - psTempl = IdToTemplate(templateId, player);
  311 + // For autogames, where we want the AI to take us over, our templates are not setup... so let's use any AI's templates.
  312 + if (!NetPlay.players[player].autoGame)
  313 + {
  314 + psTempl = IdToTemplate(templateId, player);
  315 + }
  316 + else
  317 + {
  318 + psTempl = IdToTemplate(templateId, ANYPLAYER);
  319 + }
312 320 if (psTempl == NULL)
313 321 {
314 322 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.