1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-20 20:23:03 +02:00
This commit is contained in:
Michał W. Urbańczyk 2013-06-02 19:53:13 +00:00
parent 0c5a717e08
commit 8bfc6a1116
3 changed files with 62 additions and 7 deletions

View File

@ -562,7 +562,7 @@ void CGPreGame::removeFromGui()
GH.popInt(GH.topInt()); //remove background
}
CSelectionScreen::CSelectionScreen(CMenuScreen::EState Type, CMenuScreen::EMultiMode MultiPlayer /*= CMenuScreen::SINGLE_PLAYER*/, const std::map<ui8, std::string> *Names /*= NULL*/)
CSelectionScreen::CSelectionScreen(CMenuScreen::EState Type, CMenuScreen::EMultiMode MultiPlayer /*= CMenuScreen::SINGLE_PLAYER*/, const std::map<ui8, std::string> * Names /*= NULL*/, const std::string & Address /*=""*/, const std::string & Port /*= ""*/)
: ISelectionScreenInfo(Names), serverHandlingThread(NULL), mx(new boost::recursive_mutex),
serv(NULL), ongoingClosing(false), myNameID(255)
{
@ -711,7 +711,7 @@ CSelectionScreen::CSelectionScreen(CMenuScreen::EState Type, CMenuScreen::EMulti
}
else
{
serv = CServerHandler::justConnectToServer();
serv = CServerHandler::justConnectToServer(Address, Port);
}
serv->enterPregameConnectionMode();
@ -3086,8 +3086,7 @@ void CMultiMode::joinTCP()
{
Settings name = settings.write["general"]["playerName"];
name->String() = txt->text;
GH.popIntTotally(this);
GH.pushInt(new CSelectionScreen(CMenuScreen::newGame, CMenuScreen::MULTI_NETWORK_GUEST));
GH.pushInt(new CSimpleJoinScreen);
}
CHotSeatPlayers::CHotSeatPlayers(const std::string &firstPlayer)
@ -4153,3 +4152,43 @@ void CPrologEpilogVideo::clickLeft( tribool down, bool previousState )
GH.popInt(this);
exitCb();
}
CSimpleJoinScreen::CSimpleJoinScreen()
{
OBJ_CONSTRUCTION_CAPTURING_ALL;
bg = new CPicture("MUDIALOG.bmp"); // address background
pos = bg->center(); //center, window has size of bg graphic (x,y = 396,278 w=232 h=212)
Rect boxRect(20, 20, 205, 50);
title = new CTextBox("Enter address:", boxRect, 0, FONT_BIG, CENTER, Colors::WHITE);
address = new CTextInput(Rect(25, 68, 175, 16), *bg);
address->cb += boost::bind(&CSimpleJoinScreen::onChange, this, _1);
port = new CTextInput(Rect(25, 115, 175, 16), *bg);
port->cb += boost::bind(&CSimpleJoinScreen::onChange, this, _1);
port->filters.add(boost::bind(&CTextInput::numberFilter, _1, _2, 0, 65535));
ok = new CAdventureMapButton(CGI->generaltexth->zelp[560], bind(&CSimpleJoinScreen::enterSelectionScreen, this), 26, 142, "MUBCHCK.DEF", SDLK_RETURN);
cancel = new CAdventureMapButton(CGI->generaltexth->zelp[561], bind(&CGuiHandler::popIntTotally, ref(GH), this), 142, 142, "MUBCANC.DEF", SDLK_ESCAPE);
bar = new CGStatusBar(new CPicture(Rect(7, 186, 218, 18), 0));
port->setTxt(boost::lexical_cast<std::string>(settings["server"]["port"].Float()), true);
address->setTxt(settings["server"]["server"].String(), true);
address->giveFocus();
}
void CSimpleJoinScreen::enterSelectionScreen()
{
std::string textAddress = address->text;
std::string textPort = port->text;
GH.popIntTotally(this);
GH.pushInt(new CSelectionScreen(CMenuScreen::newGame, CMenuScreen::MULTI_NETWORK_GUEST, NULL, textAddress, textPort));
}
void CSimpleJoinScreen::onChange(const std::string & newText)
{
ok->block(address->text.empty() || port->text.empty());
}

View File

@ -359,7 +359,7 @@ public:
bool ongoingClosing;
ui8 myNameID; //used when networking - otherwise all player are "mine"
CSelectionScreen(CMenuScreen::EState Type, CMenuScreen::EMultiMode MultiPlayer = CMenuScreen::SINGLE_PLAYER, const std::map<ui8, std::string> *Names = NULL);
CSelectionScreen(CMenuScreen::EState Type, CMenuScreen::EMultiMode MultiPlayer = CMenuScreen::SINGLE_PLAYER, const std::map<ui8, std::string> * Names = NULL, const std::string & Address = "", const std::string & Port = "");
~CSelectionScreen();
void toggleTab(CIntObject *tab);
void changeSelection(const CMapInfo *to);
@ -606,5 +606,21 @@ public:
void showAll(SDL_Surface *to);
};
/// Simple window to enter the server's address.
class CSimpleJoinScreen : public CIntObject
{
CPicture * bg;
CTextBox * title;
CAdventureMapButton * ok, * cancel;
CGStatusBar * bar;
CTextInput * address;
CTextInput * port;
void enterSelectionScreen();
void onChange(const std::string & newText);
public:
CSimpleJoinScreen();
};
extern ISelectionScreenInfo *SEL;
extern CGPreGame *CGP;

View File

@ -50,7 +50,7 @@ VCMI supports resolutions higher than original 800x600. Namely these are:
Switching resolution may not only change visible area of map, but also alters some interface features such as \hyperref[Stack_Queue]{Stack Queue.}\\
To change resolution or full screen mode use System Options menu when in game. Changes in resolution will take place when you restart VCMI. \\
Fullscreen mode can be toggled anytime using F4 hotkey.
\end{itemize}
%\end{itemize}
\label{Mods}
\subsection{Game modification}
Since 0.9, there is a possibility to edit gameplay settings with config file. You may turn some options on/off or adjust certain values in \texttt{config/defaultMods.json} file. This file is read at game launch and the settings are stored in savegame file, so editing config won't break existing games.\\
@ -149,7 +149,7 @@ Following cheat codes have been implemented in VCMI. Type them in console:
\item \texttt{vcmiforgeofnoldorking} - Hero gets all artifacts except spell book, spell scrolls and war machines
\end{itemize}
\subsection{Command line}
It is possible to save a starting configuration (such as map and options) in pregame by typing \"\texttt{sinfo} filename\". Then VCMI can be started with option \texttt{-i --start=fname} and it will automatically start the game.\\
It is possible to save a starting configuration (such as map and options) in pregame by typing "\texttt{sinfo} filename". Then VCMI can be started with option \texttt{-i --start=fname} and it will automatically start the game.\\
\texttt{--onlyAI} command line option allows to run AI-on-AI game (without GUI). Also, typing \texttt{onlyai} in pregame triggers that mode.
\newpage
\section{Release notes}