File tree 3 files changed +19
-3
lines changed
3 files changed +19
-3
lines changed Original file line number Diff line number Diff line change @@ -276,6 +276,7 @@ class IServer : public IInterface
276
276
virtual void ReadAnnouncementsFile (const char *pFileName) = 0;
277
277
virtual const char *GetMysteryRoundLine () = 0;
278
278
virtual void ReadMysteryRoundsFile (const char *pFileName) = 0;
279
+ virtual size_t GetMysteryRoundsSize () = 0;
279
280
virtual bool ClientPrevIngame (int ClientId) = 0;
280
281
virtual const char *GetNetErrorString (int ClientId) = 0;
281
282
virtual void ResetNetErrorString (int ClientId) = 0;
Original file line number Diff line number Diff line change @@ -452,6 +452,7 @@ class CServer : public IServer
452
452
453
453
const char *GetMysteryRoundLine () override ;
454
454
void ReadMysteryRoundsFile (const char *pFileName) override ;
455
+ size_t GetMysteryRoundsSize () override { return m_vMysteryRounds.size (); }
455
456
456
457
int *GetIdMap (int ClientId) override ;
457
458
Original file line number Diff line number Diff line change @@ -504,18 +504,32 @@ void CGameControllerBomb::EndBombRound(bool RealEnd)
504
504
GameServer ()->SendChat (-1 , TEAM_ALL, " Noone won the round!" );
505
505
}
506
506
507
- if (g_Config.m_BombtagMysteryChance && rand () % 101 <= g_Config.m_BombtagMysteryChance )
507
+ std::vector<std::string> vTemp;
508
+ while (g_Config.m_BombtagMysteryChance && rand () % 101 <= g_Config.m_BombtagMysteryChance )
508
509
{
510
+ if (vTemp.size () == Server ()->GetMysteryRoundsSize ())
511
+ {
512
+ break ;
513
+ }
514
+ if (!m_WasMysteryRound)
515
+ {
516
+ GameServer ()->SendChat (-1 , TEAM_ALL, " MYSTERY ROUND!" );
517
+ }
509
518
const char *pLine = GameServer ()->Server ()->GetMysteryRoundLine ();
510
519
if (pLine)
511
520
{
512
- GameServer ()->SendChat (-1 , TEAM_ALL, " MYSTERY ROUND!" );
521
+ if (std::find (vTemp.begin (), vTemp.end (), pLine) != vTemp.end ())
522
+ {
523
+ continue ;
524
+ }
525
+
513
526
GameServer ()->Console ()->ExecuteFile (g_Config.m_SvMysteryRoundsResetFileName );
514
527
GameServer ()->Console ()->ExecuteLine (pLine);
515
528
m_WasMysteryRound = true ;
529
+ vTemp.emplace_back (pLine);
516
530
}
517
531
}
518
- else if (m_WasMysteryRound)
532
+ if (m_WasMysteryRound)
519
533
{
520
534
GameServer ()->Console ()->ExecuteFile (g_Config.m_SvMysteryRoundsResetFileName );
521
535
m_WasMysteryRound = false ;
You can’t perform that action at this time.
0 commit comments