本文整理汇总了C++中DebugLogger函数的典型用法代码示例。如果您正苦于以下问题:C++ DebugLogger函数的具体用法?C++ DebugLogger怎么用?C++ DebugLogger使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了DebugLogger函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: m_player_name
// static member(s)
AIClientApp::AIClientApp(const std::vector<std::string>& args) :
m_player_name(""),
m_max_aggression(0)
{
if (args.size() < 2) {
std::cerr << "The AI client should not be executed directly! Run freeorion to start the game.";
ExitApp(1);
}
// read command line args
m_player_name = args.at(1);
if (args.size() >=3) {
m_max_aggression = boost::lexical_cast<int>(args.at(2));
}
// Force the log file if requested.
if (GetOptionsDB().Get<std::string>("log-file").empty()) {
const std::string AICLIENT_LOG_FILENAME((GetUserDataDir() / (m_player_name + ".log")).string());
GetOptionsDB().Set("log-file", AICLIENT_LOG_FILENAME);
}
// Force the log threshold if requested.
auto force_log_level = GetOptionsDB().Get<std::string>("log-level");
if (!force_log_level.empty())
OverrideAllLoggersThresholds(to_LogLevel(force_log_level));
InitLoggingSystem(GetOptionsDB().Get<std::string>("log-file"), "AI");
InitLoggingOptionsDBSystem();
InfoLogger() << FreeOrionVersionString();
DebugLogger() << PlayerName() + " ai client initialized.";
}
示例2: Client
boost::statechart::result WaitingForMPJoinAck::react(const JoinGame& msg) {
if (TRACE_EXECUTION) DebugLogger() << "(HumanClientFSM) WaitingForMPJoinAck.JoinGame";
Client().Networking().SetPlayerID(msg.m_message.ReceivingPlayer());
return transit<MPLobby>();
}
示例3: TraceLogger
boost::statechart::result WaitingForTurnData::react(const TurnUpdate& msg) {
TraceLogger(FSM) << "(HumanClientFSM) PlayingGame.TurnUpdate";
int current_turn = INVALID_GAME_TURN;
try {
ExtractTurnUpdateMessageData(msg.m_message, Client().EmpireID(), current_turn,
Empires(), GetUniverse(), GetSpeciesManager(),
GetCombatLogManager(), GetSupplyManager(), Client().Players());
} catch (...) {
Client().GetClientUI().GetMessageWnd()->HandleLogMessage(UserString("ERROR_PROCESSING_SERVER_MESSAGE") + "\n");
return discard_event();
}
DebugLogger(FSM) << "Extracted TurnUpdate message for turn: " << current_turn;
Client().SetCurrentTurn(current_turn);
// if I am the host, do autosave
if (Client().Networking().PlayerIsHost(Client().PlayerID()))
Client().Autosave();
Client().HandleTurnUpdate();
return transit<PlayingTurn>();
}
示例4: discard_event
boost::statechart::result MPLobby::react(const LobbyUpdate& msg) {
if (TRACE_EXECUTION) DebugLogger() << "(HumanClientFSM) MPLobby.LobbyUpdate";
MultiplayerLobbyData lobby_data;
ExtractMessageData(msg.m_message, lobby_data);
Client().GetClientUI()->GetMultiPlayerLobbyWnd()->LobbyUpdate(lobby_data);
return discard_event();
}
示例5: DebugLogger
void ProductionWnd::UpdateQueue() {
DebugLogger() << "ProductionWnd::UpdateQueue()";
ScopedTimer timer("ProductionWnd::UpdateQueue");
m_queue_wnd->SetEmpire(m_empire_shown_id);
QueueListBox* queue_lb = m_queue_wnd->GetQueueListBox();
std::size_t first_visible_queue_row = std::distance(queue_lb->begin(), queue_lb->FirstRowShown());
queue_lb->Clear();
const Empire* empire = GetEmpire(m_empire_shown_id);
if (!empire)
return;
const ProductionQueue& queue = empire->GetProductionQueue();
int i = 0;
for (ProductionQueue::const_iterator it = queue.begin(); it != queue.end(); ++it, ++i) {
QueueRow* row = new QueueRow(queue_lb->RowWidth(), *it, i);
GG::Connect(row->RowQuantChangedSignal, &ProductionWnd::ChangeBuildQuantityBlockSlot, this);
queue_lb->Insert(row);
}
if (!queue_lb->Empty())
queue_lb->BringRowIntoView(--queue_lb->end());
if (first_visible_queue_row < queue_lb->NumRows())
queue_lb->BringRowIntoView(boost::next(queue_lb->begin(), first_visible_queue_row));
}
示例6: DeleteSideBars
void GraphicalSummaryWnd::GenerateGraph() {
DeleteSideBars();
m_sizer.reset(new BarSizer(m_summaries, ClientSize()));
for (std::map<int, CombatSummary>::iterator it = m_summaries.begin(); it != m_summaries.end(); ++it) {
if (it->second.total_max_health > EPSILON) {
it->second.Sort();
SideBar* box = new SideBar(it->second, *m_sizer);
m_side_boxes.push_back(box);
AttachChild(box);
}
}
if (m_options_bar) {
DebugLogger() << "GraphicalSummaryWnd::GenerateGraph(): m_options_bar "
"already exists, calling DeleteChild(m_options_bar) "
"before creating a new one.";
DeleteChild(m_options_bar);
}
m_options_bar = new OptionsBar(m_sizer);
AttachChild(m_options_bar);
GG::Connect(m_options_bar->ChangedSignal,
&GraphicalSummaryWnd::HandleButtonChanged,
this);
MinSizeChangedSignal();
DoLayout();
}
示例7: ExtractMessageData
boost::statechart::result PlayingGame::react(const EndGame& msg) {
if (TRACE_EXECUTION) DebugLogger() << "(HumanClientFSM) PlayingGame.EndGame";
Message::EndGameReason reason;
std::string reason_player_name;
ExtractMessageData(msg.m_message, reason, reason_player_name);
std::string reason_message;
bool error = false;
switch (reason) {
case Message::LOCAL_CLIENT_DISCONNECT:
Client().EndGame(true);
reason_message = UserString("SERVER_LOST");
break;
case Message::PLAYER_DISCONNECT:
Client().EndGame(true);
reason_message = boost::io::str(FlexibleFormat(UserString("PLAYER_DISCONNECTED")) % reason_player_name);
error = true;
break;
}
//Note: Any transit<> transition must occur before the MessageBox().
// MessageBox blocks and can allow other events to transit<> to a new state
// which makes this transit fatal.
boost::statechart::result retval = transit<IntroMenu>();
ClientUI::MessageBox(reason_message, error);
return retval;
}
示例8: Base
////////////////////////////////////////////////////////////
// IntroMenu
////////////////////////////////////////////////////////////
IntroMenu::IntroMenu(my_context ctx) :
Base(ctx)
{
if (TRACE_EXECUTION) DebugLogger() << "(HumanClientFSM) IntroMenu";
Client().KillServer();
Client().GetClientUI()->ShowIntroScreen();
}
示例9: ExtractMessageData
boost::statechart::result PlayingGame::react(const EndGame& msg) {
if (TRACE_EXECUTION) DebugLogger() << "(HumanClientFSM) PlayingGame.EndGame";
Message::EndGameReason reason;
std::string reason_player_name;
ExtractMessageData(msg.m_message, reason, reason_player_name);
std::string reason_message;
bool error = false;
switch (reason) {
case Message::LOCAL_CLIENT_DISCONNECT:
Client().EndGame(true);
reason_message = UserString("SERVER_LOST");
break;
case Message::PLAYER_DISCONNECT:
Client().EndGame(true);
reason_message = boost::io::str(FlexibleFormat(UserString("PLAYER_DISCONNECTED")) % reason_player_name);
error = true;
break;
case Message::YOU_ARE_ELIMINATED:
Client().EndGame(true);
reason_message = UserString("PLAYER_DEFEATED");
break;
}
ClientUI::MessageBox(reason_message, error);
Client().Remove(Client().GetClientUI()->GetMapWnd());
Client().GetClientUI()->GetMapWnd()->RemoveWindows();
Client().Networking().SetHostPlayerID(Networking::INVALID_PLAYER_ID);
Client().Networking().SetPlayerID(Networking::INVALID_PLAYER_ID);
return transit<IntroMenu>();
}
示例10: DebugLogger
HullTypeManager::HullTypeManager() {
if (s_instance)
throw std::runtime_error("Attempted to create more than one HullTypeManager.");
s_instance = this;
parse::ship_hulls(GetResourceDir() / "ship_hulls.txt", m_hulls);
if (GetOptionsDB().Get<bool>("verbose-logging")) {
DebugLogger() << "Hull Types:";
for (iterator it = begin(); it != end(); ++it) {
const HullType* h = it->second;
DebugLogger() << " ... " << h->Name();
}
}
}
示例11: DebugLogger
void HumanClientApp::KillServer() {
DebugLogger() << "HumanClientApp::KillServer()";
m_server_process.Kill();
m_networking.SetPlayerID(Networking::INVALID_PLAYER_ID);
m_networking.SetHostPlayerID(Networking::INVALID_PLAYER_ID);
SetEmpireID(ALL_EMPIRES);
}
示例12: TraceLogger
boost::statechart::result QuittingGame::react(const ShutdownServer& u) {
TraceLogger(FSM) << "(HumanClientFSM) QuittingGame.ShutdownServer";
if (!m_server_process) {
ErrorLogger(FSM) << "m_server_process is nullptr";
post_event(TerminateServer());
return discard_event();
}
if (m_server_process->Empty()) {
if (Client().Networking().IsTxConnected()) {
WarnLogger(FSM) << "Disconnecting from server that is already killed.";
Client().Networking().DisconnectFromServer();
}
post_event(TerminateServer());
return discard_event();
}
if (Client().Networking().IsTxConnected()) {
DebugLogger(FSM) << "Sending server shutdown message.";
Client().Networking().SendMessage(ShutdownServerMessage());
post_event(WaitForDisconnect());
} else {
post_event(TerminateServer());
}
return discard_event();
}
示例13: Base
////////////////////////////////////////////////////////////
// MPLobby
////////////////////////////////////////////////////////////
MPLobby::MPLobby(my_context ctx) :
Base(ctx)
{
if (TRACE_EXECUTION) DebugLogger() << "(HumanClientFSM) MPLobby";
Client().Register(Client().GetClientUI()->GetMultiPlayerLobbyWnd());
}
示例14: Base
////////////////////////////////////////////////////////////
// PlayingTurn
////////////////////////////////////////////////////////////
PlayingTurn::PlayingTurn(my_context ctx) :
Base(ctx)
{
if (TRACE_EXECUTION) DebugLogger() << "(HumanClientFSM) PlayingTurn";
Client().Register(Client().GetClientUI()->GetMapWnd());
Client().GetClientUI()->GetMapWnd()->InitTurn();
// TODO: reselect last fleet if stored in save game ui data?
Client().GetClientUI()->GetMessageWnd()->HandleGameStatusUpdate(
boost::io::str(FlexibleFormat(UserString("TURN_BEGIN")) % CurrentTurn()) + "\n");
Client().GetClientUI()->GetMessageWnd()->HandlePlayerStatusUpdate(Message::PLAYING_TURN, Client().PlayerID());
Client().GetClientUI()->GetPlayerListWnd()->Refresh();
Client().GetClientUI()->GetPlayerListWnd()->HandlePlayerStatusUpdate(Message::PLAYING_TURN, Client().PlayerID());
if (Client().GetApp()->GetClientType() != Networking::CLIENT_TYPE_HUMAN_OBSERVER)
Client().GetClientUI()->GetMapWnd()->EnableOrderIssuing(true);
if (Client().GetApp()->GetClientType() == Networking::CLIENT_TYPE_HUMAN_OBSERVER) {
// observers can't do anything but wait for the next update, and need to
// be back in WaitingForTurnData, so posting TurnEnded here has the effect
// of keeping observers in the WaitingForTurnData state so they can receive
// updates from the server.
post_event(TurnEnded());
} else if (Client().GetApp()->GetClientType() == Networking::CLIENT_TYPE_HUMAN_PLAYER) {
if (Client().GetClientUI()->GetMapWnd()->AutoEndTurnEnabled()) {
// if in-game-GUI auto turn advance enabled, set auto turn counter to 1
Client().InitAutoTurns(1);
}
if (Client().AutoTurnsLeft() <= 0 &&
GetOptionsDB().Get<bool>("auto-quit"))
{
// if no auto turns left, and supposed to quit after that, quit
DebugLogger() << "auto-quit ending game.";
std::cout << "auto-quit ending game." << std::endl;
Client().EndGame(true);
throw HumanClientApp::CleanQuit();
}
// if there are still auto turns left, advance the turn automatically,
// and decrease the auto turn counter
if (Client().AutoTurnsLeft() > 0) {
post_event(AdvanceTurn());
Client().DecAutoTurns();
}
}
}
示例15: NumPlayableSpecies
const std::string& SpeciesManager::SequentialPlayableSpeciesName(int id) const {
if (NumPlayableSpecies() <= 0)
return EMPTY_STRING;
int species_idx = id % NumPlayableSpecies();
DebugLogger() << "SpeciesManager::SequentialPlayableSpeciesName has " << NumPlayableSpecies() << " and is given id " << id << " yielding index " << species_idx;
return std::next(playable_begin(), species_idx)->first;
}