Client: implement spectator mode via command-line options

If running with --spectate/-s CPlayerInterface will appear even without human players.
Following command-line options also available:
 --spectate-ignore-hero
 --spectate-hero-speed=N
 --spectate-battle-speed=N
 --spectate-skip-battle
 --spectate-skip-battle-result
Boolean options can also be changed in runtime via client console:
 set spectate-ignore-hero on / off
Spectator mode also:
 - Work with --onlyAI option when starting game or loading saves.
 - Allow to use any cheat codes.
 - Give recon on towns and heroes.
This commit is contained in:
Arseniy Shestakov committed 2017-06-06 07:30:16 +03:00
1 parent d95c74941b
commit 18161d3688
24 files changed
+196 -54

No files matched your search

+5 -1
View File
@@ -225,9 +225,13 @@ void CWindowObject::setShadow(bool on)
void CWindowObject::showAll(SDL_Surface *to)
{
auto color = LOCPLINT ? LOCPLINT->playerID : PlayerColor(1);
if(settings["session"]["spectate"].Bool())
color = PlayerColor(1); // TODO: Spectator shouldn't need special code for UI colors
CIntObject::showAll(to);
if ((options & BORDERED) && (pos.h != to->h || pos.w != to->w))
CMessage::drawBorder(LOCPLINT ? LOCPLINT->playerID : PlayerColor(1), to, pos.w+28, pos.h+29, pos.x-14, pos.y-15);
CMessage::drawBorder(color, to, pos.w+28, pos.h+29, pos.x-14, pos.y-15);
}
void CWindowObject::close()