Index: vcmimanual.tex =================================================================== --- vcmimanual.tex (revision 3392) +++ vcmimanual.tex (working copy) @@ -50,7 +50,7 @@ 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 @@ \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} Index: client/CPreGame.h =================================================================== --- client/CPreGame.h (revision 3392) +++ client/CPreGame.h (working copy) @@ -359,7 +359,7 @@ 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 *Names = NULL); + CSelectionScreen(CMenuScreen::EState Type, CMenuScreen::EMultiMode MultiPlayer = CMenuScreen::SINGLE_PLAYER, const std::map * Names = NULL, const std::string & Address = "", const std::string & Port = ""); ~CSelectionScreen(); void toggleTab(CIntObject *tab); void changeSelection(const CMapInfo *to); @@ -606,5 +606,21 @@ 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; Index: client/CPreGame.cpp =================================================================== --- client/CPreGame.cpp (revision 3392) +++ client/CPreGame.cpp (working copy) @@ -562,7 +562,7 @@ GH.popInt(GH.topInt()); //remove background } -CSelectionScreen::CSelectionScreen(CMenuScreen::EState Type, CMenuScreen::EMultiMode MultiPlayer /*= CMenuScreen::SINGLE_PLAYER*/, const std::map *Names /*= NULL*/) +CSelectionScreen::CSelectionScreen(CMenuScreen::EState Type, CMenuScreen::EMultiMode MultiPlayer /*= CMenuScreen::SINGLE_PLAYER*/, const std::map * 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 @@ } else { - serv = CServerHandler::justConnectToServer(); + serv = CServerHandler::justConnectToServer(Address, Port); } serv->enterPregameConnectionMode(); @@ -3086,8 +3086,7 @@ { 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 @@ 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(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()); +} +