Permalink
Browse files

Merge branch 'bugfixes'

  • Loading branch information...
2 parents d2f0082 + 3bebe1a commit 6688d820d3a533dca978490bab5df4e6d7c936a8 automerge committed with cybersphinx Apr 27, 2012
Showing with 34 additions and 3 deletions.
  1. +1 −1 data/mp/stats/templates.txt
  2. +1 −0 lib/netplay/netplay.cpp
  3. +1 −0 lib/netplay/netplay.h
  4. +4 −1 src/cheat.cpp
  5. +1 −0 src/frontend.cpp
  6. +16 −0 src/keybind.cpp
  7. +1 −0 src/keybind.h
  8. +9 −1 src/multistruct.cpp
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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);

0 comments on commit 6688d82

Please sign in to comment.