# HG changeset patch # User Bradley Arsenault # Date 1208024298 14400 # Node ID 77f56e00bc7028c7534e4c887fc507925ee3ee76 # Parent e92bedc6a1a7d78f7b1cdcebe614790efe6c9d59 Made the MultiplayerGameScreen and YOGClientLobbyScreen a tab based interface diff -r e92bedc6a1a7 -r 77f56e00bc70 data/texts.en.txt --- a/data/texts.en.txt Tue Apr 08 00:10:46 2008 -0400 +++ b/data/texts.en.txt Sat Apr 12 14:18:18 2008 -0400 @@ -18,6 +18,10 @@ Add map Add map [add shortcut] Add Shortcut +[Game] +Game +[Lobby] +Lobby [AI] AI [ai] diff -r e92bedc6a1a7 -r 77f56e00bc70 data/texts.keys.txt --- a/data/texts.keys.txt Tue Apr 08 00:10:46 2008 -0400 +++ b/data/texts.keys.txt Sat Apr 12 14:18:18 2008 -0400 @@ -152,6 +152,8 @@ [explorationflag explanation] [explorationflag] [Explorer Ratio] +[Game] +[Lobby] [Explorer] [explorers] [extra islands] diff -r e92bedc6a1a7 -r 77f56e00bc70 libgag/include/GUITabScreen.h --- a/libgag/include/GUITabScreen.h Tue Apr 08 00:10:46 2008 -0400 +++ b/libgag/include/GUITabScreen.h Sat Apr 12 14:18:18 2008 -0400 @@ -37,6 +37,8 @@ namespace GAGGUI class TabScreen : public Screen { public: + TabScreen(); + ///This adds a widget to a particular group. This calls add widget automatically void addWidgetToGroup(Widget* widget, int group_n); @@ -69,10 +71,25 @@ namespace GAGGUI ///remove it if it isn't executing, and the whole thing will close if there are no more TabScreenWindows. ///The return code is the same as the one for the most recently closed window virtual void onTimer(Uint32 tick); + + ///Returns the code that the specific tab screen group number ended with, and -1 if that groups + ///tab screen is still executing + int getReturnCode(int group_n); private: + friend class TabScreenWindow; + + ///Calls internal init on all sub widgets + void internalInit(int group_n); + + ///Re-orders all panel buttons + void repositionPanelButtons(); + std::map > groups; std::map windows; std::map groupButtons; + std::map returnCodes; + int activated; + int returnCode; }; }; diff -r e92bedc6a1a7 -r 77f56e00bc70 libgag/include/GUITabScreenWindow.h --- a/libgag/include/GUITabScreenWindow.h Tue Apr 08 00:10:46 2008 -0400 +++ b/libgag/include/GUITabScreenWindow.h Sat Apr 12 14:18:18 2008 -0400 @@ -58,16 +58,33 @@ namespace GAGGUI ///True if this TabScreenWindow is still executing, false otherwise bool isStillExecuting(); + + ///Calls internal init on all sub codes + void internalInit(); + + ///Returns the tab number + int getTabNumber(); + + ///Returns true if this window is activated + bool isActivated(); + + virtual void onActivated(); protected: friend class TabScreen; ///Ends the execution of the TabScreenWindow with the given end value void endExecute(int returnCode); + + ///Sets whether this window is acticated or not + void setActivated(bool activated); + + ///This is the parent of this tab screen window + TabScreen* parent; private: - TabScreen* parent; int tabNumber; int returnCode; bool isExecuting; + bool activated; }; }; diff -r e92bedc6a1a7 -r 77f56e00bc70 libgag/src/GUITabScreen.cpp --- a/libgag/src/GUITabScreen.cpp Tue Apr 08 00:10:46 2008 -0400 +++ b/libgag/src/GUITabScreen.cpp Sat Apr 12 14:18:18 2008 -0400 @@ -27,10 +27,24 @@ namespace GAGGUI { + TabScreen::TabScreen() + { + activated=0; + returnCode=0; + } + void TabScreen::addWidgetToGroup(Widget* widget, int group_n) { addWidget(widget); groups[group_n].push_back(widget); + if(group_n == activated) + widget->visible=true; + else + widget->visible=false; + if(groups.size()>1) + { + widget->internalInit(); + } } void TabScreen::removeWidgetFromGroup(Widget* widget, int group_n) @@ -44,6 +58,15 @@ namespace GAGGUI void TabScreen::setTabScreenWindowToGroup(TabScreenWindow* window, int group_n) { windows[group_n] = window; + if(group_n==activated) + { + window->setActivated(true); + } + else + { + window->setActivated(false); + } + returnCodes[group_n] = -1; } void TabScreen::removeTabScreenWindowFromGroup(TabScreenWindow* window, int group_n) @@ -74,29 +97,38 @@ namespace GAGGUI } } onGroupActivated(group_n); + activated = group_n; + for(std::map::iterator i = windows.begin(); i!=windows.end(); ++i) + { + if(i->first == group_n) + i->second->setActivated(true); + else + i->second->setActivated(false); + } + if(windows.find(group_n) != windows.end()) + windows[group_n]->onActivated(); } int TabScreen::addGroup(const std::string& title) { - int group_n=0; - while(groupButtons.find(group_n) != groupButtons.end()) - { - group_n+=1; - } + int group_n=returnCode; + returnCode+=1; - groupButtons[group_n] = new TextButton(10 + 210 * group_n, 10, 200, 40, ALIGN_SCREEN_CENTERED, ALIGN_SCREEN_CENTERED, "menu", title.c_str(), 0); + groupButtons[group_n] = new TextButton(0, 0, 200, 40, ALIGN_SCREEN_CENTERED, ALIGN_SCREEN_CENTERED, "menu", title.c_str(), 0); addWidget(groupButtons[group_n]); + groupButtons[group_n]->internalInit(); if(groupButtons.size() == 1) { - groupButtons[0]->visible=false; + groupButtons.begin()->second->visible=false; } else { - for(int i=0; i::iterator i=groupButtons.begin(); i!=groupButtons.end(); ++i) { - groupButtons[i]->visible=true; + i->second->visible=true; } } + repositionPanelButtons(); return group_n; } @@ -113,21 +145,23 @@ namespace GAGGUI if(windows.find(group_n) != windows.end()) windows.erase(windows.find(group_n)); - removeWidget(groupButtons[group_n]); + if(groupButtons[group_n]) + removeWidget(groupButtons[group_n]); delete groupButtons[group_n]; groupButtons.erase(groupButtons.find(group_n)); if(groupButtons.size() == 1) { - groupButtons[0]->visible=false; + groupButtons.begin()->second->visible=false; } else { - for(int i=0; i::iterator i=groupButtons.begin(); i!=groupButtons.end(); ++i) { - groupButtons[i]->visible=true; + i->second->visible=true; } } + repositionPanelButtons(); } void TabScreen::onAction(Widget *source, Action action, int par1, int par2) @@ -135,11 +169,11 @@ namespace GAGGUI bool found=false; if ((action==BUTTON_RELEASED) || (action==BUTTON_SHORTCUT)) { - for(int i=0; i::iterator i=groupButtons.begin(); i!=groupButtons.end(); ++i) { - if(source == groupButtons[i]) + if(source == i->second) { - activateGroup(i); + activateGroup(i->first); found = true; break; } @@ -162,31 +196,66 @@ namespace GAGGUI } } + + void TabScreen::onGroupActivated(int group_n) + { + + } + void TabScreen::onTimer(Uint32 tick) { + int last = -1; for(std::map::iterator i = windows.begin(); i!=windows.end();) { if(!i->second->isStillExecuting()) { - std::map::iterator ni = i++; + std::map::iterator ni = i; + i++; int rc = ni->second->getReturnCode(); - delete ni->second; - + returnCodes[ni->first] = rc; + int n = ni->first; + removeGroup(ni->first); if(windows.size() == 0) { endExecute(rc); } + else if(n == activated) + { + if(last!=-1) + { + activateGroup(last); + } + } } else { + last=i->first; i->second->onTimer(tick); i++; } } } - void TabScreen::onGroupActivated(int group_n) + int TabScreen::getReturnCode(int group_n) { + return returnCodes[group_n]; + } + void TabScreen::internalInit(int group_n) + { + for(std::vector::iterator j = groups[group_n].begin(); j!=groups[group_n].end(); ++j) + { + (*j)->internalInit(); + } + } + + void TabScreen::repositionPanelButtons() + { + int x=0; + for(std::map::iterator i=groupButtons.begin(); i!=groupButtons.end(); ++i) + { + static_cast(i->second)->setScreenPosition(10 + 210 * x, 10); + x++; + } } }; diff -r e92bedc6a1a7 -r 77f56e00bc70 libgag/src/GUITabScreenWindow.cpp --- a/libgag/src/GUITabScreenWindow.cpp Tue Apr 08 00:10:46 2008 -0400 +++ b/libgag/src/GUITabScreenWindow.cpp Sat Apr 12 14:18:18 2008 -0400 @@ -27,6 +27,7 @@ namespace GAGGUI TabScreenWindow::TabScreenWindow(TabScreen* parent, const std::string& tabName) : parent(parent), tabNumber(0), returnCode(0), isExecuting(true) { + activated=false; tabNumber = parent->addGroup(tabName); parent->setTabScreenWindowToGroup(this, tabNumber); } @@ -67,11 +68,36 @@ namespace GAGGUI return isExecuting; } + void TabScreenWindow::internalInit() + { + parent->internalInit(tabNumber); + } + + int TabScreenWindow::getTabNumber() + { + return tabNumber; + } + + bool TabScreenWindow::isActivated() + { + return activated; + } + + void TabScreenWindow::onActivated() + { + + } + void TabScreenWindow::endExecute(int nreturnCode) { isExecuting = false; returnCode = nreturnCode; } + + void TabScreenWindow::setActivated(bool nactivated) + { + activated=nactivated; + } }; diff -r e92bedc6a1a7 -r 77f56e00bc70 src/MultiplayerGame.cpp --- a/src/MultiplayerGame.cpp Tue Apr 08 00:10:46 2008 -0400 +++ b/src/MultiplayerGame.cpp Sat Apr 12 14:18:18 2008 -0400 @@ -36,6 +36,7 @@ MultiplayerGame::MultiplayerGame(boost:: wasReadyToStart=false; sentReadyToStart=false; isEveryoneReadyToGo=false; + isStarting=false; chatChannel=0; previousPercentage = 255; client->getP2PConnection()->addEventListener(this); @@ -215,6 +216,7 @@ void MultiplayerGame::setNetEngine(NetEn void MultiplayerGame::startGame() { + isStarting=true; //make sure the game headers are synced! updateGameHeader(); shared_ptr message(new NetRequestGameStart); @@ -421,7 +423,7 @@ void MultiplayerGame::recieveMessage(boo if(type==MNetRefuseGameStart) { //shared_ptr info = static_pointer_cast(message); - + isStarting=false; shared_ptr event(new MGGameStartRefused); sendToListeners(event); } @@ -624,6 +626,8 @@ Uint32 MultiplayerGame::getChatChannel() Uint8 MultiplayerGame::percentageDownloadFinished() { + if(!assembler) + return 100; return assembler->getPercentage(); } @@ -640,4 +644,10 @@ void MultiplayerGame::recieveP2PEvent(bo } +bool MultiplayerGame::isGameStarting() +{ + return isStarting; +} + + diff -r e92bedc6a1a7 -r 77f56e00bc70 src/MultiplayerGame.h --- a/src/MultiplayerGame.h Tue Apr 08 00:10:46 2008 -0400 +++ b/src/MultiplayerGame.h Sat Apr 12 14:18:18 2008 -0400 @@ -137,6 +137,10 @@ public: ///Recieves a message from the p2p event void recieveP2PEvent(boost::shared_ptr event); + + ///Returns true if the MultiplayerGame is waiting for a reply from the server + ///to start the game + bool isGameStarting(); protected: friend class YOGClient; @@ -173,6 +177,7 @@ private: std::list listeners; Uint32 chatChannel; bool isEveryoneReadyToGo; + bool isStarting; Uint8 previousPercentage; NetGamePlayerManager playerManager; diff -r e92bedc6a1a7 -r 77f56e00bc70 src/MultiplayerGameScreen.cpp --- a/src/MultiplayerGameScreen.cpp Tue Apr 08 00:10:46 2008 -0400 +++ b/src/MultiplayerGameScreen.cpp Sat Apr 12 14:18:18 2008 -0400 @@ -38,46 +38,43 @@ #include "YOGMessage.h" MultiplayerGameScreen::MultiplayerGameScreen(TabScreen* parent, boost::shared_ptr game, boost::shared_ptr client, boost::shared_ptr ircChat) - : TabScreenWindow(parent, "game"), game(game), gameChat(new YOGClientChatChannel(static_cast(-1), client)), ircChat(ircChat) + : TabScreenWindow(parent, Toolkit::getStringTable()->getString("[Game]")), game(game), gameChat(new YOGClientChatChannel(static_cast(-1), client)), ircChat(ircChat) { // we don't want to add AI_NONE for (size_t i=1; igetGameJoinCreationState() == MultiplayerGame::HostingGame || game->getGameJoinCreationState() == MultiplayerGame::WaitingForCreateReply) { - TextButton *button = new TextButton(20, 330-30*(i-1), 180, 20, ALIGN_RIGHT, ALIGN_TOP, "standard", AI::getAIText(i).c_str(), ADD_AI+i); + TextButton *button = new TextButton(20, 400-30*(i-1), 180, 20, ALIGN_RIGHT, ALIGN_TOP, "standard", AI::getAIText(i).c_str(), ADD_AI+i); button->visible = false; addWidget(button); addAI.push_back(button); } } - startButton=new TextButton(20, 385, 180, 40, ALIGN_RIGHT, ALIGN_TOP, "menu", Toolkit::getStringTable()->getString("[Start]"), START); + startButton=new TextButton(20, 455, 180, 40, ALIGN_RIGHT, ALIGN_TOP, "menu", Toolkit::getStringTable()->getString("[Start]"), START); startButton->visible=false; addWidget(startButton); - gameStartWaitingText=new Text(20, 385, ALIGN_RIGHT, ALIGN_TOP, "menu", Toolkit::getStringTable()->getString("[Waiting]"), 180, 30); + gameStartWaitingText=new Text(20, 455, ALIGN_RIGHT, ALIGN_TOP, "menu", Toolkit::getStringTable()->getString("[Waiting]"), 180, 30); addWidget(gameStartWaitingText); gameStartWaitingText->visible = false; if(game->getGameJoinCreationState() == MultiplayerGame::HostingGame || game->getGameJoinCreationState() == MultiplayerGame::WaitingForCreateReply) { - cancelButton = new TextButton(20, 435, 180, 40, ALIGN_RIGHT, ALIGN_TOP, "menu", Toolkit::getStringTable()->getString("[Cancel]"), CANCEL); + cancelButton = new TextButton(20, 505, 180, 40, ALIGN_RIGHT, ALIGN_TOP, "menu", Toolkit::getStringTable()->getString("[Cancel]"), CANCEL); } else { - cancelButton = new TextButton(20, 435, 180, 40, ALIGN_RIGHT, ALIGN_TOP, "menu", Toolkit::getStringTable()->getString("[Leave Game]"), CANCEL); + cancelButton = new TextButton(20, 505, 180, 40, ALIGN_RIGHT, ALIGN_TOP, "menu", Toolkit::getStringTable()->getString("[Leave Game]"), CANCEL); } cancelButton->visible=false; addWidget(cancelButton); - notReadyText=new Text(20, 385, ALIGN_RIGHT, ALIGN_TOP, "menu", Toolkit::getStringTable()->getString("[not ready]"), 180, 30); - notReadyText->visible=true; + notReadyText=new Text(20, 455, ALIGN_RIGHT, ALIGN_TOP, "menu", Toolkit::getStringTable()->getString("[not ready]"), 180, 30); + notReadyText->visible=isActivated(); addWidget(notReadyText); - gameFullText=new Text(20, 335, ALIGN_RIGHT, ALIGN_TOP, "menu", Toolkit::getStringTable()->getString("[game full]"), 180, 30); - gameFullText->visible=false; - addWidget(gameFullText); addWidget(new Text(0, 5, ALIGN_FILL, ALIGN_TOP, "menu", Toolkit::getStringTable()->getString("[awaiting players]"))); @@ -85,13 +82,13 @@ MultiplayerGameScreen::MultiplayerGameSc { int dx=320*(i/8); int dy=20*(i%8); - color[i]=new ColorButton(22+dx, 42+dy, 16, 16, ALIGN_SCREEN_CENTERED, ALIGN_LEFT, COLOR_BUTTONS+i); + color[i]=new ColorButton(22+dx, 112+dy, 16, 16, ALIGN_SCREEN_CENTERED, ALIGN_LEFT, COLOR_BUTTONS+i); for (int j=0; jgetMapHeader().getNumberOfTeams(); j++) color[i]->addColor(game->getMapHeader().getBaseTeam(j).color); addWidget(color[i]); - text[i]=new Text(42+dx, 40+dy, ALIGN_SCREEN_CENTERED, ALIGN_LEFT, "standard", Toolkit::getStringTable()->getString("[open]")); + text[i]=new Text(42+dx, 110+dy, ALIGN_SCREEN_CENTERED, ALIGN_LEFT, "standard", Toolkit::getStringTable()->getString("[open]")); addWidget(text[i]); - kickButton[i]=new TextButton(220+dx, 42+dy, 80, 20, ALIGN_SCREEN_CENTERED, ALIGN_LEFT, "standard", Toolkit::getStringTable()->getString("[kick]"), CLOSE_BUTTONS+i); + kickButton[i]=new TextButton(220+dx, 112+dy, 80, 20, ALIGN_SCREEN_CENTERED, ALIGN_LEFT, "standard", Toolkit::getStringTable()->getString("[kick]"), CLOSE_BUTTONS+i); addWidget(kickButton[i]); wasSlotUsed[i]=false; @@ -100,12 +97,12 @@ MultiplayerGameScreen::MultiplayerGameSc color[i]->visible=false; kickButton[i]->visible=false; } - percentDownloaded=new Text(20, 360, ALIGN_RIGHT, ALIGN_TOP, "menu", ""); + percentDownloaded=new Text(20, 430, ALIGN_RIGHT, ALIGN_TOP, "menu", ""); addWidget(percentDownloaded); - chatWindow=new TextArea(20, 210, 220, 65, ALIGN_FILL, ALIGN_FILL, "standard"); + chatWindow=new TextArea(20, 280, 220, 135, ALIGN_FILL, ALIGN_FILL, "standard"); addWidget(chatWindow); - textInput=new TextInput(20, 20, 220, 25, ALIGN_FILL, ALIGN_BOTTOM, "standard", "", true, 256); + textInput=new TextInput(20, 90, 220, 25, ALIGN_FILL, ALIGN_BOTTOM, "standard", "", true, 256); addWidget(textInput); updateJoinedPlayers(); @@ -138,8 +135,7 @@ void MultiplayerGameScreen::onAction(Wid if (par1 == START) { //MultiplayerGame will send an event when the game is over - gameStartWaitingText->visible=true; - startButton->visible=false; + updateVisibleButtons(); game->startGame(); } else if (par1 == CANCEL) @@ -191,16 +187,11 @@ void MultiplayerGameScreen::handleMultip } else if(type == MGEReadyToStart) { - if(game->getGameJoinCreationState() == MultiplayerGame::HostingGame) - startButton->visible=true; - else - startButton->visible=false; - notReadyText->visible=false; + updateVisibleButtons(); } else if(type == MGENotReadyToStart) { - startButton->visible=false; - notReadyText->visible=true; + updateVisibleButtons(); } else if(type == MGEGameStarted) { @@ -239,20 +230,11 @@ void MultiplayerGameScreen::handleMultip } else if(type == MGEGameStartRefused) { - gameStartWaitingText->visible=false; - startButton->visible=true; + updateVisibleButtons(); } else if(type == MGEGameHostJoinAccepted) { - cancelButton->visible=true; - gameChat->setChannelID(game->getChatChannel()); - if(game->getGameJoinCreationState() == MultiplayerGame::HostingGame) - { - for (size_t i=1; ivisible=true; - } - } + updateVisibleButtons(); } else if(type == MGEDownloadPercentUpdate) { @@ -260,12 +242,8 @@ void MultiplayerGameScreen::handleMultip if(info->getPercentFinished() != 100) { percentDownloaded->setText(FormatableString(Toolkit::getStringTable()->getString("[downloaded %0]")).arg((int)info->getPercentFinished())); - percentDownloaded->visible=true; } - else - { - percentDownloaded->visible=false; - } + updateVisibleButtons(); } } @@ -292,17 +270,17 @@ void MultiplayerGameScreen::updateJoined if(bp.type != BasePlayer::P_NONE) { - text[i]->visible=true; + text[i]->visible=isActivated(); text[i]->setText(bp.name); - color[i]->visible=true; + color[i]->visible=isActivated(); if(game->getGameJoinCreationState() == MultiplayerGame::HostingGame && bp.number != game->getLocalPlayerNumber()) - kickButton[i]->visible=true; + kickButton[i]->visible=isActivated(); else kickButton[i]->visible=false; } else if(i < mh.getNumberOfTeams()) { - text[i]->visible=true; + text[i]->visible=isActivated(); text[i]->setText(Toolkit::getStringTable()->getString("[open]")); color[i]->visible=false; kickButton[i]->visible=false; @@ -317,3 +295,75 @@ void MultiplayerGameScreen::updateJoined } +void MultiplayerGameScreen::updateVisibleButtons() +{ + if(game->isGameStarting()) + { + gameStartWaitingText->visible=isActivated(); + startButton->visible=false; + } + else + { + gameStartWaitingText->visible=false; + startButton->visible=isActivated(); + } + + if(game->isGameReadyToStart()) + { + if(game->getGameJoinCreationState() == MultiplayerGame::HostingGame) + { + if(game->isGameStarting()) + startButton->visible=false; + else + startButton->visible=isActivated(); + } + else + startButton->visible=false; + notReadyText->visible=false; + } + else + { + startButton->visible=false; + notReadyText->visible=isActivated(); + } + if(game->getGameJoinCreationState() == MultiplayerGame::HostingGame || game->getGameJoinCreationState() == MultiplayerGame::JoinedGame) + { + cancelButton->visible=isActivated(); + gameChat->setChannelID(game->getChatChannel()); + if(game->getGameJoinCreationState() == MultiplayerGame::HostingGame) + { + for (size_t i=1; ivisible=isActivated(); + } + } + } + else + { + cancelButton->visible=false; + gameChat->setChannelID(game->getChatChannel()); + if(game->getGameJoinCreationState() == MultiplayerGame::HostingGame) + { + for (size_t i=1; ivisible=false; + } + } + } + if(game->percentageDownloadFinished() != 100) + { + percentDownloaded->visible=isActivated(); + } + else + { + percentDownloaded->visible=false; + } +} + + +void MultiplayerGameScreen::onActivated() +{ + updateJoinedPlayers(); + updateVisibleButtons(); +} + diff -r e92bedc6a1a7 -r 77f56e00bc70 src/MultiplayerGameScreen.h --- a/src/MultiplayerGameScreen.h Tue Apr 08 00:10:46 2008 -0400 +++ b/src/MultiplayerGameScreen.h Sat Apr 12 14:18:18 2008 -0400 @@ -85,6 +85,9 @@ private: ///This function will update the list of joined players void updateJoinedPlayers(); + void updateVisibleButtons(); + + virtual void onActivated(); TextButton *startButton; TextButton *cancelButton; @@ -101,7 +104,6 @@ private: bool wasSlotUsed[MAX_NUMBER_OF_PLAYERS]; Text *notReadyText; - Text *gameFullText; Text *gameStartWaitingText; boost::shared_ptr gameChat; diff -r e92bedc6a1a7 -r 77f56e00bc70 src/P2PConnection.cpp --- a/src/P2PConnection.cpp Tue Apr 08 00:10:46 2008 -0400 +++ b/src/P2PConnection.cpp Sat Apr 12 14:18:18 2008 -0400 @@ -39,7 +39,6 @@ P2PConnection::P2PConnection(YOGClient* localPort = toTryPort; localIncoming = boost::shared_ptr(new NetConnection); isConnecting=true; - std::cout<<"attempting "<openConnection(ip, port); outgoingStates[i] = Attempting; - std::cout<<"Attempting"<isConnected()) { outgoingStates[i] = Connected; - std::cout<<"Connected"<isConnected()) { outgoingStates[i] = ReadyToTry; - std::cout<<"Lost"< client) - : client(client) +YOGClientLobbyScreen::YOGClientLobbyScreen(TabScreen* parent, boost::shared_ptr client) + : TabScreenWindow(parent, Toolkit::getStringTable()->getString("[Lobby]")), client(client) { - addWidget(new Text(0, 10, ALIGN_FILL, ALIGN_TOP, "menu", Toolkit::getStringTable()->getString("[yog]"))); - addWidget(new TextButton(20, 65, 180, 40, ALIGN_RIGHT, ALIGN_BOTTOM, "menu", Toolkit::getStringTable()->getString("[create game]"), CREATE_GAME)); + hostButton = new TextButton(20, 65, 180, 40, ALIGN_RIGHT, ALIGN_BOTTOM, "menu", Toolkit::getStringTable()->getString("[create game]"), CREATE_GAME); + addWidget(hostButton); + addWidget(new TextButton(20, 15, 180, 40, ALIGN_RIGHT, ALIGN_BOTTOM, "menu", Toolkit::getStringTable()->getString("[quit]"), CANCEL, 27)); - gameList=new List(20, 50, 220, 140, ALIGN_FILL, ALIGN_TOP, "standard"); + gameList=new List(20, 120, 220, 140, ALIGN_FILL, ALIGN_TOP, "standard"); addWidget(gameList); - gameInfo=new TextArea(20, 50, 180, 95, ALIGN_RIGHT, ALIGN_TOP, "standard"); + gameInfo=new TextArea(20, 120, 180, 95, ALIGN_RIGHT, ALIGN_TOP, "standard"); addWidget(gameInfo); - joinButton=new TextButton(20, 155, 180, 40, ALIGN_RIGHT, ALIGN_TOP, "menu", Toolkit::getStringTable()->getString("[join]"), JOIN); + joinButton=new TextButton(20, 225, 180, 40, ALIGN_RIGHT, ALIGN_TOP, "menu", Toolkit::getStringTable()->getString("[join]"), JOIN); addWidget(joinButton); - playerList=new YOGClientPlayerList(20, 210, 180, 120, ALIGN_RIGHT, ALIGN_FILL, "standard"); + playerList=new YOGClientPlayerList(20, 280, 180, 135, ALIGN_RIGHT, ALIGN_FILL, "standard"); addWidget(playerList); - chatWindow=new TextArea(20, 210, 220, 65, ALIGN_FILL, ALIGN_FILL, "standard", true, "", "data/gui/yog"); + chatWindow=new TextArea(20, 280, 220, 135, ALIGN_FILL, ALIGN_FILL, "standard", true, "", "data/gui/yog"); addWidget(chatWindow); - textInput=new TextInput(20, 20, 220, 25, ALIGN_FILL, ALIGN_BOTTOM, "standard", "", true, 256); + textInput=new TextInput(20, 90, 220, 25, ALIGN_FILL, ALIGN_BOTTOM, "standard", "", true, 256); addWidget(textInput); lobbyChat.reset(new YOGClientChatChannel(LOBBY_CHAT_CHANNEL, client)); @@ -124,6 +125,8 @@ YOGClientLobbyScreen::YOGClientLobbyScre client->getGameListManager()->addListener(this); client->getPlayerListManager()->addListener(this); lobbyChat->addListener(this); + + gameScreen=-1; } @@ -142,6 +145,7 @@ YOGClientLobbyScreen::~YOGClientLobbyScr void YOGClientLobbyScreen::onAction(Widget *source, Action action, int par1, int par2) { + TabScreenWindow::onAction(source, action, par1, par2); if ((action==BUTTON_RELEASED) || (action==BUTTON_SHORTCUT)) { if (par1==CANCEL) @@ -188,6 +192,35 @@ void YOGClientLobbyScreen::onAction(Widg void YOGClientLobbyScreen::onTimer(Uint32 tick) { + if(gameScreen != -1) + { + int rc = parent->getReturnCode(gameScreen); + if(rc!=-1) + { + boost::shared_ptr game(client->getMultiplayerGame()); + if(rc == MultiplayerGameScreen::Kicked) + recieveInternalMessage(Toolkit::getStringTable()->getString("[You where kicked from the game]")); + else if(rc == MultiplayerGameScreen::GameCancelled) + recieveInternalMessage(Toolkit::getStringTable()->getString("[The host has cancelled the game]")); + else if(rc == MultiplayerGameScreen::GameRefused) + { + if(game->getGameJoinState() == YOGServerGameHasAlreadyStarted) + recieveInternalMessage(Toolkit::getStringTable()->getString("[Can't join game, game has started]")); + else if(game->getGameJoinState() == YOGServerGameIsFull) + recieveInternalMessage(Toolkit::getStringTable()->getString("[Can't join game, game is full]")); + else if(game->getGameJoinState() == YOGServerGameDoesntExist) + recieveInternalMessage(Toolkit::getStringTable()->getString("[Can't join game, game doesn't exist]")); + else if(game->getGameCreationState() == YOGCreateRefusalUnknown) + recieveInternalMessage("Game was refused by server"); + } + client->setMultiplayerGame(boost::shared_ptr()); + gameScreen=-1; + updateButtonVisibility(); + } + } + + TabScreenWindow::onTimer(tick); + ircChat->update(); client->update(); @@ -265,15 +298,10 @@ void YOGClientLobbyScreen::hostGame() game->createNewGame(name); game->setMapHeader(cms.getMapHeader()); - - Glob2TabScreen screen; - MultiplayerGameScreen* mgs = new MultiplayerGameScreen(&screen, game, client, ircChat); - int rc = screen.execute(globalContainer->gfx, 40); - client->setMultiplayerGame(boost::shared_ptr()); - if(rc == -1) - endExecute(-1); - else if(rc == MultiplayerGameScreen::GameRefused) - recieveInternalMessage("Game was refused by server"); + MultiplayerGameScreen* mgs = new MultiplayerGameScreen(parent, game, client, ircChat); + gameScreen = mgs->getTabNumber(); + updateButtonVisibility(); + parent->activateGroup(gameScreen); } else if(rc == -1) endExecute(-1); @@ -298,23 +326,11 @@ void YOGClientLobbyScreen::joinGame() } } game->joinGame(id); - Glob2TabScreen screen; - MultiplayerGameScreen* mgs = new MultiplayerGameScreen(&screen, game, client, ircChat); - int rc = screen.execute(globalContainer->gfx, 40); - client->setMultiplayerGame(boost::shared_ptr()); - if(rc == -1) - endExecute(-1); - else if(rc == MultiplayerGameScreen::Kicked) - recieveInternalMessage(Toolkit::getStringTable()->getString("[You where kicked from the game]")); - else if(rc == MultiplayerGameScreen::GameCancelled) - recieveInternalMessage(Toolkit::getStringTable()->getString("[The host has cancelled the game]")); - else if(rc == MultiplayerGameScreen::GameRefused) - if(game->getGameJoinState() == YOGServerGameHasAlreadyStarted) - recieveInternalMessage(Toolkit::getStringTable()->getString("[Can't join game, game has started]")); - else if(game->getGameJoinState() == YOGServerGameIsFull) - recieveInternalMessage(Toolkit::getStringTable()->getString("[Can't join game, game is full]")); - else if(game->getGameJoinState() == YOGServerGameDoesntExist) - recieveInternalMessage(Toolkit::getStringTable()->getString("[Can't join game, game doesn't exist]")); + MultiplayerGameScreen* mgs = new MultiplayerGameScreen(parent, game, client, ircChat); + gameScreen = mgs->getTabNumber(); + updateButtonVisibility(); + parent->activateGroup(gameScreen); + } } @@ -449,3 +465,23 @@ void YOGClientLobbyScreen::autoCompleteN } } + +void YOGClientLobbyScreen::updateButtonVisibility() +{ + if(gameScreen != -1) + { + joinButton->visible=false; + hostButton->visible=false; + } + else + { + joinButton->visible=true; + hostButton->visible=true; + } +} + + +void YOGClientLobbyScreen::onActivated() +{ + updateButtonVisibility(); +} diff -r e92bedc6a1a7 -r 77f56e00bc70 src/YOGClientLobbyScreen.h --- a/src/YOGClientLobbyScreen.h Tue Apr 08 00:10:46 2008 -0400 +++ b/src/YOGClientLobbyScreen.h Sat Apr 12 14:18:18 2008 -0400 @@ -24,22 +24,27 @@ #include #include -#include "Glob2Screen.h" #include "IRCTextMessageHandler.h" #include "YOGClientEventListener.h" #include "YOGClientChatListener.h" #include "YOGClientGameListListener.h" #include "YOGClientPlayerListListener.h" +#include "GUITabScreenWindow.h" namespace GAGGUI { class TextInput; class TextArea; class TextButton; + class TabScreen; + class Widget; } class YOGClient; class YOGClientChatChannel; +class MultiplayerGameScreen; + +using namespace GAGGUI; /// A widget that maintains the list of players, and draws an icon based /// on whether that player is from YOG or from IRC @@ -78,11 +83,11 @@ private: }; ///This is the main YOG screen -class YOGClientLobbyScreen : public Glob2Screen, public YOGClientEventListener, public YOGClientChatListener, public IRCTextMessageListener, public YOGClientGameListListener, public YOGClientPlayerListListener +class YOGClientLobbyScreen : public TabScreenWindow, public YOGClientEventListener, public YOGClientChatListener, public IRCTextMessageListener, public YOGClientGameListListener, public YOGClientPlayerListListener { public: ///This takes a YOGClient. The client must be logged in when this is called. - YOGClientLobbyScreen(boost::shared_ptr client); + YOGClientLobbyScreen(TabScreen* parent, boost::shared_ptr client); virtual ~YOGClientLobbyScreen(); @@ -134,6 +139,11 @@ private: void updateGameInfo(); ///This will try to match and auto-complete a half-entered nick name void autoCompleteNick(); + ///This wsill update the visibility of the host and join buttons depnding on whether the player + ///is currently in a game or not + void updateButtonVisibility(); + ///Called when this tab is activated + void onActivated(); List *gameList; TextArea *gameInfo; @@ -142,10 +152,13 @@ private: TextArea *chatWindow; TextButton *joinButton; + TextButton *hostButton; boost::shared_ptr client; boost::shared_ptr lobbyChat; boost::shared_ptr ircChat; + + int gameScreen; }; diff -r e92bedc6a1a7 -r 77f56e00bc70 src/YOGConsts.cpp --- a/src/YOGConsts.cpp Tue Apr 08 00:10:46 2008 -0400 +++ b/src/YOGConsts.cpp Sat Apr 12 14:18:18 2008 -0400 @@ -20,6 +20,6 @@ #include "YOGConsts.h" const Uint16 YOG_SERVER_PORT = 7488; -const std::string YOG_SERVER_IP = "yog.globulation2.org"; -//const std::string YOG_SERVER_IP = "127.0.0.1"; +//const std::string YOG_SERVER_IP = "yog.globulation2.org"; +const std::string YOG_SERVER_IP = "127.0.0.1"; diff -r e92bedc6a1a7 -r 77f56e00bc70 src/YOGLoginScreen.cpp --- a/src/YOGLoginScreen.cpp Tue Apr 08 00:10:46 2008 -0400 +++ b/src/YOGLoginScreen.cpp Sat Apr 12 14:18:18 2008 -0400 @@ -150,7 +150,9 @@ void YOGLoginScreen::handleYOGClientEven { //shared_ptr info = static_pointer_cast(event); animation->visible=false; - YOGClientLobbyScreen screen(client); + + Glob2TabScreen screen; + YOGClientLobbyScreen lobby(&screen, client); int rc = screen.execute(globalContainer->gfx, 40); if(rc == YOGClientLobbyScreen::ConnectionLost) endExecute(ConnectionLost); # HG changeset patch # User Bradley Arsenault # Date 1208031179 14400 # Node ID 963e91aba5f2fd408ef26f7a4f89e6d805c261d8 # Parent 77f56e00bc7028c7534e4c887fc507925ee3ee76 Added new class YOGGameResults which will store the results of a match diff -r 77f56e00bc70 -r 963e91aba5f2 src/SConscript --- a/src/SConscript Sat Apr 12 14:18:18 2008 -0400 +++ b/src/SConscript Sat Apr 12 16:12:59 2008 -0400 @@ -1,41 +1,41 @@ source_files = Split(""" source_files = Split(""" -AICastor.cpp AI.cpp AIEcho.cpp AINicowar.cpp -AINull.cpp AINumbi.cpp AIToubib.cpp AIWarrush.cpp -BasePlayer.cpp BaseTeam.cpp BitArray.cpp Brush.cpp -Building.cpp BuildingsTypes.cpp BuildingType.cpp Bullet.cpp -Campaign.cpp CampaignEditor.cpp CampaignMainMenu.cpp CampaignMenuScreen.cpp -CampaignScreen.cpp CampaignSelectorScreen.cpp ChooseMapScreen.cpp CPUStatisticsManager.cpp -CreditScreen.cpp CustomGameScreen.cpp DynamicClouds.cpp EditorMainMenu.cpp -EndGameScreen.cpp Engine.cpp EntityType.cpp Fatal.cpp -FertilityCalculatorDialog.cpp FertilityCalculatorThread.cpp FertilityCalculatorThreadMessage.cpp Game.cpp -GameEvent.cpp GameGUI.cpp GameGUIDefaultAssignManager.cpp GameGUIDialog.cpp -GameGUIGhostBuildingManager.cpp GameGUIKeyActions.cpp GameGUILoadSave.cpp GameGUIMessageManager.cpp -GameGUIToolManager.cpp GameHeader.cpp GameUtilities.cpp Glob2.cpp -Glob2Screen.cpp Glob2Style.cpp GlobalContainer.cpp GUIGlob2FileList.cpp -GUIMapPreview.cpp HeightMapGenerator.cpp IntBuildingType.cpp IRC.cpp -IRCTextMessageHandler.cpp IRCThread.cpp IRCThreadMessage.cpp KeyboardManager.cpp -LANFindScreen.cpp LANGameInformation.cpp LANMenuScreen.cpp LogFileManager.cpp -MainMenuScreen.cpp MapAssembler.cpp Map.cpp MapEdit.cpp -MapEditKeyActions.cpp MapGenerationDescriptor.cpp MapGenerator.cpp MapHeader.cpp -MarkManager.cpp Minimap.cpp MultiplayerGame.cpp MultiplayerGameEvent.cpp -MultiplayerGameEventListener.cpp MultiplayerGameScreen.cpp NetBroadcaster.cpp NetBroadcastListener.cpp -NetConnection.cpp NetConnectionThread.cpp NetConnectionThreadMessage.cpp NetEngine.cpp -NetGamePlayerManager.cpp NetListener.cpp NetMessage.cpp NetReteamingInformation.cpp -NetTestSuite.cpp NewMapScreen.cpp Order.cpp OverlayAreas.cpp -P2PConnection.cpp P2PConnectionEvent.cpp P2PConnectionListener.cpp P2PInformation.cpp -P2PManager.cpp P2PPlayerInformation.cpp PerlinNoise.cpp Player.cpp -Race.cpp Ressource.cpp RessourcesTypes.cpp ScriptEditorScreen.cpp -Sector.cpp Settings.cpp SettingsScreen.cpp SGSL.cpp -SimplexNoise.cpp SoundMixer.cpp Team.cpp TeamStat.cpp -UnitConsts.cpp Unit.cpp UnitEditorScreen.cpp UnitSkin.cpp -UnitsSkins.cpp UnitType.cpp Utilities.cpp VoiceRecorder.cpp -YOGClientChatChannel.cpp YOGClientChatListener.cpp YOGClient.cpp YOGClientEvent.cpp -YOGClientEventListener.cpp YOGClientGameListListener.cpp YOGClientGameListManager.cpp YOGClientLobbyScreen.cpp -YOGClientPlayerListListener.cpp YOGClientPlayerListManager.cpp YOGConsts.cpp -YOGGameInfo.cpp YOGLoginScreen.cpp YOGMessage.cpp YOGPlayerSessionInfo.cpp -YOGPlayerStoredInfo.cpp YOGServerAdministrator.cpp YOGServerAdministratorList.cpp YOGServerChatChannel.cpp -YOGServerChatChannelManager.cpp YOGServer.cpp YOGServerGame.cpp YOGServerMapDistributor.cpp -YOGServerPasswordRegistry.cpp YOGServerPlayer.cpp YOGServerPlayerStoredInfoManager.cpp +AICastor.cpp AI.cpp AIEcho.cpp AINicowar.cpp +AINull.cpp AINumbi.cpp AIToubib.cpp AIWarrush.cpp +BasePlayer.cpp BaseTeam.cpp BitArray.cpp Brush.cpp +Building.cpp BuildingsTypes.cpp BuildingType.cpp Bullet.cpp +Campaign.cpp CampaignEditor.cpp CampaignMainMenu.cpp CampaignMenuScreen.cpp +CampaignScreen.cpp CampaignSelectorScreen.cpp ChooseMapScreen.cpp CPUStatisticsManager.cpp +CreditScreen.cpp CustomGameScreen.cpp DynamicClouds.cpp EditorMainMenu.cpp +EndGameScreen.cpp Engine.cpp EntityType.cpp Fatal.cpp +FertilityCalculatorDialog.cpp FertilityCalculatorThread.cpp FertilityCalculatorThreadMessage.cpp Game.cpp +GameEvent.cpp GameGUI.cpp GameGUIDefaultAssignManager.cpp GameGUIDialog.cpp +GameGUIGhostBuildingManager.cpp GameGUIKeyActions.cpp GameGUILoadSave.cpp GameGUIMessageManager.cpp +GameGUIToolManager.cpp GameHeader.cpp GameUtilities.cpp Glob2.cpp +Glob2Screen.cpp Glob2Style.cpp GlobalContainer.cpp GUIGlob2FileList.cpp +GUIMapPreview.cpp HeightMapGenerator.cpp IntBuildingType.cpp IRC.cpp +IRCTextMessageHandler.cpp IRCThread.cpp IRCThreadMessage.cpp KeyboardManager.cpp +LANFindScreen.cpp LANGameInformation.cpp LANMenuScreen.cpp LogFileManager.cpp +MainMenuScreen.cpp MapAssembler.cpp Map.cpp MapEdit.cpp +MapEditKeyActions.cpp MapGenerationDescriptor.cpp MapGenerator.cpp MapHeader.cpp +MarkManager.cpp Minimap.cpp MultiplayerGame.cpp MultiplayerGameEvent.cpp +MultiplayerGameEventListener.cpp MultiplayerGameScreen.cpp NetBroadcaster.cpp NetBroadcastListener.cpp +NetConnection.cpp NetConnectionThread.cpp NetConnectionThreadMessage.cpp NetEngine.cpp +NetGamePlayerManager.cpp NetListener.cpp NetMessage.cpp NetReteamingInformation.cpp +NetTestSuite.cpp NewMapScreen.cpp Order.cpp OverlayAreas.cpp +P2PConnection.cpp P2PConnectionEvent.cpp P2PConnectionListener.cpp P2PInformation.cpp +P2PManager.cpp P2PPlayerInformation.cpp PerlinNoise.cpp Player.cpp +Race.cpp Ressource.cpp RessourcesTypes.cpp ScriptEditorScreen.cpp +Sector.cpp Settings.cpp SettingsScreen.cpp SGSL.cpp +SimplexNoise.cpp SoundMixer.cpp Team.cpp TeamStat.cpp +UnitConsts.cpp Unit.cpp UnitEditorScreen.cpp UnitSkin.cpp +UnitsSkins.cpp UnitType.cpp Utilities.cpp VoiceRecorder.cpp +YOGClientChatChannel.cpp YOGClientChatListener.cpp YOGClient.cpp YOGClientEvent.cpp +YOGClientEventListener.cpp YOGClientGameListListener.cpp YOGClientGameListManager.cpp YOGClientLobbyScreen.cpp +YOGClientPlayerListListener.cpp YOGClientPlayerListManager.cpp YOGConsts.cpp +YOGGameInfo.cpp YOGGameResults.cpp YOGLoginScreen.cpp YOGMessage.cpp +YOGPlayerSessionInfo.cpp YOGPlayerStoredInfo.cpp YOGServerAdministrator.cpp YOGServerAdministratorList.cpp +YOGServerChatChannel.cpp YOGServerChatChannelManager.cpp YOGServer.cpp YOGServerGame.cpp +YOGServerMapDistributor.cpp YOGServerPasswordRegistry.cpp YOGServerPlayer.cpp YOGServerPlayerStoredInfoManager.cpp """) Import('env') diff -r 77f56e00bc70 -r 963e91aba5f2 src/YOGConsts.h --- a/src/YOGConsts.h Sat Apr 12 14:18:18 2008 -0400 +++ b/src/YOGConsts.h Sat Apr 12 16:12:59 2008 -0400 @@ -138,117 +138,17 @@ enum YOGServerGameStartRefusalReason }; -/* - -#define YOG_SERVER_IP "yog.globulation2.org" -#define YOG_SERVER_PORT 7486 - -// 1s-4s-7.5s-14.5s-22s -#ifndef SECOND_TIMEOUT - -#define SECOND_TIMEOUT 25 -#define SHORT_NETWORK_TIMEOUT 75 -#define DEFAULT_NETWORK_TIMEOUT 175 -#define LONG_NETWORK_TIMEOUT 350 -#define MAX_NETWORK_TIMEOUT 550 - -#define DEFAULT_NETWORK_TOTL 3 -#endif - - -//We allways have: -// 512 char max local messages size, -// 256 char max messages size, -// 64 char max games name size, -// 64 char max map name size, -// 32 char max userName size. - -//Max size is defined by games lists. (4+2+4+2+4+4+64)*16+4=1348 -//or clients (4+32+2)*32+1=1217 -#define YOG_MAX_PACKET_SIZE 1348 -#define YOG_PROTOCOL_VERSION 5 - -enum clientUpdateChange +///This is used to represent the a players success state after a game, +enum YOGGameResult { - CUP_BAD=0, - CUP_LEFT=1, - CUP_PLAYING=2, - CUP_NOT_PLAYING=4, - CUP_AWAY=8, - CUP_NOT_AWAY=16 + ///This represents when the player in question has won the game + YOGGameResultWonGame, + ///This resprsents when the player in question has lost the game + YOGGameResultLostGame, + ///This represents when the player in question has quit its last game + YOGGameResultQuitGame, + ///This reprsents when the player in question lost connection + YOGGameResultConnectionLost, }; -// Those are the messages identifiers inside YOG-client. -// It has to guarantee the binnary compatibility with YOGMessageType, -// except for inside YOG-client only messages. -enum YOGClientMessageType -{ - YCMT_BAD=0, - YCMT_EVENT_MESSAGE=8, - YCMT_MESSAGE=12, - YCMT_PRIVATE_MESSAGE=14, - YCMT_PRIVATE_RECEIPT=16, - YCMT_PRIVATE_RECEIPT_BUT_AWAY=18, - YCMT_ADMIN_MESSAGE=20, -}; - -// data[4] of a YMT_CONNECTION_REFUSED message: -enum YogConnectionRefusedType -{ - YCRT_NOTHING=0, - YCRT_PROTOCOL_TOO_OLD=10, - YCRT_USERNAME_ALLREADY_USED=20, - YCRT_BAD_PASSWORD=30, - YCRT_BAD_PASSWORD_NON_ZERO=34, - YCRT_ALREADY_PASSWORD=40, - YCRT_ALREADY_AUTHENTICATED=50, - YCRT_NOT_CONNECTED_YET=60 -}; - -// Those are all the possible UDP packet identifier, -// used to communicate betweem the YOG-client and the YOG-metaserver. -enum YOGMessageType -{ - YMT_BAD=0, - - YMT_BROADCAST_LAN_GAME_HOSTING=1, - YMT_BROADCAST_REQUEST=2, - YMT_BROADCAST_RESPONSE_LAN=3, - YMT_BROADCAST_RESPONSE_YOG=4, - - YMT_GAME_INFO_FROM_HOST=5, - - YMT_CONNECTING=6, - YMT_AUTHENTICATING=7, - YMT_CONNECTION_REFUSED=8, - YMT_DECONNECTING=9, - - YMT_SEND_MESSAGE=10, - YMT_MESSAGE=12, - YMT_PRIVATE_MESSAGE=14, - YMT_PRIVATE_RECEIPT=16, - YMT_ADMIN_MESSAGE=20, - - YMT_SHARING_GAME=22, - YMT_STOP_SHARING_GAME=24, - YMT_STOP_PLAYING_GAME=26, - - YMT_HOST_GAME_SOCKET=30, - YMT_JOIN_GAME_SOCKET=32, - - YMT_GAMES_LIST=40, - YMT_UNSHARED_LIST=42, - - YMT_CLIENTS_LIST=50, - YMT_UPDATE_CLIENTS_LIST=52, - - YMT_CONNECTION_PRESENCE=80, - - YMT_PLAYERS_WANTS_TO_JOIN=100, - - YMT_FLUSH_FILES=126, - YMT_CLOSE_YOG=127 -}; -*/ - #endif diff -r 77f56e00bc70 -r 963e91aba5f2 src/YOGGameResults.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/YOGGameResults.cpp Sat Apr 12 16:12:59 2008 -0400 @@ -0,0 +1,123 @@ +/* + Copyright 2008 (C) Bradley Arsenault + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + + +#include "YOGGameResults.h" + +#include +#include "Stream.h" + +YOGGameResults::YOGGameResults() +{ + +} + + +void YOGGameResults::setNumberOfPlayers(int number) +{ + results.resize(number); + names.resize(number); +} + + +void YOGGameResults::setGameResultState(int player, YOGGameResult result) +{ + results[player] = result; +} + + +YOGGameResult YOGGameResults::getGameResultState(int player) +{ + return results[player]; +} + + +void YOGGameResults::setPlayerName(int player, const std::string& name) +{ + names[player] = name; +} + + +std::string YOGGameResults::getPlayerName(int player) +{ + return names[player]; +} + + +void YOGGameResults::encodeData(GAGCore::OutputStream* stream) const +{ + stream->writeEnterSection("YOGGameResults"); + stream->writeUint32(results.size(), "size"); + for(int i=0; iwriteEnterSection(i); + stream->writeUint8(static_cast(results[i]), "result"); + stream->writeText(names[i], "name"); + stream->writeLeaveSection(); + } + stream->writeLeaveSection(); +} + + + +void YOGGameResults::decodeData(GAGCore::InputStream* stream) +{ + stream->readEnterSection("YOGGameResults"); + Uint32 size = stream->readUint32("size"); + results.resize(size); + names.resize(size); + for(int i=0; ireadEnterSection(i); + results[i] = static_cast(stream->readUint8("result")); + names[i] = stream->readText("name"); + stream->readLeaveSection(); + } + + stream->readLeaveSection(); +} + + + +bool YOGGameResults::operator==(const YOGGameResults& rhs) const +{ + if(results == rhs.results && names == rhs.names) + { + return true; + } + else + { + return false; + } + return false; +} + + + +bool YOGGameResults::operator!=(const YOGGameResults& rhs) const +{ + if(results != rhs.results || names != rhs.names) + { + return true; + } + else + { + return false; + } + return false; +} diff -r 77f56e00bc70 -r 963e91aba5f2 src/YOGGameResults.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/YOGGameResults.h Sat Apr 12 16:12:59 2008 -0400 @@ -0,0 +1,68 @@ +/* + Copyright 2008 (C) Bradley Arsenault + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + + +#ifndef YOGGameResults_h +#define YOGGameResults_h + +#include "YOGConsts.h" +#include + +namespace GAGCore +{ + class OutputStream; + class InputStream; +} + +///This stores the win/lose/disconnected results for a single game +class YOGGameResults +{ +public: + ///Constructs a default yog game results + YOGGameResults(); + + ///Sets the number of players for this game result + void setNumberOfPlayers(int number); + + ///Sets the game result state for a particular player + void setGameResultState(int player, YOGGameResult result); + + ///Gets the game result state for a particular player + YOGGameResult getGameResultState(int player); + + ///Sets the player name for a particular player number + void setPlayerName(int player, const std::string& name); + + ///Returns the player name for a particular player number + std::string getPlayerName(int player); + + ///Encodes this YOGGameResults into a bit stream + void encodeData(GAGCore::OutputStream* stream) const; + + ///Decodes this YOGGameResults from a bit stream + void decodeData(GAGCore::InputStream* stream); + + ///Test for equality between two YOGGameResults + bool operator==(const YOGGameResults& rhs) const; + bool operator!=(const YOGGameResults& rhs) const; +private: + std::vector results; + std::vector names; +}; + +#endif diff -r 77f56e00bc70 -r 963e91aba5f2 src/YOGServerGame.cpp --- a/src/YOGServerGame.cpp Sat Apr 12 14:18:18 2008 -0400 +++ b/src/YOGServerGame.cpp Sat Apr 12 16:12:59 2008 -0400 @@ -132,6 +132,7 @@ void YOGServerGame::addPlayer(shared_ptr chooseLatencyMode(); server.getGameInfo(gameID).setPlayersJoined(players.size()); + gameResults.setNumberOfPlayers(aiNum + players.size()); } @@ -145,6 +146,7 @@ void YOGServerGame::addAIPlayer(AI::Impl aiNum+=1; server.getGameInfo(gameID).setAIJoined(aiNum); + gameResults.setNumberOfPlayers(aiNum + players.size()); } @@ -190,6 +192,7 @@ void YOGServerGame::removePlayer(shared_ chooseLatencyMode(); server.getGameInfo(gameID).setPlayersJoined(players.size()); + gameResults.setNumberOfPlayers(aiNum + players.size()); } @@ -203,6 +206,7 @@ void YOGServerGame::removeAIPlayer(int p aiNum-=1; server.getGameInfo(gameID).setAIJoined(aiNum); + gameResults.setNumberOfPlayers(aiNum + players.size()); } @@ -392,8 +396,7 @@ void YOGServerGame::chooseLatencyMode() } //Add 5% to both pings. The given pings are such that 99.7% of all pings will - //be under those amounts, provided pings are normally distributed, which they - //usually are + //be under those amounts, provided pings are normally distributed int total_allocation = (highest * 105 + second_highest * 105) / 100; int latency_adjustment = (total_allocation+39) / 40; diff -r 77f56e00bc70 -r 963e91aba5f2 src/YOGServerGame.h --- a/src/YOGServerGame.h Sat Apr 12 14:18:18 2008 -0400 +++ b/src/YOGServerGame.h Sat Apr 12 16:12:59 2008 -0400 @@ -24,6 +24,7 @@ #include "NetGamePlayerManager.h" #include "NetReteamingInformation.h" #include "P2PManager.h" +#include "YOGGameResults.h" class NetKickPlayer; class NetSendOrder; @@ -133,6 +134,7 @@ private: Uint32 chatChannel; Uint8 aiNum; YOGServer& server; + YOGGameResults gameResults; }; # HG changeset patch # User Bradley Arsenault # Date 1208096675 14400 # Node ID 6d38e0c8879a36242c2403e50aa926e4aa583886 # Parent 963e91aba5f2fd408ef26f7a4f89e6d805c261d8 Made YOGServerGame store a YOGGameResult and keep it updated diff -r 963e91aba5f2 -r 6d38e0c8879a src/Engine.cpp --- a/src/Engine.cpp Sat Apr 12 16:12:59 2008 -0400 +++ b/src/Engine.cpp Sun Apr 13 10:24:35 2008 -0400 @@ -424,6 +424,38 @@ int Engine::run(void) } cpuStats.format(); + + if(multiplayer) + { + if (gui.game.totalPrestigeReached) + { + Team *t=gui.game.getTeamWithMostPrestige(); + assert(t); + if (t==gui.getLocalTeam()) + { + multiplayer->setGameResult(YOGGameResultWonGame); + } + else + { + if ((t->allies) & (gui.getLocalTeam()->me)) + multiplayer->setGameResult(YOGGameResultWonGame); + else + multiplayer->setGameResult(YOGGameResultLostGame); + } + } + else if(gui.getLocalTeam()->hasWon) + { + multiplayer->setGameResult(YOGGameResultWonGame); + } + else if (!gui.getLocalTeam()->isAlive) + { + multiplayer->setGameResult(YOGGameResultLostGame); + } + else if (!gui.game.isGameEnded) + { + multiplayer->setGameResult(YOGGameResultQuitGame); + } + } delete net; net=NULL; diff -r 963e91aba5f2 -r 6d38e0c8879a src/MultiplayerGame.cpp --- a/src/MultiplayerGame.cpp Sat Apr 12 16:12:59 2008 -0400 +++ b/src/MultiplayerGame.cpp Sun Apr 13 10:24:35 2008 -0400 @@ -644,6 +644,7 @@ void MultiplayerGame::recieveP2PEvent(bo } + bool MultiplayerGame::isGameStarting() { return isStarting; @@ -651,3 +652,10 @@ bool MultiplayerGame::isGameStarting() +void MultiplayerGame::setGameResult(YOGGameResult result) +{ + shared_ptr message(new NetSendGameResult(result)); + client->sendNetMessage(message); +} + + diff -r 963e91aba5f2 -r 6d38e0c8879a src/MultiplayerGame.h --- a/src/MultiplayerGame.h Sat Apr 12 16:12:59 2008 -0400 +++ b/src/MultiplayerGame.h Sun Apr 13 10:24:35 2008 -0400 @@ -141,6 +141,9 @@ public: ///Returns true if the MultiplayerGame is waiting for a reply from the server ///to start the game bool isGameStarting(); + + ///This sets the game result for the local player + void setGameResult(YOGGameResult result); protected: friend class YOGClient; diff -r 963e91aba5f2 -r 6d38e0c8879a src/NetMessage.cpp --- a/src/NetMessage.cpp Sat Apr 12 16:12:59 2008 -0400 +++ b/src/NetMessage.cpp Sun Apr 13 10:24:35 2008 -0400 @@ -166,6 +166,9 @@ shared_ptr NetMessage::getNe case MNetSetPlayerLocalPort: message.reset(new NetSetPlayerLocalPort); break; + case MNetSendGameResult: + message.reset(new NetSendGameResult); + break; ///append_create_point } message->decodeData(stream); @@ -3304,4 +3307,73 @@ Uint16 NetSetPlayerLocalPort::getPort() + +NetSendGameResult::NetSendGameResult() + : result(YOGGameResultUnknown) +{ + +} + + + +NetSendGameResult::NetSendGameResult(YOGGameResult result) + :result(result) +{ +} + + + +Uint8 NetSendGameResult::getMessageType() const +{ + return MNetSendGameResult; +} + + + +void NetSendGameResult::encodeData(GAGCore::OutputStream* stream) const +{ + stream->writeEnterSection("NetSendGameResult"); + stream->writeUint8(static_cast(result), "result"); + stream->writeLeaveSection(); +} + + + +void NetSendGameResult::decodeData(GAGCore::InputStream* stream) +{ + stream->readEnterSection("NetSendGameResult"); + result = static_cast(stream->readUint8("result")); + stream->readLeaveSection(); +} + + + +std::string NetSendGameResult::format() const +{ + std::ostringstream s; + s<<"NetSendGameResult("<<"result="<(rhs); + if(r.result == result) + return true; + } + return false; +} + + +YOGGameResult NetSendGameResult::getGameResult() const +{ + return result; +} + + + //append_code_position diff -r 963e91aba5f2 -r 6d38e0c8879a src/NetMessage.h --- a/src/NetMessage.h Sat Apr 12 16:12:59 2008 -0400 +++ b/src/NetMessage.h Sun Apr 13 10:24:35 2008 -0400 @@ -78,16 +78,17 @@ enum NetMessageType MNetSendFileInformation, MNetSendGameHeader, MNetSendGamePlayerInfo, + MNetSendGameResult, MNetSendMapHeader, MNetSendOrder, + MNetSendP2PInformation, + MNetSendReteamingInformation, MNetSendYOGMessage, MNetSetLatencyMode, + MNetSetPlayerLocalPort, MNetStartGame, MNetUpdateGameList, MNetUpdatePlayerList, - MNetSendReteamingInformation, - MNetSendP2PInformation, - MNetSetPlayerLocalPort, //type_append_marker }; @@ -1671,6 +1672,42 @@ private: private: private: Uint16 port; +}; + + + + +///NetSendGameResult +class NetSendGameResult : public NetMessage +{ +public: + ///Creates a NetSendGameResult message + NetSendGameResult(); + + ///Creates a NetSendGameResult message + NetSendGameResult(YOGGameResult result); + + ///Returns MNetSendGameResult + Uint8 getMessageType() const; + + ///Encodes the data + void encodeData(GAGCore::OutputStream* stream) const; + + ///Decodes the data + void decodeData(GAGCore::InputStream* stream); + + ///Formats the NetSendGameResult message with a small amount + ///of information. + std::string format() const; + + ///Compares with another NetSendGameResult + bool operator==(const NetMessage& rhs) const; + + ///Retrieves result + YOGGameResult getGameResult() const; +private: +private: + YOGGameResult result; }; diff -r 963e91aba5f2 -r 6d38e0c8879a src/YOGConsts.h --- a/src/YOGConsts.h Sat Apr 12 16:12:59 2008 -0400 +++ b/src/YOGConsts.h Sun Apr 13 10:24:35 2008 -0400 @@ -149,6 +149,8 @@ enum YOGGameResult YOGGameResultQuitGame, ///This reprsents when the player in question lost connection YOGGameResultConnectionLost, + ///This represents when the game result is unknown + YOGGameResultUnknown, }; #endif diff -r 963e91aba5f2 -r 6d38e0c8879a src/YOGGameResults.cpp --- a/src/YOGGameResults.cpp Sat Apr 12 16:12:59 2008 -0400 +++ b/src/YOGGameResults.cpp Sun Apr 13 10:24:35 2008 -0400 @@ -30,7 +30,7 @@ YOGGameResults::YOGGameResults() void YOGGameResults::setNumberOfPlayers(int number) { - results.resize(number); + results.resize(number, YOGGameResultUnknown); names.resize(number); } diff -r 963e91aba5f2 -r 6d38e0c8879a src/YOGServerGame.cpp --- a/src/YOGServerGame.cpp Sat Apr 12 16:12:59 2008 -0400 +++ b/src/YOGServerGame.cpp Sun Apr 13 10:24:35 2008 -0400 @@ -177,6 +177,10 @@ void YOGServerGame::removePlayer(shared_ } } } + else + { + setPlayerGameResult(player, YOGGameResultConnectionLost); + }; p2p.removePlayer(player); @@ -409,4 +413,19 @@ void YOGServerGame::chooseLatencyMode() } +void YOGServerGame::setPlayerGameResult(boost::shared_ptr sender, YOGGameResult result) +{ + for(int i=0; igetPlayerID()) + { + if(gameResults.getGameResultState(i) == YOGGameResultUnknown) + { + std::cout<<"player "< sender, YOGGameResult result); private: bool gameStarted; diff -r 963e91aba5f2 -r 6d38e0c8879a src/YOGServerPlayer.cpp --- a/src/YOGServerPlayer.cpp Sat Apr 12 16:12:59 2008 -0400 +++ b/src/YOGServerPlayer.cpp Sun Apr 13 10:24:35 2008 -0400 @@ -264,6 +264,12 @@ void YOGServerPlayer::update() shared_ptr info = static_pointer_cast(message); port = info->getPort(); } + //This recieves a ping reply + else if(type==MNetSendGameResult) + { + shared_ptr info = static_pointer_cast(message); + ngame->setPlayerGameResult(server.getPlayer(playerID), info->getGameResult()); + } } diff -r 963e91aba5f2 -r 6d38e0c8879a src/add_irc_message.py --- a/src/add_irc_message.py Sat Apr 12 16:12:59 2008 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,103 +0,0 @@ -from add_stuff_base import * - -backup("IRCThreadMessage.h") -backup("IRCThreadMessage.cpp") - -print "Name? " -name = raw_input() -tname = "ITM"+name.replace("IT", "") - -variables = assemble_variables(False, False) -vn = len(variables) - -constructor=assemble_constructor_define(variables) - -declare_functions=assemble_declare_get_functions(variables) -declare_variables=assemble_declare_variables(variables) - - -initialize_variables="" -if vn: - initialize_variables=" : " - initialize_variables+=assemble_initialize_variables(variables) - initialize_variables+="\n" - - -format_variables = assemble_format_variables(variables) -compare_variables = assemble_compare_variables(variables) -get_function_defines = assemble_get_function_definitions(variables) - -hcode = """ -///mname -class mname : public IRCThreadMessage -{ -public: - ///Creates a mname event - """ + constructor + """; - - ///Returns tname - Uint8 getMessageType() const; - - ///Returns a formatted version of the event - std::string format() const; - - ///Compares two IRCThreadMessage - bool operator==(const IRCThreadMessage& rhs) const; -""" -hcode+=declare_functions -hcode+=declare_variables -hcode+="""}; - - - -""" - -scode="" - -scode+="mname::%s\n" % constructor -scode+=initialize_variables -scode+="{\n}\n\n\n\n" -scode+="""Uint8 mname::getMessageType() const -{ - return tname; -} - - - -std::string mname::format() const -{ -""" + format_variables + """ - return s.str(); -} - - - -bool mname::operator==(const IRCThreadMessage& rhs) const -{ - if(typeid(rhs)==typeid(mname)) - { -""" + compare_variables + """ - } - return false; -} - - -""" - -scode += get_function_defines - - -lines = readLines("IRCThreadMessage.h") -i = findMarker(lines,"type_append_marker") -lines.insert(i, " %s,\n" % tname) - - -i = findMarker(lines,"event_append_marker") -lines.insert(i, hcode.replace("mname", name).replace("tname", tname)) -writeLines("IRCThreadMessage.h", lines) - -lines = readLines("IRCThreadMessage.cpp") -i = findMarker(lines, "code_append_marker") -lines.insert(i, scode.replace("mname", name).replace("tname", tname)) -writeLines("IRCThreadMessage.cpp", lines) - diff -r 963e91aba5f2 -r 6d38e0c8879a src/add_irc_thread_message.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/add_irc_thread_message.py Sun Apr 13 10:24:35 2008 -0400 @@ -0,0 +1,103 @@ +from add_stuff_base import * + +backup("IRCThreadMessage.h") +backup("IRCThreadMessage.cpp") + +print "Name? " +name = raw_input() +tname = "ITM"+name.replace("IT", "") + +variables = assemble_variables(False, False) +vn = len(variables) + +constructor=assemble_constructor_define(variables) + +declare_functions=assemble_declare_get_functions(variables) +declare_variables=assemble_declare_variables(variables) + + +initialize_variables="" +if vn: + initialize_variables=" : " + initialize_variables+=assemble_initialize_variables(variables) + initialize_variables+="\n" + + +format_variables = assemble_format_variables(variables) +compare_variables = assemble_compare_variables(variables) +get_function_defines = assemble_get_function_definitions(variables) + +hcode = """ +///mname +class mname : public IRCThreadMessage +{ +public: + ///Creates a mname event + """ + constructor + """; + + ///Returns tname + Uint8 getMessageType() const; + + ///Returns a formatted version of the event + std::string format() const; + + ///Compares two IRCThreadMessage + bool operator==(const IRCThreadMessage& rhs) const; +""" +hcode+=declare_functions +hcode+=declare_variables +hcode+="""}; + + + +""" + +scode="" + +scode+="mname::%s\n" % constructor +scode+=initialize_variables +scode+="{\n}\n\n\n\n" +scode+="""Uint8 mname::getMessageType() const +{ + return tname; +} + + + +std::string mname::format() const +{ +""" + format_variables + """ + return s.str(); +} + + + +bool mname::operator==(const IRCThreadMessage& rhs) const +{ + if(typeid(rhs)==typeid(mname)) + { +""" + compare_variables + """ + } + return false; +} + + +""" + +scode += get_function_defines + + +lines = readLines("IRCThreadMessage.h") +i = findMarker(lines,"type_append_marker") +lines.insert(i, " %s,\n" % tname) + + +i = findMarker(lines,"event_append_marker") +lines.insert(i, hcode.replace("mname", name).replace("tname", tname)) +writeLines("IRCThreadMessage.h", lines) + +lines = readLines("IRCThreadMessage.cpp") +i = findMarker(lines, "code_append_marker") +lines.insert(i, scode.replace("mname", name).replace("tname", tname)) +writeLines("IRCThreadMessage.cpp", lines) + diff -r 963e91aba5f2 -r 6d38e0c8879a src/add_message.py --- a/src/add_message.py Sat Apr 12 16:12:59 2008 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,160 +0,0 @@ -from add_stuff_base import * - -backup("NetMessage.h") -backup("NetMessage.cpp") - -print "Name? " -name = raw_input() - -variables = assemble_variables(True, True) -vn = len(variables) - - -constructor="" -if vn: - constructor = assemble_constructor_define(variables) - -declare_functions = assemble_declare_get_functions(variables) -declare_variables = assemble_declare_variables(variables) -initialize_variable_defaults = assemble_initialize_variable_defaults(variables) -initialize_variables = assemble_initialize_variables(variables) -format_variables = assemble_format_variables(variables) -compare_variables = assemble_compare_variables(variables) -get_function_defines = assemble_get_function_definitions(variables) - -hcode = """ -///mname -class mname : public NetMessage -{ -public: - ///Creates a mname message - mname(); - -""" - -if vn: - hcode+=" ///Creates a mname message\n" - hcode+=" %s;\n\n" % constructor -hcode+=""" ///Returns Mmname - Uint8 getMessageType() const; - - ///Encodes the data - void encodeData(GAGCore::OutputStream* stream) const; - - ///Decodes the data - void decodeData(GAGCore::InputStream* stream); - - ///Formats the mname message with a small amount - ///of information. - std::string format() const; - - ///Compares with another mname - bool operator==(const NetMessage& rhs) const; -""" -if vn: - hcode+=declare_functions - hcode+="private:\n" - hcode+=declare_variables -hcode+="""}; - - - -""" - -scode=""" -mname::mname() -""" -if vn: - scode+=" :" - scode+=initialize_variable_defaults - scode+="\n" -scode+="""{ - -} - - - -""" - -if vn: - scode+="mname::%s\n" % constructor - scode+=" :" - scode+=initialize_variables - scode+="\n" - scode+="{\n}\n\n\n\n" -scode+="""Uint8 mname::getMessageType() const -{ - return Mmname; -} - - - -void mname::encodeData(GAGCore::OutputStream* stream) const -{ - stream->writeEnterSection("mname"); -""" -if vn: - for v in variables: - scode+=" stream->write%s(%s, \"%s\");\n" % (v[5], v[1], v[1]) -scode+=""" stream->writeLeaveSection(); -} - - - -void mname::decodeData(GAGCore::InputStream* stream) -{ - stream->readEnterSection("mname"); -""" -if vn: - for v in variables: - scode+=" %s = stream->read%s(\"%s\");\n" % (v[1], v[5], v[1]) -scode+=""" stream->readLeaveSection(); -} - - - -std::string mname::format() const -{ -""" + format_variables + """ - return s.str(); -} - - - -bool mname::operator==(const NetMessage& rhs) const -{ - if(typeid(rhs)==typeid(mname)) - { -""" + compare_variables + """ - } - return false; -} - - -""" - -scode += get_function_defines - - -lines = readLines("NetMessage.h") -i = findMarker(lines,"type_append_marker") -lines.insert(i, " M%s,\n" % name) - - -i = findMarker(lines,"message_append_marker") -lines.insert(i, hcode.replace("mname", name)) -writeLines("NetMessage.h", lines) - - -lines = readLines("NetMessage.cpp") -i = findMarker(lines, "append_create_point") -lines.insert(i, """ case Mmname: - message.reset(new mname); - break; -""".replace("mname", name)) - -i = findMarker(lines, "append_code_position") -lines.insert(i, scode.replace("mname", name)) - -writeLines("NetMessage.cpp", lines) - diff -r 963e91aba5f2 -r 6d38e0c8879a src/add_net_message.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/add_net_message.py Sun Apr 13 10:24:35 2008 -0400 @@ -0,0 +1,160 @@ +from add_stuff_base import * + +backup("NetMessage.h") +backup("NetMessage.cpp") + +print "Name? " +name = raw_input() + +variables = assemble_variables(True, True) +vn = len(variables) + + +constructor="" +if vn: + constructor = assemble_constructor_define(variables) + +declare_functions = assemble_declare_get_functions(variables) +declare_variables = assemble_declare_variables(variables) +initialize_variable_defaults = assemble_initialize_variable_defaults(variables) +initialize_variables = assemble_initialize_variables(variables) +format_variables = assemble_format_variables(variables) +compare_variables = assemble_compare_variables(variables) +get_function_defines = assemble_get_function_definitions(variables) + +hcode = """ +///mname +class mname : public NetMessage +{ +public: + ///Creates a mname message + mname(); + +""" + +if vn: + hcode+=" ///Creates a mname message\n" + hcode+=" %s;\n\n" % constructor +hcode+=""" ///Returns Mmname + Uint8 getMessageType() const; + + ///Encodes the data + void encodeData(GAGCore::OutputStream* stream) const; + + ///Decodes the data + void decodeData(GAGCore::InputStream* stream); + + ///Formats the mname message with a small amount + ///of information. + std::string format() const; + + ///Compares with another mname + bool operator==(const NetMessage& rhs) const; +""" +if vn: + hcode+=declare_functions + hcode+="private:\n" + hcode+=declare_variables +hcode+="""}; + + + +""" + +scode=""" +mname::mname() +""" +if vn: + scode+=" :" + scode+=initialize_variable_defaults + scode+="\n" +scode+="""{ + +} + + + +""" + +if vn: + scode+="mname::%s\n" % constructor + scode+=" :" + scode+=initialize_variables + scode+="\n" + scode+="{\n}\n\n\n\n" +scode+="""Uint8 mname::getMessageType() const +{ + return Mmname; +} + + + +void mname::encodeData(GAGCore::OutputStream* stream) const +{ + stream->writeEnterSection("mname"); +""" +if vn: + for v in variables: + scode+=" stream->write%s(%s, \"%s\");\n" % (v[5], v[1], v[1]) +scode+=""" stream->writeLeaveSection(); +} + + + +void mname::decodeData(GAGCore::InputStream* stream) +{ + stream->readEnterSection("mname"); +""" +if vn: + for v in variables: + scode+=" %s = stream->read%s(\"%s\");\n" % (v[1], v[5], v[1]) +scode+=""" stream->readLeaveSection(); +} + + + +std::string mname::format() const +{ +""" + format_variables + """ + return s.str(); +} + + + +bool mname::operator==(const NetMessage& rhs) const +{ + if(typeid(rhs)==typeid(mname)) + { +""" + compare_variables + """ + } + return false; +} + + +""" + +scode += get_function_defines + + +lines = readLines("NetMessage.h") +i = findMarker(lines,"type_append_marker") +lines.insert(i, " M%s,\n" % name) + + +i = findMarker(lines,"message_append_marker") +lines.insert(i, hcode.replace("mname", name)) +writeLines("NetMessage.h", lines) + + +lines = readLines("NetMessage.cpp") +i = findMarker(lines, "append_create_point") +lines.insert(i, """ case Mmname: + message.reset(new mname); + break; +""".replace("mname", name)) + +i = findMarker(lines, "append_code_position") +lines.insert(i, scode.replace("mname", name)) + +writeLines("NetMessage.cpp", lines) + # HG changeset patch # User Bradley Arsenault # Date 1208140003 14400 # Node ID beec6cd83d42596f62ce86d121819c60bb51b75f # Parent 6d38e0c8879a36242c2403e50aa926e4aa583886 Started seperating the YOG daemon from the rest of the game. diff -r 6d38e0c8879a -r beec6cd83d42 SConstruct --- a/SConstruct Sun Apr 13 10:24:35 2008 -0400 +++ b/SConstruct Sun Apr 13 22:26:43 2008 -0400 @@ -25,6 +25,7 @@ def establish_options(env): opts.Add(BoolOption("release", "Build for release", 0)) opts.Add(BoolOption("profile", "Build with profiling on", 0)) opts.Add(BoolOption("mingw", "Build with mingw enabled if not auto-detected", 0)) + opts.Add(BoolOption("server", "Build only the YOG server, excluding the game and any GUI/sound components", 0)) Help(opts.GenerateHelpText(env)) opts.Update(env) opts.Save("options_cache.py", env) @@ -60,33 +61,38 @@ def configure(env): configfile.add("USE_OSX", "Set when this build is OSX") if isWindowsPlatform: configfile.add("USE_WIN32", "Set when this build is Win32") + + server_only=False + if env['server']: + env.Append(CPPDEFINES=["YOG_SERVER_ONLY"]) + server_only=True missing=[] env.Append(CPPDEFINES=["HAVE_CONFIG_H"]) #Simple checks for required libraries - if not conf.CheckLib("SDL"): + if not conf.CheckLib("SDL") and not server_only: print "Could not find libSDL" missing.append("SDL") - if not conf.CheckLib("SDL_ttf"): + if not conf.CheckLib("SDL_ttf") and not server_only: print "Could not find libSDL_ttf" missing.append("SDL_ttf") - if not conf.CheckLib("SDL_image"): + if not conf.CheckLib("SDL_image") and not server_only: print "Could not find libSDL_image" missing.append("SDL_image") - if not conf.CheckLib("SDL_net"): + if not conf.CheckLib("SDL_net") and not server_only: print "Could not find libSDL_net" missing.append("SDL_net") - if not conf.CheckLib("speex") or not conf.CheckCXXHeader("speex/speex.h"): + if not conf.CheckLib("speex") or not conf.CheckCXXHeader("speex/speex.h") and not server_only: print "Could not find libspeex or could not find 'speex/speex.h'" missing.append("speex") - if not conf.CheckLib("vorbisfile"): + if not conf.CheckLib("vorbisfile") and not server_only: print "Could not find libvorbisfile" missing.append("vorbisfile") - if not conf.CheckLib("vorbis"): + if not conf.CheckLib("vorbis") and not server_only: print "Could not find libvorbis" missing.append("vorbis") - if not conf.CheckLib("ogg"): + if not conf.CheckLib("ogg") and not server_only: print "Could not find libogg" missing.append("ogg") if not conf.CheckCXXHeader("zlib.h"): @@ -133,31 +139,30 @@ def configure(env): #Do checks for OpenGL, which is different on every system gl_libraries = [] - if isDarwinPlatform: + if isDarwinPlatform and not server_only: print "Using Apple's OpenGL framework" env.Append(FRAMEWORKS="OpenGL") - elif conf.CheckLib("GL") and conf.CheckCXXHeader("GL/gl.h"): + elif conf.CheckLib("GL") and conf.CheckCXXHeader("GL/gl.h") and not server_only: gl_libraries.append("GL") - elif conf.CheckLib("GL") and conf.CheckCXXHeader("OpenGL/gl.h"): + elif conf.CheckLib("GL") and conf.CheckCXXHeader("OpenGL/gl.h") and not server_only: gl_libraries.append("GL") - elif conf.CheckLib("opengl32") and conf.CheckCXXHeader("GL/gl.h"): + elif conf.CheckLib("opengl32") and conf.CheckCXXHeader("GL/gl.h") and not server_only: gl_libraries.append("opengl32") - - else: + elif not server_only: print "Could not find libGL or opengl32, or could not find GL/gl.h or OpenGL/gl.h" missing.append("OpenGL") #Do checks for GLU, which is different on every system - if isDarwinPlatform: + if isDarwinPlatform and not server_only: print "Using Apple's GLUT framework" env.Append(FRAMEWORKS="GLUT") - elif conf.CheckLib('GLU') and conf.CheckCXXHeader("GL/glu.h"): + elif conf.CheckLib('GLU') and conf.CheckCXXHeader("GL/glu.h") and not server_only: gl_libraries.append("GLU") - elif conf.CheckLib('GLU') and conf.CheckCXXHeader("OpenGL/glu.h"): + elif conf.CheckLib('GLU') and conf.CheckCXXHeader("OpenGL/glu.h") and not server_only: gl_libraries.append("GLU") - elif conf.CheckLib('glu32') and conf.CheckCXXHeader('GL/glu.h'): + elif conf.CheckLib('glu32') and conf.CheckCXXHeader('GL/glu.h') and not server_only: gl_libraries.append("glu32") - else: + elif not server_only: print "Could not find libGLU or glu32, or could not find GL/glu.h or OpenGL/glu.h" missing.append("GLU") diff -r 6d38e0c8879a -r beec6cd83d42 gnupg/sha1.h --- a/gnupg/sha1.h Sun Apr 13 10:24:35 2008 -0400 +++ b/gnupg/sha1.h Sun Apr 13 22:26:43 2008 -0400 @@ -12,7 +12,7 @@ # define _SHA1_H #ifndef DX9_BACKEND // TODO:Die! -#include +#include typedef Uint32 uint32_t; #else diff -r 6d38e0c8879a -r beec6cd83d42 libgag/include/Toolkit.h --- a/libgag/include/Toolkit.h Sun Apr 13 10:24:35 2008 -0400 +++ b/libgag/include/Toolkit.h Sun Apr 13 22:26:43 2008 -0400 @@ -41,11 +41,13 @@ namespace GAGCore public: //! Initialize gag, must be called before any call to GAG static void init(const char *gameName); + //! Close gag, must be called after any call to GAG + static void close(void); + + #ifndef YOG_SERVER_ONLY //! Initialize the graphic part static GraphicContext *initGraphic(int w, int h, unsigned int flags, const char *title = NULL, const char *icon = NULL); - //! Close gag, must be called after any call to GAG - static void close(void); static Sprite *getSprite(const char *name); static Sprite *getSprite(const std::string &name); @@ -56,10 +58,12 @@ namespace GAGCore static Font *getFont(const char *name); static void releaseFont(const char *name); + #endif static FileManager *getFileManager(void) { return fileManager; } static StringTable *const getStringTable(void) { return strings; } protected: + #ifndef YOG_SERVER_ONLY friend class Sprite; typedef std::map SpriteMap; @@ -69,12 +73,13 @@ namespace GAGCore static SpriteMap spriteMap; //! All loaded fonts static FontMap fontMap; + //! The actual graphic context + static GraphicContext *gc; + #endif //! The virtual file system static FileManager *fileManager; //! The table of strings static StringTable *strings; - //! The actual graphic context - static GraphicContext *gc; }; } diff -r 6d38e0c8879a -r beec6cd83d42 libgag/include/Types.h --- a/libgag/include/Types.h Sun Apr 13 10:24:35 2008 -0400 +++ b/libgag/include/Types.h Sun Apr 13 22:26:43 2008 -0400 @@ -21,7 +21,7 @@ #define __TYPES_H #ifndef DX9_BACKEND -#include +#include #endif #ifdef DX9_BACKEND diff -r 6d38e0c8879a -r beec6cd83d42 libgag/src/SConscript --- a/libgag/src/SConscript Sun Apr 13 10:24:35 2008 -0400 +++ b/libgag/src/SConscript Sun Apr 13 22:26:43 2008 -0400 @@ -7,13 +7,25 @@ Sprite.cpp StreamBackend.cpp Sprite.cpp StreamBackend.cpp Stream.cpp StreamFilter.cpp StringTable.cpp SupportFunctions.cpp TextStream.cpp Toolkit.cpp TrueTypeFont.cpp win32_dirent.cpp GUITabScreen.cpp GUITabScreenWindow.cpp""") - - + +libgag_just_server = Split(""" + +BinaryStream.cpp Stream.cpp FileManager.cpp FormatableString.cpp +TextStream.cpp StreamFilter.cpp StreamBackend.cpp StringTable.cpp Toolkit.cpp +""") + Import("env") -l = env.StaticLibrary("gag", libgag_sources) -Default(l) - +l1 = env.StaticLibrary("gag", libgag_sources) + +l2 = env.StaticLibrary("gag_server", libgag_just_server) + + +if not env['server']: + Default(l1) +else: + Default(l2) + Import("env") Import("PackTar") diff -r 6d38e0c8879a -r beec6cd83d42 libgag/src/StringTable.cpp --- a/libgag/src/StringTable.cpp Sun Apr 13 10:24:35 2008 -0400 +++ b/libgag/src/StringTable.cpp Sun Apr 13 22:26:43 2008 -0400 @@ -25,7 +25,9 @@ #include #include +#ifndef YOG_SERVER_ONLY #include +#endif namespace GAGCore { @@ -259,8 +261,10 @@ namespace GAGCore if (accessIt == stringAccess.end()) { std::cerr << "StringTable::getString(\"" << stringname << ", " << index << "\") : error, no such key." << std::endl; + #ifndef YOG_SERVER_ONLY if(!GAGCore::DrawableSurface::translationPicturesDirectory.empty() && GAGCore::DrawableSurface::wroteTexts.find(std::string(stringname))==GAGCore::DrawableSurface::wroteTexts.end()) GAGCore::DrawableSurface::texts[std::string(stringname)]=key; + #endif return stringname; } else @@ -274,14 +278,18 @@ namespace GAGCore std::string &s = strings[accessIt->second+dec]->data[actLang]; if (s.length() == 0) { + #ifndef YOG_SERVER_ONLY if(!GAGCore::DrawableSurface::translationPicturesDirectory.empty() && GAGCore::DrawableSurface::wroteTexts.find(std::string(stringname))==GAGCore::DrawableSurface::wroteTexts.end()) GAGCore::DrawableSurface::texts[strings[accessIt->second+dec]->data[defaultLang]]=key; + #endif return strings[accessIt->second+dec]->data[defaultLang].c_str(); } else { + #ifndef YOG_SERVER_ONLY if(!GAGCore::DrawableSurface::translationPicturesDirectory.empty() && GAGCore::DrawableSurface::wroteTexts.find(std::string(stringname))==GAGCore::DrawableSurface::wroteTexts.end()) GAGCore::DrawableSurface::texts[s]=key; + #endif return s.c_str(); } } diff -r 6d38e0c8879a -r beec6cd83d42 libgag/src/Toolkit.cpp --- a/libgag/src/Toolkit.cpp Sun Apr 13 10:24:35 2008 -0400 +++ b/libgag/src/Toolkit.cpp Sun Apr 13 22:26:43 2008 -0400 @@ -20,20 +20,25 @@ #include #include #include -#include #include #include #ifndef DX9_BACKEND // TODO:Die! #include "TrueTypeFont.h" #endif +#ifndef YOG_SERVER_ONLY +#include +#endif + namespace GAGCore { + #ifndef YOG_SERVER_ONLY Toolkit::SpriteMap Toolkit::spriteMap; Toolkit::FontMap Toolkit::fontMap; + GraphicContext *Toolkit::gc = NULL; + #endif FileManager *Toolkit::fileManager = NULL; StringTable *Toolkit::strings = NULL; - GraphicContext *Toolkit::gc = NULL; void Toolkit::init(const char *gameName) { @@ -46,20 +51,24 @@ namespace GAGCore assert(false); } + #ifndef YOG_SERVER_ONLY GraphicContext *Toolkit::initGraphic(int w, int h, unsigned int flags, const char *title, const char *icon) { gc = new GraphicContext(w, h, flags, title, icon); return gc; } + #endif void Toolkit::close(void) { + #ifndef YOG_SERVER_ONLY for (SpriteMap::iterator it=spriteMap.begin(); it!=spriteMap.end(); ++it) delete (*it).second; spriteMap.clear(); for (FontMap::iterator it=fontMap.begin(); it!=fontMap.end(); ++it) delete (*it).second; fontMap.clear(); + #endif if (fileManager) { @@ -69,13 +78,16 @@ namespace GAGCore strings = NULL; } + #ifndef YOG_SERVER_ONLY if (gc) { delete gc; gc = NULL; } + #endif } + #ifndef YOG_SERVER_ONLY Sprite *Toolkit::getSprite(const char *name) { assert(name); @@ -151,6 +163,7 @@ namespace GAGCore delete (*it).second; fontMap.erase(it); } + #endif } diff -r 6d38e0c8879a -r beec6cd83d42 src/AINames.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/AINames.cpp Sun Apr 13 22:26:43 2008 -0400 @@ -0,0 +1,62 @@ +/* + Copyright (C) 2008 Bradley Arsenault + + Copyright (C) 2001-2004 Stephane Magnenat & Luc-Olivier de Charrière + for any question or comment contact us at or + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +#include "AI.h" +#include "Toolkit.h" +#include "StringTable.h" + +using namespace GAGCore; + +namespace AINames +{ + std::string getAIText(int id) + { + if(id == AI::NONE) + { + return Toolkit::getStringTable()->getString("[AINone]"); + } + else if(id == AI::NUMBI) + { + return Toolkit::getStringTable()->getString("[AINumbi]"); + } + else if(id == AI::CASTOR) + { + return Toolkit::getStringTable()->getString("[AICastor]"); + } + else if(id == AI::WARRUSH) + { + return Toolkit::getStringTable()->getString("[AIWarrush]"); + } + else if(id == AI::REACHTOINFINITY) + { + return Toolkit::getStringTable()->getString("[AIReachToInfinity]"); + } + else if(id == AI::NICOWAR) + { + return Toolkit::getStringTable()->getString("[AINicowar]"); + } + else if(id == AI::TOUBIB) + { + return Toolkit::getStringTable()->getString("[AIToubib]"); + } + return ""; + } +} diff -r 6d38e0c8879a -r beec6cd83d42 src/AINames.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/AINames.h Sun Apr 13 22:26:43 2008 -0400 @@ -0,0 +1,27 @@ +/* + Copyright (C) 2008 Bradley Arsenault + + Copyright (C) 2001-2004 Stephane Magnenat & Luc-Olivier de Charrière + for any question or comment contact us at or + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +#include "AI.h" + +namespace AINames +{ + std::string getAIText(int id); +} diff -r 6d38e0c8879a -r beec6cd83d42 src/BasePlayer.cpp --- a/src/BasePlayer.cpp Sun Apr 13 10:24:35 2008 -0400 +++ b/src/BasePlayer.cpp Sun Apr 13 22:26:43 2008 -0400 @@ -63,9 +63,6 @@ void BasePlayer::init() lastUStepToExecute=0; disableRecursiveDestruction=false; - - logFile=globalContainer->logFileManager->getFile("Player.log"); - assert(logFile); } BasePlayer::~BasePlayer(void) @@ -86,7 +83,6 @@ void BasePlayer::setTeamNumber(Sint32 te bool BasePlayer::load(GAGCore::InputStream *stream, Sint32 versionMinor) { - fprintf(logFile, "versionMinor=%d.\n", versionMinor); stream->readEnterSection("BasePlayer"); type = (PlayerType)stream->readUint32("type"); number = stream->readSint32("number"); diff -r 6d38e0c8879a -r beec6cd83d42 src/BasePlayer.h --- a/src/BasePlayer.h Sun Apr 13 10:24:35 2008 -0400 +++ b/src/BasePlayer.h Sun Apr 13 22:26:43 2008 -0400 @@ -87,9 +87,6 @@ public: public: bool disableRecursiveDestruction; - -public: - FILE *logFile; }; #endif diff -r 6d38e0c8879a -r beec6cd83d42 src/Game.cpp --- a/src/Game.cpp Sun Apr 13 10:24:35 2008 -0400 +++ b/src/Game.cpp Sun Apr 13 22:26:43 2008 -0400 @@ -2833,45 +2833,3 @@ Team *Game::getTeamWithMostPrestige(void return maxPrestigeTeam; } -std::string glob2FilenameToName(const std::string& filename) -{ - std::string mapName; - if(filename.find(".game")!=std::string::npos) - mapName=filename.substr(filename.find("/")+1, filename.size()-6-filename.find("/")); - else - mapName=filename.substr(filename.find("/")+1, filename.size()-5-filename.find("/")); - size_t pos = mapName.find("_"); - while(pos != std::string::npos) - { - mapName.replace(pos, 1, " "); - pos = mapName.find("_"); - } - return mapName; -} - -template -class contains: std::unary_function -{ -public: - contains(const It from, const It to) : from(from), to(to) {} - bool operator()(T d) { return (std::find(from, to, d) != to); } -private: - const It from; - const It to; -}; - -std::string glob2NameToFilename(const std::string& dir, const std::string& name, const std::string& extension) -{ - const char* pattern = " \t"; - const char* endPattern = strchr(pattern, '\0'); - std::string fileName = name; - std::replace_if(fileName.begin(), fileName.end(), contains(pattern, endPattern), '_'); - std::string fullFileName = dir; - fullFileName += DIR_SEPARATOR + fileName; - if (extension != "" && extension != "\0") - { - fullFileName += '.'; - fullFileName += extension; - } - return fullFileName; -} diff -r 6d38e0c8879a -r beec6cd83d42 src/Game.h --- a/src/Game.h Sun Apr 13 10:24:35 2008 -0400 +++ b/src/Game.h Sun Apr 13 22:26:43 2008 -0400 @@ -240,10 +240,4 @@ protected: int ticksGameSum[32]; }; -//! extract the user-visible name from a glob2 map filename, return empty string if filename is an invalid glob2 map -std::string glob2FilenameToName(const std::string& filename); -//! create the filename from the directory, end user-visible name and extension. directory and extension must be given without the / and the . -std::string glob2NameToFilename(const std::string& dir, const std::string& name, const std::string& extension=""); - - #endif diff -r 6d38e0c8879a -r beec6cd83d42 src/MapHeader.cpp --- a/src/MapHeader.cpp Sun Apr 13 10:24:35 2008 -0400 +++ b/src/MapHeader.cpp Sun Apr 13 22:26:43 2008 -0400 @@ -19,6 +19,7 @@ #include "MapHeader.h" #include "Game.h" #include +#include "FileManager.h" MapHeader::MapHeader() { @@ -254,3 +255,46 @@ bool MapHeader::operator!=(const MapHead +std::string glob2FilenameToName(const std::string& filename) +{ + std::string mapName; + if(filename.find(".game")!=std::string::npos) + mapName=filename.substr(filename.find("/")+1, filename.size()-6-filename.find("/")); + else + mapName=filename.substr(filename.find("/")+1, filename.size()-5-filename.find("/")); + size_t pos = mapName.find("_"); + while(pos != std::string::npos) + { + mapName.replace(pos, 1, " "); + pos = mapName.find("_"); + } + return mapName; +} + +template +class contains: std::unary_function +{ +public: + contains(const It from, const It to) : from(from), to(to) {} + bool operator()(T d) { return (std::find(from, to, d) != to); } +private: + const It from; + const It to; +}; + +std::string glob2NameToFilename(const std::string& dir, const std::string& name, const std::string& extension) +{ + const char* pattern = " \t"; + const char* endPattern = strchr(pattern, '\0'); + std::string fileName = name; + std::replace_if(fileName.begin(), fileName.end(), contains(pattern, endPattern), '_'); + std::string fullFileName = dir; + fullFileName += DIR_SEPARATOR + fileName; + if (extension != "" && extension != "\0") + { + fullFileName += '.'; + fullFileName += extension; + } + return fullFileName; +} + diff -r 6d38e0c8879a -r beec6cd83d42 src/MapHeader.h --- a/src/MapHeader.h Sun Apr 13 10:24:35 2008 -0400 +++ b/src/MapHeader.h Sun Apr 13 22:26:43 2008 -0400 @@ -124,4 +124,10 @@ private: std::string mapName; }; + +//! extract the user-visible name from a glob2 map filename, return empty string if filename is an invalid glob2 map +std::string glob2FilenameToName(const std::string& filename); +//! create the filename from the directory, end user-visible name and extension. directory and extension must be given without the / and the . +std::string glob2NameToFilename(const std::string& dir, const std::string& name, const std::string& extension=""); + #endif diff -r 6d38e0c8879a -r beec6cd83d42 src/NetGamePlayerManager.cpp --- a/src/NetGamePlayerManager.cpp Sun Apr 13 10:24:35 2008 -0400 +++ b/src/NetGamePlayerManager.cpp Sun Apr 13 22:26:43 2008 -0400 @@ -20,6 +20,7 @@ #include "FormatableString.h" #include "YOGServerGame.h" #include "Player.h" +#include "AINames.h" using namespace GAGCore; @@ -76,7 +77,7 @@ void NetGamePlayerManager::addAIPlayer(A if(bp.type == BasePlayer::P_NONE) { FormatableString name("%0 %1"); - name.arg(AI::getAIText(type)).arg(x+1); + name.arg(AINames::getAIText(type)).arg(x+1); bp = BasePlayer(x, name, team_number, Player::playerTypeFromImplementitionID(type)); readyToStart[x] = true; break; @@ -117,7 +118,7 @@ void NetGamePlayerManager::removePlayer( if(bp.type >= Player::P_AI) { FormatableString name("%0 %1"); - name.arg(AI::getAIText(bp.type - (int)Player::P_AI)).arg(bp.number+1); + name.arg(AINames::getAIText(bp.type - (int)Player::P_AI)).arg(bp.number+1); bp.name = name; } diff -r 6d38e0c8879a -r beec6cd83d42 src/Order.cpp --- a/src/Order.cpp Sun Apr 13 10:24:35 2008 -0400 +++ b/src/Order.cpp Sun Apr 13 22:26:43 2008 -0400 @@ -598,6 +598,7 @@ OrderAlterateArea::OrderAlterateArea(con assert(good); } +#ifndef YOG_SERVER_ONLY OrderAlterateArea::OrderAlterateArea(Uint8 teamNumber, Uint8 type, BrushAccumulator *acc, const Map* map) { assert(acc); @@ -616,6 +617,7 @@ OrderAlterateArea::OrderAlterateArea(Uin assert(maxX-minX <= 512); assert(maxY-minY <= 512); } +#endif OrderAlterateArea::~OrderAlterateArea(void) { diff -r 6d38e0c8879a -r beec6cd83d42 src/Order.h --- a/src/Order.h Sun Apr 13 10:24:35 2008 -0400 +++ b/src/Order.h Sun Apr 13 22:26:43 2008 -0400 @@ -316,7 +316,9 @@ class OrderAlterateArea:public OrderModi { public: OrderAlterateArea(const Uint8 *data, int dataLength); + #ifndef YOG_SERVER_ONLY OrderAlterateArea(Uint8 teamNumber, Uint8 type, BrushAccumulator *acc, const Map* map); + #endif virtual ~OrderAlterateArea(void); Uint8 *getData(void); @@ -341,7 +343,9 @@ class OrderAlterateForbidden:public Orde { public: OrderAlterateForbidden(const Uint8 *data, int dataLength) : OrderAlterateArea(data, dataLength) { } + #ifndef YOG_SERVER_ONLY OrderAlterateForbidden(Uint8 teamNumber, Uint8 type, BrushAccumulator *acc, const Map* map) : OrderAlterateArea(teamNumber, type, acc, map) { } + #endif Uint8 getOrderType(void) { return ORDER_ALTERATE_FORBIDDEN; } }; @@ -350,7 +354,9 @@ class OrderAlterateGuardArea:public Orde { public: OrderAlterateGuardArea(const Uint8 *data, int dataLength) : OrderAlterateArea(data, dataLength) { } + #ifndef YOG_SERVER_ONLY OrderAlterateGuardArea(Uint8 teamNumber, Uint8 type, BrushAccumulator *acc, const Map* map) : OrderAlterateArea(teamNumber, type, acc, map) { } + #endif Uint8 getOrderType(void) { return ORDER_ALTERATE_GUARD_AREA; } }; @@ -359,7 +365,9 @@ class OrderAlterateClearArea:public Orde { public: OrderAlterateClearArea(const Uint8 *data, int dataLength) : OrderAlterateArea(data, dataLength) { } + #ifndef YOG_SERVER_ONLY OrderAlterateClearArea(Uint8 teamNumber, Uint8 type, BrushAccumulator *acc, const Map* map) : OrderAlterateArea(teamNumber, type, acc, map) { } + #endif Uint8 getOrderType(void) { return ORDER_ALTERATE_CLEAR_AREA; } }; diff -r 6d38e0c8879a -r beec6cd83d42 src/SConscript --- a/src/SConscript Sun Apr 13 10:24:35 2008 -0400 +++ b/src/SConscript Sun Apr 13 22:26:43 2008 -0400 @@ -1,41 +1,58 @@ source_files = Split(""" source_files = Split(""" -AICastor.cpp AI.cpp AIEcho.cpp AINicowar.cpp -AINull.cpp AINumbi.cpp AIToubib.cpp AIWarrush.cpp -BasePlayer.cpp BaseTeam.cpp BitArray.cpp Brush.cpp -Building.cpp BuildingsTypes.cpp BuildingType.cpp Bullet.cpp -Campaign.cpp CampaignEditor.cpp CampaignMainMenu.cpp CampaignMenuScreen.cpp -CampaignScreen.cpp CampaignSelectorScreen.cpp ChooseMapScreen.cpp CPUStatisticsManager.cpp -CreditScreen.cpp CustomGameScreen.cpp DynamicClouds.cpp EditorMainMenu.cpp -EndGameScreen.cpp Engine.cpp EntityType.cpp Fatal.cpp -FertilityCalculatorDialog.cpp FertilityCalculatorThread.cpp FertilityCalculatorThreadMessage.cpp Game.cpp -GameEvent.cpp GameGUI.cpp GameGUIDefaultAssignManager.cpp GameGUIDialog.cpp -GameGUIGhostBuildingManager.cpp GameGUIKeyActions.cpp GameGUILoadSave.cpp GameGUIMessageManager.cpp -GameGUIToolManager.cpp GameHeader.cpp GameUtilities.cpp Glob2.cpp -Glob2Screen.cpp Glob2Style.cpp GlobalContainer.cpp GUIGlob2FileList.cpp -GUIMapPreview.cpp HeightMapGenerator.cpp IntBuildingType.cpp IRC.cpp -IRCTextMessageHandler.cpp IRCThread.cpp IRCThreadMessage.cpp KeyboardManager.cpp -LANFindScreen.cpp LANGameInformation.cpp LANMenuScreen.cpp LogFileManager.cpp -MainMenuScreen.cpp MapAssembler.cpp Map.cpp MapEdit.cpp -MapEditKeyActions.cpp MapGenerationDescriptor.cpp MapGenerator.cpp MapHeader.cpp -MarkManager.cpp Minimap.cpp MultiplayerGame.cpp MultiplayerGameEvent.cpp -MultiplayerGameEventListener.cpp MultiplayerGameScreen.cpp NetBroadcaster.cpp NetBroadcastListener.cpp -NetConnection.cpp NetConnectionThread.cpp NetConnectionThreadMessage.cpp NetEngine.cpp -NetGamePlayerManager.cpp NetListener.cpp NetMessage.cpp NetReteamingInformation.cpp -NetTestSuite.cpp NewMapScreen.cpp Order.cpp OverlayAreas.cpp -P2PConnection.cpp P2PConnectionEvent.cpp P2PConnectionListener.cpp P2PInformation.cpp -P2PManager.cpp P2PPlayerInformation.cpp PerlinNoise.cpp Player.cpp -Race.cpp Ressource.cpp RessourcesTypes.cpp ScriptEditorScreen.cpp -Sector.cpp Settings.cpp SettingsScreen.cpp SGSL.cpp -SimplexNoise.cpp SoundMixer.cpp Team.cpp TeamStat.cpp -UnitConsts.cpp Unit.cpp UnitEditorScreen.cpp UnitSkin.cpp -UnitsSkins.cpp UnitType.cpp Utilities.cpp VoiceRecorder.cpp -YOGClientChatChannel.cpp YOGClientChatListener.cpp YOGClient.cpp YOGClientEvent.cpp -YOGClientEventListener.cpp YOGClientGameListListener.cpp YOGClientGameListManager.cpp YOGClientLobbyScreen.cpp -YOGClientPlayerListListener.cpp YOGClientPlayerListManager.cpp YOGConsts.cpp -YOGGameInfo.cpp YOGGameResults.cpp YOGLoginScreen.cpp YOGMessage.cpp -YOGPlayerSessionInfo.cpp YOGPlayerStoredInfo.cpp YOGServerAdministrator.cpp YOGServerAdministratorList.cpp -YOGServerChatChannel.cpp YOGServerChatChannelManager.cpp YOGServer.cpp YOGServerGame.cpp -YOGServerMapDistributor.cpp YOGServerPasswordRegistry.cpp YOGServerPlayer.cpp YOGServerPlayerStoredInfoManager.cpp +AICastor.cpp AI.cpp AIEcho.cpp AINames.cpp +AINicowar.cpp AINull.cpp AINumbi.cpp AIToubib.cpp +AIWarrush.cpp BasePlayer.cpp BaseTeam.cpp BitArray.cpp + Brush.cpp Building.cpp BuildingsTypes.cpp +BuildingType.cpp Bullet.cpp Campaign.cpp CampaignEditor.cpp +CampaignMainMenu.cpp CampaignMenuScreen.cpp CampaignScreen.cpp CampaignSelectorScreen.cpp +ChooseMapScreen.cpp CPUStatisticsManager.cpp CreditScreen.cpp CustomGameScreen.cpp +DynamicClouds.cpp EditorMainMenu.cpp EndGameScreen.cpp Engine.cpp +EntityType.cpp Fatal.cpp FertilityCalculatorDialog.cpp FertilityCalculatorThread.cpp +FertilityCalculatorThreadMessage.cpp Game.cpp GameEvent.cpp GameGUI.cpp +GameGUIDefaultAssignManager.cpp GameGUIDialog.cpp GameGUIGhostBuildingManager.cpp GameGUIKeyActions.cpp +GameGUILoadSave.cpp GameGUIMessageManager.cpp GameGUIToolManager.cpp GameHeader.cpp +GameUtilities.cpp Glob2.cpp Glob2Screen.cpp Glob2Style.cpp +GlobalContainer.cpp GUIGlob2FileList.cpp GUIMapPreview.cpp HeightMapGenerator.cpp +IntBuildingType.cpp IRC.cpp IRCTextMessageHandler.cpp IRCThread.cpp +IRCThreadMessage.cpp KeyboardManager.cpp LANFindScreen.cpp LANGameInformation.cpp +LANMenuScreen.cpp LogFileManager.cpp MainMenuScreen.cpp MapAssembler.cpp +Map.cpp MapEdit.cpp MapEditKeyActions.cpp MapGenerationDescriptor.cpp +MapGenerator.cpp MapHeader.cpp MarkManager.cpp Minimap.cpp +MultiplayerGame.cpp MultiplayerGameEvent.cpp MultiplayerGameEventListener.cpp MultiplayerGameScreen.cpp +NetBroadcaster.cpp NetBroadcastListener.cpp NetConnection.cpp NetConnectionThread.cpp +NetConnectionThreadMessage.cpp NetEngine.cpp NetGamePlayerManager.cpp NetListener.cpp +NetMessage.cpp NetReteamingInformation.cpp NetTestSuite.cpp NewMapScreen.cpp +Order.cpp OverlayAreas.cpp P2PConnection.cpp P2PConnectionEvent.cpp +P2PConnectionListener.cpp P2PInformation.cpp P2PManager.cpp P2PPlayerInformation.cpp +PerlinNoise.cpp Player.cpp Race.cpp Ressource.cpp +RessourcesTypes.cpp ScriptEditorScreen.cpp Sector.cpp Settings.cpp +SettingsScreen.cpp SGSL.cpp SimplexNoise.cpp SoundMixer.cpp +Team.cpp TeamStat.cpp UnitConsts.cpp Unit.cpp +UnitEditorScreen.cpp UnitSkin.cpp UnitsSkins.cpp UnitType.cpp +Utilities.cpp VoiceRecorder.cpp YOGClientChatChannel.cpp YOGClientChatListener.cpp +YOGClient.cpp YOGClientEvent.cpp YOGClientEventListener.cpp YOGClientGameListListener.cpp +YOGClientGameListManager.cpp YOGClientLobbyScreen.cpp YOGClientPlayerListListener.cpp YOGClientPlayerListManager.cpp +YOGConsts.cpp YOGGameInfo.cpp YOGGameResults.cpp +YOGLoginScreen.cpp YOGMessage.cpp YOGPlayerSessionInfo.cpp YOGPlayerStoredInfo.cpp +YOGServerAdministrator.cpp YOGServerAdministratorList.cpp YOGServerChatChannel.cpp YOGServerChatChannelManager.cpp +YOGServer.cpp YOGServerGame.cpp YOGServerMapDistributor.cpp YOGServerPasswordRegistry.cpp +YOGServerPlayer.cpp YOGServerPlayerStoredInfoManager.cpp + +""") + +server_source_files = Split(""" +AINames.cpp BasePlayer.cpp BaseTeam.cpp BitArray.cpp + GameHeader.cpp LANGameInformation.cpp LogFileManager.cpp +MapHeader.cpp NetBroadcaster.cpp NetConnection.cpp NetConnectionThread.cpp +NetConnectionThreadMessage.cpp NetGamePlayerManager.cpp NetListener.cpp NetMessage.cpp +NetReteamingInformation.cpp NetTestSuite.cpp Order.cpp P2PConnectionEvent.cpp +P2PConnectionListener.cpp P2PInformation.cpp P2PManager.cpp P2PPlayerInformation.cpp +Race.cpp UnitType.cpp Utilities.cpp YOGConsts.cpp +YOGDaemon.cpp YOGGameInfo.cpp YOGGameResults.cpp YOGMessage.cpp +YOGPlayerSessionInfo.cpp YOGPlayerStoredInfo.cpp YOGServerAdministrator.cpp YOGServerAdministratorList.cpp +YOGServerChatChannel.cpp YOGServerChatChannelManager.cpp YOGServer.cpp YOGServerGame.cpp +YOGServerMapDistributor.cpp YOGServerPasswordRegistry.cpp YOGServerPlayer.cpp YOGServerPlayerStoredInfoManager.cpp + """) Import('env') @@ -44,9 +61,17 @@ if env["mingw"] or env['PLATFORM'] == 'w source_files.extend(["C:/msys/1.0/local/lib/libvorbisfile.a", "C:/msys/1.0/local/lib/libvorbis.a", "C:/msys/1.0/local/lib/libogg.a"]) #Add libgag, not as a library, but as an object source_files.append("#libgag//src/libgag.a") -p = local.Program("glob2", source_files) -local.Default(p) - +p1 = local.Program("glob2", source_files) + +#Add libgag, not as a library, but as an object +server_source_files.append("#libgag//src/libgag_server.a") +p2 = local.Program("glob2-server", server_source_files) + +if not env['server']: + local.Default(p1) +else: + local.Default(p2) + Import('env') Import("PackTar") diff -r 6d38e0c8879a -r beec6cd83d42 src/YOGDaemon.cpp --- a/src/YOGDaemon.cpp Sun Apr 13 10:24:35 2008 -0400 +++ b/src/YOGDaemon.cpp Sun Apr 13 22:26:43 2008 -0400 @@ -18,9 +18,40 @@ #include "YOGDaemon.h" #include "YOGServer.h" +#include "Toolkit.h" +#include "FileManager.h" +#include "StringTable.h" + +using namespace GAGCore; int main(int argc, char** argv) { + Toolkit::init("glob2"); + // init virtual filesystem + FileManager* fileManager = Toolkit::getFileManager(); + assert(fileManager); + fileManager->addWriteSubdir("maps"); + fileManager->addWriteSubdir("games"); + fileManager->addWriteSubdir("campaigns"); + fileManager->addWriteSubdir("logs"); + fileManager->addWriteSubdir("scripts"); + fileManager->addWriteSubdir("videoshots"); + + // load texts + if (!Toolkit::getStringTable()->load("data/texts.list.txt")) + { + std::cerr << "Fatal error : while loading \"data/texts.list.txt\"" << std::endl; + assert(false); + exit(-1); + } + // load texts + if (!Toolkit::getStringTable()->loadIncompleteList("data/texts.incomplete.txt")) + { + std::cerr << "Fatal error : while loading \"data/texts.incomplete.txt\"" << std::endl; + assert(false); + exit(-1); + } + YOGServer server(YOGRequirePassword, YOGMultipleGames);; server.run(); } # HG changeset patch # User Bradley Arsenault # Date 1208215999 14400 # Node ID 1aa6ab443568d1632313cba38e9ec289c749f804 # Parent beec6cd83d42596f62ce86d121819c60bb51b75f Slightly changed infastructure for YOGServerAdministrator. Added file versioning for the servers databases. Added new system for doing player name bans. diff -r beec6cd83d42 -r 1aa6ab443568 data/texts.ar.txt --- a/data/texts.ar.txt Sun Apr 13 22:26:43 2008 -0400 +++ b/data/texts.ar.txt Mon Apr 14 19:33:19 2008 -0400 @@ -370,6 +370,8 @@ Game full Game full [game shortcuts] Game Shortcuts +[Game] + [general settings] اعدادات عامه [go to event] @@ -484,6 +486,8 @@ ar [load] تحميل +[Lobby] + [login] اتصال [Lost : %0 has more prestige than you] @@ -1040,6 +1044,8 @@ The YOG metaserver has refused the conne The YOG metaserver has refused the connection without explanation! [YESTS_CONNECTION_REFUSED_USERNAME_ALLREADY_USED] The YOG metaserver has refused the connection because your username is already used by someone else. +[YESTS_CONNECTION_REFUSED_USERNAME_BANNED] + [YESTS_CREATED] The connection system is ready to contact the YOG metaserver for connection. [YESTS_UNABLE_TO_CONNECT] @@ -1056,3 +1062,5 @@ Ysagoon Online Gaming %0 تحت الهجوم [Your unit got converted to %0's team] Your unit got converted to %0's team +[Your username was banned] + diff -r beec6cd83d42 -r 1aa6ab443568 data/texts.br.txt --- a/data/texts.br.txt Sun Apr 13 22:26:43 2008 -0400 +++ b/data/texts.br.txt Mon Apr 14 19:33:19 2008 -0400 @@ -372,6 +372,8 @@ Jogo cheio Jogo cheio [game shortcuts] Atalhos do jogo +[Game] + [general settings] Ajustes gerais [go to event] @@ -486,6 +488,8 @@ Carregar mapa [load] Carrregar +[Lobby] + [login] Login [Lost : %0 has more prestige than you] @@ -1040,6 +1044,8 @@ O metaservidor YOG recusou a conexão se O metaservidor YOG recusou a conexão sem explicação alguma! [YESTS_CONNECTION_REFUSED_USERNAME_ALLREADY_USED] O metaservidor YOG recusou a sua conexão porque este nome de usuário está sendo usado por outro. +[YESTS_CONNECTION_REFUSED_USERNAME_BANNED] + [YESTS_CREATED] O sistema de conexão está pronto para contatar o metaservidor YOG para conexão. [YESTS_UNABLE_TO_CONNECT] @@ -1056,3 +1062,5 @@ Seus %0 estão sendo atacados Seus %0 estão sendo atacados [Your unit got converted to %0's team] Sua unidade foi convertido para o time do %0 +[Your username was banned] + diff -r beec6cd83d42 -r 1aa6ab443568 data/texts.ca.txt --- a/data/texts.ca.txt Sun Apr 13 22:26:43 2008 -0400 +++ b/data/texts.ca.txt Mon Apr 14 19:33:19 2008 -0400 @@ -370,6 +370,8 @@ Partida Completa Partida Completa [game shortcuts] +[Game] + [general settings] [go to event] @@ -484,6 +486,8 @@ Cargar partida [load] Carregar +[Lobby] + [login] Conectar [Lost : %0 has more prestige than you] @@ -1040,6 +1044,8 @@ El servidor YOG ha rebutjat la conexió El servidor YOG ha rebutjat la conexió inexplicablement. [YESTS_CONNECTION_REFUSED_USERNAME_ALLREADY_USED] No es pot conectar al metaservidor YOG. Nom d'usuari en ús +[YESTS_CONNECTION_REFUSED_USERNAME_BANNED] + [YESTS_CREATED] El sistema de conexió està llest per contactar amb el metaservidor YOG [YESTS_UNABLE_TO_CONNECT] @@ -1056,3 +1062,5 @@ El teu %0 està sent atacat El teu %0 està sent atacat [Your unit got converted to %0's team] Una unitat teva s'ha convertit a l'equip de %0 +[Your username was banned] + diff -r beec6cd83d42 -r 1aa6ab443568 data/texts.cz.txt --- a/data/texts.cz.txt Sun Apr 13 22:26:43 2008 -0400 +++ b/data/texts.cz.txt Mon Apr 14 19:33:19 2008 -0400 @@ -370,6 +370,8 @@ Plně obsazená hra Plně obsazená hra [game shortcuts] +[Game] + [general settings] [go to event] @@ -484,6 +486,8 @@ Nahrát hru [load] Nahrát +[Lobby] + [login] Přihlásit [Lost : %0 has more prestige than you] @@ -1038,6 +1042,8 @@ YOG metaserver odmítnul spojení bez ud YOG metaserver odmítnul spojení bez udání důvodu. [YESTS_CONNECTION_REFUSED_USERNAME_ALLREADY_USED] YOG metaserver odmítnul spojení, protože Tvé jméno je již používáno jiným hráčem. +[YESTS_CONNECTION_REFUSED_USERNAME_BANNED] + [YESTS_CREATED] Systém připojení je připraven na kontakt s YOG metaserverem. [YESTS_UNABLE_TO_CONNECT] @@ -1054,3 +1060,5 @@ Tvoji %0 jsou pod útokem Tvoji %0 jsou pod útokem [Your unit got converted to %0's team] Tva jednotka změnila víru v jiného hráče %0 +[Your username was banned] + diff -r beec6cd83d42 -r 1aa6ab443568 data/texts.de.txt --- a/data/texts.de.txt Sun Apr 13 22:26:43 2008 -0400 +++ b/data/texts.de.txt Mon Apr 14 19:33:19 2008 -0400 @@ -364,6 +364,8 @@ Spiel komplett Spiel komplett [game shortcuts] +[Game] + [general settings] Allgemein [go to event] @@ -478,6 +480,8 @@ Spiel laden [load] Laden +[Lobby] + [login] Login [Lost : %0 has more prestige than you] @@ -1030,6 +1034,8 @@ Der YOG-Metaserver hat die Verbindung oh Der YOG-Metaserver hat die Verbindung ohne weitere Erklärung verweigert. [YESTS_CONNECTION_REFUSED_USERNAME_ALLREADY_USED] Der YOG-Metaserver hat die Verbindung verweigert, da Ihr Spitzname schon von jemand anderem benutzt wird. +[YESTS_CONNECTION_REFUSED_USERNAME_BANNED] + [YESTS_CREATED] Das Verbindungsystem ist bereit, mit YOG in Kontakt zu treten. [YESTS_UNABLE_TO_CONNECT] @@ -1046,3 +1052,5 @@ Eure %0 werden angegriffen Eure %0 werden angegriffen [Your unit got converted to %0's team] Eine Ihrer Einheiten wurde von einem %0-Team übernommen. +[Your username was banned] + diff -r beec6cd83d42 -r 1aa6ab443568 data/texts.dk.txt --- a/data/texts.dk.txt Sun Apr 13 22:26:43 2008 -0400 +++ b/data/texts.dk.txt Mon Apr 14 19:33:19 2008 -0400 @@ -370,6 +370,8 @@ Spillet er fyldt op. Spillet er fyldt op. [game shortcuts] Gem genveje +[Game] + [general settings] Generelt [go to event] @@ -484,6 +486,8 @@ Hent bane [load] hent +[Lobby] + [login] Log ind [Lost : %0 has more prestige than you] @@ -1040,6 +1044,8 @@ YOG-metaserveren har afbrudt forbindelse YOG-metaserveren har afbrudt forbindelsen uden en forklaring! [YESTS_CONNECTION_REFUSED_USERNAME_ALLREADY_USED] YOG-metaserveren har afbrudt forbindelsen, fordi dit brugernavn er allerede i brug af en anden. +[YESTS_CONNECTION_REFUSED_USERNAME_BANNED] + [YESTS_CREATED] Forbindelsesystemet er klar til at forbinde til YOG-metaserveren. [YESTS_UNABLE_TO_CONNECT] @@ -1056,3 +1062,5 @@ Dine %0 er under angreb Dine %0 er under angreb [Your unit got converted to %0's team] En af dine enheder blev konverteret til et %0 hold +[Your username was banned] + diff -r beec6cd83d42 -r 1aa6ab443568 data/texts.en.txt --- a/data/texts.en.txt Sun Apr 13 22:26:43 2008 -0400 +++ b/data/texts.en.txt Mon Apr 14 19:33:19 2008 -0400 @@ -18,10 +18,6 @@ Add map Add map [add shortcut] Add Shortcut -[Game] -Game -[Lobby] -Lobby [AI] AI [ai] @@ -370,6 +366,8 @@ Game full Game full [game shortcuts] Game Shortcuts +[Game] +Game [general settings] General Settings [go to event] @@ -484,6 +482,8 @@ Load Script Load Script [load] Load +[Lobby] +Lobby [login] Login [Lost : %0 has more prestige than you] @@ -1038,6 +1038,8 @@ The YOG metaserver has refused the conne The YOG metaserver has refused the connection without explanation! [YESTS_CONNECTION_REFUSED_USERNAME_ALLREADY_USED] The YOG metaserver has refused the connection because your username is already used by someone else. +[YESTS_CONNECTION_REFUSED_USERNAME_BANNED] +The YOG metaserver had refused the connection because this username is banned. Please contact the administrators. [YESTS_CREATED] The connection system is ready to contact the YOG metaserver for connection. [YESTS_UNABLE_TO_CONNECT] @@ -1054,3 +1056,5 @@ Your %0 are under attack Your %0 are under attack [Your unit got converted to %0's team] Your unit got converted to %0's team +[Your username was banned] +Your username was banned. Please contact the administrators to have this changed. diff -r beec6cd83d42 -r 1aa6ab443568 data/texts.es.txt --- a/data/texts.es.txt Sun Apr 13 22:26:43 2008 -0400 +++ b/data/texts.es.txt Mon Apr 14 19:33:19 2008 -0400 @@ -370,6 +370,8 @@ Juego Lleno Juego Lleno [game shortcuts] +[Game] + [general settings] [go to event] @@ -484,6 +486,8 @@ Cargar Juego [load] Cargar +[Lobby] + [login] Login [Lost : %0 has more prestige than you] @@ -1040,6 +1044,8 @@ YOG metaserver ha rechazado la conecció YOG metaserver ha rechazado la conección sin explicación! [YESTS_CONNECTION_REFUSED_USERNAME_ALLREADY_USED] YOG ha rechazado la conección porque tu nombre de usuario ya ha sido utilizado por alguien más. +[YESTS_CONNECTION_REFUSED_USERNAME_BANNED] + [YESTS_CREATED] La Conección del Sistema está lista para contactar al YOG metaserver para la conección. [YESTS_UNABLE_TO_CONNECT] @@ -1056,3 +1062,5 @@ Tu %0 están bajo ataque Tu %0 están bajo ataque [Your unit got converted to %0's team] Tu unidad fué convertida a %0 del equipo +[Your username was banned] + diff -r beec6cd83d42 -r 1aa6ab443568 data/texts.eu.txt --- a/data/texts.eu.txt Sun Apr 13 22:26:43 2008 -0400 +++ b/data/texts.eu.txt Mon Apr 14 19:33:19 2008 -0400 @@ -370,6 +370,8 @@ Partida osorik Partida osorik [game shortcuts] Partida teklak +[Game] + [general settings] Ezarpen orokorrak [go to event] @@ -484,6 +486,8 @@ Kargatu mapa [load] Kargatu +[Lobby] + [login] Saioa hasi [Lost : %0 has more prestige than you] @@ -1040,6 +1044,8 @@ YOG metazerbitzariak estekatzea ukatu du YOG metazerbitzariak estekatzea ukatu du inolako azalpenik eman gabe! [YESTS_CONNECTION_REFUSED_USERNAME_ALLREADY_USED] YOG metazerbitzariak estekatzea ukatu du zure erabiltzaile izena beste batek duelako. +[YESTS_CONNECTION_REFUSED_USERNAME_BANNED] + [YESTS_CREATED] Konektatze sistema prest dago YOG metazerbitzarira konektatzeko. [YESTS_UNABLE_TO_CONNECT] @@ -1056,3 +1062,5 @@ Zure %0ak erasopean daude Zure %0ak erasopean daude [Your unit got converted to %0's team] Zure unitatea %0(r)en taldera pasatu da +[Your username was banned] + diff -r beec6cd83d42 -r 1aa6ab443568 data/texts.fr.txt --- a/data/texts.fr.txt Sun Apr 13 22:26:43 2008 -0400 +++ b/data/texts.fr.txt Mon Apr 14 19:33:19 2008 -0400 @@ -370,6 +370,8 @@ Jeu complet Jeu complet [game shortcuts] Raccourcis du jeu +[Game] + [general settings] Réglages généraux [go to event] @@ -484,6 +486,8 @@ Charger la carte [load] Charger +[Lobby] + [login] Login [Lost : %0 has more prestige than you] @@ -1040,6 +1044,8 @@ Le metaserveur YOG a refusé la connexio Le metaserveur YOG a refusé la connexion pour une raison inconnue! [YESTS_CONNECTION_REFUSED_USERNAME_ALLREADY_USED] Le metaserveur YOG a refusé la connexion car votre nom d'utilisateur est déjà utilisé par une autre personne. +[YESTS_CONNECTION_REFUSED_USERNAME_BANNED] + [YESTS_CREATED] Le système de connexion est prêt à contacter le metaserveur YOG pour se connecter. [YESTS_UNABLE_TO_CONNECT] @@ -1056,3 +1062,5 @@ Vos %0 sont attaquées Vos %0 sont attaquées [Your unit got converted to %0's team] Votre unité est passée à l'équipe %0 +[Your username was banned] + diff -r beec6cd83d42 -r 1aa6ab443568 data/texts.gr.txt --- a/data/texts.gr.txt Sun Apr 13 22:26:43 2008 -0400 +++ b/data/texts.gr.txt Mon Apr 14 19:33:19 2008 -0400 @@ -372,6 +372,8 @@ Ok Πλήρης παιχνίδι [game shortcuts] Συντομεύσεις παιχνιδιού +[Game] + [general settings] Γενικές Ρυθμίσεις [go to event] @@ -486,6 +488,8 @@ Anastasios M. Pingios [load] Φόρτωση +[Lobby] + [login] Σύνδεση [Lost : %0 has more prestige than you] @@ -1042,6 +1046,8 @@ Tutorial Ο YOG metaserver αρνήθηκε την σύνδεση χωρίς εξήγηση! [YESTS_CONNECTION_REFUSED_USERNAME_ALLREADY_USED] Ο YOG metaserver αρνήθηκε την σύνδεση γιατί το όνομα χρήστη είναι ήδη σε χρήση από κάποιον άλλον. +[YESTS_CONNECTION_REFUSED_USERNAME_BANNED] + [YESTS_CREATED] Το σύστημα σύνδεσης είναι έτοιμο για επαφή με τον YOG metaserver για σύνδεση. [YESTS_UNABLE_TO_CONNECT] @@ -1058,3 +1064,5 @@ Ysagoon Online Gaming Το %0 δέχετε επίθεση [Your unit got converted to %0's team] Η μονάδα σας άλλαξε σε %0 ομάδα +[Your username was banned] + diff -r beec6cd83d42 -r 1aa6ab443568 data/texts.hu.txt --- a/data/texts.hu.txt Sun Apr 13 22:26:43 2008 -0400 +++ b/data/texts.hu.txt Mon Apr 14 19:33:19 2008 -0400 @@ -370,6 +370,8 @@ A játék megtelt A játék megtelt [game shortcuts] +[Game] + [general settings] [go to event] @@ -484,6 +486,8 @@ Játék betöltése [load] Betölt +[Lobby] + [login] Bejelentkezés [Lost : %0 has more prestige than you] @@ -1038,6 +1042,8 @@ A YOG metaszerver ismeretlen okból kifo A YOG metaszerver ismeretlen okból kifolyólag visszautasította a kapcsolatot. [YESTS_CONNECTION_REFUSED_USERNAME_ALLREADY_USED] A YOG metaszerver visszautasította a kapcsolatot, mivel a felhasználói nevedet már egy másik játékos használja. +[YESTS_CONNECTION_REFUSED_USERNAME_BANNED] + [YESTS_CREATED] A kapcsolódó rendszer készen áll a kapcsolat felvételére a YOG metaszerverrel. [YESTS_UNABLE_TO_CONNECT] @@ -1054,3 +1060,5 @@ Megtámadták a %0 -t Megtámadták a %0 -t [Your unit got converted to %0's team] Az egységedet az ellenség elfogta %0 +[Your username was banned] + diff -r beec6cd83d42 -r 1aa6ab443568 data/texts.it.txt --- a/data/texts.it.txt Sun Apr 13 22:26:43 2008 -0400 +++ b/data/texts.it.txt Mon Apr 14 19:33:19 2008 -0400 @@ -364,6 +364,8 @@ Partita al completo Partita al completo [game shortcuts] Scorciatoie da tastiera +[Game] + [general settings] Impostazioni generali [go to event] @@ -478,6 +480,8 @@ Carica Mappa [load] Carica +[Lobby] + [login] Login [Lost : %0 has more prestige than you] @@ -1030,6 +1034,8 @@ Il metaserver YOG ha respinto la conness Il metaserver YOG ha respinto la connessione senza spiegazione! [YESTS_CONNECTION_REFUSED_USERNAME_ALLREADY_USED] Il metaserver YOG ha rifiutato la tua connessione perchè il tuo username è già in uso da qualcun altro. +[YESTS_CONNECTION_REFUSED_USERNAME_BANNED] + [YESTS_CREATED] Il sistema di connessione è in attesa del metaserver YOG per la connessione. [YESTS_UNABLE_TO_CONNECT] @@ -1046,3 +1052,5 @@ Il tuo %0 è sotto attacco Il tuo %0 è sotto attacco [Your unit got converted to %0's team] La tua unità è stata convertita alla squadra di %0 +[Your username was banned] + diff -r beec6cd83d42 -r 1aa6ab443568 data/texts.keys.txt --- a/data/texts.keys.txt Sun Apr 13 22:26:43 2008 -0400 +++ b/data/texts.keys.txt Mon Apr 14 19:33:19 2008 -0400 @@ -152,8 +152,6 @@ [explorationflag explanation] [explorationflag] [Explorer Ratio] -[Game] -[Lobby] [Explorer] [explorers] [extra islands] @@ -184,6 +182,7 @@ [fullscreen] [game full] [game shortcuts] +[Game] [general settings] [go to event] [go to home] @@ -241,6 +240,7 @@ [load map] [load script] [load] +[Lobby] [login] [Lost : %0 has more prestige than you] [Lost : your colony is dead] @@ -517,6 +517,7 @@ [YESTS_CONNECTION_REFUSED_PROTOCOL_TOO_OLD] [YESTS_CONNECTION_REFUSED_UNEXPLAINED] [YESTS_CONNECTION_REFUSED_USERNAME_ALLREADY_USED] +[YESTS_CONNECTION_REFUSED_USERNAME_BANNED] [YESTS_CREATED] [YESTS_UNABLE_TO_CONNECT] [yog] @@ -525,3 +526,4 @@ [You where kicked from the game] [Your %0 are under attack] [Your unit got converted to %0's team] +[Your username was banned] diff -r beec6cd83d42 -r 1aa6ab443568 data/texts.nl.txt --- a/data/texts.nl.txt Sun Apr 13 22:26:43 2008 -0400 +++ b/data/texts.nl.txt Mon Apr 14 19:33:19 2008 -0400 @@ -370,6 +370,8 @@ Spel is vol Spel is vol [game shortcuts] Spel toetsen +[Game] + [general settings] Algemeen [go to event] @@ -484,6 +486,8 @@ Speelveld laden [load] Laden +[Lobby] + [login] Aanmelden [Lost : %0 has more prestige than you] @@ -1040,6 +1044,8 @@ De verbinding met de YOG server is zonde De verbinding met de YOG server is zonder duidelijke verklaring geweigerd! [YESTS_CONNECTION_REFUSED_USERNAME_ALLREADY_USED] De verbinding met de YOG server is geweigerd omdat uw gebruikersnaam al bestaat. +[YESTS_CONNECTION_REFUSED_USERNAME_BANNED] + [YESTS_CREATED] Je kunt nu met de YOG server verbinden. Log in met een reeds geregistreerde gebruikersnaam, of registreer een nieuwe gebruikersnaam door een vinkje te zetten voor "Registreer nieuwe gebruiker met wachtwoord". [YESTS_UNABLE_TO_CONNECT] @@ -1056,3 +1062,5 @@ Je %0 worden aangevallen Je %0 worden aangevallen [Your unit got converted to %0's team] Een eenheid van jou is overgelopen naar %0's team +[Your username was banned] + diff -r beec6cd83d42 -r 1aa6ab443568 data/texts.pl.txt --- a/data/texts.pl.txt Sun Apr 13 22:26:43 2008 -0400 +++ b/data/texts.pl.txt Mon Apr 14 19:33:19 2008 -0400 @@ -370,6 +370,8 @@ Komplet graczy Komplet graczy [game shortcuts] +[Game] + [general settings] [go to event] @@ -484,6 +486,8 @@ Załaduj grę [load] Ładuj +[Lobby] + [login] Login [Lost : %0 has more prestige than you] @@ -1038,6 +1042,8 @@ Metaserwer YOG odmĂłwił połąc Metaserwer YOG odmĂłwił połączenia bez dalszego wyjaśnienia. [YESTS_CONNECTION_REFUSED_USERNAME_ALLREADY_USED] Metaserwer YOG odmówił połączenia, ponieważ twój login jest już zajęty przez kogoś innego. +[YESTS_CONNECTION_REFUSED_USERNAME_BANNED] + [YESTS_CREATED] System jest gotowy do połączenia z metaserwerem YOG. [YESTS_UNABLE_TO_CONNECT] @@ -1054,3 +1060,5 @@ Twój %0 jest atakowany Twój %0 jest atakowany [Your unit got converted to %0's team] Twoja jednostka została przeciągnięta na stronę wroga %0 +[Your username was banned] + diff -r beec6cd83d42 -r 1aa6ab443568 data/texts.pt.txt --- a/data/texts.pt.txt Sun Apr 13 22:26:43 2008 -0400 +++ b/data/texts.pt.txt Mon Apr 14 19:33:19 2008 -0400 @@ -370,6 +370,8 @@ Partida alotada Partida alotada [game shortcuts] +[Game] + [general settings] [go to event] @@ -484,6 +486,8 @@ Carregar partida [load] Carregar +[Lobby] + [login] Login [Lost : %0 has more prestige than you] @@ -1038,6 +1042,8 @@ O metaservidor YOG tem rejeitado a conex O metaservidor YOG tem rejeitado a conexão sem dar uma explicação. [YESTS_CONNECTION_REFUSED_USERNAME_ALLREADY_USED] O metaservidor YOG tem rejeitado a conexão porque o nome de usuário está em uso. +[YESTS_CONNECTION_REFUSED_USERNAME_BANNED] + [YESTS_CREATED] O sistema de conexão está pronto para contactar-se com o metaservidor YOG. [YESTS_UNABLE_TO_CONNECT] @@ -1054,3 +1060,5 @@ Seus %0 estão sendo atacados Seus %0 estão sendo atacados [Your unit got converted to %0's team] Uma unidade tem se passado ao bando de %0 +[Your username was banned] + diff -r beec6cd83d42 -r 1aa6ab443568 data/texts.ro.txt --- a/data/texts.ro.txt Sun Apr 13 22:26:43 2008 -0400 +++ b/data/texts.ro.txt Mon Apr 14 19:33:19 2008 -0400 @@ -370,6 +370,8 @@ Joc complet Joc complet [game shortcuts] +[Game] + [general settings] [go to event] @@ -484,6 +486,8 @@ Nivele [load] Încarcă +[Lobby] + [login] Login [Lost : %0 has more prestige than you] @@ -1038,6 +1042,8 @@ Metaserverul YOG a refuzat sa vă conect Metaserverul YOG a refuzat sa vă conectaÅ£i dintr-un motiv necunoscut. [YESTS_CONNECTION_REFUSED_USERNAME_ALLREADY_USED] Metaserverul YOG a refuzat sa vă conectaÅ£i din motiv că numele vostru de utilizator este deja utilizat de către o altă persoană. +[YESTS_CONNECTION_REFUSED_USERNAME_BANNED] + [YESTS_CREATED] Sistemul de conecÅ£ie este gata să contacteze metaserverul YOG pentru conectare. [YESTS_UNABLE_TO_CONNECT] @@ -1054,3 +1060,5 @@ AÅ£i câştigat! %0 voastre sunt atacate [Your unit got converted to %0's team] Unitatea voastră a trecut de partea %0 +[Your username was banned] + diff -r beec6cd83d42 -r 1aa6ab443568 data/texts.ru.txt --- a/data/texts.ru.txt Sun Apr 13 22:26:43 2008 -0400 +++ b/data/texts.ru.txt Mon Apr 14 19:33:19 2008 -0400 @@ -366,6 +366,8 @@ Ok Игра заполнена [game shortcuts] Игра +[Game] + [general settings] Общие [go to event] @@ -482,6 +484,8 @@ left Загрузить [load] Загрузить карту +[Lobby] + [login] Вход [Lost : %0 has more prestige than you] @@ -1036,6 +1040,8 @@ up Метасервер YOG отказал в соединении без объяснения причин! [YESTS_CONNECTION_REFUSED_USERNAME_ALLREADY_USED] Метасервер YOG отказал в соединении, потому что ваше имя уже используется кем-то ещё. +[YESTS_CONNECTION_REFUSED_USERNAME_BANNED] + [YESTS_CREATED] Система соединения готова обратиться к метасерверу YOG за подключением. [YESTS_UNABLE_TO_CONNECT] @@ -1052,3 +1058,5 @@ Ysagoon-игра в Интернете %0 под ударом [Your unit got converted to %0's team] Ваш юнит перешёл к врагу %0 +[Your username was banned] + diff -r beec6cd83d42 -r 1aa6ab443568 data/texts.si.txt --- a/data/texts.si.txt Sun Apr 13 22:26:43 2008 -0400 +++ b/data/texts.si.txt Mon Apr 14 19:33:19 2008 -0400 @@ -370,6 +370,8 @@ Igra je polna Igra je polna [game shortcuts] +[Game] + [general settings] [go to event] @@ -484,6 +486,8 @@ Naloži igro [load] Naloži +[Lobby] + [login] Prijava [Lost : %0 has more prestige than you] @@ -1038,6 +1042,8 @@ Yog metastrežnik je brezobrazložitve z Yog metastrežnik je brezobrazložitve zavrnil povezavo! [YESTS_CONNECTION_REFUSED_USERNAME_ALLREADY_USED] YOG metastrežnik je zavrnil povezavo ker je tvoje uporabniÅ¡ko ime zasedeno. +[YESTS_CONNECTION_REFUSED_USERNAME_BANNED] + [YESTS_CREATED] Povezovalni sistem je pripravljen, da vzpostavi povezavo z YOG metastrežnikom. [YESTS_UNABLE_TO_CONNECT] @@ -1054,3 +1060,5 @@ Tvoji %0 so napadeni Tvoji %0 so napadeni [Your unit got converted to %0's team] Tvoje enote so bile spreobrnjene %0 +[Your username was banned] + diff -r beec6cd83d42 -r 1aa6ab443568 data/texts.sk.txt --- a/data/texts.sk.txt Sun Apr 13 22:26:43 2008 -0400 +++ b/data/texts.sk.txt Mon Apr 14 19:33:19 2008 -0400 @@ -370,6 +370,8 @@ Plné Plné [game shortcuts] +[Game] + [general settings] Základ [go to event] @@ -484,6 +486,8 @@ NahraÅ¥ hru [load] NahraÅ¥ +[Lobby] + [login] Prihlásenie [Lost : %0 has more prestige than you] @@ -1040,6 +1044,8 @@ YOG metaserver odmietol spojenie bez vys YOG metaserver odmietol spojenie bez vysvetlenia! [YESTS_CONNECTION_REFUSED_USERNAME_ALLREADY_USED] YOG metaserver odmietol spojenie, pretože tvoje meno už niekto používa. +[YESTS_CONNECTION_REFUSED_USERNAME_BANNED] + [YESTS_CREATED] Systém pripojenia je pripravený kontaktovaÅ¥ YOG metaserver. [YESTS_UNABLE_TO_CONNECT] @@ -1056,3 +1062,5 @@ Tvoji %0 čelia útoku Tvoji %0 čelia útoku [Your unit got converted to %0's team] Tvoja jednotka konvertovala k tímu %0 +[Your username was banned] + diff -r beec6cd83d42 -r 1aa6ab443568 data/texts.sr.txt --- a/data/texts.sr.txt Sun Apr 13 22:26:43 2008 -0400 +++ b/data/texts.sr.txt Mon Apr 14 19:33:19 2008 -0400 @@ -370,6 +370,8 @@ AIWarrush Потпуна игра [game shortcuts] +[Game] + [general settings] [go to event] @@ -484,6 +486,8 @@ sr [load] Учитај +[Lobby] + [login] Пријава [Lost : %0 has more prestige than you] @@ -1038,6 +1042,8 @@ YOG мета-сервер је одбиРYOG мета-сервер је одбио везу али није назначио разлог. [YESTS_CONNECTION_REFUSED_USERNAME_ALLREADY_USED] YOG мета-сервер је одбио везу јер корисничко име које сте изабрали неко већ користи. +[YESTS_CONNECTION_REFUSED_USERNAME_BANNED] + [YESTS_CREATED] Подсистем за повезивање је спреман за контакт са YOG метасервером. [YESTS_UNABLE_TO_CONNECT] @@ -1054,3 +1060,5 @@ YOG мета-сервер је одбиРНападнута јединица: %0 [Your unit got converted to %0's team] Ваша јединица је пребегла %0 +[Your username was banned] + diff -r beec6cd83d42 -r 1aa6ab443568 data/texts.sv.txt --- a/data/texts.sv.txt Sun Apr 13 22:26:43 2008 -0400 +++ b/data/texts.sv.txt Mon Apr 14 19:33:19 2008 -0400 @@ -370,6 +370,8 @@ Spelet är fullt Spelet är fullt [game shortcuts] Spelgenvägar +[Game] + [general settings] Allmänt [go to event] @@ -484,6 +486,8 @@ Ladda Karta [load] Ladda +[Lobby] + [login] Logga in [Lost : %0 has more prestige than you] @@ -1040,6 +1044,8 @@ YOG metaserver vägrar anslutning utan a YOG metaserver vägrar anslutning utan att lämna förklaring! [YESTS_CONNECTION_REFUSED_USERNAME_ALLREADY_USED] YOG metaserver vägrar anslutning eftersom ditt användarnamn redan används. +[YESTS_CONNECTION_REFUSED_USERNAME_BANNED] + [YESTS_CREATED] Anslutningssystemet är redo att kontakta YOG metaserver för anslutning. [YESTS_UNABLE_TO_CONNECT] @@ -1056,3 +1062,5 @@ Din %0 är under attack Din %0 är under attack [Your unit got converted to %0's team] Din enhet blev omvänd till %0s lag +[Your username was banned] + diff -r beec6cd83d42 -r 1aa6ab443568 data/texts.tr.txt --- a/data/texts.tr.txt Sun Apr 13 22:26:43 2008 -0400 +++ b/data/texts.tr.txt Mon Apr 14 19:33:19 2008 -0400 @@ -370,6 +370,8 @@ Oyun dolu Oyun dolu [game shortcuts] +[Game] + [general settings] [go to event] @@ -484,6 +486,8 @@ Oyun yukle [load] Yukle +[Lobby] + [login] Giris [Lost : %0 has more prestige than you] @@ -1040,6 +1044,8 @@ YOG onsunucusu baglantiyi reddetti. Gere YOG onsunucusu baglantiyi reddetti. Gerekce: Yok! [YESTS_CONNECTION_REFUSED_USERNAME_ALLREADY_USED] YOG onsunucusu baglantiyi reddetti. Gerekce: Bu kullanici adi kullanimda. +[YESTS_CONNECTION_REFUSED_USERNAME_BANNED] + [YESTS_CREATED] Baglanti sistemi baglanti icin YOG onsunucusuna baglanmaya hazir. [YESTS_UNABLE_TO_CONNECT] @@ -1056,3 +1062,5 @@ Kazandiniz! %0 'leriniz saldiri altinda [Your unit got converted to %0's team] Bir biriminiz %0 'nin tarafina gecti +[Your username was banned] + diff -r beec6cd83d42 -r 1aa6ab443568 data/texts.zh-tw.txt --- a/data/texts.zh-tw.txt Sun Apr 13 22:26:43 2008 -0400 +++ b/data/texts.zh-tw.txt Mon Apr 14 19:33:19 2008 -0400 @@ -370,6 +370,8 @@ AIWarrush 遊戲已滿 [game shortcuts] 遊戲快捷鍵 +[Game] + [general settings] 基本設定 [go to event] @@ -484,6 +486,8 @@ zh-tw [load] 載入 +[Lobby] + [login] 登入 [Lost : %0 has more prestige than you] @@ -1040,6 +1044,8 @@ YOG metaä¼ºæœå™¨æ‹’çµ•é€£ç·šè€Œæ²’æœ‰ä» YOG meta伺服器拒絕連線而沒有任何解釋!! [YESTS_CONNECTION_REFUSED_USERNAME_ALLREADY_USED] YOG meta伺服器拒絕連線因為你的用戶名已被使用。 +[YESTS_CONNECTION_REFUSED_USERNAME_BANNED] + [YESTS_CREATED] 連線系統已準備連接YOG meta伺服器。 [YESTS_UNABLE_TO_CONNECT] @@ -1056,3 +1062,5 @@ Ysagoon 線上遊戲 你的 %0 正遭受攻擊 [Your unit got converted to %0's team] 你的單位遭 %0 招降 +[Your username was banned] + diff -r beec6cd83d42 -r 1aa6ab443568 src/NetMessage.cpp --- a/src/NetMessage.cpp Sun Apr 13 22:26:43 2008 -0400 +++ b/src/NetMessage.cpp Mon Apr 14 19:33:19 2008 -0400 @@ -169,6 +169,9 @@ shared_ptr NetMessage::getNe case MNetSendGameResult: message.reset(new NetSendGameResult); break; + case MNetPlayerIsBanned: + message.reset(new NetPlayerIsBanned); + break; ///append_create_point } message->decodeData(stream); @@ -3376,4 +3379,55 @@ YOGGameResult NetSendGameResult::getGame + +NetPlayerIsBanned::NetPlayerIsBanned() +{ + +} + + + +Uint8 NetPlayerIsBanned::getMessageType() const +{ + return MNetPlayerIsBanned; +} + + + +void NetPlayerIsBanned::encodeData(GAGCore::OutputStream* stream) const +{ + stream->writeEnterSection("NetPlayerIsBanned"); + stream->writeLeaveSection(); +} + + + +void NetPlayerIsBanned::decodeData(GAGCore::InputStream* stream) +{ + stream->readEnterSection("NetPlayerIsBanned"); + stream->readLeaveSection(); +} + + + +std::string NetPlayerIsBanned::format() const +{ + std::ostringstream s; + s<<"NetPlayerIsBanned()"; + return s.str(); +} + + + +bool NetPlayerIsBanned::operator==(const NetMessage& rhs) const +{ + if(typeid(rhs)==typeid(NetPlayerIsBanned)) + { + //const NetPlayerIsBanned& r = dynamic_cast(rhs); + return true; + } + return false; +} + + //append_code_position diff -r beec6cd83d42 -r 1aa6ab443568 src/NetMessage.h --- a/src/NetMessage.h Sun Apr 13 22:26:43 2008 -0400 +++ b/src/NetMessage.h Mon Apr 14 19:33:19 2008 -0400 @@ -89,6 +89,7 @@ enum NetMessageType MNetStartGame, MNetUpdateGameList, MNetUpdatePlayerList, + MNetPlayerIsBanned, //type_append_marker }; @@ -1708,6 +1709,33 @@ private: private: private: YOGGameResult result; +}; + + + + +///NetPlayerIsBanned this bassically tells the client that their username was banned by the administrators +class NetPlayerIsBanned : public NetMessage +{ +public: + ///Creates a NetPlayerIsBanned message + NetPlayerIsBanned(); + + ///Returns MNetPlayerIsBanned + Uint8 getMessageType() const; + + ///Encodes the data + void encodeData(GAGCore::OutputStream* stream) const; + + ///Decodes the data + void decodeData(GAGCore::InputStream* stream); + + ///Formats the NetPlayerIsBanned message with a small amount + ///of information. + std::string format() const; + + ///Compares with another NetPlayerIsBanned + bool operator==(const NetMessage& rhs) const; }; diff -r beec6cd83d42 -r 1aa6ab443568 src/Player.cpp --- a/src/Player.cpp Sun Apr 13 22:26:43 2008 -0400 +++ b/src/Player.cpp Mon Apr 14 19:33:19 2008 -0400 @@ -41,11 +41,6 @@ Player::Player(GAGCore::InputStream *str :BasePlayer() { bool success=load(stream, teams, versionMinor); - if (success) - { - fprintf(logFile, "!success\n"); - fflush(logFile); - } assert(success); } @@ -128,7 +123,6 @@ bool Player::load(GAGCore::InputStream * if (memcmp(signature,"PLYb",4)!=0) { fprintf(stderr, "Player::load: Signature missmatch at begin of Player\n"); - fprintf(logFile, "Player::load: Signature missmatch at begin of Player\n"); stream->readLeaveSection(); return false; } @@ -146,7 +140,6 @@ bool Player::load(GAGCore::InputStream * if (!success) { fprintf(stderr, "Player::load: Error during BasePlayer load\n"); - fprintf(logFile, "Player::load: Error during BasePlayer load\n"); stream->readLeaveSection(); return false; } @@ -161,7 +154,6 @@ bool Player::load(GAGCore::InputStream * if (!ai->load(stream, versionMinor)) { fprintf(stderr, "Player::load: Error during AI load\n"); - fprintf(logFile, "Player::load: Error during AI load\n"); stream->readLeaveSection(); return false; } @@ -176,7 +168,6 @@ bool Player::load(GAGCore::InputStream * if (memcmp(signature,"PLYe",4)!=0) { fprintf(stderr, "Player::load: Signature missmatch at end of Player\n"); - fprintf(logFile, "Player::load: Signature missmatch at end of Player\n"); stream->readLeaveSection(); return false; } diff -r beec6cd83d42 -r 1aa6ab443568 src/SConscript --- a/src/SConscript Sun Apr 13 22:26:43 2008 -0400 +++ b/src/SConscript Mon Apr 14 19:33:19 2008 -0400 @@ -1,42 +1,43 @@ source_files = Split(""" source_files = Split(""" -AICastor.cpp AI.cpp AIEcho.cpp AINames.cpp -AINicowar.cpp AINull.cpp AINumbi.cpp AIToubib.cpp -AIWarrush.cpp BasePlayer.cpp BaseTeam.cpp BitArray.cpp - Brush.cpp Building.cpp BuildingsTypes.cpp -BuildingType.cpp Bullet.cpp Campaign.cpp CampaignEditor.cpp -CampaignMainMenu.cpp CampaignMenuScreen.cpp CampaignScreen.cpp CampaignSelectorScreen.cpp -ChooseMapScreen.cpp CPUStatisticsManager.cpp CreditScreen.cpp CustomGameScreen.cpp -DynamicClouds.cpp EditorMainMenu.cpp EndGameScreen.cpp Engine.cpp -EntityType.cpp Fatal.cpp FertilityCalculatorDialog.cpp FertilityCalculatorThread.cpp -FertilityCalculatorThreadMessage.cpp Game.cpp GameEvent.cpp GameGUI.cpp -GameGUIDefaultAssignManager.cpp GameGUIDialog.cpp GameGUIGhostBuildingManager.cpp GameGUIKeyActions.cpp -GameGUILoadSave.cpp GameGUIMessageManager.cpp GameGUIToolManager.cpp GameHeader.cpp -GameUtilities.cpp Glob2.cpp Glob2Screen.cpp Glob2Style.cpp -GlobalContainer.cpp GUIGlob2FileList.cpp GUIMapPreview.cpp HeightMapGenerator.cpp -IntBuildingType.cpp IRC.cpp IRCTextMessageHandler.cpp IRCThread.cpp -IRCThreadMessage.cpp KeyboardManager.cpp LANFindScreen.cpp LANGameInformation.cpp -LANMenuScreen.cpp LogFileManager.cpp MainMenuScreen.cpp MapAssembler.cpp -Map.cpp MapEdit.cpp MapEditKeyActions.cpp MapGenerationDescriptor.cpp -MapGenerator.cpp MapHeader.cpp MarkManager.cpp Minimap.cpp -MultiplayerGame.cpp MultiplayerGameEvent.cpp MultiplayerGameEventListener.cpp MultiplayerGameScreen.cpp -NetBroadcaster.cpp NetBroadcastListener.cpp NetConnection.cpp NetConnectionThread.cpp -NetConnectionThreadMessage.cpp NetEngine.cpp NetGamePlayerManager.cpp NetListener.cpp -NetMessage.cpp NetReteamingInformation.cpp NetTestSuite.cpp NewMapScreen.cpp -Order.cpp OverlayAreas.cpp P2PConnection.cpp P2PConnectionEvent.cpp -P2PConnectionListener.cpp P2PInformation.cpp P2PManager.cpp P2PPlayerInformation.cpp -PerlinNoise.cpp Player.cpp Race.cpp Ressource.cpp -RessourcesTypes.cpp ScriptEditorScreen.cpp Sector.cpp Settings.cpp -SettingsScreen.cpp SGSL.cpp SimplexNoise.cpp SoundMixer.cpp -Team.cpp TeamStat.cpp UnitConsts.cpp Unit.cpp -UnitEditorScreen.cpp UnitSkin.cpp UnitsSkins.cpp UnitType.cpp -Utilities.cpp VoiceRecorder.cpp YOGClientChatChannel.cpp YOGClientChatListener.cpp -YOGClient.cpp YOGClientEvent.cpp YOGClientEventListener.cpp YOGClientGameListListener.cpp -YOGClientGameListManager.cpp YOGClientLobbyScreen.cpp YOGClientPlayerListListener.cpp YOGClientPlayerListManager.cpp -YOGConsts.cpp YOGGameInfo.cpp YOGGameResults.cpp -YOGLoginScreen.cpp YOGMessage.cpp YOGPlayerSessionInfo.cpp YOGPlayerStoredInfo.cpp -YOGServerAdministrator.cpp YOGServerAdministratorList.cpp YOGServerChatChannel.cpp YOGServerChatChannelManager.cpp -YOGServer.cpp YOGServerGame.cpp YOGServerMapDistributor.cpp YOGServerPasswordRegistry.cpp -YOGServerPlayer.cpp YOGServerPlayerStoredInfoManager.cpp +AICastor.cpp AI.cpp AIEcho.cpp AINames.cpp +AINicowar.cpp AINull.cpp AINumbi.cpp AIToubib.cpp +AIWarrush.cpp BasePlayer.cpp BaseTeam.cpp BitArray.cpp +Brush.cpp Building.cpp BuildingsTypes.cpp BuildingType.cpp +Bullet.cpp Campaign.cpp CampaignEditor.cpp CampaignMainMenu.cpp +CampaignMenuScreen.cpp CampaignScreen.cpp CampaignSelectorScreen.cpp ChooseMapScreen.cpp +CPUStatisticsManager.cpp CreditScreen.cpp CustomGameScreen.cpp DynamicClouds.cpp +EditorMainMenu.cpp EndGameScreen.cpp Engine.cpp EntityType.cpp +Fatal.cpp FertilityCalculatorDialog.cpp FertilityCalculatorThread.cpp FertilityCalculatorThreadMessage.cpp +Game.cpp GameEvent.cpp GameGUI.cpp GameGUIDefaultAssignManager.cpp +GameGUIDialog.cpp GameGUIGhostBuildingManager.cpp GameGUIKeyActions.cpp GameGUILoadSave.cpp +GameGUIMessageManager.cpp GameGUIToolManager.cpp GameHeader.cpp GameUtilities.cpp +Glob2.cpp Glob2Screen.cpp Glob2Style.cpp GlobalContainer.cpp +GUIGlob2FileList.cpp GUIMapPreview.cpp HeightMapGenerator.cpp IntBuildingType.cpp +IRC.cpp IRCTextMessageHandler.cpp IRCThread.cpp IRCThreadMessage.cpp +KeyboardManager.cpp LANFindScreen.cpp LANGameInformation.cpp LANMenuScreen.cpp +LogFileManager.cpp MainMenuScreen.cpp MapAssembler.cpp Map.cpp +MapEdit.cpp MapEditKeyActions.cpp MapGenerationDescriptor.cpp MapGenerator.cpp +MapHeader.cpp MarkManager.cpp Minimap.cpp MultiplayerGame.cpp +MultiplayerGameEvent.cpp MultiplayerGameEventListener.cpp MultiplayerGameScreen.cpp NetBroadcaster.cpp +NetBroadcastListener.cpp NetConnection.cpp NetConnectionThread.cpp NetConnectionThreadMessage.cpp +NetEngine.cpp NetGamePlayerManager.cpp NetListener.cpp NetMessage.cpp +NetReteamingInformation.cpp NetTestSuite.cpp NewMapScreen.cpp Order.cpp +OverlayAreas.cpp P2PConnection.cpp P2PConnectionEvent.cpp P2PConnectionListener.cpp +P2PInformation.cpp P2PManager.cpp P2PPlayerInformation.cpp PerlinNoise.cpp +Player.cpp Race.cpp Ressource.cpp RessourcesTypes.cpp +ScriptEditorScreen.cpp Sector.cpp Settings.cpp SettingsScreen.cpp +SGSL.cpp SimplexNoise.cpp SoundMixer.cpp Team.cpp +TeamStat.cpp UnitConsts.cpp Unit.cpp UnitEditorScreen.cpp +UnitSkin.cpp UnitsSkins.cpp UnitType.cpp Utilities.cpp +VoiceRecorder.cpp YOGClientChatChannel.cpp YOGClientChatListener.cpp YOGClient.cpp +YOGClientEvent.cpp YOGClientEventListener.cpp YOGClientGameListListener.cpp YOGClientGameListManager.cpp +YOGClientLobbyScreen.cpp YOGClientPlayerListListener.cpp YOGClientPlayerListManager.cpp YOGConsts.cpp + YOGGameInfo.cpp YOGGameResults.cpp YOGLoginScreen.cpp +YOGMessage.cpp YOGPlayerSessionInfo.cpp YOGPlayerStoredInfo.cpp YOGServerAdministratorCommands.cpp +YOGServerAdministrator.cpp YOGServerAdministratorList.cpp YOGServerChatChannel.cpp YOGServerChatChannelManager.cpp +YOGServer.cpp YOGServerGame.cpp YOGServerMapDistributor.cpp YOGServerPasswordRegistry.cpp +YOGServerPlayer.cpp YOGServerPlayerStoredInfoManager.cpp + """) diff -r beec6cd83d42 -r 1aa6ab443568 src/Version.h --- a/src/Version.h Sun Apr 13 22:26:43 2008 -0400 +++ b/src/Version.h Mon Apr 14 19:33:19 2008 -0400 @@ -97,4 +97,8 @@ // version 26 changed heavy updates to YOG in general // version 27 reordered the NetMessages so that reverse compatibility with future game versions can be done, added random seed in GameHeader +///This must be updated if changes to YOGPlayerStoredInfo, or YOGServerPasswordRegistry occur +#define NET_DATA_VERSION 1 +// version 1 Created NET_DATA_VERSION + #endif diff -r beec6cd83d42 -r 1aa6ab443568 src/YOGClient.cpp --- a/src/YOGClient.cpp Sun Apr 13 22:26:43 2008 -0400 +++ b/src/YOGClient.cpp Mon Apr 14 19:33:19 2008 -0400 @@ -117,232 +117,234 @@ void YOGClient::update() wasConnected=false; } - if(nc.isConnected()) + //If we need to send client information, send it + if(connectionState == NeedToSendClientInformation) { - //If we need to send client information, send it - if(connectionState == NeedToSendClientInformation) + shared_ptr message(new NetSendClientInformation); + nc.sendMessage(message); + connectionState = WaitingForServerInformation; + } + + //Parse incoming messages and generate events + shared_ptr message = nc.getMessage(); + if(!message) + return; + Uint8 type = message->getMessageType(); + //This recieves the server information + if(type==MNetSendServerInformation) + { + shared_ptr info = static_pointer_cast(message); + loginPolicy = info->getLoginPolicy(); + gamePolicy = info->getGamePolicy(); + playerID = info->getPlayerID(); + shared_ptr event(new YOGConnectedEvent); + sendToListeners(event); + connectionState = WaitingForLoginInformation; + } + //This recieves a login acceptance message + if(type==MNetLoginSuccessful) + { + shared_ptr info = static_pointer_cast(message); + connectionState = ClientOnStandby; + loginState = YOGLoginSuccessful; + shared_ptr event(new YOGLoginAcceptedEvent); + sendToListeners(event); + + //Set the local p2p port + int port = p2pconnection->getPort(); + shared_ptr message(new NetSetPlayerLocalPort(port)); + sendNetMessage(message); + } + //This recieves a login refusal message + if(type==MNetRefuseLogin) + { + shared_ptr info = static_pointer_cast(message); + connectionState = WaitingForLoginInformation; + loginState = info->getRefusalReason(); + shared_ptr event(new YOGLoginRefusedEvent(info->getRefusalReason())); + sendToListeners(event); + } + //This recieves a registration acceptance message + if(type==MNetAcceptRegistration) + { + shared_ptr info = static_pointer_cast(message); + connectionState = ClientOnStandby; + loginState = YOGLoginSuccessful; + shared_ptr event(new YOGLoginAcceptedEvent); + sendToListeners(event); + } + //This recieves a regisration refusal message + if(type==MNetRefuseRegistration) + { + shared_ptr info = static_pointer_cast(message); + connectionState = WaitingForLoginInformation; + loginState = info->getRefusalReason(); + shared_ptr event(new YOGLoginRefusedEvent(info->getRefusalReason())); + sendToListeners(event); + } + ///This recieves a game list update message + if(type==MNetUpdateGameList) + { + if(gameListManager) + gameListManager->recieveMessage(message); + } + ///This recieves a player list update message + if(type==MNetUpdatePlayerList) + { + if(playerListManager) + playerListManager->recieveMessage(message); + } + ///This recieves a YOGMessage list update message + if(type==MNetSendYOGMessage) + { + shared_ptr yogmessage = static_pointer_cast(message); + if(chatChannels.find(yogmessage->getChannel()) != chatChannels.end()) { - shared_ptr message(new NetSendClientInformation); - nc.sendMessage(message); - connectionState = WaitingForServerInformation; + chatChannels[yogmessage->getChannel()]->recieveMessage(yogmessage->getMessage()); } + else + { + std::cerr<<"Recieved YOGMessage on a channel without a local YOGClientChatChannel"< message = nc.getMessage(); - if(!message) - return; - Uint8 type = message->getMessageType(); - //This recieves the server information - if(type==MNetSendServerInformation) - { - shared_ptr info = static_pointer_cast(message); - loginPolicy = info->getLoginPolicy(); - gamePolicy = info->getGamePolicy(); - playerID = info->getPlayerID(); - shared_ptr event(new YOGConnectedEvent); - sendToListeners(event); - connectionState = WaitingForLoginInformation; - } - //This recieves a login acceptance message - if(type==MNetLoginSuccessful) - { - shared_ptr info = static_pointer_cast(message); - connectionState = ClientOnStandby; - loginState = YOGLoginSuccessful; - shared_ptr event(new YOGLoginAcceptedEvent); - sendToListeners(event); - - //Set the local p2p port - int port = p2pconnection->getPort(); - shared_ptr message(new NetSetPlayerLocalPort(port)); - sendNetMessage(message); - } - //This recieves a login refusal message - if(type==MNetRefuseLogin) - { - shared_ptr info = static_pointer_cast(message); - connectionState = WaitingForLoginInformation; - loginState = info->getRefusalReason(); - shared_ptr event(new YOGLoginRefusedEvent(info->getRefusalReason())); - sendToListeners(event); - } - //This recieves a registration acceptance message - if(type==MNetAcceptRegistration) - { - shared_ptr info = static_pointer_cast(message); - connectionState = ClientOnStandby; - loginState = YOGLoginSuccessful; - shared_ptr event(new YOGLoginAcceptedEvent); - sendToListeners(event); - } - //This recieves a regisration refusal message - if(type==MNetRefuseRegistration) - { - shared_ptr info = static_pointer_cast(message); - connectionState = WaitingForLoginInformation; - loginState = info->getRefusalReason(); - shared_ptr event(new YOGLoginRefusedEvent(info->getRefusalReason())); - sendToListeners(event); - } - ///This recieves a game list update message - if(type==MNetUpdateGameList) - { - if(gameListManager) - gameListManager->recieveMessage(message); - } - ///This recieves a player list update message - if(type==MNetUpdatePlayerList) - { - if(playerListManager) - playerListManager->recieveMessage(message); - } - ///This recieves a YOGMessage list update message - if(type==MNetSendYOGMessage) - { - shared_ptr yogmessage = static_pointer_cast(message); - if(chatChannels.find(yogmessage->getChannel()) != chatChannels.end()) - { - chatChannels[yogmessage->getChannel()]->recieveMessage(yogmessage->getMessage()); - } - else - { - std::cerr<<"Recieved YOGMessage on a channel without a local YOGClientChatChannel"<recieveMessage(message); - } - if(type==MNetCreateGameRefused) - { - if(joinedGame) - joinedGame->recieveMessage(message); - } - if(type==MNetGameJoinAccepted) - { - if(joinedGame) - joinedGame->recieveMessage(message); - } - if(type==MNetGameJoinRefused) - { - if(joinedGame) - joinedGame->recieveMessage(message); - } - if(type==MNetSendMapHeader) - { - if(joinedGame) - joinedGame->recieveMessage(message); - } - if(type==MNetSendGameHeader) - { - if(joinedGame) - joinedGame->recieveMessage(message); - } - if(type==MNetSendGamePlayerInfo) - { - if(joinedGame) - joinedGame->recieveMessage(message); - } - if(type==MNetStartGame) - { - if(joinedGame) - joinedGame->recieveMessage(message); - } - if(type==MNetRefuseGameStart) - { - if(joinedGame) - joinedGame->recieveMessage(message); - } - if(type==MNetSendOrder) - { - //ignore orders for when there is no joined game, - //say, the leftover orders in transit after a player - //quits a game - if(joinedGame) - joinedGame->recieveMessage(message); - } - if(type==MNetRequestMap) - { - if(joinedGame) - joinedGame->recieveMessage(message); - } - if(type==MNetKickPlayer) - { - if(joinedGame) - joinedGame->recieveMessage(message); - } - if(type==MNetReadyToLaunch) - { - if(joinedGame) - joinedGame->recieveMessage(message); - } - if(type==MNetEveryoneReadyToLaunch) - { - if(joinedGame) - joinedGame->recieveMessage(message); - } - if(type==MNetNotEveryoneReadyToLaunch) - { - if(joinedGame) - joinedGame->recieveMessage(message); - } - if(type==MNetSetLatencyMode) - { - if(joinedGame) - joinedGame->recieveMessage(message); - } - if(type == MNetPlayerJoinsGame) - { - if(joinedGame) - joinedGame->recieveMessage(message); - } - if(type == MNetAddAI) - { - if(joinedGame) - joinedGame->recieveMessage(message); - } - if(type == MNetRemoveAI) - { - if(joinedGame) - joinedGame->recieveMessage(message); - } - if(type == MNetChangePlayersTeam) - { - if(joinedGame) - joinedGame->recieveMessage(message); - } - if(type == MNetSendReteamingInformation) - { - if(joinedGame) - joinedGame->recieveMessage(message); - } - if(type==MNetSendFileInformation) - { - if(assembler) - assembler->handleMessage(message); - } - if(type==MNetRequestNextChunk) - { - if(assembler) - assembler->handleMessage(message); - } - if(type==MNetSendFileChunk) - { - if(assembler) - assembler->handleMessage(message); - } - if(type == MNetPing) - { - shared_ptr event(new NetPingReply); - nc.sendMessage(event); - } - if(type == MNetSendP2PInformation) - { - if(p2pconnection) - p2pconnection->recieveMessage(message); - } + if(type==MNetCreateGameAccepted) + { + if(joinedGame) + joinedGame->recieveMessage(message); + } + if(type==MNetCreateGameRefused) + { + if(joinedGame) + joinedGame->recieveMessage(message); + } + if(type==MNetGameJoinAccepted) + { + if(joinedGame) + joinedGame->recieveMessage(message); + } + if(type==MNetGameJoinRefused) + { + if(joinedGame) + joinedGame->recieveMessage(message); + } + if(type==MNetSendMapHeader) + { + if(joinedGame) + joinedGame->recieveMessage(message); + } + if(type==MNetSendGameHeader) + { + if(joinedGame) + joinedGame->recieveMessage(message); + } + if(type==MNetSendGamePlayerInfo) + { + if(joinedGame) + joinedGame->recieveMessage(message); + } + if(type==MNetStartGame) + { + if(joinedGame) + joinedGame->recieveMessage(message); + } + if(type==MNetRefuseGameStart) + { + if(joinedGame) + joinedGame->recieveMessage(message); + } + if(type==MNetSendOrder) + { + //ignore orders for when there is no joined game, + //say, the leftover orders in transit after a player + //quits a game + if(joinedGame) + joinedGame->recieveMessage(message); + } + if(type==MNetRequestMap) + { + if(joinedGame) + joinedGame->recieveMessage(message); + } + if(type==MNetKickPlayer) + { + if(joinedGame) + joinedGame->recieveMessage(message); + } + if(type==MNetReadyToLaunch) + { + if(joinedGame) + joinedGame->recieveMessage(message); + } + if(type==MNetEveryoneReadyToLaunch) + { + if(joinedGame) + joinedGame->recieveMessage(message); + } + if(type==MNetNotEveryoneReadyToLaunch) + { + if(joinedGame) + joinedGame->recieveMessage(message); + } + if(type==MNetSetLatencyMode) + { + if(joinedGame) + joinedGame->recieveMessage(message); + } + if(type == MNetPlayerJoinsGame) + { + if(joinedGame) + joinedGame->recieveMessage(message); + } + if(type == MNetAddAI) + { + if(joinedGame) + joinedGame->recieveMessage(message); + } + if(type == MNetRemoveAI) + { + if(joinedGame) + joinedGame->recieveMessage(message); + } + if(type == MNetChangePlayersTeam) + { + if(joinedGame) + joinedGame->recieveMessage(message); + } + if(type == MNetSendReteamingInformation) + { + if(joinedGame) + joinedGame->recieveMessage(message); + } + if(type==MNetSendFileInformation) + { + if(assembler) + assembler->handleMessage(message); + } + if(type==MNetRequestNextChunk) + { + if(assembler) + assembler->handleMessage(message); + } + if(type==MNetSendFileChunk) + { + if(assembler) + assembler->handleMessage(message); + } + if(type == MNetPing) + { + shared_ptr event(new NetPingReply); + nc.sendMessage(event); + } + if(type == MNetSendP2PInformation) + { + if(p2pconnection) + p2pconnection->recieveMessage(message); + } + if(type == MNetPlayerIsBanned) + { + shared_ptr event(new YOGPlayerBannedEvent); + sendToListeners(event); } } diff -r beec6cd83d42 -r 1aa6ab443568 src/YOGClientEvent.cpp --- a/src/YOGClientEvent.cpp Sun Apr 13 22:26:43 2008 -0400 +++ b/src/YOGClientEvent.cpp Mon Apr 14 19:33:19 2008 -0400 @@ -160,4 +160,37 @@ YOGLoginState YOGLoginRefusedEvent::getR return reason; } +YOGPlayerBannedEvent::YOGPlayerBannedEvent() +{ +} + + + +Uint8 YOGPlayerBannedEvent::getEventType() const +{ + return YEPlayerBanned; +} + + + +std::string YOGPlayerBannedEvent::format() const +{ + std::ostringstream s; + s<<"YOGPlayerBannedEvent()"; + return s.str(); +} + + + +bool YOGPlayerBannedEvent::operator==(const YOGClientEvent& rhs) const +{ + if(typeid(rhs)==typeid(YOGPlayerBannedEvent)) + { + //const YOGPlayerBannedEvent& r = dynamic_cast(rhs); + return true; + } + return false; +} + + //code_append_marker diff -r beec6cd83d42 -r 1aa6ab443568 src/YOGClientEvent.h --- a/src/YOGClientEvent.h Sun Apr 13 22:26:43 2008 -0400 +++ b/src/YOGClientEvent.h Mon Apr 14 19:33:19 2008 -0400 @@ -29,6 +29,7 @@ enum YOGClientEventType YEConnectionLost, YELoginAccepted, YELoginRefused, + YEPlayerBanned, //type_append_marker }; @@ -137,6 +138,26 @@ private: + +///YOGPlayerBannedEvent +class YOGPlayerBannedEvent : public YOGClientEvent +{ +public: + ///Creates a YOGPlayerBannedEvent event + YOGPlayerBannedEvent(); + + ///Returns YEPlayerBanned + Uint8 getEventType() const; + + ///Returns a formatted version of the event + std::string format() const; + + ///Compares two YOGEvent + bool operator==(const YOGClientEvent& rhs) const; +}; + + + //event_append_marker #endif diff -r beec6cd83d42 -r 1aa6ab443568 src/YOGClientLobbyScreen.cpp --- a/src/YOGClientLobbyScreen.cpp Sun Apr 13 22:26:43 2008 -0400 +++ b/src/YOGClientLobbyScreen.cpp Mon Apr 14 19:33:19 2008 -0400 @@ -23,6 +23,7 @@ #include "GlobalContainer.h" #include #include +#include "GUIMessageBox.h" #include #include #include @@ -238,6 +239,10 @@ void YOGClientLobbyScreen::handleYOGClie { endExecute(ConnectionLost); } + else if(type == YEPlayerBanned) + { + GAGGUI::MessageBox(globalContainer->gfx, "standard", GAGGUI::MB_ONEBUTTON, Toolkit::getStringTable()->getString("[Your username was banned]"), Toolkit::getStringTable()->getString("[Ok]")); + } } diff -r beec6cd83d42 -r 1aa6ab443568 src/YOGConsts.h --- a/src/YOGConsts.h Sun Apr 13 22:26:43 2008 -0400 +++ b/src/YOGConsts.h Mon Apr 14 19:33:19 2008 -0400 @@ -79,6 +79,8 @@ enum YOGLoginState YOGClientVersionTooOld, ///This means that this username is already logged in YOGAlreadyAuthenticated, + ///This means that this username is banned + YOGUsernameBanned, }; ///This represents the reason why the player could not join a game. diff -r beec6cd83d42 -r 1aa6ab443568 src/YOGLoginScreen.cpp --- a/src/YOGLoginScreen.cpp Sun Apr 13 22:26:43 2008 -0400 +++ b/src/YOGLoginScreen.cpp Mon Apr 14 19:33:19 2008 -0400 @@ -186,6 +186,10 @@ void YOGLoginScreen::handleYOGClientEven { statusText->setText(Toolkit::getStringTable()->getString("[YESTS_CONNECTION_REFUSED_USERNAME_ALLREADY_USED]")); } + else if(reason == YOGUsernameBanned) + { + statusText->setText(Toolkit::getStringTable()->getString("[YESTS_CONNECTION_REFUSED_USERNAME_BANNED]")); + } else if(reason == YOGLoginUnknown) { statusText->setText(Toolkit::getStringTable()->getString("[YESTS_CONNECTION_REFUSED_UNEXPLAINED]")); diff -r beec6cd83d42 -r 1aa6ab443568 src/YOGPlayerStoredInfo.cpp --- a/src/YOGPlayerStoredInfo.cpp Sun Apr 13 22:26:43 2008 -0400 +++ b/src/YOGPlayerStoredInfo.cpp Mon Apr 14 19:33:19 2008 -0400 @@ -23,6 +23,7 @@ YOGPlayerStoredInfo::YOGPlayerStoredInfo() { + banned=false; } @@ -53,24 +54,47 @@ bool YOGPlayerStoredInfo::isMuted() +void YOGPlayerStoredInfo::setBanned() +{ + banned = true; +} + + + +void YOGPlayerStoredInfo::setUnbanned() +{ + banned = false; +} + + + +bool YOGPlayerStoredInfo::isBanned() +{ + return banned; +} + + + void YOGPlayerStoredInfo::encodeData(GAGCore::OutputStream* stream) const { stream->writeEnterSection("YOGPlayerStoredInfo"); std::stringstream time; time<writeText(time.str(), "unmute_time"); + stream->writeUint8(banned, "banned"); stream->writeLeaveSection(); } -void YOGPlayerStoredInfo::decodeData(GAGCore::InputStream* stream) +void YOGPlayerStoredInfo::decodeData(GAGCore::InputStream* stream, Uint32 dataVersionMinor) { stream->readEnterSection("YOGPlayerStoredInfo"); std::string b = stream->readText("unmute_time"); std::stringstream time; time<>unmute_time; + banned=stream->readUint8("banned"); stream->readLeaveSection(); } @@ -78,7 +102,7 @@ void YOGPlayerStoredInfo::decodeData(GAG bool YOGPlayerStoredInfo::operator==(const YOGPlayerStoredInfo& rhs) const { - if(unmute_time == rhs.unmute_time) + if(unmute_time == rhs.unmute_time && banned == rhs.banned) return true; return false; } @@ -87,7 +111,7 @@ bool YOGPlayerStoredInfo::operator==(con bool YOGPlayerStoredInfo::operator!=(const YOGPlayerStoredInfo& rhs) const { - if(unmute_time != rhs.unmute_time) + if(unmute_time != rhs.unmute_time && banned == rhs.banned) return true; return false; } diff -r beec6cd83d42 -r 1aa6ab443568 src/YOGPlayerStoredInfo.h --- a/src/YOGPlayerStoredInfo.h Sun Apr 13 22:26:43 2008 -0400 +++ b/src/YOGPlayerStoredInfo.h Mon Apr 14 19:33:19 2008 -0400 @@ -20,6 +20,7 @@ #define YOGPlayerStoredInfo_h #include "boost/date_time/posix_time/posix_time.hpp" +#include "SDL_net.h" namespace GAGCore { @@ -43,18 +44,27 @@ public: ///Returns true if this player is muted, false otherwise bool isMuted(); + ///Sets this player to be banned + void setBanned(); + + ///Sets this player to be unbanned + void setUnbanned(); + + ///Returns true if this player is banned, false otherwise + bool isBanned(); + ///Encodes this YOGPlayerStoredInfo into a bit stream void encodeData(GAGCore::OutputStream* stream) const; ///Decodes this YOGPlayerStoredInfo from a bit stream - void decodeData(GAGCore::InputStream* stream); + void decodeData(GAGCore::InputStream* stream, Uint32 dataVersionMinor); ///Test for equality between two YOGPlayerStoredInfo bool operator==(const YOGPlayerStoredInfo& rhs) const; bool operator!=(const YOGPlayerStoredInfo& rhs) const; private: boost::posix_time::ptime unmute_time; - + bool banned; }; #endif diff -r beec6cd83d42 -r 1aa6ab443568 src/YOGServer.cpp --- a/src/YOGServer.cpp Sun Apr 13 22:26:43 2008 -0400 +++ b/src/YOGServer.cpp Mon Apr 14 19:33:19 2008 -0400 @@ -173,6 +173,15 @@ YOGLoginState YOGServer::verifyLoginInfo return YOGClientVersionTooOld; if(loginPolicy == YOGAnonymousLogin) return YOGLoginSuccessful; + + ///check if the player is banned + if(playerInfos.doesStoredInfoExist(username)) + { + if(playerInfos.getPlayerStoredInfo(username).isBanned()) + { + return YOGUsernameBanned; + } + } ///check if the player is already logged in for(std::map >::iterator i = players.begin(); i!=players.end(); ++i) @@ -308,6 +317,20 @@ shared_ptr YOGServer::g +boost::shared_ptr YOGServer::getPlayer(const std::string& name) +{ + for(std::map >::iterator i = players.begin(); i!=players.end(); ++i) + { + if(i->second->getPlayerName() == name) + { + return i->second; + } + } + return boost::shared_ptr(); +} + + + void YOGServer::enableLANBroadcasting() { if(gameList.size()) diff -r beec6cd83d42 -r 1aa6ab443568 src/YOGServer.h --- a/src/YOGServer.h Sun Apr 13 22:26:43 2008 -0400 +++ b/src/YOGServer.h Mon Apr 14 19:33:19 2008 -0400 @@ -111,6 +111,9 @@ public: ///Returns the player assocciatted with the given ID boost::shared_ptr getPlayer(Uint16 playerID); + + ///Returns the player assocciatted with the given name + boost::shared_ptr getPlayer(const std::string& name); ///This starts LAN broadcasting of the first game, if it exists void enableLANBroadcasting(); diff -r beec6cd83d42 -r 1aa6ab443568 src/YOGServerAdministrator.cpp --- a/src/YOGServerAdministrator.cpp Sun Apr 13 22:26:43 2008 -0400 +++ b/src/YOGServerAdministrator.cpp Mon Apr 14 19:33:19 2008 -0400 @@ -17,6 +17,7 @@ */ #include "YOGServerAdministrator.h" +#include "YOGServerAdministratorCommands.h" #include "YOGServer.h" #include "YOGServerPlayer.h" #include "YOGMessage.h" @@ -25,59 +26,93 @@ YOGServerAdministrator::YOGServerAdminis YOGServerAdministrator::YOGServerAdministrator(YOGServer* server) : server(server) { + commands.push_back(new YOGServerRestart); + commands.push_back(new YOGMutePlayer); + commands.push_back(new YOGUnmutePlayer); + commands.push_back(new YOGResetPassword); + commands.push_back(new YOGBanPlayer); + commands.push_back(new YOGUnbanPlayer); + commands.push_back(new YOGShowBannedPlayers); +} + + +YOGServerAdministrator::~YOGServerAdministrator() +{ + for(int i=0; i player) { - if(message.substr(0, 15)==".server_restart") + std::vector tokens; + std::string token; + bool isQuotes=false; + for(int i=0; igetPlayerStoredInfoManager().doesStoredInfoExist(name)) + if(message[i]==' ' && !isQuotes) { - boost::posix_time::ptime unmute_time = boost::posix_time::second_clock::local_time() + boost::posix_time::minutes(10); - server->getPlayerStoredInfoManager().getPlayerStoredInfo(name).setMuted(unmute_time); - sendTextMessage("Player muted: "+name, player); + if(!token.empty()) + { + tokens.push_back(token); + token.clear(); + } + } + else if(message[i]=='"' && isQuotes) + { + isQuotes=false; + } + else if(message[i]=='"' && !isQuotes) + { + isQuotes=true; } else { - sendTextMessage("Could not find player: "+name, player); + token+=message[i]; } } - else if(message.substr(0, 15) == ".unmute_player ") + if(!token.empty()) { - std::string name = message.substr(15, message.size()); - if(server->getPlayerStoredInfoManager().doesStoredInfoExist(name)) + tokens.push_back(token); + token.clear(); + } + + if(tokens.size() == 0) + { + return false; + } + + + if(tokens[0] == ".help") + { + sendTextMessage("The current list of YOG Administrative Commands are: ", player); + for(int i=0; igetPlayerStoredInfoManager().getPlayerStoredInfo(name).setUnmuted(); - sendTextMessage("Player unmuted: "+name, player); + sendTextMessage(commands[i]->getHelpMessage(), player); } - else - { - sendTextMessage("Could not find player: "+name, player); + sendTextMessage(".help Shows this help message", player); + } + else + { + for(int i=0; igetCommandName()) + { + if(!commands[i]->doesMatch(tokens)) + { + sendTextMessage(commands[i]->getHelpMessage(), player); + } + else + { + commands[i]->execute(server, this, tokens, player); + } + } } } - else if(message.substr(0, 16) == ".reset_password ") - { - std::string name = message.substr(16, message.size()); - server->getServerPasswordRegistry().resetPlayersPassword(name); - sendTextMessage("Players password reset: "+name, player); - } - else if(message.substr(0, 5) == ".help") - { - sendTextMessage("The current list of YOG Administrative Commands are: ", player); - sendTextMessage(".server_restart Hard resets the server", player); - sendTextMessage(".mute_player Mutes a player for 10 minutes ", player); - sendTextMessage(".unmute_player Unmutes a player", player); - sendTextMessage(".reset_password Resets the password for a player", player); - sendTextMessage(".help Shows this help message", player); - } - return false; } diff -r beec6cd83d42 -r 1aa6ab443568 src/YOGServerAdministrator.h --- a/src/YOGServerAdministrator.h Sun Apr 13 22:26:43 2008 -0400 +++ b/src/YOGServerAdministrator.h Mon Apr 14 19:33:19 2008 -0400 @@ -21,9 +21,11 @@ #include #include "boost/shared_ptr.hpp" +#include class YOGServer; class YOGServerPlayer; +class YOGServerAdministratorCommand; ///This governs the system of administrative commands to the YOG server class YOGServerAdministrator @@ -32,16 +34,22 @@ public: ///Constructs the administration engine YOGServerAdministrator(YOGServer* server); + ///Destroys the administration engine + ~YOGServerAdministrator(); + ///Interprets whether the given message is an administrative command, ///and if so, executes it. If it was, returns true, otherwise, returns ///false bool executeAdministrativeCommand(const std::string& message, boost::shared_ptr player); - -private: + ///This sends a message to the player from the administrator engine void sendTextMessage(const std::string& message, boost::shared_ptr player); +private: + YOGServer* server; + + std::vector commands; }; #endif diff -r beec6cd83d42 -r 1aa6ab443568 src/YOGServerPasswordRegistry.cpp --- a/src/YOGServerPasswordRegistry.cpp Sun Apr 13 22:26:43 2008 -0400 +++ b/src/YOGServerPasswordRegistry.cpp Mon Apr 14 19:33:19 2008 -0400 @@ -22,6 +22,7 @@ #include "Toolkit.h" #include "FileManager.h" #include "../gnupg/sha1.c" +#include "Version.h" #include @@ -67,6 +68,7 @@ void YOGServerPasswordRegistry::flushPas void YOGServerPasswordRegistry::flushPasswords() { OutputStream* stream = new BinaryOutputStream(Toolkit::getFileManager()->openOutputStreamBackend("registry")); + stream->writeUint32(NET_DATA_VERSION, "version"); stream->writeUint32(passwords.size(), "size"); for(std::map::iterator i = passwords.begin(); i!=passwords.end(); ++i) { @@ -83,6 +85,7 @@ void YOGServerPasswordRegistry::readPass InputStream* stream = new BinaryInputStream(Toolkit::getFileManager()->openInputStreamBackend("registry")); if(stream->isEndOfStream()) return; + Uint32 dataVersionMinor = stream->readUint32("version"); Uint32 size = stream->readUint32("size"); for(unsigned i=0; i info = static_pointer_cast(message); @@ -397,6 +398,12 @@ int YOGServerPlayer::getP2PPort() +void YOGServerPlayer::closeConnection() +{ + connection->closeConnection(); +} + + void YOGServerPlayer::updateConnectionSates() { diff -r beec6cd83d42 -r 1aa6ab443568 src/YOGServerPlayer.h --- a/src/YOGServerPlayer.h Sun Apr 13 22:26:43 2008 -0400 +++ b/src/YOGServerPlayer.h Mon Apr 14 19:33:19 2008 -0400 @@ -83,6 +83,9 @@ public: ///This returns the port for the p2p connection client end on this player int getP2PPort(); + + ///Tells this YOGServerPlayer to close connection + void closeConnection(); private: ///This enum represents the state machine of the initial connection enum ConnectionState diff -r beec6cd83d42 -r 1aa6ab443568 src/YOGServerPlayerStoredInfoManager.cpp --- a/src/YOGServerPlayerStoredInfoManager.cpp Sun Apr 13 22:26:43 2008 -0400 +++ b/src/YOGServerPlayerStoredInfoManager.cpp Mon Apr 14 19:33:19 2008 -0400 @@ -22,6 +22,7 @@ #include "BinaryStream.h" #include "Toolkit.h" #include "FileManager.h" +#include "Version.h" using namespace GAGCore; @@ -79,9 +80,23 @@ YOGPlayerStoredInfo& YOGServerPlayerStor +std::list YOGServerPlayerStoredInfoManager::getBannedPlayers() +{ + std::list players; + for(std::map::iterator i = playerInfos.begin(); i!=playerInfos.end(); ++i) + { + if(i->second.isBanned()) + players.push_back(i->first); + } + return players; +} + + + void YOGServerPlayerStoredInfoManager::savePlayerInfos() { OutputStream* stream = new BinaryOutputStream(Toolkit::getFileManager()->openOutputStreamBackend("playerinfo")); + stream->writeUint32(NET_DATA_VERSION, "version"); stream->writeUint32(playerInfos.size(), "size"); for(std::map::iterator i = playerInfos.begin(); i!=playerInfos.end(); ++i) { @@ -98,12 +113,13 @@ void YOGServerPlayerStoredInfoManager::l InputStream* stream = new BinaryInputStream(Toolkit::getFileManager()->openInputStreamBackend("playerinfo")); if(!stream->isEndOfStream()) { + Uint32 dataVersionMinor = stream->readUint32("version"); Uint32 size = stream->readUint32("size"); for(unsigned i=0; ireadText("username"); YOGPlayerStoredInfo info; - info.decodeData(stream); + info.decodeData(stream, dataVersionMinor); playerInfos.insert(std::make_pair(name, info)); } } diff -r beec6cd83d42 -r 1aa6ab443568 src/YOGServerPlayerStoredInfoManager.h --- a/src/YOGServerPlayerStoredInfoManager.h Sun Apr 13 22:26:43 2008 -0400 +++ b/src/YOGServerPlayerStoredInfoManager.h Mon Apr 14 19:33:19 2008 -0400 @@ -24,6 +24,7 @@ #include #include #include "SDL_net.h" +#include ///This class stores and records YOGPlayerStoredInfo for the server class YOGServerPlayerStoredInfoManager @@ -44,6 +45,9 @@ public: ///Returns the player info YOGPlayerStoredInfo& getPlayerStoredInfo(const std::string& username); + ///Returns a list of the banned players + std::list getBannedPlayers(); + ///This stores the player infos in a file void savePlayerInfos(); diff -r beec6cd83d42 -r 1aa6ab443568 src/add_yog_event.py --- a/src/add_yog_event.py Sun Apr 13 22:26:43 2008 -0400 +++ b/src/add_yog_event.py Mon Apr 14 19:33:19 2008 -0400 @@ -1,12 +1,14 @@ from add_stuff_base import * from add_stuff_base import * -backup("YOGEvent.h") -backup("YOGEvent.cpp") +backup("YOGClientEvent.h") +backup("YOGClientEvent.cpp") print "Name? " name = raw_input() tname = "YE"+name.replace("YOG", "").replace("Event", "") + variables = assemble_variables(False, False) +vn = len(variables) constructor=assemble_constructor_define(variables) @@ -26,7 +28,7 @@ get_function_defines = assemble_get_func hcode = """ ///mname -class mname : public YOGEvent +class mname : public YOGClientEvent { public: ///Creates a mname event @@ -39,7 +41,7 @@ public: std::string format() const; ///Compares two YOGEvent - bool operator==(const YOGEvent& rhs) const; + bool operator==(const YOGClientEvent& rhs) const; """ hcode+=declare_functions hcode+=declare_variables @@ -69,7 +71,7 @@ std::string mname::format() const -bool mname::operator==(const YOGEvent& rhs) const +bool mname::operator==(const YOGClientEvent& rhs) const { if(typeid(rhs)==typeid(mname)) { @@ -85,17 +87,17 @@ scode += get_function_defines -lines = readLines("YOGEvent.h") +lines = readLines("YOGClientEvent.h") i = findMarker(lines,"type_append_marker") lines.insert(i, " %s,\n" % tname) i = findMarker(lines,"event_append_marker") lines.insert(i, hcode.replace("mname", name).replace("tname", tname)) -writeLines("YOGEvent.h", lines) +writeLines("YOGClientEvent.h", lines) -lines = readLines("YOGEvent.cpp") +lines = readLines("YOGClientEvent.cpp") i = findMarker(lines, "code_append_marker") lines.insert(i, scode.replace("mname", name).replace("tname", tname)) -writeLines("YOGEvent.cpp", lines) +writeLines("YOGClientEvent.cpp", lines) # HG changeset patch # User Bradley Arsenault # Date 1208219361 14400 # Node ID 983067233fce6c6c82ff4439899f427932fe8928 # Parent 1aa6ab443568d1632313cba38e9ec289c749f804 Added new engine for Banning IP addresses on the yog meta server. Added a few missing files from last commit. diff -r 1aa6ab443568 -r 983067233fce data/texts.ar.txt --- a/data/texts.ar.txt Mon Apr 14 19:33:19 2008 -0400 +++ b/data/texts.ar.txt Mon Apr 14 20:29:21 2008 -0400 @@ -1038,6 +1038,8 @@ The YOG metaserver has refused connectio The YOG metaserver has refused connection because the supplied password was incorrect. [YESTS_CONNECTION_REFUSED_BAD_PASSWORD_NON_ZERO] The YOG metaserver has refused connection because this username has no password yet. You probably want to register your username with this password. Therefore, activate the option "Register a new YOG user with password" before connecting. You'll need to activate this option only once. +[YESTS_CONNECTION_REFUSED_IP_TEMPORARILY_BANNED] + [YESTS_CONNECTION_REFUSED_PROTOCOL_TOO_OLD] The YOG metaserver has refused connection because your globulation2 client is obsolete. [YESTS_CONNECTION_REFUSED_UNEXPLAINED] @@ -1060,6 +1062,8 @@ Ysagoon Online Gaming [Your %0 are under attack] %0 تحت الهجوم +[Your IP address was temporarily banned] + [Your unit got converted to %0's team] Your unit got converted to %0's team [Your username was banned] diff -r 1aa6ab443568 -r 983067233fce data/texts.br.txt --- a/data/texts.br.txt Mon Apr 14 19:33:19 2008 -0400 +++ b/data/texts.br.txt Mon Apr 14 20:29:21 2008 -0400 @@ -1038,6 +1038,8 @@ O metaservidor YOG recusou a sua conexã O metaservidor YOG recusou a sua conexão porque a senha estava incorreta. [YESTS_CONNECTION_REFUSED_BAD_PASSWORD_NON_ZERO] O metaservidor YOG recusou a sua conexão porque este nome de usuário não tem senha ainda. Provavelmente você quer registrar o seu nome de usuário com esta senha. Logo, ative a opção "Registrar um novo usuário YOG com uma senha" antes de conectar. Você precisa ativar esta opção somente uma vez. +[YESTS_CONNECTION_REFUSED_IP_TEMPORARILY_BANNED] + [YESTS_CONNECTION_REFUSED_PROTOCOL_TOO_OLD] O metaservidor YOG recusou a sua conexão porque o cliente globulation2 está obsoleto. [YESTS_CONNECTION_REFUSED_UNEXPLAINED] @@ -1060,6 +1062,8 @@ Você ganhou! [Your %0 are under attack] Seus %0 estão sendo atacados +[Your IP address was temporarily banned] + [Your unit got converted to %0's team] Sua unidade foi convertido para o time do %0 [Your username was banned] diff -r 1aa6ab443568 -r 983067233fce data/texts.ca.txt --- a/data/texts.ca.txt Mon Apr 14 19:33:19 2008 -0400 +++ b/data/texts.ca.txt Mon Apr 14 20:29:21 2008 -0400 @@ -1038,6 +1038,8 @@ No es pot conectar al metaservidor YOG. No es pot conectar al metaservidor YOG. Contrassenya Incorrecta [YESTS_CONNECTION_REFUSED_BAD_PASSWORD_NON_ZERO] El metaservidor YOG ha rebutjat la conexió per que usuari no te contrasenya encara, activa l' opció: Registrar un nou usuari YOG amb contrasenya +[YESTS_CONNECTION_REFUSED_IP_TEMPORARILY_BANNED] + [YESTS_CONNECTION_REFUSED_PROTOCOL_TOO_OLD] No es pot conectar al metaservidor YOG, el teu client Globulation2 està obsolet [YESTS_CONNECTION_REFUSED_UNEXPLAINED] @@ -1060,6 +1062,8 @@ Has guanyat [Your %0 are under attack] El teu %0 està sent atacat +[Your IP address was temporarily banned] + [Your unit got converted to %0's team] Una unitat teva s'ha convertit a l'equip de %0 [Your username was banned] diff -r 1aa6ab443568 -r 983067233fce data/texts.cz.txt --- a/data/texts.cz.txt Mon Apr 14 19:33:19 2008 -0400 +++ b/data/texts.cz.txt Mon Apr 14 20:29:21 2008 -0400 @@ -1036,6 +1036,8 @@ YOG metaserver odmítnul spojení, proto YOG metaserver odmítnul spojení, protože heslo nebylo zadáno správně. [YESTS_CONNECTION_REFUSED_BAD_PASSWORD_NON_ZERO] YOG metaserver odmítnul spojení, protože tato přezdívka jeÅ¡tě nemá přidělené heslo. Pro registraci přezdívky s tímto heslem zaÅ¡krtni políčko "Registrace nového YOG uživatele s heslem" před připojením. BudeÅ¡ potřebovat zaÅ¡krtnout toto políčko pouze jednou. +[YESTS_CONNECTION_REFUSED_IP_TEMPORARILY_BANNED] + [YESTS_CONNECTION_REFUSED_PROTOCOL_TOO_OLD] YOG metaserver odmítnul spojení, protože máš příliÅ¡ starou verzi Globulation2. [YESTS_CONNECTION_REFUSED_UNEXPLAINED] @@ -1058,6 +1060,8 @@ Vyhrál jsi! [Your %0 are under attack] Tvoji %0 jsou pod útokem +[Your IP address was temporarily banned] + [Your unit got converted to %0's team] Tva jednotka změnila víru v jiného hráče %0 [Your username was banned] diff -r 1aa6ab443568 -r 983067233fce data/texts.de.txt --- a/data/texts.de.txt Mon Apr 14 19:33:19 2008 -0400 +++ b/data/texts.de.txt Mon Apr 14 20:29:21 2008 -0400 @@ -1028,6 +1028,8 @@ Der YOG Metaserver hat die Verbindung ab Der YOG Metaserver hat die Verbindung abgewiesen da ihr Passwort falsch ist. [YESTS_CONNECTION_REFUSED_BAD_PASSWORD_NON_ZERO] Der YOG Metaserver hat die Verbindung abgewiesen da ihr Benutzername noch nicht registriert ist. Wenn sie diesen Benutzernamen mit diesem Passwort registrieren wollen aktivieren sie die Option "Neuen YOG Benutzer mit Passwort registrieren". Diese Option muss nur einmal aktiviert werden. +[YESTS_CONNECTION_REFUSED_IP_TEMPORARILY_BANNED] + [YESTS_CONNECTION_REFUSED_PROTOCOL_TOO_OLD] Der YOG-Metaserver hat die Verbindung verweigert, da Ihre Version von Globulation 2 zu alt ist. [YESTS_CONNECTION_REFUSED_UNEXPLAINED] @@ -1050,6 +1052,8 @@ Sie haben gewonnen! [Your %0 are under attack] Eure %0 werden angegriffen +[Your IP address was temporarily banned] + [Your unit got converted to %0's team] Eine Ihrer Einheiten wurde von einem %0-Team übernommen. [Your username was banned] diff -r 1aa6ab443568 -r 983067233fce data/texts.dk.txt --- a/data/texts.dk.txt Mon Apr 14 19:33:19 2008 -0400 +++ b/data/texts.dk.txt Mon Apr 14 20:29:21 2008 -0400 @@ -1038,6 +1038,8 @@ YOG-metaserveren har afbrudt forbindelse YOG-metaserveren har afbrudt forbindelsen fordi den indtastede adgangskode er forkert. [YESTS_CONNECTION_REFUSED_BAD_PASSWORD_NON_ZERO] YOG-metaserveren har afbrudt forbindelsen fordi dette brugernavn har +[YESTS_CONNECTION_REFUSED_IP_TEMPORARILY_BANNED] + [YESTS_CONNECTION_REFUSED_PROTOCOL_TOO_OLD] YOG-metaserveren har afbrudt forbindelsen, fordi din Globulation2-klient er forældet. [YESTS_CONNECTION_REFUSED_UNEXPLAINED] @@ -1060,6 +1062,8 @@ Du har vundet! [Your %0 are under attack] Dine %0 er under angreb +[Your IP address was temporarily banned] + [Your unit got converted to %0's team] En af dine enheder blev konverteret til et %0 hold [Your username was banned] diff -r 1aa6ab443568 -r 983067233fce data/texts.en.txt --- a/data/texts.en.txt Mon Apr 14 19:33:19 2008 -0400 +++ b/data/texts.en.txt Mon Apr 14 20:29:21 2008 -0400 @@ -1032,6 +1032,8 @@ The YOG metaserver has refused connectio The YOG metaserver has refused connection because the supplied password was incorrect. [YESTS_CONNECTION_REFUSED_BAD_PASSWORD_NON_ZERO] The YOG metaserver has refused connection because this username has no password yet. You probably want to register your username with this password. Therefore, activate the option "Register a new YOG user with password" before connecting. You'll need to activate this option only once. +[YESTS_CONNECTION_REFUSED_IP_TEMPORARILY_BANNED] +The YOG metaserver has refused the connection because this IP address is temporarily banned. You will have to wait patiently until it is unbanned or contact the administrators. [YESTS_CONNECTION_REFUSED_PROTOCOL_TOO_OLD] The YOG metaserver has refused connection because your Globulation 2 client is out of date. Please obtain the latest version from www.globulation2.org to play online [YESTS_CONNECTION_REFUSED_UNEXPLAINED] @@ -1039,7 +1041,7 @@ The YOG metaserver has refused the conne [YESTS_CONNECTION_REFUSED_USERNAME_ALLREADY_USED] The YOG metaserver has refused the connection because your username is already used by someone else. [YESTS_CONNECTION_REFUSED_USERNAME_BANNED] -The YOG metaserver had refused the connection because this username is banned. Please contact the administrators. +The YOG metaserver has refused the connection because this username is banned. Please contact the administrators. [YESTS_CREATED] The connection system is ready to contact the YOG metaserver for connection. [YESTS_UNABLE_TO_CONNECT] @@ -1054,6 +1056,8 @@ You where kicked from the game You where kicked from the game [Your %0 are under attack] Your %0 are under attack +[Your IP address was temporarily banned] +Your IP address was temporarily banned. Please wait patiently until it is unbanned or contact the administrators. [Your unit got converted to %0's team] Your unit got converted to %0's team [Your username was banned] diff -r 1aa6ab443568 -r 983067233fce data/texts.es.txt --- a/data/texts.es.txt Mon Apr 14 19:33:19 2008 -0400 +++ b/data/texts.es.txt Mon Apr 14 20:29:21 2008 -0400 @@ -1038,6 +1038,8 @@ YOG metaserver ha rechazado la conecció YOG metaserver ha rechazado la conección porque la contraseña es incorrecta. [YESTS_CONNECTION_REFUSED_BAD_PASSWORD_NON_ZERO] YOG metaserver ha rechazado la conección porque este nombre de usuario aún no tiene una contraseña. Probablemente deseas registrar tu nombre de Usuario con esta Contraseña. Por lo Tanto, Activa la Opción "Registrar a un Nuevo Usuario YOG con Contraseña"( "Register a new YOG user with password") Antes de Conectarse. Necesitarás Activar Está Opción Solamente una Vez. +[YESTS_CONNECTION_REFUSED_IP_TEMPORARILY_BANNED] + [YESTS_CONNECTION_REFUSED_PROTOCOL_TOO_OLD] YOG metaserver ha rechazado la conección porque tu cliente globulation 2 es obsoleto. [YESTS_CONNECTION_REFUSED_UNEXPLAINED] @@ -1060,6 +1062,8 @@ Has ganado! [Your %0 are under attack] Tu %0 están bajo ataque +[Your IP address was temporarily banned] + [Your unit got converted to %0's team] Tu unidad fué convertida a %0 del equipo [Your username was banned] diff -r 1aa6ab443568 -r 983067233fce data/texts.eu.txt --- a/data/texts.eu.txt Mon Apr 14 19:33:19 2008 -0400 +++ b/data/texts.eu.txt Mon Apr 14 20:29:21 2008 -0400 @@ -1038,6 +1038,8 @@ YOG metazerbitzariak estekatzea ukatu du YOG metazerbitzariak estekatzea ukatu du zure pasahitza gaizki dagoelako. [YESTS_CONNECTION_REFUSED_BAD_PASSWORD_NON_ZERO] YOG metazerbitzariak estekatzea ukatu du zerabiltzaile izen honek ez duelako pasahitzik oraindik. Ziur aski izena eman nahi duzu. Kasu hortan, markatu "YOG erabiltzaile gisa izena eman pasahitza barne" konektatu aurretik. Aukera hau behin bakarrik markatu beharko duzu. +[YESTS_CONNECTION_REFUSED_IP_TEMPORARILY_BANNED] + [YESTS_CONNECTION_REFUSED_PROTOCOL_TOO_OLD] YOG metazerbitzariak estekatzea ukatu du zure globulation2 bezeroa zaharregia delako. [YESTS_CONNECTION_REFUSED_UNEXPLAINED] @@ -1060,6 +1062,8 @@ Irabazi duzu! [Your %0 are under attack] Zure %0ak erasopean daude +[Your IP address was temporarily banned] + [Your unit got converted to %0's team] Zure unitatea %0(r)en taldera pasatu da [Your username was banned] diff -r 1aa6ab443568 -r 983067233fce data/texts.fr.txt --- a/data/texts.fr.txt Mon Apr 14 19:33:19 2008 -0400 +++ b/data/texts.fr.txt Mon Apr 14 20:29:21 2008 -0400 @@ -1038,6 +1038,8 @@ Le metaserveur YOG a refusé la connexio Le metaserveur YOG a refusé la connexion car le mot de passe est faux. [YESTS_CONNECTION_REFUSED_BAD_PASSWORD_NON_ZERO] Le metaserveur YOG a refusé la connexion car cet utilisateur n'a pas encore de mot de passe. Vous voulez probablement enregistrer votre utilisateur avec ce mot de passe. Pour cela, activez l'option "Enregistrer le nouvel utilisateur YOG avec mot de passe" ci-dessous avant de vous connecter. Vous n'avez besoin d'activer cette option qu'une seule fois. +[YESTS_CONNECTION_REFUSED_IP_TEMPORARILY_BANNED] + [YESTS_CONNECTION_REFUSED_PROTOCOL_TOO_OLD] Le metaserveur YOG a refusé la connexion car votre version de globulation2 est trop ancienne pour communiquer avec. [YESTS_CONNECTION_REFUSED_UNEXPLAINED] @@ -1060,6 +1062,8 @@ Vous avez gagné! [Your %0 are under attack] Vos %0 sont attaquées +[Your IP address was temporarily banned] + [Your unit got converted to %0's team] Votre unité est passée à l'équipe %0 [Your username was banned] diff -r 1aa6ab443568 -r 983067233fce data/texts.gr.txt --- a/data/texts.gr.txt Mon Apr 14 19:33:19 2008 -0400 +++ b/data/texts.gr.txt Mon Apr 14 20:29:21 2008 -0400 @@ -1040,6 +1040,8 @@ Tutorial Ο YOG metaserver αρνήθηκε την σύνδεση γιατί ο κωδικός που δώσατε ήταν λάνθασμενος. [YESTS_CONNECTION_REFUSED_BAD_PASSWORD_NON_ZERO] Ο YOG metaserver αρνήθηκε την σύνδεση γιατί το όνομα χρήστη δεν έχει ακόμα κωδικό. Πιθανόν θέλετε να καταχωρήσετε αυτό το όνομα χρήστη με αυτό τον κωδικό. Γι' αυτό, ενεργοποιήστε την επιλογή "Καταχώρηση νέου YOG χρήστη με κωδικό" πριν συνδεθείτε. Θα πρέπει να ενεργοποιήσετε αυτή την επιλογή μόνο μία φορά. +[YESTS_CONNECTION_REFUSED_IP_TEMPORARILY_BANNED] + [YESTS_CONNECTION_REFUSED_PROTOCOL_TOO_OLD] Ο YOG metaserver αρνήθηκε την σύνδεση γιατί το globulation2 client σας είναι παλιό. [YESTS_CONNECTION_REFUSED_UNEXPLAINED] @@ -1062,6 +1064,8 @@ Ysagoon Online Gaming [Your %0 are under attack] Το %0 δέχετε επίθεση +[Your IP address was temporarily banned] + [Your unit got converted to %0's team] Η μονάδα σας άλλαξε σε %0 ομάδα [Your username was banned] diff -r 1aa6ab443568 -r 983067233fce data/texts.hu.txt --- a/data/texts.hu.txt Mon Apr 14 19:33:19 2008 -0400 +++ b/data/texts.hu.txt Mon Apr 14 20:29:21 2008 -0400 @@ -1036,6 +1036,8 @@ A YOG metaszerver visszautasította a ka A YOG metaszerver visszautasította a kapcsolatot, mivel helytelen jelszót adtál meg. [YESTS_CONNECTION_REFUSED_BAD_PASSWORD_NON_ZERO] A YOG metaszerver visszautasította a kapcsolatot, mivel ehhez a felhasználónévhez még nem létezik jelszó. Valószínűleg regisztrálni akartad a felhasználónevedet ezzel a jelszóval. Ehhez kapcsold be az "Új YOG felhasználó regisztrálása jelszóval" opciót a kapcsolat felvétele előtt. Ezt az opciót csak egy alkalommal kell bekapcsolni. +[YESTS_CONNECTION_REFUSED_IP_TEMPORARILY_BANNED] + [YESTS_CONNECTION_REFUSED_PROTOCOL_TOO_OLD] A YOG metaszerver visszautasította a kapcsolatot, mivel a globulation 2 verziód túl régi a kapcsolat felvételéhez. [YESTS_CONNECTION_REFUSED_UNEXPLAINED] @@ -1058,6 +1060,8 @@ Megnyerted a játékot! [Your %0 are under attack] Megtámadták a %0 -t +[Your IP address was temporarily banned] + [Your unit got converted to %0's team] Az egységedet az ellenség elfogta %0 [Your username was banned] diff -r 1aa6ab443568 -r 983067233fce data/texts.it.txt --- a/data/texts.it.txt Mon Apr 14 19:33:19 2008 -0400 +++ b/data/texts.it.txt Mon Apr 14 20:29:21 2008 -0400 @@ -1028,6 +1028,8 @@ Il metaserver YOG ha rifiutato la connes Il metaserver YOG ha rifiutato la connessione perchè la password è errata [YESTS_CONNECTION_REFUSED_BAD_PASSWORD_NON_ZERO] Il metaserver YOG ha rifiutato la connessione perchè hai digitato una password errata +[YESTS_CONNECTION_REFUSED_IP_TEMPORARILY_BANNED] + [YESTS_CONNECTION_REFUSED_PROTOCOL_TOO_OLD] Il metaserver YOG ha rifiutato la connessione perchè la versione di Globulation2 che hai installato è troppo vecchia [YESTS_CONNECTION_REFUSED_UNEXPLAINED] @@ -1050,6 +1052,8 @@ Sei stato espulso dalla partita Sei stato espulso dalla partita [Your %0 are under attack] Il tuo %0 è sotto attacco +[Your IP address was temporarily banned] + [Your unit got converted to %0's team] La tua unità è stata convertita alla squadra di %0 [Your username was banned] diff -r 1aa6ab443568 -r 983067233fce data/texts.keys.txt --- a/data/texts.keys.txt Mon Apr 14 19:33:19 2008 -0400 +++ b/data/texts.keys.txt Mon Apr 14 20:29:21 2008 -0400 @@ -514,6 +514,7 @@ [YESTS_CONNECTION_REFUSED_ALREADY_PASSWORD] [YESTS_CONNECTION_REFUSED_BAD_PASSWORD] [YESTS_CONNECTION_REFUSED_BAD_PASSWORD_NON_ZERO] +[YESTS_CONNECTION_REFUSED_IP_TEMPORARILY_BANNED] [YESTS_CONNECTION_REFUSED_PROTOCOL_TOO_OLD] [YESTS_CONNECTION_REFUSED_UNEXPLAINED] [YESTS_CONNECTION_REFUSED_USERNAME_ALLREADY_USED] @@ -525,5 +526,6 @@ [you have won] [You where kicked from the game] [Your %0 are under attack] +[Your IP address was temporarily banned] [Your unit got converted to %0's team] [Your username was banned] diff -r 1aa6ab443568 -r 983067233fce data/texts.nl.txt --- a/data/texts.nl.txt Mon Apr 14 19:33:19 2008 -0400 +++ b/data/texts.nl.txt Mon Apr 14 20:29:21 2008 -0400 @@ -1038,6 +1038,8 @@ De verbinding met de YOG server is gewei De verbinding met de YOG server is geweigerd omdat uw wachtwoord onjuist is. [YESTS_CONNECTION_REFUSED_BAD_PASSWORD_NON_ZERO] De verbinding met de YOG server is geweigerd omdat er nog geen wachtwoord is ingesteld voor deze gebruikersnaam. Waarschijnlijk wil je je gebruikersnaam eerst registreren. Om dit te doen kun je een vinkje zetten voor "Registreer nieuwe YOG gebruiker met wachtwoord" alvorens je een verbinding maakt. Je hoeft dit slechts één keer te doen. +[YESTS_CONNECTION_REFUSED_IP_TEMPORARILY_BANNED] + [YESTS_CONNECTION_REFUSED_PROTOCOL_TOO_OLD] De verbinding met de YOG is geweigerd omdat uw globulation2 client te oud is. [YESTS_CONNECTION_REFUSED_UNEXPLAINED] @@ -1060,6 +1062,8 @@ Je hebt gewonnen! [Your %0 are under attack] Je %0 worden aangevallen +[Your IP address was temporarily banned] + [Your unit got converted to %0's team] Een eenheid van jou is overgelopen naar %0's team [Your username was banned] diff -r 1aa6ab443568 -r 983067233fce data/texts.pl.txt --- a/data/texts.pl.txt Mon Apr 14 19:33:19 2008 -0400 +++ b/data/texts.pl.txt Mon Apr 14 20:29:21 2008 -0400 @@ -1036,6 +1036,8 @@ Metaserwer YOG odmówił połączenia z Metaserwer YOG odmówił połączenia z powodu błędnego hasła. [YESTS_CONNECTION_REFUSED_BAD_PASSWORD_NON_ZERO] +[YESTS_CONNECTION_REFUSED_IP_TEMPORARILY_BANNED] + [YESTS_CONNECTION_REFUSED_PROTOCOL_TOO_OLD] Metaserwer YOG odmówił połączenia, ponieważ Twoja wersja Globulation 2 jest zbyt stara, by mógł się z nią komunikować. [YESTS_CONNECTION_REFUSED_UNEXPLAINED] @@ -1058,6 +1060,8 @@ Wygrałeś !!! [Your %0 are under attack] Twój %0 jest atakowany +[Your IP address was temporarily banned] + [Your unit got converted to %0's team] Twoja jednostka została przeciągnięta na stronę wroga %0 [Your username was banned] diff -r 1aa6ab443568 -r 983067233fce data/texts.pt.txt --- a/data/texts.pt.txt Mon Apr 14 19:33:19 2008 -0400 +++ b/data/texts.pt.txt Mon Apr 14 20:29:21 2008 -0400 @@ -1036,6 +1036,8 @@ O metaservidor YOG tem rejeitado a conex O metaservidor YOG tem rejeitado a conexão porque a contrasenha fornecida é incorreta. [YESTS_CONNECTION_REFUSED_BAD_PASSWORD_NON_ZERO] O metaservidor YOG tem rejeitado a conexão porque usuário aínda não tem uma contrasenha. Active por uma vez a opção "Registrar um novo usuário de YOG com contrasenha". +[YESTS_CONNECTION_REFUSED_IP_TEMPORARILY_BANNED] + [YESTS_CONNECTION_REFUSED_PROTOCOL_TOO_OLD] O metaservidor YOG tem rejeitado a conexão porque o cliente globulation2 é obsoleto. [YESTS_CONNECTION_REFUSED_UNEXPLAINED] @@ -1058,6 +1060,8 @@ Jogo em linha com Ysagoon [Your %0 are under attack] Seus %0 estão sendo atacados +[Your IP address was temporarily banned] + [Your unit got converted to %0's team] Uma unidade tem se passado ao bando de %0 [Your username was banned] diff -r 1aa6ab443568 -r 983067233fce data/texts.ro.txt --- a/data/texts.ro.txt Mon Apr 14 19:33:19 2008 -0400 +++ b/data/texts.ro.txt Mon Apr 14 20:29:21 2008 -0400 @@ -1036,6 +1036,8 @@ Metaserverul YOG a refuzat sa vă conect Metaserverul YOG a refuzat sa vă conectaÅ£i din motiv că parola este falsă. [YESTS_CONNECTION_REFUSED_BAD_PASSWORD_NON_ZERO] Metaserverul YOG a refuzat sa vă conectaÅ£i din motiv că acest utilizator nu are înca o parola in baza de date. +[YESTS_CONNECTION_REFUSED_IP_TEMPORARILY_BANNED] + [YESTS_CONNECTION_REFUSED_PROTOCOL_TOO_OLD] Metaserverul YOG a refuzat sa vă conectaÅ£i din motiv că versiunea de globulation2 pe care o folosiÅ£i este prea veche pentru a se putea comunica corect. [YESTS_CONNECTION_REFUSED_UNEXPLAINED] @@ -1058,6 +1060,8 @@ AÅ£i câştigat! [Your %0 are under attack] %0 voastre sunt atacate +[Your IP address was temporarily banned] + [Your unit got converted to %0's team] Unitatea voastră a trecut de partea %0 [Your username was banned] diff -r 1aa6ab443568 -r 983067233fce data/texts.ru.txt --- a/data/texts.ru.txt Mon Apr 14 19:33:19 2008 -0400 +++ b/data/texts.ru.txt Mon Apr 14 20:29:21 2008 -0400 @@ -1034,6 +1034,8 @@ up Метасервер YOG отказал в соединении, потому что вы указали неверный пароль. [YESTS_CONNECTION_REFUSED_BAD_PASSWORD_NON_ZERO] Метасервер YOG отказал в соединении, потому что данному имени пользователя ещё не соответствует пароль. Вероятно, Вы хотите зарегистрировать это имя с этим паролем. Поэтому, активируйте опцию "Зарегистрировать нового пользователя YOG с паролем" перед тем, как соединяться. Вам придётся сделать это только один раз. +[YESTS_CONNECTION_REFUSED_IP_TEMPORARILY_BANNED] + [YESTS_CONNECTION_REFUSED_PROTOCOL_TOO_OLD] Метасервер YOG отказал в соединении, потому что Ваша версия Globulation 2 устарела. Пожалуйста, возьмите последнюю версию с www.globulation2.org чтобы сыграть online. [YESTS_CONNECTION_REFUSED_UNEXPLAINED] @@ -1056,6 +1058,8 @@ Ysagoon-игра в Интернете Вас выкинули из игры [Your %0 are under attack] %0 под ударом +[Your IP address was temporarily banned] + [Your unit got converted to %0's team] Ваш юнит перешёл к врагу %0 [Your username was banned] diff -r 1aa6ab443568 -r 983067233fce data/texts.si.txt --- a/data/texts.si.txt Mon Apr 14 19:33:19 2008 -0400 +++ b/data/texts.si.txt Mon Apr 14 20:29:21 2008 -0400 @@ -1036,6 +1036,8 @@ YOG metastrežnik je zavrnil povezavo, k YOG metastrežnik je zavrnil povezavo, ker je vpisano geslo napačno. [YESTS_CONNECTION_REFUSED_BAD_PASSWORD_NON_ZERO] YOG metastrežnik je zavrnil povezavo ker tvoje uporabniÅ¡ko ime nima določenega gesla. Gotovo hočeÅ¡ registrirati to uporabniÅ¡ko ime zato poskusi aktivirati možnost "Registriraj novega YOG uporabnika s tem geslom". To možnost moraÅ¡ aktivirati le enkrat. +[YESTS_CONNECTION_REFUSED_IP_TEMPORARILY_BANNED] + [YESTS_CONNECTION_REFUSED_PROTOCOL_TOO_OLD] YOG metastrežnik je zavrnil povezavo ker je verzija globulation2 prestara. [YESTS_CONNECTION_REFUSED_UNEXPLAINED] @@ -1058,6 +1060,8 @@ Zmagal si! [Your %0 are under attack] Tvoji %0 so napadeni +[Your IP address was temporarily banned] + [Your unit got converted to %0's team] Tvoje enote so bile spreobrnjene %0 [Your username was banned] diff -r 1aa6ab443568 -r 983067233fce data/texts.sk.txt --- a/data/texts.sk.txt Mon Apr 14 19:33:19 2008 -0400 +++ b/data/texts.sk.txt Mon Apr 14 20:29:21 2008 -0400 @@ -1038,6 +1038,8 @@ YOG metaserver odmietol spojenie, pretoÅ YOG metaserver odmietol spojenie, pretože bolo zadané zlé heslo. [YESTS_CONNECTION_REFUSED_BAD_PASSWORD_NON_ZERO] YOG metaserver odmietol spojenie, pretože toto meno eÅ¡te nemá nastavené heslo. Najprv je potrebné meno a heslo zaregistrovaÅ¥. Preto aktivuj možnosÅ¥ "ZaregistrovaÅ¥ nové YOG meno s heslom" a až potom sa pokús pripojiÅ¥. Toto je potrebné swpraviÅ¥ len raz. +[YESTS_CONNECTION_REFUSED_IP_TEMPORARILY_BANNED] + [YESTS_CONNECTION_REFUSED_PROTOCOL_TOO_OLD] YOG metaserver odmietol spojenie, pretože je tvoj Globulation 2 klient zastaralý. [YESTS_CONNECTION_REFUSED_UNEXPLAINED] @@ -1060,6 +1062,8 @@ Vyhral(a) si! [Your %0 are under attack] Tvoji %0 čelia útoku +[Your IP address was temporarily banned] + [Your unit got converted to %0's team] Tvoja jednotka konvertovala k tímu %0 [Your username was banned] diff -r 1aa6ab443568 -r 983067233fce data/texts.sr.txt --- a/data/texts.sr.txt Mon Apr 14 19:33:19 2008 -0400 +++ b/data/texts.sr.txt Mon Apr 14 20:29:21 2008 -0400 @@ -1036,6 +1036,8 @@ YOG мета-сервер је одбиРYOG мета-сервер је одбио везу јер лозинка коју сте уписали није исправна. [YESTS_CONNECTION_REFUSED_BAD_PASSWORD_NON_ZERO] YOG мета-сервер је одбио везу јер ваше корисничко име нема одређену лозинку. Морате регистровати ваше име и изабрати лозинку. +[YESTS_CONNECTION_REFUSED_IP_TEMPORARILY_BANNED] + [YESTS_CONNECTION_REFUSED_PROTOCOL_TOO_OLD] YOG мета-сервер је прекинуо везу јер је ваше издање Глобулације2 престаро. [YESTS_CONNECTION_REFUSED_UNEXPLAINED] @@ -1058,6 +1060,8 @@ YOG мета-сервер је одбиР[Your %0 are under attack] Нападнута јединица: %0 +[Your IP address was temporarily banned] + [Your unit got converted to %0's team] Ваша јединица је пребегла %0 [Your username was banned] diff -r 1aa6ab443568 -r 983067233fce data/texts.sv.txt --- a/data/texts.sv.txt Mon Apr 14 19:33:19 2008 -0400 +++ b/data/texts.sv.txt Mon Apr 14 20:29:21 2008 -0400 @@ -1038,6 +1038,8 @@ YOG metaserver lÃ¥ter dig inte ansluta e YOG metaserver lÃ¥ter dig inte ansluta eftersom du har angett ett felaktigt lösenord. [YESTS_CONNECTION_REFUSED_BAD_PASSWORD_NON_ZERO] YOG metaserver vägrar anslutning därför att det här användarnamnet inte har ett lösenord. Du vill förmodligen registrera ditt användarnamn med det här lösenordet. Aktivera därför inställningen "Registrera en ny YOG-användare med lösenord" innan du ansluter. Du mÃ¥ste bara aktivera den inställningen en gÃ¥ng. +[YESTS_CONNECTION_REFUSED_IP_TEMPORARILY_BANNED] + [YESTS_CONNECTION_REFUSED_PROTOCOL_TOO_OLD] YOG metaserver vägrar anslutning eftersom din globulation2-klient är för gammal. [YESTS_CONNECTION_REFUSED_UNEXPLAINED] @@ -1060,6 +1062,8 @@ Du har vunnit! [Your %0 are under attack] Din %0 är under attack +[Your IP address was temporarily banned] + [Your unit got converted to %0's team] Din enhet blev omvänd till %0s lag [Your username was banned] diff -r 1aa6ab443568 -r 983067233fce data/texts.tr.txt --- a/data/texts.tr.txt Mon Apr 14 19:33:19 2008 -0400 +++ b/data/texts.tr.txt Mon Apr 14 20:29:21 2008 -0400 @@ -1038,6 +1038,8 @@ YOG onsunucusu baglantiyi reddetti. Gere YOG onsunucusu baglantiyi reddetti. Gerekce: Girdiginiz sifre yanlis. [YESTS_CONNECTION_REFUSED_BAD_PASSWORD_NON_ZERO] YOG onsunucusu baglantiyi reddetti. Gerekce: Bu kullanici adinin henuz bir parolasi yok. Muhtemelen kullanici adinizi bu parola ile kaydetmek istiyorsunuz. O halde, baglanmadan once "Bu parolayla yeni bir YOG kullanicisi kaydet" secenegini aktiflestirin. Bu secenegi yalnizca bir kez aktiflestirmeniz yeterli olacaktir. +[YESTS_CONNECTION_REFUSED_IP_TEMPORARILY_BANNED] + [YESTS_CONNECTION_REFUSED_PROTOCOL_TOO_OLD] YOG onsunucusu baglantiyi reddetti. Gerekce: Oyun versiyonunuz cok eski. [YESTS_CONNECTION_REFUSED_UNEXPLAINED] @@ -1060,6 +1062,8 @@ Kazandiniz! [Your %0 are under attack] %0 'leriniz saldiri altinda +[Your IP address was temporarily banned] + [Your unit got converted to %0's team] Bir biriminiz %0 'nin tarafina gecti [Your username was banned] diff -r 1aa6ab443568 -r 983067233fce data/texts.zh-tw.txt --- a/data/texts.zh-tw.txt Mon Apr 14 19:33:19 2008 -0400 +++ b/data/texts.zh-tw.txt Mon Apr 14 20:29:21 2008 -0400 @@ -1038,6 +1038,8 @@ YOG metaä¼ºæœå™¨æ‹’çµ•é€£ç·šå› ç‚ºä½ çš YOG meta伺服器拒絕連線因為你的密碼錯誤。 [YESTS_CONNECTION_REFUSED_BAD_PASSWORD_NON_ZERO] YOG meta伺服器拒絕連線因為你沒有密碼。請選擇"註冊一個新 YOG 帳號和密碼"以登入,你只需要註冊一次。 +[YESTS_CONNECTION_REFUSED_IP_TEMPORARILY_BANNED] + [YESTS_CONNECTION_REFUSED_PROTOCOL_TOO_OLD] YOG meta伺服器拒絕連線因為你的globulation2版本已過時。 [YESTS_CONNECTION_REFUSED_UNEXPLAINED] @@ -1060,6 +1062,8 @@ Ysagoon 線上遊戲 [Your %0 are under attack] 你的 %0 正遭受攻擊 +[Your IP address was temporarily banned] + [Your unit got converted to %0's team] 你的單位遭 %0 招降 [Your username was banned] diff -r 1aa6ab443568 -r 983067233fce src/NetMessage.cpp --- a/src/NetMessage.cpp Mon Apr 14 19:33:19 2008 -0400 +++ b/src/NetMessage.cpp Mon Apr 14 20:29:21 2008 -0400 @@ -172,6 +172,9 @@ shared_ptr NetMessage::getNe case MNetPlayerIsBanned: message.reset(new NetPlayerIsBanned); break; + case MNetIPIsBanned: + message.reset(new NetIPIsBanned); + break; ///append_create_point } message->decodeData(stream); @@ -3430,4 +3433,55 @@ bool NetPlayerIsBanned::operator==(const } + +NetIPIsBanned::NetIPIsBanned() +{ + +} + + + +Uint8 NetIPIsBanned::getMessageType() const +{ + return MNetIPIsBanned; +} + + + +void NetIPIsBanned::encodeData(GAGCore::OutputStream* stream) const +{ + stream->writeEnterSection("NetIPIsBanned"); + stream->writeLeaveSection(); +} + + + +void NetIPIsBanned::decodeData(GAGCore::InputStream* stream) +{ + stream->readEnterSection("NetIPIsBanned"); + stream->readLeaveSection(); +} + + + +std::string NetIPIsBanned::format() const +{ + std::ostringstream s; + s<<"NetIPIsBanned()"; + return s.str(); +} + + + +bool NetIPIsBanned::operator==(const NetMessage& rhs) const +{ + if(typeid(rhs)==typeid(NetIPIsBanned)) + { + //const NetIPIsBanned& r = dynamic_cast(rhs); + return true; + } + return false; +} + + //append_code_position diff -r 1aa6ab443568 -r 983067233fce src/NetMessage.h --- a/src/NetMessage.h Mon Apr 14 19:33:19 2008 -0400 +++ b/src/NetMessage.h Mon Apr 14 20:29:21 2008 -0400 @@ -90,6 +90,7 @@ enum NetMessageType MNetUpdateGameList, MNetUpdatePlayerList, MNetPlayerIsBanned, + MNetIPIsBanned, //type_append_marker }; @@ -1735,6 +1736,33 @@ public: std::string format() const; ///Compares with another NetPlayerIsBanned + bool operator==(const NetMessage& rhs) const; +}; + + + + +///NetIPIsBanned +class NetIPIsBanned : public NetMessage +{ +public: + ///Creates a NetIPIsBanned message + NetIPIsBanned(); + + ///Returns MNetIPIsBanned + Uint8 getMessageType() const; + + ///Encodes the data + void encodeData(GAGCore::OutputStream* stream) const; + + ///Decodes the data + void decodeData(GAGCore::InputStream* stream); + + ///Formats the NetIPIsBanned message with a small amount + ///of information. + std::string format() const; + + ///Compares with another NetIPIsBanned bool operator==(const NetMessage& rhs) const; }; diff -r 1aa6ab443568 -r 983067233fce src/SConscript --- a/src/SConscript Mon Apr 14 19:33:19 2008 -0400 +++ b/src/SConscript Mon Apr 14 20:29:21 2008 -0400 @@ -1,44 +1,42 @@ source_files = Split(""" source_files = Split(""" -AICastor.cpp AI.cpp AIEcho.cpp AINames.cpp -AINicowar.cpp AINull.cpp AINumbi.cpp AIToubib.cpp -AIWarrush.cpp BasePlayer.cpp BaseTeam.cpp BitArray.cpp -Brush.cpp Building.cpp BuildingsTypes.cpp BuildingType.cpp -Bullet.cpp Campaign.cpp CampaignEditor.cpp CampaignMainMenu.cpp -CampaignMenuScreen.cpp CampaignScreen.cpp CampaignSelectorScreen.cpp ChooseMapScreen.cpp -CPUStatisticsManager.cpp CreditScreen.cpp CustomGameScreen.cpp DynamicClouds.cpp -EditorMainMenu.cpp EndGameScreen.cpp Engine.cpp EntityType.cpp -Fatal.cpp FertilityCalculatorDialog.cpp FertilityCalculatorThread.cpp FertilityCalculatorThreadMessage.cpp -Game.cpp GameEvent.cpp GameGUI.cpp GameGUIDefaultAssignManager.cpp -GameGUIDialog.cpp GameGUIGhostBuildingManager.cpp GameGUIKeyActions.cpp GameGUILoadSave.cpp -GameGUIMessageManager.cpp GameGUIToolManager.cpp GameHeader.cpp GameUtilities.cpp -Glob2.cpp Glob2Screen.cpp Glob2Style.cpp GlobalContainer.cpp -GUIGlob2FileList.cpp GUIMapPreview.cpp HeightMapGenerator.cpp IntBuildingType.cpp -IRC.cpp IRCTextMessageHandler.cpp IRCThread.cpp IRCThreadMessage.cpp -KeyboardManager.cpp LANFindScreen.cpp LANGameInformation.cpp LANMenuScreen.cpp -LogFileManager.cpp MainMenuScreen.cpp MapAssembler.cpp Map.cpp -MapEdit.cpp MapEditKeyActions.cpp MapGenerationDescriptor.cpp MapGenerator.cpp -MapHeader.cpp MarkManager.cpp Minimap.cpp MultiplayerGame.cpp -MultiplayerGameEvent.cpp MultiplayerGameEventListener.cpp MultiplayerGameScreen.cpp NetBroadcaster.cpp -NetBroadcastListener.cpp NetConnection.cpp NetConnectionThread.cpp NetConnectionThreadMessage.cpp -NetEngine.cpp NetGamePlayerManager.cpp NetListener.cpp NetMessage.cpp -NetReteamingInformation.cpp NetTestSuite.cpp NewMapScreen.cpp Order.cpp -OverlayAreas.cpp P2PConnection.cpp P2PConnectionEvent.cpp P2PConnectionListener.cpp -P2PInformation.cpp P2PManager.cpp P2PPlayerInformation.cpp PerlinNoise.cpp -Player.cpp Race.cpp Ressource.cpp RessourcesTypes.cpp -ScriptEditorScreen.cpp Sector.cpp Settings.cpp SettingsScreen.cpp -SGSL.cpp SimplexNoise.cpp SoundMixer.cpp Team.cpp -TeamStat.cpp UnitConsts.cpp Unit.cpp UnitEditorScreen.cpp -UnitSkin.cpp UnitsSkins.cpp UnitType.cpp Utilities.cpp -VoiceRecorder.cpp YOGClientChatChannel.cpp YOGClientChatListener.cpp YOGClient.cpp -YOGClientEvent.cpp YOGClientEventListener.cpp YOGClientGameListListener.cpp YOGClientGameListManager.cpp -YOGClientLobbyScreen.cpp YOGClientPlayerListListener.cpp YOGClientPlayerListManager.cpp YOGConsts.cpp - YOGGameInfo.cpp YOGGameResults.cpp YOGLoginScreen.cpp -YOGMessage.cpp YOGPlayerSessionInfo.cpp YOGPlayerStoredInfo.cpp YOGServerAdministratorCommands.cpp -YOGServerAdministrator.cpp YOGServerAdministratorList.cpp YOGServerChatChannel.cpp YOGServerChatChannelManager.cpp -YOGServer.cpp YOGServerGame.cpp YOGServerMapDistributor.cpp YOGServerPasswordRegistry.cpp -YOGServerPlayer.cpp YOGServerPlayerStoredInfoManager.cpp - - +AICastor.cpp AI.cpp AIEcho.cpp AINames.cpp +AINicowar.cpp AINull.cpp AINumbi.cpp AIToubib.cpp +AIWarrush.cpp BasePlayer.cpp BaseTeam.cpp BitArray.cpp +Brush.cpp Building.cpp BuildingsTypes.cpp BuildingType.cpp +Bullet.cpp Campaign.cpp CampaignEditor.cpp CampaignMainMenu.cpp +CampaignMenuScreen.cpp CampaignScreen.cpp CampaignSelectorScreen.cpp ChooseMapScreen.cpp +CPUStatisticsManager.cpp CreditScreen.cpp CustomGameScreen.cpp DynamicClouds.cpp +EditorMainMenu.cpp EndGameScreen.cpp Engine.cpp EntityType.cpp +Fatal.cpp FertilityCalculatorDialog.cpp FertilityCalculatorThread.cpp FertilityCalculatorThreadMessage.cpp +Game.cpp GameEvent.cpp GameGUI.cpp GameGUIDefaultAssignManager.cpp +GameGUIDialog.cpp GameGUIGhostBuildingManager.cpp GameGUIKeyActions.cpp GameGUILoadSave.cpp +GameGUIMessageManager.cpp GameGUIToolManager.cpp GameHeader.cpp GameUtilities.cpp +Glob2.cpp Glob2Screen.cpp Glob2Style.cpp GlobalContainer.cpp +GUIGlob2FileList.cpp GUIMapPreview.cpp HeightMapGenerator.cpp IntBuildingType.cpp +IRC.cpp IRCTextMessageHandler.cpp IRCThread.cpp IRCThreadMessage.cpp +KeyboardManager.cpp LANFindScreen.cpp LANGameInformation.cpp LANMenuScreen.cpp +LogFileManager.cpp MainMenuScreen.cpp MapAssembler.cpp Map.cpp +MapEdit.cpp MapEditKeyActions.cpp MapGenerationDescriptor.cpp MapGenerator.cpp +MapHeader.cpp MarkManager.cpp Minimap.cpp MultiplayerGame.cpp +MultiplayerGameEvent.cpp MultiplayerGameEventListener.cpp MultiplayerGameScreen.cpp NetBroadcaster.cpp +NetBroadcastListener.cpp NetConnection.cpp NetConnectionThread.cpp NetConnectionThreadMessage.cpp +NetEngine.cpp NetGamePlayerManager.cpp NetListener.cpp NetMessage.cpp +NetReteamingInformation.cpp NetTestSuite.cpp NewMapScreen.cpp Order.cpp +OverlayAreas.cpp P2PConnection.cpp P2PConnectionEvent.cpp P2PConnectionListener.cpp +P2PInformation.cpp P2PManager.cpp P2PPlayerInformation.cpp PerlinNoise.cpp +Player.cpp Race.cpp Ressource.cpp RessourcesTypes.cpp +ScriptEditorScreen.cpp Sector.cpp Settings.cpp SettingsScreen.cpp +SGSL.cpp SimplexNoise.cpp SoundMixer.cpp Team.cpp +TeamStat.cpp UnitConsts.cpp Unit.cpp UnitEditorScreen.cpp +UnitSkin.cpp UnitsSkins.cpp UnitType.cpp Utilities.cpp +VoiceRecorder.cpp YOGClientChatChannel.cpp YOGClientChatListener.cpp YOGClient.cpp +YOGClientEvent.cpp YOGClientEventListener.cpp YOGClientGameListListener.cpp YOGClientGameListManager.cpp +YOGClientLobbyScreen.cpp YOGClientPlayerListListener.cpp YOGClientPlayerListManager.cpp YOGConsts.cpp + YOGGameInfo.cpp YOGGameResults.cpp YOGLoginScreen.cpp +YOGMessage.cpp YOGPlayerSessionInfo.cpp YOGPlayerStoredInfo.cpp YOGServerAdministratorCommands.cpp +YOGServerAdministrator.cpp YOGServerAdministratorList.cpp YOGServerBannedIPListManager.cpp YOGServerChatChannel.cpp +YOGServerChatChannelManager.cpp YOGServer.cpp YOGServerGame.cpp YOGServerMapDistributor.cpp +YOGServerPasswordRegistry.cpp YOGServerPlayer.cpp YOGServerPlayerStoredInfoManager.cpp """) server_source_files = Split(""" diff -r 1aa6ab443568 -r 983067233fce src/YOGClient.cpp --- a/src/YOGClient.cpp Mon Apr 14 19:33:19 2008 -0400 +++ b/src/YOGClient.cpp Mon Apr 14 20:29:21 2008 -0400 @@ -346,6 +346,11 @@ void YOGClient::update() shared_ptr event(new YOGPlayerBannedEvent); sendToListeners(event); } + if(type == MNetIPIsBanned) + { + shared_ptr event(new YOGIPBannedEvent); + sendToListeners(event); + } } diff -r 1aa6ab443568 -r 983067233fce src/YOGClientEvent.cpp --- a/src/YOGClientEvent.cpp Mon Apr 14 19:33:19 2008 -0400 +++ b/src/YOGClientEvent.cpp Mon Apr 14 20:29:21 2008 -0400 @@ -193,4 +193,37 @@ bool YOGPlayerBannedEvent::operator==(co } +YOGIPBannedEvent::YOGIPBannedEvent() +{ +} + + + +Uint8 YOGIPBannedEvent::getEventType() const +{ + return YEIPBanned; +} + + + +std::string YOGIPBannedEvent::format() const +{ + std::ostringstream s; + s<<"YOGIPBannedEvent()"; + return s.str(); +} + + + +bool YOGIPBannedEvent::operator==(const YOGClientEvent& rhs) const +{ + if(typeid(rhs)==typeid(YOGIPBannedEvent)) + { + //const YOGIPBannedEvent& r = dynamic_cast(rhs); + return true; + } + return false; +} + + //code_append_marker diff -r 1aa6ab443568 -r 983067233fce src/YOGClientEvent.h --- a/src/YOGClientEvent.h Mon Apr 14 19:33:19 2008 -0400 +++ b/src/YOGClientEvent.h Mon Apr 14 20:29:21 2008 -0400 @@ -30,6 +30,7 @@ enum YOGClientEventType YELoginAccepted, YELoginRefused, YEPlayerBanned, + YEIPBanned, //type_append_marker }; @@ -158,6 +159,26 @@ public: + +///YOGIPBannedEvent +class YOGIPBannedEvent : public YOGClientEvent +{ +public: + ///Creates a YOGIPBannedEvent event + YOGIPBannedEvent(); + + ///Returns YEIPBanned + Uint8 getEventType() const; + + ///Returns a formatted version of the event + std::string format() const; + + ///Compares two YOGEvent + bool operator==(const YOGClientEvent& rhs) const; +}; + + + //event_append_marker #endif diff -r 1aa6ab443568 -r 983067233fce src/YOGClientLobbyScreen.cpp --- a/src/YOGClientLobbyScreen.cpp Mon Apr 14 19:33:19 2008 -0400 +++ b/src/YOGClientLobbyScreen.cpp Mon Apr 14 20:29:21 2008 -0400 @@ -241,7 +241,11 @@ void YOGClientLobbyScreen::handleYOGClie } else if(type == YEPlayerBanned) { - GAGGUI::MessageBox(globalContainer->gfx, "standard", GAGGUI::MB_ONEBUTTON, Toolkit::getStringTable()->getString("[Your username was banned]"), Toolkit::getStringTable()->getString("[Ok]")); + GAGGUI::MessageBox(globalContainer->gfx, "standard", GAGGUI::MB_ONEBUTTON, Toolkit::getStringTable()->getString("[Your username was banned]"), Toolkit::getStringTable()->getString("[ok]")); + } + else if(type == YEIPBanned) + { + GAGGUI::MessageBox(globalContainer->gfx, "standard", GAGGUI::MB_ONEBUTTON, Toolkit::getStringTable()->getString("[Your IP address was temporarily banned]"), Toolkit::getStringTable()->getString("[ok]")); } } diff -r 1aa6ab443568 -r 983067233fce src/YOGConsts.h --- a/src/YOGConsts.h Mon Apr 14 19:33:19 2008 -0400 +++ b/src/YOGConsts.h Mon Apr 14 20:29:21 2008 -0400 @@ -81,6 +81,8 @@ enum YOGLoginState YOGAlreadyAuthenticated, ///This means that this username is banned YOGUsernameBanned, + ///This means that this ip address is temporarily banned + YOGIPAddressBanned, }; ///This represents the reason why the player could not join a game. diff -r 1aa6ab443568 -r 983067233fce src/YOGLoginScreen.cpp --- a/src/YOGLoginScreen.cpp Mon Apr 14 19:33:19 2008 -0400 +++ b/src/YOGLoginScreen.cpp Mon Apr 14 20:29:21 2008 -0400 @@ -190,6 +190,10 @@ void YOGLoginScreen::handleYOGClientEven { statusText->setText(Toolkit::getStringTable()->getString("[YESTS_CONNECTION_REFUSED_USERNAME_BANNED]")); } + else if(reason == YOGIPAddressBanned) + { + statusText->setText(Toolkit::getStringTable()->getString("[YESTS_CONNECTION_REFUSED_IP_TEMPORARILY_BANNED]")); + } else if(reason == YOGLoginUnknown) { statusText->setText(Toolkit::getStringTable()->getString("[YESTS_CONNECTION_REFUSED_UNEXPLAINED]")); diff -r 1aa6ab443568 -r 983067233fce src/YOGServer.cpp --- a/src/YOGServer.cpp Mon Apr 14 19:33:19 2008 -0400 +++ b/src/YOGServer.cpp Mon Apr 14 20:29:21 2008 -0400 @@ -107,6 +107,7 @@ void YOGServer::update() } playerInfos.update(); + bannedIPs.update(); int t = SDL_GetTicks(); if(organizedGameTimeEnabled) @@ -167,7 +168,7 @@ YOGGamePolicy YOGServer::getGamePolicy() -YOGLoginState YOGServer::verifyLoginInformation(const std::string& username, const std::string& password, Uint16 version) +YOGLoginState YOGServer::verifyLoginInformation(const std::string& username, const std::string& password, const std::string& ip, Uint16 version) { if(version < NET_PROTOCOL_VERSION) return YOGClientVersionTooOld; @@ -182,6 +183,10 @@ YOGLoginState YOGServer::verifyLoginInfo return YOGUsernameBanned; } } + if(bannedIPs.isIPBanned(ip)) + { + return YOGIPAddressBanned; + } ///check if the player is already logged in for(std::map >::iterator i = players.begin(); i!=players.end(); ++i) @@ -197,12 +202,17 @@ YOGLoginState YOGServer::verifyLoginInfo -YOGLoginState YOGServer::registerInformation(const std::string& username, const std::string& password, Uint16 version) +YOGLoginState YOGServer::registerInformation(const std::string& username, const std::string& password, const std::string& ip, Uint16 version) { if(version < NET_PROTOCOL_VERSION) return YOGClientVersionTooOld; if(loginPolicy == YOGAnonymousLogin) return YOGLoginSuccessful; + + if(bannedIPs.isIPBanned(ip)) + { + return YOGIPAddressBanned; + } return registry.registerInformation(username, password); } @@ -393,6 +403,13 @@ YOGServerPasswordRegistry& YOGServer::ge +YOGServerBannedIPListManager& YOGServer::getServerBannedIPListManager() +{ + return bannedIPs; +} + + + Uint16 YOGServer::chooseNewPlayerID() { //choose the new player ID. diff -r 1aa6ab443568 -r 983067233fce src/YOGServer.h --- a/src/YOGServer.h Mon Apr 14 19:33:19 2008 -0400 +++ b/src/YOGServer.h Mon Apr 14 20:29:21 2008 -0400 @@ -26,6 +26,7 @@ #include "YOGConsts.h" #include "YOGGameInfo.h" #include "YOGPlayerSessionInfo.h" +#include "YOGServerBannedIPListManager.h" #include "YOGServerChatChannelManager.h" #include "YOGServerPasswordRegistry.h" #include "YOGServerAdministrator.h" @@ -74,10 +75,10 @@ public: YOGGamePolicy getGamePolicy() const; ///Returns whether the users password is correct. - YOGLoginState verifyLoginInformation(const std::string& username, const std::string& password, Uint16 version); + YOGLoginState verifyLoginInformation(const std::string& username, const std::string& password, const std::string& ip, Uint16 version); ///This reigsters a new user - YOGLoginState registerInformation(const std::string& username, const std::string& password, Uint16 version); + YOGLoginState registerInformation(const std::string& username, const std::string& password, const std::string& ip, Uint16 version); ///Returns the list of games the server currently has const std::list& getGameList() const; @@ -135,6 +136,9 @@ public: ///Returns the YOGServerPasswordRegistry YOGServerPasswordRegistry& getServerPasswordRegistry(); + + ///Returns the YOGServerBannedIPListManager + YOGServerBannedIPListManager& getServerBannedIPListManager(); private: Uint16 chooseNewPlayerID(); @@ -163,6 +167,7 @@ private: YOGServerAdministrator administrator; YOGServerAdministratorList adminList; YOGServerPlayerStoredInfoManager playerInfos; + YOGServerBannedIPListManager bannedIPs; }; #endif diff -r 1aa6ab443568 -r 983067233fce src/YOGServerAdministrator.cpp --- a/src/YOGServerAdministrator.cpp Mon Apr 14 19:33:19 2008 -0400 +++ b/src/YOGServerAdministrator.cpp Mon Apr 14 20:29:21 2008 -0400 @@ -33,6 +33,7 @@ YOGServerAdministrator::YOGServerAdminis commands.push_back(new YOGBanPlayer); commands.push_back(new YOGUnbanPlayer); commands.push_back(new YOGShowBannedPlayers); + commands.push_back(new YOGBanIP); } diff -r 1aa6ab443568 -r 983067233fce src/YOGServerAdministratorCommands.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/YOGServerAdministratorCommands.cpp Mon Apr 14 20:29:21 2008 -0400 @@ -0,0 +1,333 @@ +/* + Copyright (C) 2008 Bradley Arsenault + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +#include "YOGServerAdministratorCommands.h" +#include "YOGServerAdministrator.h" +#include "YOGServer.h" +#include "NetMessage.h" +#include "YOGServerPlayer.h" + +std::string YOGServerRestart::getHelpMessage() +{ + return ".server_restart Hard resets the server"; +} + + + +std::string YOGServerRestart::getCommandName() +{ + return ".server_restart"; +} + + + +bool YOGServerRestart::doesMatch(const std::vector& tokens) +{ + if(tokens.size() != 1) + return false; + return true; +} + + + +void YOGServerRestart::execute(YOGServer* server, YOGServerAdministrator* admin, const std::vector& tokens, boost::shared_ptr player) +{ + exit(0); +} + + + +std::string YOGMutePlayer::getHelpMessage() +{ + return ".mute_player Mutes a player for 10 minutes"; +} + + + +std::string YOGMutePlayer::getCommandName() +{ + return ".mute_player"; +} + + + +bool YOGMutePlayer::doesMatch(const std::vector& tokens) +{ + if(tokens.size() != 2) + return false; + return true; +} + + + +void YOGMutePlayer::execute(YOGServer* server, YOGServerAdministrator* admin, const std::vector& tokens, boost::shared_ptr player) +{ + std::string name = tokens[1]; + if(server->getPlayerStoredInfoManager().doesStoredInfoExist(name)) + { + boost::posix_time::ptime unmute_time = boost::posix_time::second_clock::local_time() + boost::posix_time::minutes(10); + server->getPlayerStoredInfoManager().getPlayerStoredInfo(name).setMuted(unmute_time); + admin->sendTextMessage("Player muted: "+name, player); + } + else + { + admin->sendTextMessage("Could not find player: "+name, player); + } +} + + + +std::string YOGUnmutePlayer::getHelpMessage() +{ + return ".unmute_player Unmutes a player"; +} + + + +std::string YOGUnmutePlayer::getCommandName() +{ + return ".unmute_player"; +} + + + +bool YOGUnmutePlayer::doesMatch(const std::vector& tokens) +{ + if(tokens.size() != 2) + return false; + return true; +} + + + +void YOGUnmutePlayer::execute(YOGServer* server, YOGServerAdministrator* admin, const std::vector& tokens, boost::shared_ptr player) +{ + std::string name = tokens[1]; + if(server->getPlayerStoredInfoManager().doesStoredInfoExist(name)) + { + server->getPlayerStoredInfoManager().getPlayerStoredInfo(name).setUnmuted(); + admin->sendTextMessage("Player unmuted: "+name, player); + } + else + { + admin->sendTextMessage("Could not find player: "+name, player); + } +} + + + +std::string YOGResetPassword::getHelpMessage() +{ + return ".reset_password Resets the password for a player"; +} + + + +std::string YOGResetPassword::getCommandName() +{ + return ".reset_password"; +} + + + +bool YOGResetPassword::doesMatch(const std::vector& tokens) +{ + if(tokens.size() != 2) + return false; + return true; +} + + + +void YOGResetPassword::execute(YOGServer* server, YOGServerAdministrator* admin, const std::vector& tokens, boost::shared_ptr player) +{ + std::string name = tokens[1]; + server->getServerPasswordRegistry().resetPlayersPassword(name); + admin->sendTextMessage("Players password reset: "+name, player); +} + + + +std::string YOGBanPlayer::getHelpMessage() +{ + return ".ban_player Bans a player indefinitly"; +} + + + +std::string YOGBanPlayer::getCommandName() +{ + return ".ban_player"; +} + + + +bool YOGBanPlayer::doesMatch(const std::vector& tokens) +{ + if(tokens.size() != 2) + return false; + return true; +} + + + +void YOGBanPlayer::execute(YOGServer* server, YOGServerAdministrator* admin, const std::vector& tokens, boost::shared_ptr player) +{ + std::string name = tokens[1]; + if(server->getPlayerStoredInfoManager().doesStoredInfoExist(name)) + { + server->getPlayerStoredInfoManager().getPlayerStoredInfo(name).setBanned(); + boost::shared_ptr nplayer = server->getPlayer(name); + if(nplayer) + { + boost::shared_ptr send(new NetPlayerIsBanned); + nplayer->sendMessage(send); + nplayer->closeConnection(); + } + admin->sendTextMessage("Player banned: "+name, player); + } + else + { + admin->sendTextMessage("Could not find player: "+name, player); + } +} + + + +std::string YOGUnbanPlayer::getHelpMessage() +{ + return ".unban_player Unbans a player"; +} + + + +std::string YOGUnbanPlayer::getCommandName() +{ + return ".unban_player"; +} + + + +bool YOGUnbanPlayer::doesMatch(const std::vector& tokens) +{ + if(tokens.size() != 2) + return false; + return true; +} + + + +void YOGUnbanPlayer::execute(YOGServer* server, YOGServerAdministrator* admin, const std::vector& tokens, boost::shared_ptr player) +{ + std::string name = tokens[1]; + if(server->getPlayerStoredInfoManager().doesStoredInfoExist(name)) + { + server->getPlayerStoredInfoManager().getPlayerStoredInfo(name).setUnbanned(); + admin->sendTextMessage("Player unbanned: "+name, player); + } + else + { + admin->sendTextMessage("Could not find player: "+name, player); + } +} + + + +std::string YOGShowBannedPlayers::getHelpMessage() +{ + return ".show_banned_players Prints the list of banned players"; +} + + + +std::string YOGShowBannedPlayers::getCommandName() +{ + return ".show_banned_players"; +} + + + +bool YOGShowBannedPlayers::doesMatch(const std::vector& tokens) +{ + if(tokens.size() != 1) + return false; + return true; +} + + + +void YOGShowBannedPlayers::execute(YOGServer* server, YOGServerAdministrator* admin, const std::vector& tokens, boost::shared_ptr player) +{ + std::list bannedPlayers = server->getPlayerStoredInfoManager().getBannedPlayers(); + std::string line; + admin->sendTextMessage("Banned players: ", player); + for(std::list::iterator i=bannedPlayers.begin(); i!=bannedPlayers.end(); ++i) + { + line += *i; + line += " "; + } + if(!line.empty()) + { + admin->sendTextMessage(line, player); + } +} + + + +std::string YOGBanIP::getHelpMessage() +{ + return ".ban_ip Bans the IP address of the given player for 24 hours"; +} + + + +std::string YOGBanIP::getCommandName() +{ + return ".ban_ip"; +} + + + +bool YOGBanIP::doesMatch(const std::vector& tokens) +{ + if(tokens.size() != 2) + return false; + return true; +} + + + +void YOGBanIP::execute(YOGServer* server, YOGServerAdministrator* admin, const std::vector& tokens, boost::shared_ptr player) +{ + std::string name = tokens[1]; + boost::shared_ptr nplayer = server->getPlayer(name); + if(nplayer) + { + boost::posix_time::ptime unban_time = boost::posix_time::second_clock::local_time() + boost::posix_time::minutes(1); + server->getServerBannedIPListManager().addBannedIP(nplayer->getPlayerIP(), unban_time); + boost::shared_ptr send(new NetIPIsBanned); + nplayer->sendMessage(send); + nplayer->closeConnection(); + admin->sendTextMessage("Player "+name+"'s IP "+nplayer->getPlayerIP()+" has been banned.", player); + } + else + { + admin->sendTextMessage("Player not logged in to ban: "+name, player); + } +} + diff -r 1aa6ab443568 -r 983067233fce src/YOGServerAdministratorCommands.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/YOGServerAdministratorCommands.h Mon Apr 14 20:29:21 2008 -0400 @@ -0,0 +1,201 @@ +/* + Copyright (C) 2008 Bradley Arsenault + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +#ifndef YOGServerAdministratorCommand_h +#define YOGServerAdministratorCommand_h + +#include +#include +#include "boost/shared_ptr.hpp" + +class YOGServerAdministrator; +class YOGServer; +class YOGServerPlayer; + +///This defines a generic command +class YOGServerAdministratorCommand +{ +public: + virtual ~YOGServerAdministratorCommand() {} + + ///Returns this YOGServerAdministratorCommand help message + virtual std::string getHelpMessage()=0; + + ///Returns the command name for this YOGServerAdministratorCommand + virtual std::string getCommandName()=0; + + ///Returns true if the given set of tokens match whats required for this YOGServerAdministratorCommand + virtual bool doesMatch(const std::vector& tokens)=0; + + ///Executes the code for the administrator command + virtual void execute(YOGServer* server, YOGServerAdministrator* admin, const std::vector& tokens, boost::shared_ptr player)=0; +}; + + + +///Shutsdown the server +class YOGServerRestart : public YOGServerAdministratorCommand +{ +public: + ///Returns this YOGServerAdministratorCommand help message + std::string getHelpMessage(); + + ///Returns the command name for this YOGServerAdministratorCommand + std::string getCommandName(); + + ///Returns true if the given set of tokens match whats required for this YOGServerAdministratorCommand + bool doesMatch(const std::vector& tokens); + + ///Executes the code for the administrator command + void execute(YOGServer* server, YOGServerAdministrator* admin, const std::vector& tokens, boost::shared_ptr player); +}; + + + +///Mutes a player +class YOGMutePlayer : public YOGServerAdministratorCommand +{ +public: + ///Returns this YOGServerAdministratorCommand help message + std::string getHelpMessage(); + + ///Returns the command name for this YOGServerAdministratorCommand + std::string getCommandName(); + + ///Returns true if the given set of tokens match whats required for this YOGServerAdministratorCommand + bool doesMatch(const std::vector& tokens); + + ///Executes the code for the administrator command + void execute(YOGServer* server, YOGServerAdministrator* admin, const std::vector& tokens, boost::shared_ptr player); +}; + + + +///Unmutes a player +class YOGUnmutePlayer : public YOGServerAdministratorCommand +{ +public: + ///Returns this YOGServerAdministratorCommand help message + std::string getHelpMessage(); + + ///Returns the command name for this YOGServerAdministratorCommand + std::string getCommandName(); + + ///Returns true if the given set of tokens match whats required for this YOGServerAdministratorCommand + bool doesMatch(const std::vector& tokens); + + ///Executes the code for the administrator command + void execute(YOGServer* server, YOGServerAdministrator* admin, const std::vector& tokens, boost::shared_ptr player); +}; + + + +///Resets a password +class YOGResetPassword : public YOGServerAdministratorCommand +{ +public: + ///Returns this YOGServerAdministratorCommand help message + std::string getHelpMessage(); + + ///Returns the command name for this YOGServerAdministratorCommand + std::string getCommandName(); + + ///Returns true if the given set of tokens match whats required for this YOGServerAdministratorCommand + bool doesMatch(const std::vector& tokens); + + ///Executes the code for the administrator command + void execute(YOGServer* server, YOGServerAdministrator* admin, const std::vector& tokens, boost::shared_ptr player); +}; + + + +///Bans a user +class YOGBanPlayer : public YOGServerAdministratorCommand +{ +public: + ///Returns this YOGServerAdministratorCommand help message + std::string getHelpMessage(); + + ///Returns the command name for this YOGServerAdministratorCommand + std::string getCommandName(); + + ///Returns true if the given set of tokens match whats required for this YOGServerAdministratorCommand + bool doesMatch(const std::vector& tokens); + + ///Executes the code for the administrator command + void execute(YOGServer* server, YOGServerAdministrator* admin, const std::vector& tokens, boost::shared_ptr player); +}; + + + +///Unbans a user +class YOGUnbanPlayer : public YOGServerAdministratorCommand +{ +public: + ///Returns this YOGServerAdministratorCommand help message + std::string getHelpMessage(); + + ///Returns the command name for this YOGServerAdministratorCommand + std::string getCommandName(); + + ///Returns true if the given set of tokens match whats required for this YOGServerAdministratorCommand + bool doesMatch(const std::vector& tokens); + + ///Executes the code for the administrator command + void execute(YOGServer* server, YOGServerAdministrator* admin, const std::vector& tokens, boost::shared_ptr player); +}; + + + +///Prints the list of banned players +class YOGShowBannedPlayers : public YOGServerAdministratorCommand +{ +public: + ///Returns this YOGServerAdministratorCommand help message + std::string getHelpMessage(); + + ///Returns the command name for this YOGServerAdministratorCommand + std::string getCommandName(); + + ///Returns true if the given set of tokens match whats required for this YOGServerAdministratorCommand + bool doesMatch(const std::vector& tokens); + + ///Executes the code for the administrator command + void execute(YOGServer* server, YOGServerAdministrator* admin, const std::vector& tokens, boost::shared_ptr player); +}; + + + +///Bans an IP +class YOGBanIP : public YOGServerAdministratorCommand +{ +public: + ///Returns this YOGServerAdministratorCommand help message + std::string getHelpMessage(); + + ///Returns the command name for this YOGServerAdministratorCommand + std::string getCommandName(); + + ///Returns true if the given set of tokens match whats required for this YOGServerAdministratorCommand + bool doesMatch(const std::vector& tokens); + + ///Executes the code for the administrator command + void execute(YOGServer* server, YOGServerAdministrator* admin, const std::vector& tokens, boost::shared_ptr player); +}; + +#endif diff -r 1aa6ab443568 -r 983067233fce src/YOGServerBannedIPListManager.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/YOGServerBannedIPListManager.cpp Mon Apr 14 20:29:21 2008 -0400 @@ -0,0 +1,131 @@ +/* + Copyright (C) 2008 Bradley Arsenault + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + + +#include "BinaryStream.h" +#include "boost/date_time/posix_time/posix_time.hpp" +#include "FileManager.h" +#include +#include "SDL_net.h" +#include "Stream.h" +#include +#include "Toolkit.h" +#include "Version.h" +#include "YOGServerBannedIPListManager.h" + +using namespace GAGCore; + +YOGServerBannedIPListManager::YOGServerBannedIPListManager() +{ + loadBannedIPList(); + saveCountdown=0; +} + + + +void YOGServerBannedIPListManager::update() +{ + if(saveCountdown == 0) + { + if(modified) + { + saveBannedIPList(); + modified=false; + } + saveCountdown = 300; + } + else + { + saveCountdown -= 1; + } + + boost::posix_time::ptime current_time = boost::posix_time::second_clock::local_time(); + for(std::map::iterator i=bannedIPs.begin(); i!=bannedIPs.end();) + { + if(i->second < current_time) + { + modified=true; + bannedIPs.erase(i++); + } + else + { + ++i; + } + } +} + + + +void YOGServerBannedIPListManager::addBannedIP(const std::string& bannedIP, boost::posix_time::ptime unban_time) +{ + modified=true; + bannedIPs[bannedIP] = unban_time; +} + + + +bool YOGServerBannedIPListManager::isIPBanned(const std::string& bannedIP) +{ + if(bannedIPs.find(bannedIP) != bannedIPs.end()) + { + return true; + } + return false; +} + + + +void YOGServerBannedIPListManager::saveBannedIPList() +{ + OutputStream* stream = new BinaryOutputStream(Toolkit::getFileManager()->openOutputStreamBackend("bannedips")); + stream->writeUint32(NET_DATA_VERSION, "version"); + stream->writeUint32(bannedIPs.size(), "size"); + for(std::map::iterator i = bannedIPs.begin(); i!=bannedIPs.end(); ++i) + { + stream->writeText(i->first, "ip"); + std::stringstream time; + time<second; + stream->writeText(time.str(), "time"); + } + delete stream; +} + + + +void YOGServerBannedIPListManager::loadBannedIPList() +{ + InputStream* stream = new BinaryInputStream(Toolkit::getFileManager()->openInputStreamBackend("bannedips")); + if(!stream->isEndOfStream()) + { + Uint32 dataVersionMinor = stream->readUint32("version"); + Uint32 size = stream->readUint32("size"); + for(unsigned i=0; ireadText("ip"); + std::string b = stream->readText("time"); + + std::stringstream time; + boost::posix_time::ptime unban_time; + time<>unban_time; + bannedIPs[ip]=unban_time; + } + } + delete stream; +} + diff -r 1aa6ab443568 -r 983067233fce src/YOGServerBannedIPListManager.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/YOGServerBannedIPListManager.h Mon Apr 14 20:29:21 2008 -0400 @@ -0,0 +1,57 @@ +/* + Copyright (C) 2008 Bradley Arsenault + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + + +#ifndef YOGServerBannedIPListManager_h +#define YOGServerBannedIPListManager_h + +#include +#include +#include "SDL_net.h" +#include "boost/date_time/posix_time/posix_time.hpp" + +///This class stores and records YOGPlayerStoredInfo for the server +class YOGServerBannedIPListManager +{ +public: + ///Constructs a YOGServerBannedIPListManager, reads from the database + YOGServerBannedIPListManager(); + + ///Updates this YOGServerBannedIPListManager, periodically saving + void update(); + + ///Adds the given IP address to the list of IP's banned for however long + void addBannedIP(const std::string& bannedIP, boost::posix_time::ptime unban_time); + + ///Returns true if the given IP address is in the list of ones banned + bool isIPBanned(const std::string& bannedIP); + + ///This stores the player infos in a file + void saveBannedIPList(); + + ///This loads the player infos from a file + void loadBannedIPList(); +private: + bool modified; + int saveCountdown; + std::map bannedIPs; +}; + + + +#endif diff -r 1aa6ab443568 -r 983067233fce src/YOGServerPlayer.cpp --- a/src/YOGServerPlayer.cpp Mon Apr 14 19:33:19 2008 -0400 +++ b/src/YOGServerPlayer.cpp Mon Apr 14 20:29:21 2008 -0400 @@ -79,7 +79,7 @@ void YOGServerPlayer::update() shared_ptr info = static_pointer_cast(message); std::string username = info->getUsername(); std::string password = info->getPassword(); - loginState = server.verifyLoginInformation(username, password, netVersion); + loginState = server.verifyLoginInformation(username, password, getPlayerIP(), netVersion); if(loginState == YOGLoginSuccessful) { server.playerHasLoggedIn(username, playerID); @@ -99,7 +99,7 @@ void YOGServerPlayer::update() shared_ptr info = static_pointer_cast(message); std::string username = info->getUsername(); std::string password = info->getPassword(); - loginState = server.registerInformation(username, password, netVersion); + loginState = server.registerInformation(username, password, getPlayerIP(), netVersion); if(loginState == YOGLoginSuccessful) { server.playerHasLoggedIn(username, playerID); diff -r 1aa6ab443568 -r 983067233fce src/YOGServerPlayerStoredInfoManager.cpp --- a/src/YOGServerPlayerStoredInfoManager.cpp Mon Apr 14 19:33:19 2008 -0400 +++ b/src/YOGServerPlayerStoredInfoManager.cpp Mon Apr 14 20:29:21 2008 -0400 @@ -39,7 +39,11 @@ void YOGServerPlayerStoredInfoManager::u { if(saveCountdown == 0) { - savePlayerInfos(); + if(modified) + { + savePlayerInfos(); + modified=false; + } saveCountdown = 300; } else # HG changeset patch # User Bradley Arsenault # Date 1208229063 14400 # Node ID b3da401ff6c61adbecf58dc7cb6f9f4e0e88b2d0 # Parent 983067233fce6c6c82ff4439899f427932fe8928 Added new YOG administration commands to add and remove server administrator status diff -r 983067233fce -r b3da401ff6c6 src/NetTestSuite.cpp --- a/src/NetTestSuite.cpp Mon Apr 14 20:29:21 2008 -0400 +++ b/src/NetTestSuite.cpp Mon Apr 14 23:11:03 2008 -0400 @@ -652,12 +652,12 @@ int NetTestSuite::testNetReteamingInform int NetTestSuite::testListenerConnection() { - //Creates the NetListener at port 7485 + //Creates the NetListener at port 7480 NetListener nl; - nl.startListening(7485); + nl.startListening(7480); //Creates a NetConnection representing the client NetConnection nc_client; - nc_client.openConnection("127.0.0.1", 7485); + nc_client.openConnection("127.0.0.1", 7480); //Give it time to proccess the request SDL_Delay(40); //The server connection diff -r 983067233fce -r b3da401ff6c6 src/YOGServerAdministrator.cpp --- a/src/YOGServerAdministrator.cpp Mon Apr 14 20:29:21 2008 -0400 +++ b/src/YOGServerAdministrator.cpp Mon Apr 14 23:11:03 2008 -0400 @@ -34,6 +34,8 @@ YOGServerAdministrator::YOGServerAdminis commands.push_back(new YOGUnbanPlayer); commands.push_back(new YOGShowBannedPlayers); commands.push_back(new YOGBanIP); + commands.push_back(new YOGAddAdministrator); + commands.push_back(new YOGRemoveAdministrator); } diff -r 983067233fce -r b3da401ff6c6 src/YOGServerAdministratorCommands.cpp --- a/src/YOGServerAdministratorCommands.cpp Mon Apr 14 20:29:21 2008 -0400 +++ b/src/YOGServerAdministratorCommands.cpp Mon Apr 14 23:11:03 2008 -0400 @@ -318,7 +318,7 @@ void YOGBanIP::execute(YOGServer* server boost::shared_ptr nplayer = server->getPlayer(name); if(nplayer) { - boost::posix_time::ptime unban_time = boost::posix_time::second_clock::local_time() + boost::posix_time::minutes(1); + boost::posix_time::ptime unban_time = boost::posix_time::second_clock::local_time() + boost::posix_time::hours(24); server->getServerBannedIPListManager().addBannedIP(nplayer->getPlayerIP(), unban_time); boost::shared_ptr send(new NetIPIsBanned); nplayer->sendMessage(send); @@ -331,3 +331,82 @@ void YOGBanIP::execute(YOGServer* server } } + + +std::string YOGAddAdministrator::getHelpMessage() +{ + return ".add_administrator Sets the player as an administrator"; +} + + + +std::string YOGAddAdministrator::getCommandName() +{ + return ".add_administrator"; +} + + + +bool YOGAddAdministrator::doesMatch(const std::vector& tokens) +{ + if(tokens.size() != 2) + return false; + return true; +} + + + +void YOGAddAdministrator::execute(YOGServer* server, YOGServerAdministrator* admin, const std::vector& tokens, boost::shared_ptr player) +{ + std::string name = tokens[1]; + + if(server->getAdministratorList().isAdministrator(name)) + { + admin->sendTextMessage("Player "+name+" is already an admin.", player); + } + else + { + server->getAdministratorList().addAdministrator(name); + admin->sendTextMessage("Player "+name+" is now an admin.", player); + } +} + + + +std::string YOGRemoveAdministrator::getHelpMessage() +{ + return ".remove_administrator Removes administrator status from the player"; +} + + + +std::string YOGRemoveAdministrator::getCommandName() +{ + return ".remove_administrator"; +} + + + +bool YOGRemoveAdministrator::doesMatch(const std::vector& tokens) +{ + if(tokens.size() != 2) + return false; + return true; +} + + + +void YOGRemoveAdministrator::execute(YOGServer* server, YOGServerAdministrator* admin, const std::vector& tokens, boost::shared_ptr player) +{ + std::string name = tokens[1]; + if(server->getAdministratorList().isAdministrator(name)) + { + admin->sendTextMessage("Player "+name+" is no longer an admin.", player); + server->getAdministratorList().removeAdministrator(name); + } + else + { + admin->sendTextMessage("Player "+name+" is not an admin.", player); + } +} + diff -r 983067233fce -r b3da401ff6c6 src/YOGServerAdministratorCommands.h --- a/src/YOGServerAdministratorCommands.h Mon Apr 14 20:29:21 2008 -0400 +++ b/src/YOGServerAdministratorCommands.h Mon Apr 14 23:11:03 2008 -0400 @@ -198,4 +198,42 @@ public: void execute(YOGServer* server, YOGServerAdministrator* admin, const std::vector& tokens, boost::shared_ptr player); }; + + +///This adds an administrator +class YOGAddAdministrator : public YOGServerAdministratorCommand +{ +public: + ///Returns this YOGServerAdministratorCommand help message + std::string getHelpMessage(); + + ///Returns the command name for this YOGServerAdministratorCommand + std::string getCommandName(); + + ///Returns true if the given set of tokens match whats required for this YOGServerAdministratorCommand + bool doesMatch(const std::vector& tokens); + + ///Executes the code for the administrator command + void execute(YOGServer* server, YOGServerAdministrator* admin, const std::vector& tokens, boost::shared_ptr player); +}; + + + +///This removes an administrator +class YOGRemoveAdministrator : public YOGServerAdministratorCommand +{ +public: + ///Returns this YOGServerAdministratorCommand help message + std::string getHelpMessage(); + + ///Returns the command name for this YOGServerAdministratorCommand + std::string getCommandName(); + + ///Returns true if the given set of tokens match whats required for this YOGServerAdministratorCommand + bool doesMatch(const std::vector& tokens); + + ///Executes the code for the administrator command + void execute(YOGServer* server, YOGServerAdministrator* admin, const std::vector& tokens, boost::shared_ptr player); +}; + #endif diff -r 983067233fce -r b3da401ff6c6 src/YOGServerAdministratorList.cpp --- a/src/YOGServerAdministratorList.cpp Mon Apr 14 20:29:21 2008 -0400 +++ b/src/YOGServerAdministratorList.cpp Mon Apr 14 23:11:03 2008 -0400 @@ -27,6 +27,54 @@ using namespace GAGCore; YOGServerAdministratorList::YOGServerAdministratorList() { + load(); +} + + + +bool YOGServerAdministratorList::isAdministrator(const std::string& playerName) +{ + if(admins.find(playerName) != admins.end()) + return true; + return false; +} + + + +void YOGServerAdministratorList::addAdministrator(const std::string& playerName) +{ + admins.insert(playerName); + save(); +} + + + +void YOGServerAdministratorList::removeAdministrator(const std::string& playerName) +{ + if(admins.find(playerName)!=admins.end()) + admins.erase(admins.find(playerName)); + save(); +} + + + +void YOGServerAdministratorList::save() +{ + OutputLineStream* stream = new OutputLineStream(Toolkit::getFileManager()->openOutputStreamBackend("admins.txt")); + for(std::set::iterator i=admins.begin(); i!=admins.end(); ++i) + { + if(*i != "") + { + stream->writeLine(*i); + } + } + delete stream; +} + + + +void YOGServerAdministratorList::load() +{ InputLineStream* stream = new InputLineStream(Toolkit::getFileManager()->openInputStreamBackend("admins.txt")); while(!stream->isEndOfStream()) { @@ -37,10 +85,3 @@ YOGServerAdministratorList::YOGServerAdm } - -bool YOGServerAdministratorList::isAdministrator(const std::string& playerName) -{ - if(admins.find(playerName) != admins.end()) - return true; - return false; -} diff -r 983067233fce -r b3da401ff6c6 src/YOGServerAdministratorList.h --- a/src/YOGServerAdministratorList.h Mon Apr 14 20:29:21 2008 -0400 +++ b/src/YOGServerAdministratorList.h Mon Apr 14 23:11:03 2008 -0400 @@ -31,7 +31,19 @@ public: ///Returns true if the given username is an administrator, false otherwise bool isAdministrator(const std::string& playerName); + + ///Adds the specificed user as an administrator + void addAdministrator(const std::string& playerName); + + ///Removes the specified user from the administrator list + void removeAdministrator(const std::string& playerName); private: + ///Saves the list of administrators + void save(); + + ///Loads the list of administrators + void load(); + std::set admins; }; # HG changeset patch # User Bradley Arsenault # Date 1208230430 14400 # Node ID 2300fb6d6d835991767c7f0d0a13b620b7d16f5d # Parent b3da401ff6c61adbecf58dc7cb6f9f4e0e88b2d0 Added the concept of moderators who are able to execute a limited set of YOG commands diff -r b3da401ff6c6 -r 2300fb6d6d83 src/YOGPlayerStoredInfo.cpp --- a/src/YOGPlayerStoredInfo.cpp Mon Apr 14 23:11:03 2008 -0400 +++ b/src/YOGPlayerStoredInfo.cpp Mon Apr 14 23:33:50 2008 -0400 @@ -24,6 +24,7 @@ YOGPlayerStoredInfo::YOGPlayerStoredInfo YOGPlayerStoredInfo::YOGPlayerStoredInfo() { banned=false; + moderator=false; } @@ -75,6 +76,20 @@ bool YOGPlayerStoredInfo::isBanned() +void YOGPlayerStoredInfo::setModerator(bool isModerator) +{ + moderator=isModerator; +} + + + +bool YOGPlayerStoredInfo::isModerator() +{ + return moderator; +} + + + void YOGPlayerStoredInfo::encodeData(GAGCore::OutputStream* stream) const { stream->writeEnterSection("YOGPlayerStoredInfo"); @@ -82,6 +97,7 @@ void YOGPlayerStoredInfo::encodeData(GAG time<writeText(time.str(), "unmute_time"); stream->writeUint8(banned, "banned"); + stream->writeUint8(moderator, "moderator"); stream->writeLeaveSection(); } @@ -95,6 +111,7 @@ void YOGPlayerStoredInfo::decodeData(GAG time<>unmute_time; banned=stream->readUint8("banned"); + moderator=stream->readUint8("moderator"); stream->readLeaveSection(); } diff -r b3da401ff6c6 -r 2300fb6d6d83 src/YOGPlayerStoredInfo.h --- a/src/YOGPlayerStoredInfo.h Mon Apr 14 23:11:03 2008 -0400 +++ b/src/YOGPlayerStoredInfo.h Mon Apr 14 23:33:50 2008 -0400 @@ -52,6 +52,12 @@ public: ///Returns true if this player is banned, false otherwise bool isBanned(); + + ///Sets whether this player is a moderator or not + void setModerator(bool isModerator); + + ///Returns whether this player is a moderator + bool isModerator(); ///Encodes this YOGPlayerStoredInfo into a bit stream void encodeData(GAGCore::OutputStream* stream) const; @@ -65,6 +71,7 @@ private: private: boost::posix_time::ptime unmute_time; bool banned; + bool moderator; }; #endif diff -r b3da401ff6c6 -r 2300fb6d6d83 src/YOGServerAdministrator.cpp --- a/src/YOGServerAdministrator.cpp Mon Apr 14 23:11:03 2008 -0400 +++ b/src/YOGServerAdministrator.cpp Mon Apr 14 23:33:50 2008 -0400 @@ -36,6 +36,8 @@ YOGServerAdministrator::YOGServerAdminis commands.push_back(new YOGBanIP); commands.push_back(new YOGAddAdministrator); commands.push_back(new YOGRemoveAdministrator); + commands.push_back(new YOGAddModerator); + commands.push_back(new YOGRemoveModerator); } @@ -50,7 +52,7 @@ YOGServerAdministrator::~YOGServerAdmini -bool YOGServerAdministrator::executeAdministrativeCommand(const std::string& message, boost::shared_ptr player) +bool YOGServerAdministrator::executeAdministrativeCommand(const std::string& message, boost::shared_ptr player, bool moderator) { std::vector tokens; std::string token; @@ -92,10 +94,16 @@ bool YOGServerAdministrator::executeAdmi if(tokens[0] == ".help") { - sendTextMessage("The current list of YOG Administrative Commands are: ", player); + if(moderator) + sendTextMessage("The current list of YOG Administrative Commands available for moderators are: ", player); + else + sendTextMessage("The current list of YOG Administrative Commands are: ", player); for(int i=0; igetHelpMessage(), player); + if(!moderator || commands[i]->allowedForModerator()) + { + sendTextMessage(commands[i]->getHelpMessage(), player); + } } sendTextMessage(".help Shows this help message", player); } @@ -103,15 +111,18 @@ bool YOGServerAdministrator::executeAdmi { for(int i=0; igetCommandName()) + if(!moderator || commands[i]->allowedForModerator()) { - if(!commands[i]->doesMatch(tokens)) + if(tokens[0] == commands[i]->getCommandName()) { - sendTextMessage(commands[i]->getHelpMessage(), player); - } - else - { - commands[i]->execute(server, this, tokens, player); + if(!commands[i]->doesMatch(tokens)) + { + sendTextMessage(commands[i]->getHelpMessage(), player); + } + else + { + commands[i]->execute(server, this, tokens, player); + } } } } diff -r b3da401ff6c6 -r 2300fb6d6d83 src/YOGServerAdministrator.h --- a/src/YOGServerAdministrator.h Mon Apr 14 23:11:03 2008 -0400 +++ b/src/YOGServerAdministrator.h Mon Apr 14 23:33:50 2008 -0400 @@ -40,7 +40,7 @@ public: ///Interprets whether the given message is an administrative command, ///and if so, executes it. If it was, returns true, otherwise, returns ///false - bool executeAdministrativeCommand(const std::string& message, boost::shared_ptr player); + bool executeAdministrativeCommand(const std::string& message, boost::shared_ptr player, bool moderator); ///This sends a message to the player from the administrator engine void sendTextMessage(const std::string& message, boost::shared_ptr player); diff -r b3da401ff6c6 -r 2300fb6d6d83 src/YOGServerAdministratorCommands.cpp --- a/src/YOGServerAdministratorCommands.cpp Mon Apr 14 23:11:03 2008 -0400 +++ b/src/YOGServerAdministratorCommands.cpp Mon Apr 14 23:33:50 2008 -0400 @@ -42,6 +42,13 @@ bool YOGServerRestart::doesMatch(const s return false; return true; } + + + +bool YOGServerRestart::allowedForModerator() +{ + return false; +} @@ -70,6 +77,13 @@ bool YOGMutePlayer::doesMatch(const std: { if(tokens.size() != 2) return false; + return true; +} + + + +bool YOGMutePlayer::allowedForModerator() +{ return true; } @@ -112,6 +126,13 @@ bool YOGUnmutePlayer::doesMatch(const st return false; return true; } + + + +bool YOGUnmutePlayer::allowedForModerator() +{ + return true; +} @@ -151,6 +172,13 @@ bool YOGResetPassword::doesMatch(const s return false; return true; } + + + +bool YOGResetPassword::allowedForModerator() +{ + return false; +} @@ -182,6 +210,13 @@ bool YOGBanPlayer::doesMatch(const std:: if(tokens.size() != 2) return false; return true; +} + + + +bool YOGBanPlayer::allowedForModerator() +{ + return false; } @@ -229,6 +264,13 @@ bool YOGUnbanPlayer::doesMatch(const std return false; return true; } + + + +bool YOGUnbanPlayer::allowedForModerator() +{ + return false; +} @@ -267,6 +309,13 @@ bool YOGShowBannedPlayers::doesMatch(con if(tokens.size() != 1) return false; return true; +} + + + +bool YOGShowBannedPlayers::allowedForModerator() +{ + return false; } @@ -291,7 +340,7 @@ void YOGShowBannedPlayers::execute(YOGSe std::string YOGBanIP::getHelpMessage() { - return ".ban_ip Bans the IP address of the given player for 24 hours"; + return ".ban_ip Bans the players IP address for 24 hours"; } @@ -308,6 +357,13 @@ bool YOGBanIP::doesMatch(const std::vect if(tokens.size() != 2) return false; return true; +} + + + +bool YOGBanIP::allowedForModerator() +{ + return false; } @@ -353,6 +409,13 @@ bool YOGAddAdministrator::doesMatch(cons return false; return true; } + + + +bool YOGAddAdministrator::allowedForModerator() +{ + return false; +} @@ -393,6 +456,13 @@ bool YOGRemoveAdministrator::doesMatch(c return false; return true; } + + + +bool YOGRemoveAdministrator::allowedForModerator() +{ + return false; +} @@ -410,3 +480,95 @@ void YOGRemoveAdministrator::execute(YOG } } + + +std::string YOGAddModerator::getHelpMessage() +{ + return ".add_moderator Adds moderator status to a player"; +} + + + +std::string YOGAddModerator::getCommandName() +{ + return ".add_moderator"; +} + + + +bool YOGAddModerator::doesMatch(const std::vector& tokens) +{ + if(tokens.size() != 2) + return false; + return true; +} + + + +bool YOGAddModerator::allowedForModerator() +{ + return false; +} + + + +void YOGAddModerator::execute(YOGServer* server, YOGServerAdministrator* admin, const std::vector& tokens, boost::shared_ptr player) +{ + std::string name = tokens[1]; + if(server->getPlayerStoredInfoManager().doesStoredInfoExist(name)) + { + server->getPlayerStoredInfoManager().getPlayerStoredInfo(name).setModerator(true); + admin->sendTextMessage("Player made moderator: "+name, player); + } + else + { + admin->sendTextMessage("Could not find player: "+name, player); + } +} + + + +std::string YOGRemoveModerator::getHelpMessage() +{ + return ".remove_moderator Removes moderator status from a player"; +} + + + +std::string YOGRemoveModerator::getCommandName() +{ + return ".remove_moderator"; +} + + + +bool YOGRemoveModerator::doesMatch(const std::vector& tokens) +{ + if(tokens.size() != 2) + return false; + return true; +} + + + +bool YOGRemoveModerator::allowedForModerator() +{ + return false; +} + + + +void YOGRemoveModerator::execute(YOGServer* server, YOGServerAdministrator* admin, const std::vector& tokens, boost::shared_ptr player) +{ + std::string name = tokens[1]; + if(server->getPlayerStoredInfoManager().doesStoredInfoExist(name)) + { + server->getPlayerStoredInfoManager().getPlayerStoredInfo(name).setModerator(false); + admin->sendTextMessage("Player "+name+" had moderator status removed", player); + } + else + { + admin->sendTextMessage("Could not find player: "+name, player); + } +} + diff -r b3da401ff6c6 -r 2300fb6d6d83 src/YOGServerAdministratorCommands.h --- a/src/YOGServerAdministratorCommands.h Mon Apr 14 23:11:03 2008 -0400 +++ b/src/YOGServerAdministratorCommands.h Mon Apr 14 23:33:50 2008 -0400 @@ -42,6 +42,9 @@ public: ///Returns true if the given set of tokens match whats required for this YOGServerAdministratorCommand virtual bool doesMatch(const std::vector& tokens)=0; + ///Returns true if this command can be executed by both moderators and administrators, false if it can only be executed by administrators + virtual bool allowedForModerator()=0; + ///Executes the code for the administrator command virtual void execute(YOGServer* server, YOGServerAdministrator* admin, const std::vector& tokens, boost::shared_ptr player)=0; }; @@ -61,6 +64,9 @@ public: ///Returns true if the given set of tokens match whats required for this YOGServerAdministratorCommand bool doesMatch(const std::vector& tokens); + ///Returns true if this command can be executed by both moderators and administrators, false if it can only be executed by administrators + bool allowedForModerator(); + ///Executes the code for the administrator command void execute(YOGServer* server, YOGServerAdministrator* admin, const std::vector& tokens, boost::shared_ptr player); }; @@ -80,6 +86,9 @@ public: ///Returns true if the given set of tokens match whats required for this YOGServerAdministratorCommand bool doesMatch(const std::vector& tokens); + ///Returns true if this command can be executed by both moderators and administrators, false if it can only be executed by administrators + bool allowedForModerator(); + ///Executes the code for the administrator command void execute(YOGServer* server, YOGServerAdministrator* admin, const std::vector& tokens, boost::shared_ptr player); }; @@ -99,6 +108,9 @@ public: ///Returns true if the given set of tokens match whats required for this YOGServerAdministratorCommand bool doesMatch(const std::vector& tokens); + ///Returns true if this command can be executed by both moderators and administrators, false if it can only be executed by administrators + bool allowedForModerator(); + ///Executes the code for the administrator command void execute(YOGServer* server, YOGServerAdministrator* admin, const std::vector& tokens, boost::shared_ptr player); }; @@ -118,6 +130,9 @@ public: ///Returns true if the given set of tokens match whats required for this YOGServerAdministratorCommand bool doesMatch(const std::vector& tokens); + ///Returns true if this command can be executed by both moderators and administrators, false if it can only be executed by administrators + bool allowedForModerator(); + ///Executes the code for the administrator command void execute(YOGServer* server, YOGServerAdministrator* admin, const std::vector& tokens, boost::shared_ptr player); }; @@ -137,6 +152,9 @@ public: ///Returns true if the given set of tokens match whats required for this YOGServerAdministratorCommand bool doesMatch(const std::vector& tokens); + ///Returns true if this command can be executed by both moderators and administrators, false if it can only be executed by administrators + bool allowedForModerator(); + ///Executes the code for the administrator command void execute(YOGServer* server, YOGServerAdministrator* admin, const std::vector& tokens, boost::shared_ptr player); }; @@ -156,6 +174,9 @@ public: ///Returns true if the given set of tokens match whats required for this YOGServerAdministratorCommand bool doesMatch(const std::vector& tokens); + ///Returns true if this command can be executed by both moderators and administrators, false if it can only be executed by administrators + bool allowedForModerator(); + ///Executes the code for the administrator command void execute(YOGServer* server, YOGServerAdministrator* admin, const std::vector& tokens, boost::shared_ptr player); }; @@ -175,6 +196,9 @@ public: ///Returns true if the given set of tokens match whats required for this YOGServerAdministratorCommand bool doesMatch(const std::vector& tokens); + ///Returns true if this command can be executed by both moderators and administrators, false if it can only be executed by administrators + bool allowedForModerator(); + ///Executes the code for the administrator command void execute(YOGServer* server, YOGServerAdministrator* admin, const std::vector& tokens, boost::shared_ptr player); }; @@ -194,6 +218,9 @@ public: ///Returns true if the given set of tokens match whats required for this YOGServerAdministratorCommand bool doesMatch(const std::vector& tokens); + ///Returns true if this command can be executed by both moderators and administrators, false if it can only be executed by administrators + bool allowedForModerator(); + ///Executes the code for the administrator command void execute(YOGServer* server, YOGServerAdministrator* admin, const std::vector& tokens, boost::shared_ptr player); }; @@ -213,6 +240,9 @@ public: ///Returns true if the given set of tokens match whats required for this YOGServerAdministratorCommand bool doesMatch(const std::vector& tokens); + ///Returns true if this command can be executed by both moderators and administrators, false if it can only be executed by administrators + bool allowedForModerator(); + ///Executes the code for the administrator command void execute(YOGServer* server, YOGServerAdministrator* admin, const std::vector& tokens, boost::shared_ptr player); }; @@ -232,6 +262,53 @@ public: ///Returns true if the given set of tokens match whats required for this YOGServerAdministratorCommand bool doesMatch(const std::vector& tokens); + ///Returns true if this command can be executed by both moderators and administrators, false if it can only be executed by administrators + bool allowedForModerator(); + + ///Executes the code for the administrator command + void execute(YOGServer* server, YOGServerAdministrator* admin, const std::vector& tokens, boost::shared_ptr player); +}; + + + +///This adds a moderator +class YOGAddModerator : public YOGServerAdministratorCommand +{ +public: + ///Returns this YOGServerAdministratorCommand help message + std::string getHelpMessage(); + + ///Returns the command name for this YOGServerAdministratorCommand + std::string getCommandName(); + + ///Returns true if the given set of tokens match whats required for this YOGServerAdministratorCommand + bool doesMatch(const std::vector& tokens); + + ///Returns true if this command can be executed by both moderators and administrators, false if it can only be executed by administrators + bool allowedForModerator(); + + ///Executes the code for the administrator command + void execute(YOGServer* server, YOGServerAdministrator* admin, const std::vector& tokens, boost::shared_ptr player); +}; + + + +///This removes a moderator +class YOGRemoveModerator : public YOGServerAdministratorCommand +{ +public: + ///Returns this YOGServerAdministratorCommand help message + std::string getHelpMessage(); + + ///Returns the command name for this YOGServerAdministratorCommand + std::string getCommandName(); + + ///Returns true if the given set of tokens match whats required for this YOGServerAdministratorCommand + bool doesMatch(const std::vector& tokens); + + ///Returns true if this command can be executed by both moderators and administrators, false if it can only be executed by administrators + bool allowedForModerator(); + ///Executes the code for the administrator command void execute(YOGServer* server, YOGServerAdministrator* admin, const std::vector& tokens, boost::shared_ptr player); }; diff -r b3da401ff6c6 -r 2300fb6d6d83 src/YOGServerPlayer.cpp --- a/src/YOGServerPlayer.cpp Mon Apr 14 23:11:03 2008 -0400 +++ b/src/YOGServerPlayer.cpp Mon Apr 14 23:33:50 2008 -0400 @@ -117,9 +117,14 @@ void YOGServerPlayer::update() else if(type==MNetSendYOGMessage) { shared_ptr info = static_pointer_cast(message); - ///This is a special override used to restart development server + ///This is sends a command to the administrator engine if(server.getAdministratorList().isAdministrator(info->getMessage()->getSender())) - server.getAdministrator().executeAdministrativeCommand(info->getMessage()->getMessage(), server.getPlayer(playerID)); + server.getAdministrator().executeAdministrativeCommand(info->getMessage()->getMessage(), server.getPlayer(playerID), false); + ///If this player is a moderator, also execute a command, however, moderators can only execute a limtied number of commands + else if(server.getPlayerStoredInfoManager().getPlayerStoredInfo(info->getMessage()->getSender()).isModerator()) + server.getAdministrator().executeAdministrativeCommand(info->getMessage()->getMessage(), server.getPlayer(playerID), true); + + ///Check if this player is muted, ignore otherwise if(!server.getPlayerStoredInfoManager().getPlayerStoredInfo(info->getMessage()->getSender()).isMuted()) server.getChatChannelManager().getChannel(info->getChannel())->routeMessage(info->getMessage(), server.getPlayer(playerID)); # HG changeset patch # User Bradley Arsenault # Date 1208302157 14400 # Node ID 1e6581deb6e970af603baaccb950fe3b15283a87 # Parent 2300fb6d6d835991767c7f0d0a13b620b7d16f5d Added new class to store a continuous log of game files. Modified the workings of YOGGameResults diff -r 2300fb6d6d83 -r 1e6581deb6e9 src/SConscript --- a/src/SConscript Mon Apr 14 23:33:50 2008 -0400 +++ b/src/SConscript Tue Apr 15 19:29:17 2008 -0400 @@ -1,42 +1,42 @@ source_files = Split(""" source_files = Split(""" -AICastor.cpp AI.cpp AIEcho.cpp AINames.cpp -AINicowar.cpp AINull.cpp AINumbi.cpp AIToubib.cpp -AIWarrush.cpp BasePlayer.cpp BaseTeam.cpp BitArray.cpp -Brush.cpp Building.cpp BuildingsTypes.cpp BuildingType.cpp -Bullet.cpp Campaign.cpp CampaignEditor.cpp CampaignMainMenu.cpp -CampaignMenuScreen.cpp CampaignScreen.cpp CampaignSelectorScreen.cpp ChooseMapScreen.cpp -CPUStatisticsManager.cpp CreditScreen.cpp CustomGameScreen.cpp DynamicClouds.cpp -EditorMainMenu.cpp EndGameScreen.cpp Engine.cpp EntityType.cpp -Fatal.cpp FertilityCalculatorDialog.cpp FertilityCalculatorThread.cpp FertilityCalculatorThreadMessage.cpp -Game.cpp GameEvent.cpp GameGUI.cpp GameGUIDefaultAssignManager.cpp -GameGUIDialog.cpp GameGUIGhostBuildingManager.cpp GameGUIKeyActions.cpp GameGUILoadSave.cpp -GameGUIMessageManager.cpp GameGUIToolManager.cpp GameHeader.cpp GameUtilities.cpp -Glob2.cpp Glob2Screen.cpp Glob2Style.cpp GlobalContainer.cpp -GUIGlob2FileList.cpp GUIMapPreview.cpp HeightMapGenerator.cpp IntBuildingType.cpp -IRC.cpp IRCTextMessageHandler.cpp IRCThread.cpp IRCThreadMessage.cpp -KeyboardManager.cpp LANFindScreen.cpp LANGameInformation.cpp LANMenuScreen.cpp -LogFileManager.cpp MainMenuScreen.cpp MapAssembler.cpp Map.cpp -MapEdit.cpp MapEditKeyActions.cpp MapGenerationDescriptor.cpp MapGenerator.cpp -MapHeader.cpp MarkManager.cpp Minimap.cpp MultiplayerGame.cpp -MultiplayerGameEvent.cpp MultiplayerGameEventListener.cpp MultiplayerGameScreen.cpp NetBroadcaster.cpp -NetBroadcastListener.cpp NetConnection.cpp NetConnectionThread.cpp NetConnectionThreadMessage.cpp -NetEngine.cpp NetGamePlayerManager.cpp NetListener.cpp NetMessage.cpp -NetReteamingInformation.cpp NetTestSuite.cpp NewMapScreen.cpp Order.cpp -OverlayAreas.cpp P2PConnection.cpp P2PConnectionEvent.cpp P2PConnectionListener.cpp -P2PInformation.cpp P2PManager.cpp P2PPlayerInformation.cpp PerlinNoise.cpp -Player.cpp Race.cpp Ressource.cpp RessourcesTypes.cpp -ScriptEditorScreen.cpp Sector.cpp Settings.cpp SettingsScreen.cpp -SGSL.cpp SimplexNoise.cpp SoundMixer.cpp Team.cpp -TeamStat.cpp UnitConsts.cpp Unit.cpp UnitEditorScreen.cpp -UnitSkin.cpp UnitsSkins.cpp UnitType.cpp Utilities.cpp -VoiceRecorder.cpp YOGClientChatChannel.cpp YOGClientChatListener.cpp YOGClient.cpp -YOGClientEvent.cpp YOGClientEventListener.cpp YOGClientGameListListener.cpp YOGClientGameListManager.cpp -YOGClientLobbyScreen.cpp YOGClientPlayerListListener.cpp YOGClientPlayerListManager.cpp YOGConsts.cpp - YOGGameInfo.cpp YOGGameResults.cpp YOGLoginScreen.cpp -YOGMessage.cpp YOGPlayerSessionInfo.cpp YOGPlayerStoredInfo.cpp YOGServerAdministratorCommands.cpp -YOGServerAdministrator.cpp YOGServerAdministratorList.cpp YOGServerBannedIPListManager.cpp YOGServerChatChannel.cpp -YOGServerChatChannelManager.cpp YOGServer.cpp YOGServerGame.cpp YOGServerMapDistributor.cpp -YOGServerPasswordRegistry.cpp YOGServerPlayer.cpp YOGServerPlayerStoredInfoManager.cpp +AICastor.cpp AI.cpp AIEcho.cpp AINames.cpp +AINicowar.cpp AINull.cpp AINumbi.cpp AIToubib.cpp +AIWarrush.cpp BasePlayer.cpp BaseTeam.cpp BitArray.cpp +Brush.cpp Building.cpp BuildingsTypes.cpp BuildingType.cpp +Bullet.cpp Campaign.cpp CampaignEditor.cpp CampaignMainMenu.cpp +CampaignMenuScreen.cpp CampaignScreen.cpp CampaignSelectorScreen.cpp ChooseMapScreen.cpp +CPUStatisticsManager.cpp CreditScreen.cpp CustomGameScreen.cpp DynamicClouds.cpp +EditorMainMenu.cpp EndGameScreen.cpp Engine.cpp EntityType.cpp +Fatal.cpp FertilityCalculatorDialog.cpp FertilityCalculatorThread.cpp FertilityCalculatorThreadMessage.cpp +Game.cpp GameEvent.cpp GameGUI.cpp GameGUIDefaultAssignManager.cpp +GameGUIDialog.cpp GameGUIGhostBuildingManager.cpp GameGUIKeyActions.cpp GameGUILoadSave.cpp +GameGUIMessageManager.cpp GameGUIToolManager.cpp GameHeader.cpp GameUtilities.cpp +Glob2.cpp Glob2Screen.cpp Glob2Style.cpp GlobalContainer.cpp +GUIGlob2FileList.cpp GUIMapPreview.cpp HeightMapGenerator.cpp IntBuildingType.cpp +IRC.cpp IRCTextMessageHandler.cpp IRCThread.cpp IRCThreadMessage.cpp +KeyboardManager.cpp LANFindScreen.cpp LANGameInformation.cpp LANMenuScreen.cpp +LogFileManager.cpp MainMenuScreen.cpp MapAssembler.cpp Map.cpp +MapEdit.cpp MapEditKeyActions.cpp MapGenerationDescriptor.cpp MapGenerator.cpp +MapHeader.cpp MarkManager.cpp Minimap.cpp MultiplayerGame.cpp +MultiplayerGameEvent.cpp MultiplayerGameEventListener.cpp MultiplayerGameScreen.cpp NetBroadcaster.cpp +NetBroadcastListener.cpp NetConnection.cpp NetConnectionThread.cpp NetConnectionThreadMessage.cpp +NetEngine.cpp NetGamePlayerManager.cpp NetListener.cpp NetMessage.cpp +NetReteamingInformation.cpp NetTestSuite.cpp NewMapScreen.cpp Order.cpp +OverlayAreas.cpp P2PConnection.cpp P2PConnectionEvent.cpp P2PConnectionListener.cpp +P2PInformation.cpp P2PManager.cpp P2PPlayerInformation.cpp PerlinNoise.cpp +Player.cpp Race.cpp Ressource.cpp RessourcesTypes.cpp +ScriptEditorScreen.cpp Sector.cpp Settings.cpp SettingsScreen.cpp +SGSL.cpp SimplexNoise.cpp SoundMixer.cpp Team.cpp +TeamStat.cpp UnitConsts.cpp Unit.cpp UnitEditorScreen.cpp +UnitSkin.cpp UnitsSkins.cpp UnitType.cpp Utilities.cpp +VoiceRecorder.cpp YOGClientChatChannel.cpp YOGClientChatListener.cpp YOGClient.cpp +YOGClientEvent.cpp YOGClientEventListener.cpp YOGClientGameListListener.cpp YOGClientGameListManager.cpp +YOGClientLobbyScreen.cpp YOGClientPlayerListListener.cpp YOGClientPlayerListManager.cpp YOGConsts.cpp + YOGGameInfo.cpp YOGGameResults.cpp YOGLoginScreen.cpp +YOGMessage.cpp YOGPlayerSessionInfo.cpp YOGPlayerStoredInfo.cpp YOGServerAdministratorCommands.cpp +YOGServerAdministrator.cpp YOGServerAdministratorList.cpp YOGServerBannedIPListManager.cpp YOGServerChatChannel.cpp +YOGServerChatChannelManager.cpp YOGServer.cpp YOGServerGame.cpp YOGServerGameLog.cpp +YOGServerMapDistributor.cpp YOGServerPasswordRegistry.cpp YOGServerPlayer.cpp YOGServerPlayerStoredInfoManager.cpp """) server_source_files = Split(""" diff -r 2300fb6d6d83 -r 1e6581deb6e9 src/YOGGameResults.cpp --- a/src/YOGGameResults.cpp Mon Apr 14 23:33:50 2008 -0400 +++ b/src/YOGGameResults.cpp Tue Apr 15 19:29:17 2008 -0400 @@ -28,64 +28,51 @@ YOGGameResults::YOGGameResults() } -void YOGGameResults::setNumberOfPlayers(int number) +void YOGGameResults::setGameResultState(const std::string& player, YOGGameResult result) { - results.resize(number, YOGGameResultUnknown); - names.resize(number); + results[player] = result; } -void YOGGameResults::setGameResultState(int player, YOGGameResult result) +YOGGameResult YOGGameResults::getGameResultState(const std::string& player) { - results[player] = result; + if(results.find(player)!=results.end()) + { + return results[player]; + } + return YOGGameResultUnknown; } - -YOGGameResult YOGGameResults::getGameResultState(int player) -{ - return results[player]; -} - - -void YOGGameResults::setPlayerName(int player, const std::string& name) -{ - names[player] = name; -} - - -std::string YOGGameResults::getPlayerName(int player) -{ - return names[player]; -} void YOGGameResults::encodeData(GAGCore::OutputStream* stream) const { stream->writeEnterSection("YOGGameResults"); stream->writeUint32(results.size(), "size"); - for(int i=0; i::const_iterator i=results.begin(); i!=results.end(); ++i) { - stream->writeEnterSection(i); - stream->writeUint8(static_cast(results[i]), "result"); - stream->writeText(names[i], "name"); + stream->writeEnterSection(n); + stream->writeText(i->first, "name"); + stream->writeUint8(i->second, "result"); stream->writeLeaveSection(); + n+=1; } stream->writeLeaveSection(); } -void YOGGameResults::decodeData(GAGCore::InputStream* stream) +void YOGGameResults::decodeData(GAGCore::InputStream* stream, Uint32 netDataVersion) { stream->readEnterSection("YOGGameResults"); Uint32 size = stream->readUint32("size"); - results.resize(size); - names.resize(size); for(int i=0; ireadEnterSection(i); - results[i] = static_cast(stream->readUint8("result")); - names[i] = stream->readText("name"); + std::string name = stream->readText("name"); + YOGGameResult result = static_cast(stream->readUint8("result")); + results[name] = result; stream->readLeaveSection(); } @@ -96,7 +83,7 @@ void YOGGameResults::decodeData(GAGCore: bool YOGGameResults::operator==(const YOGGameResults& rhs) const { - if(results == rhs.results && names == rhs.names) + if(results == rhs.results) { return true; } @@ -111,7 +98,7 @@ bool YOGGameResults::operator==(const YO bool YOGGameResults::operator!=(const YOGGameResults& rhs) const { - if(results != rhs.results || names != rhs.names) + if(results != rhs.results) { return true; } diff -r 2300fb6d6d83 -r 1e6581deb6e9 src/YOGGameResults.h --- a/src/YOGGameResults.h Mon Apr 14 23:33:50 2008 -0400 +++ b/src/YOGGameResults.h Tue Apr 15 19:29:17 2008 -0400 @@ -21,7 +21,7 @@ #define YOGGameResults_h #include "YOGConsts.h" -#include +#include namespace GAGCore { @@ -36,33 +36,23 @@ public: ///Constructs a default yog game results YOGGameResults(); - ///Sets the number of players for this game result - void setNumberOfPlayers(int number); - ///Sets the game result state for a particular player - void setGameResultState(int player, YOGGameResult result); + void setGameResultState(const std::string& player, YOGGameResult result); ///Gets the game result state for a particular player - YOGGameResult getGameResultState(int player); - - ///Sets the player name for a particular player number - void setPlayerName(int player, const std::string& name); - - ///Returns the player name for a particular player number - std::string getPlayerName(int player); - + YOGGameResult getGameResultState(const std::string& player); + ///Encodes this YOGGameResults into a bit stream void encodeData(GAGCore::OutputStream* stream) const; ///Decodes this YOGGameResults from a bit stream - void decodeData(GAGCore::InputStream* stream); + void decodeData(GAGCore::InputStream* stream, Uint32 netDataVersion); ///Test for equality between two YOGGameResults bool operator==(const YOGGameResults& rhs) const; bool operator!=(const YOGGameResults& rhs) const; private: - std::vector results; - std::vector names; + std::map results; }; #endif diff -r 2300fb6d6d83 -r 1e6581deb6e9 src/YOGServer.cpp --- a/src/YOGServer.cpp Mon Apr 14 23:33:50 2008 -0400 +++ b/src/YOGServer.cpp Tue Apr 15 19:29:17 2008 -0400 @@ -86,6 +86,7 @@ void YOGServer::update() { if(i->second->isEmpty()) { + i->second->sendGameResultsToGameLog(); removeGameInfo(i->second->getGameID()); std::map >::iterator to_erase=i; i++; @@ -108,6 +109,7 @@ void YOGServer::update() playerInfos.update(); bannedIPs.update(); + gameLog.update(); int t = SDL_GetTicks(); if(organizedGameTimeEnabled) @@ -410,6 +412,13 @@ YOGServerBannedIPListManager& YOGServer: +YOGServerGameLog& YOGServer::getGameLog() +{ + return gameLog; +} + + + Uint16 YOGServer::chooseNewPlayerID() { //choose the new player ID. diff -r 2300fb6d6d83 -r 1e6581deb6e9 src/YOGServer.h --- a/src/YOGServer.h Mon Apr 14 23:33:50 2008 -0400 +++ b/src/YOGServer.h Tue Apr 15 19:29:17 2008 -0400 @@ -32,6 +32,7 @@ #include "YOGServerAdministrator.h" #include "YOGServerAdministratorList.h" #include "YOGServerPlayerStoredInfoManager.h" +#include "YOGServerGameLog.h" class NetBroadcaster; @@ -139,7 +140,11 @@ public: ///Returns the YOGServerBannedIPListManager YOGServerBannedIPListManager& getServerBannedIPListManager(); + + ///Returns the YOGServerGameLog + YOGServerGameLog& getGameLog(); private: + ///This looks for a free player id to assign to the player Uint16 chooseNewPlayerID(); ///Removes the GameInfo with the given ID @@ -168,6 +173,7 @@ private: YOGServerAdministratorList adminList; YOGServerPlayerStoredInfoManager playerInfos; YOGServerBannedIPListManager bannedIPs; + YOGServerGameLog gameLog; }; #endif diff -r 2300fb6d6d83 -r 1e6581deb6e9 src/YOGServerGame.cpp --- a/src/YOGServerGame.cpp Mon Apr 14 23:33:50 2008 -0400 +++ b/src/YOGServerGame.cpp Tue Apr 15 19:29:17 2008 -0400 @@ -132,7 +132,6 @@ void YOGServerGame::addPlayer(shared_ptr chooseLatencyMode(); server.getGameInfo(gameID).setPlayersJoined(players.size()); - gameResults.setNumberOfPlayers(aiNum + players.size()); } @@ -146,7 +145,6 @@ void YOGServerGame::addAIPlayer(AI::Impl aiNum+=1; server.getGameInfo(gameID).setAIJoined(aiNum); - gameResults.setNumberOfPlayers(aiNum + players.size()); } @@ -180,7 +178,7 @@ void YOGServerGame::removePlayer(shared_ else { setPlayerGameResult(player, YOGGameResultConnectionLost); - }; + } p2p.removePlayer(player); @@ -196,7 +194,6 @@ void YOGServerGame::removePlayer(shared_ chooseLatencyMode(); server.getGameInfo(gameID).setPlayersJoined(players.size()); - gameResults.setNumberOfPlayers(aiNum + players.size()); } @@ -210,7 +207,6 @@ void YOGServerGame::removeAIPlayer(int p aiNum-=1; server.getGameInfo(gameID).setAIJoined(aiNum); - gameResults.setNumberOfPlayers(aiNum + players.size()); } @@ -415,17 +411,19 @@ void YOGServerGame::chooseLatencyMode() void YOGServerGame::setPlayerGameResult(boost::shared_ptr sender, YOGGameResult result) { - for(int i=0; igetPlayerName()) == YOGGameResultUnknown) { - if(gameHeader.getBasePlayer(i).playerID == sender->getPlayerID()) - { - if(gameResults.getGameResultState(i) == YOGGameResultUnknown) - { - std::cout<<"player "<getPlayerName(), result); } } + +void YOGServerGame::sendGameResultsToGameLog() +{ + if(gameStarted) + { + server.getGameLog().addGameResults(gameResults); + } +} + diff -r 2300fb6d6d83 -r 1e6581deb6e9 src/YOGServerGame.h --- a/src/YOGServerGame.h Mon Apr 14 23:33:50 2008 -0400 +++ b/src/YOGServerGame.h Tue Apr 15 19:29:17 2008 -0400 @@ -117,6 +117,8 @@ public: ///This sets a players game result void setPlayerGameResult(boost::shared_ptr sender, YOGGameResult result); + ///This sends the games results to the game log, if this game actually went through + void sendGameResultsToGameLog(); private: bool gameStarted; bool hasAddedHost; diff -r 2300fb6d6d83 -r 1e6581deb6e9 src/YOGServerGameLog.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/YOGServerGameLog.cpp Tue Apr 15 19:29:17 2008 -0400 @@ -0,0 +1,119 @@ +/* + Copyright (C) 2008 Bradley Arsenault + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + + +#include "YOGServerGameLog.h" +#include +#include "Stream.h" +#include "BinaryStream.h" +#include "Toolkit.h" +#include "FileManager.h" +#include "Version.h" + +using namespace GAGCore; + +YOGServerGameLog::YOGServerGameLog() +{ + boost::posix_time::ptime local = boost::posix_time::second_clock::local_time(); + hour = local - boost::posix_time::seconds(local.time_of_day().seconds()%3600); + flushTime = local + boost::posix_time::minutes(5); + modified=false; + load(); +} + + + +void YOGServerGameLog::addGameResults(YOGGameResults results) +{ + games.push_back(results); + modified=true; +} + + + +void YOGServerGameLog::update() +{ + boost::posix_time::ptime local = boost::posix_time::second_clock::local_time(); + boost::posix_time::ptime new_hour = local - boost::posix_time::seconds(local.time_of_day().total_seconds()%3600); + if(new_hour != hour) + { + if(modified) + { + save(); + modified=false; + } + hour = new_hour; + load(); + } + + if(local > flushTime) + { + if(modified) + { + save(); + modified=false; + } + flushTime = local + boost::posix_time::minutes(5); + } +} + + + +void YOGServerGameLog::save() +{ + std::stringstream s; + s<<"logs/gamelog"; + s<openOutputStreamBackend(s.str())); + + stream->writeUint32(NET_DATA_VERSION, "version"); + stream->writeUint32(games.size(), "size"); + for(std::vector::iterator i = games.begin(); i!=games.end(); ++i) + { + i->encodeData(stream); + } + delete stream; +} + + + +void YOGServerGameLog::load() +{ + games.clear(); + std::stringstream s; + s<<"logs/gamelog"; + s<openInputStreamBackend(s.str()); + if(!backend->isEndOfStream()) + { + InputStream* stream = new BinaryInputStream(backend); + Uint32 version = stream->readUint32("version"); + Uint32 size = stream->readUint32("size"); + games.resize(size); + for(std::vector::iterator i = games.begin(); i!=games.end(); ++i) + { + i->decodeData(stream, version); + } + delete stream; + } + else + { + delete backend; + } +} + diff -r 2300fb6d6d83 -r 1e6581deb6e9 src/YOGServerGameLog.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/YOGServerGameLog.h Tue Apr 15 19:29:17 2008 -0400 @@ -0,0 +1,53 @@ +/* + Copyright (C) 2008 Bradley Arsenault + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +#ifndef __YOGServerGameLog_h +#define __YOGServerGameLog_h + +#include "YOGGameResults.h" +#include "boost/date_time/posix_time/posix_time.hpp" +#include "SDL_net.h" + +///This class keeps a complete list of games played +class YOGServerGameLog +{ +public: + ///Constructs the game log + YOGServerGameLog(); + + ///Adds a game result to the log + void addGameResults(YOGGameResults results); + + ///Updates this game log, periodically saving and changing the log file + void update(); +private: + ///This saves the game log + void save(); + ///This loads the game log + void load(); + ///This is the current hour + boost::posix_time::ptime hour; + ///This is the list of games from this hour + std::vector games; + ///This is the next time the list will be flushed + boost::posix_time::ptime flushTime; + ///This is set when the list has changed + bool modified; +}; + +#endif # HG changeset patch # User Bradley Arsenault # Date 1208311191 14400 # Node ID b0c1fbde3b231b1a4cdaa12d8b7efad45b5b70a9 # Parent 1e6581deb6e970af603baaccb950fe3b15283a87 Added new menu called the 'Other Options' menu that allows configuring extra options for games. Added pre-game alliances, and the ability to fix the alliances so that they can not be changed throughout a game diff -r 1e6581deb6e9 -r b0c1fbde3b23 data/texts.en.txt --- a/data/texts.en.txt Tue Apr 15 19:29:17 2008 -0400 +++ b/data/texts.en.txt Tue Apr 15 21:59:51 2008 -0400 @@ -554,6 +554,10 @@ there are there are [ok] Ok +[Other Options] +Other Options +[Teams Fixed] +Teams Fixed [old islands terrain] old random islands [old random terrain] diff -r 1e6581deb6e9 -r b0c1fbde3b23 data/texts.keys.txt --- a/data/texts.keys.txt Tue Apr 15 19:29:17 2008 -0400 +++ b/data/texts.keys.txt Tue Apr 15 21:59:51 2008 -0400 @@ -508,7 +508,9 @@ [workers] [working] [wounded] +[Other Options] [Yes] +[Teams Fixed] [YESTS_CONNECTING] [YESTS_CONNECTION_LOST] [YESTS_CONNECTION_REFUSED_ALREADY_PASSWORD] diff -r 1e6581deb6e9 -r b0c1fbde3b23 libgag/include/GUIButton.h --- a/libgag/include/GUIButton.h Tue Apr 15 19:29:17 2008 -0400 +++ b/libgag/include/GUIButton.h Tue Apr 15 21:59:51 2008 -0400 @@ -75,9 +75,10 @@ namespace GAGGUI protected: bool state; + bool isClickable; public: - OnOffButton() { state=false; returnCode=0; } - OnOffButton(const std::string &tooltip, const std::string &tooltipFont) :HighlightableWidget(tooltip, tooltipFont) { state=false; returnCode=0; } + OnOffButton() { state=false; returnCode=0; isClickable=true; } + OnOffButton(const std::string &tooltip, const std::string &tooltipFont) :HighlightableWidget(tooltip, tooltipFont) { state=false; returnCode=0; isClickable=true; } OnOffButton(int x, int y, int w, int h, Uint32 hAlign, Uint32 vAlign, bool startState, int returnCode); OnOffButton(int x, int y, int w, int h, Uint32 hAlign, Uint32 vAlign, bool startState, int returnCode, const std::string &tooltip, const std::string &tooltipFont); virtual ~OnOffButton() { } @@ -85,6 +86,8 @@ namespace GAGGUI virtual void paint(void); virtual bool getState(void) { return state; } virtual void setState(bool newState); + //! Makes it so that nothing occurs on click + virtual void setClickable(bool enabled) { isClickable = enabled; } protected: virtual void onSDLMouseButtonDown(SDL_Event *event); virtual void onSDLMouseButtonUp(SDL_Event *event); diff -r 1e6581deb6e9 -r b0c1fbde3b23 libgag/src/GUIButton.cpp --- a/libgag/src/GUIButton.cpp Tue Apr 15 19:29:17 2008 -0400 +++ b/libgag/src/GUIButton.cpp Tue Apr 15 21:59:51 2008 -0400 @@ -143,6 +143,7 @@ namespace GAGGUI this->vAlignFlag=vAlign; this->state=startState; + isClickable=true; } OnOffButton::OnOffButton(int x, int y, int w, int h, Uint32 hAlign, Uint32 vAlign, bool startState, int returnCode, const std::string &tooltip, const std::string &tooltipFont) @@ -156,13 +157,14 @@ namespace GAGGUI this->vAlignFlag=vAlign; this->state=startState; + isClickable=true; } void OnOffButton::onSDLMouseButtonDown(SDL_Event *event) { assert(event->type == SDL_MOUSEBUTTONDOWN); if (isOnWidget(event->button.x, event->button.y) && - (event->button.button == SDL_BUTTON_LEFT)) + (event->button.button == SDL_BUTTON_LEFT) && isClickable) { state=!state; parent->onAction(this, BUTTON_PRESSED, returnCode, 0); @@ -173,7 +175,7 @@ namespace GAGGUI void OnOffButton::onSDLMouseButtonUp(SDL_Event *event) { assert(event->type == SDL_MOUSEBUTTONUP); - if (isOnWidget(event->button.x, event->button.y)) + if (isOnWidget(event->button.x, event->button.y) && isClickable) parent->onAction(this, BUTTON_RELEASED, returnCode, 0); } diff -r 1e6581deb6e9 -r b0c1fbde3b23 src/CustomGameOtherOptions.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/CustomGameOtherOptions.cpp Tue Apr 15 21:59:51 2008 -0400 @@ -0,0 +1,132 @@ +/* + Copyright (C) 2008 Bradley Arsenault + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +#include "CustomGameOtherOptions.h" + +#include +#include +#include +#include +#include +#include + +CustomGameOtherOptions::CustomGameOtherOptions(GameHeader& gameHeader, MapHeader& mapHeader) + : gameHeader(gameHeader), oldGameHeader(gameHeader), mapHeader(mapHeader) +{ + ok = new TextButton(440, 360, 180, 40, ALIGN_SCREEN_CENTERED, ALIGN_SCREEN_CENTERED, "menu", Toolkit::getStringTable()->getString("[ok]"), OK, 13); + addWidget(ok); + + cancel = new TextButton(440, 420, 180, 40, ALIGN_SCREEN_CENTERED, ALIGN_SCREEN_CENTERED, "menu", Toolkit::getStringTable()->getString("[Cancel]"), CANCEL, 27); + addWidget(cancel); + + title = new Text(0, 18, ALIGN_FILL, ALIGN_SCREEN_CENTERED, "menu", Toolkit::getStringTable()->getString("[Other Options]")); + addWidget(title); + + for(int i=0; i<32; ++i) + { + playerNames[i] = NULL; + color[i] = NULL; + } + + for(int i=0; iclearTexts(); + for(int j=0; jaddText(s.str()); + } + allyTeamNumbers[i]->setIndex(gameHeader.getAllyTeamNumber(gameHeader.getBasePlayer(i).teamNumber)-1); + + color[i]->clearColors(); + color[i]->addColor(mapHeader.getBaseTeam(gameHeader.getBasePlayer(i).teamNumber).color); + color[i]->setSelectedColor(0); + + addWidget(playerNames[i]); + addWidget(color[i]); + addWidget(allyTeamNumbers[i]); + } + + teamsFixed = new OnOffButton(300, 60, 21, 21, ALIGN_SCREEN_CENTERED, ALIGN_SCREEN_CENTERED, "menu", TEAMSFIXED); + addWidget(teamsFixed); + + teamsFixedText = new Text(325, 60, ALIGN_SCREEN_CENTERED, ALIGN_SCREEN_CENTERED, "standard", Toolkit::getStringTable()->getString("[Teams Fixed]")); + addWidget(teamsFixedText); +} + + + +CustomGameOtherOptions::~CustomGameOtherOptions() +{ + +} + + +void CustomGameOtherOptions::onAction(Widget *source, Action action, int par1, int par2) +{ + if ((action == BUTTON_RELEASED) || (action == BUTTON_SHORTCUT)) + { + if(par1 == OK) + { + endExecute(Finished); + } + if(par1 == CANCEL) + { + gameHeader = oldGameHeader; + endExecute(Canceled); + } + } + else if (action==BUTTON_STATE_CHANGED) + { + if(par1>=200 && par1<300) + { + int team = -1; + int nth = 0; + int n = 0; + ///Find which team number this widget is for + for(int i=0; igetIndex(); + n = nth+1; + break; + } + } + ///Adjust all widgets that have this team number + for(int i=0; isetIndex(nth); + } + } + gameHeader.setAllyTeamNumber(team, n); + } + else if(par1 == TEAMSFIXED) + { + gameHeader.setAllyTeamsFixed(teamsFixed->getState()); + } + } +} + diff -r 1e6581deb6e9 -r b0c1fbde3b23 src/CustomGameOtherOptions.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/CustomGameOtherOptions.h Tue Apr 15 21:59:51 2008 -0400 @@ -0,0 +1,92 @@ +/* + Copyright (C) 2008 Bradley Arsenault + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +#ifndef CustomGameOtherOptions_h +#define CustomGameOtherOptions_h + +#include "AI.h" +#include "Glob2Screen.h" +#include "GameHeader.h" +#include "MapHeader.h" + +using namespace GAGGUI; + +namespace GAGGUI +{ + class Button; + class TextButton; + class OnOffButton; + class ColorButton; + class MultiTextButton; + class Text; + class Number; +} + +/// This screen is used to set the other settings, like alliances, for the game +class CustomGameOtherOptions : public Glob2Screen +{ + +public: + /// Constructor, edits the given game header and map header + CustomGameOtherOptions(GameHeader& gameHeader, MapHeader& mapHeader); + /// Destructor + virtual ~CustomGameOtherOptions(); + ///Recieves an action from a widget + virtual void onAction(Widget *source, Action action, int par1, int par2); + + ///These are the end values for this screen + enum EndValues + { + Finished, + Canceled, + }; + +private: + enum + { + OK, + CANCEL, + TEAMSFIXED, + }; + + ///"Other Options" Title + Text* title; + ///Ok button + TextButton* ok; + ///Cancel button + TextButton* cancel; + + ///List of the player names + Text* playerNames[32]; + //! Player colors + ColorButton *color[32]; + //! Player ally temas + MultiTextButton *allyTeamNumbers[32]; + + ///Button fixing teams during the match + OnOffButton *teamsFixed; + ///Text for above button + Text* teamsFixedText; + + + MapHeader& mapHeader; + GameHeader& gameHeader; + GameHeader oldGameHeader; +}; + +#endif diff -r 1e6581deb6e9 -r b0c1fbde3b23 src/CustomGameScreen.cpp --- a/src/CustomGameScreen.cpp Tue Apr 15 19:29:17 2008 -0400 +++ b/src/CustomGameScreen.cpp Tue Apr 15 21:59:51 2008 -0400 @@ -30,6 +30,7 @@ #include #include #include "Player.h" +#include "CustomGameOtherOptions.h" CustomGameScreen::CustomGameScreen() : ChooseMapScreen("maps", "map", true) @@ -62,6 +63,9 @@ CustomGameScreen::CustomGameScreen() : aiSelector[i]->setIndex(AI::NUMBI); } } + otherOptions = new TextButton(230, 420, 170, 40, ALIGN_SCREEN_CENTERED, ALIGN_SCREEN_CENTERED, "standard", Toolkit::getStringTable()->getString("[Other Options]"), 0); + addWidget(otherOptions); + otherOptions->visible=false; } @@ -112,6 +116,7 @@ void CustomGameScreen::validMapSelectedh closedText[i]->show(); } updatePlayers(); + otherOptions->visible=true; } @@ -144,6 +149,14 @@ void CustomGameScreen::onAction(Widget * } updatePlayers(); } + if ((action == BUTTON_RELEASED) || (action == BUTTON_SHORTCUT)) + { + if(source == otherOptions) + { + CustomGameOtherOptions settings(gameHeader, mapHeader); + int rc = settings.execute(globalContainer->gfx, 40); + } + } } @@ -172,6 +185,7 @@ void CustomGameScreen::updatePlayers() void CustomGameScreen::updatePlayers() { int count = 0; + int humanColor = 0; for (int i=0; igetUsername().c_str(), teamColor, BasePlayer::P_LOCAL); + humanColor = teamColor; + gameHeader.setAllyTeamNumber(teamColor, 1); } else { @@ -187,6 +203,8 @@ void CustomGameScreen::updatePlayers() FormatableString name("%0 %1"); name.arg(AI::getAIText(iid)).arg(i-1); gameHeader.getBasePlayer(count) = BasePlayer(i, name.c_str(), teamColor, Player::playerTypeFromImplementitionID(iid)); + if(teamColor != humanColor) + gameHeader.setAllyTeamNumber(teamColor, 2); } count+=1; } diff -r 1e6581deb6e9 -r b0c1fbde3b23 src/CustomGameScreen.h --- a/src/CustomGameScreen.h Tue Apr 15 19:29:17 2008 -0400 +++ b/src/CustomGameScreen.h Tue Apr 15 21:59:51 2008 -0400 @@ -37,7 +37,7 @@ class Glob2FileList; class Glob2FileList; class MapPreview; -const int NumberOfPlayerSelectors=16; +const int NumberOfPlayerSelectors=14; //! This screen is used to setup a custom game. AI can be set. Map choosing functionnalities are inherited from ChooseMapScreen class CustomGameScreen : public ChooseMapScreen @@ -58,6 +58,8 @@ public: int getSelectedColor(int i); private: + + ///Updates the gameHeader with the chosen players for the map void updatePlayers(); @@ -69,6 +71,8 @@ private: Text *closedText[NumberOfPlayerSelectors]; //! Multi-text button containing names of availables Player MultiTextButton *aiSelector[NumberOfPlayerSelectors]; + //! Text button that links to the custom game other settings screen + TextButton* otherOptions; }; diff -r 1e6581deb6e9 -r b0c1fbde3b23 src/Engine.cpp --- a/src/Engine.cpp Tue Apr 15 19:29:17 2008 -0400 +++ b/src/Engine.cpp Tue Apr 15 21:59:51 2008 -0400 @@ -107,9 +107,6 @@ int Engine::initCustom(void) else if(ret == -1) return -1; - // set the correct alliance - gui.game.setAIAlliance(); - return EE_NO_ERROR; } @@ -137,9 +134,6 @@ int Engine::initCustom(const std::string else if(ret == -1) return -1; - // set the correct alliance - gui.game.setAIAlliance(); - return EE_NO_ERROR; } @@ -197,9 +191,6 @@ void Engine::createRandomGame() gui.localTeamNo=0; initGame(map, game); - - // set the correct alliance - gui.game.setAIFFA(); } @@ -704,6 +695,7 @@ GameHeader Engine::createRandomGame(int name.arg(AI::getAIText(iid)).arg(i-1); gameHeader.getBasePlayer(count) = BasePlayer(i, name.c_str(), teamColor, Player::playerTypeFromImplementitionID(iid)); } + gameHeader.setAllyTeamNumber(teamColor, teamColor); count+=1; } gameHeader.setNumberOfPlayers(count); @@ -719,4 +711,5 @@ void Engine::finalAdjustements(void) { gui.adjustInitialViewport(); } + gui.game.setAlliances(); } diff -r 1e6581deb6e9 -r b0c1fbde3b23 src/Game.cpp --- a/src/Game.cpp Tue Apr 15 19:29:17 2008 -0400 +++ b/src/Game.cpp Tue Apr 15 21:59:51 2008 -0400 @@ -698,7 +698,6 @@ void Game::executeOrder(boost::shared_pt teams[team]->sharedVisionExchange=sao->visionExchangeMask; teams[team]->sharedVisionFood=sao->visionFoodMask; teams[team]->sharedVisionOther=sao->visionOtherMask; - setAIAlliance(); fprintf(logFile, "ORDER_SET_ALLIANCE"); } break; @@ -730,84 +729,26 @@ void Game::executeOrder(boost::shared_pt } } -bool Game::isHumanAllAllied(void) + + +void Game::setAlliances(void) { - Uint32 nonAIMask=0; - - // AIMask now have the mask of everything which isn't AI - for (int i=0; itype != BaseTeam::T_AI) ? 1 : 0) << i; - //printf("team %d is AI is %d\n", i, teams[i]->type == BaseTeam::T_AI); - } - - // if there is any non-AI player with which we aren't allied, return false - // or if there is any player allied to AI - for (int i=0; itype != BaseTeam::T_AI) + int allyTeam = gameHeader.getAllyTeamNumber(i); + teams[i]->allies = 0; + teams[i]->enemies = 0; + for(int j=0; jallies != nonAIMask) - return false; - } - - return true; -} - -void Game::setAIAlliance(void) -{ - if (isHumanAllAllied()) - { - if (verbose) - printf("Game : AIs are now allied vs human\n"); - - // all human are allied, ally AI - Uint32 aiMask = 0; - - // find all AI - for (int i=0; itype == BaseTeam::T_AI) - aiMask |= (1<type == BaseTeam::T_AI) + int otherAllyTeam = gameHeader.getAllyTeamNumber(j); + if(allyTeam == otherAllyTeam) { - teams[i]->allies = aiMask; - teams[i]->enemies = ~teams[i]->allies; + teams[i]->allies |= teams[j]->me; } - } - else - { - if (verbose) - printf("Game : AIs are now in ffa mode\n"); - - // free for all on AI side - for (int i=0; itype == BaseTeam::T_AI) + else { - teams[i]->allies = teams[i]->me; - teams[i]->enemies = ~teams[i]->allies; + teams[i]->enemies |= teams[j]->me; } - } - } -} - - - -void Game::setAIFFA(void) -{ - // free for all on AI side - for (int i=0; itype == BaseTeam::T_AI) - { - teams[i]->allies = teams[i]->me; - teams[i]->enemies = ~teams[i]->allies; } } } diff -r 1e6581deb6e9 -r b0c1fbde3b23 src/Game.h --- a/src/Game.h Tue Apr 15 19:29:17 2008 -0400 +++ b/src/Game.h Tue Apr 15 21:59:51 2008 -0400 @@ -160,9 +160,6 @@ private: ///Clears existing game information, deleting the teams and players, in preperation of a new game. void clearGame(); - //! return true if all human are allied together, flase otherwise - bool isHumanAllAllied(void); - public: bool anyPlayerWaited; int anyPlayerWaitedTimeFor; @@ -191,11 +188,8 @@ public: public: Uint32 checkSum(std::vector *checkSumsVector=NULL, std::vector *checkSumsVectorForBuildings=NULL, std::vector *checkSumsVectorForUnits=NULL, bool heavy=false); - //! ally or disally AI following human alliances - void setAIAlliance(void); - - //! Sets the AI for free for all - void setAIFFA(void); + /// Sets the alliances from the GameHeader alliance teams + void setAlliances(void); public: ///This is a static header for a map. It remains the same in between games on the same map. diff -r 1e6581deb6e9 -r b0c1fbde3b23 src/GameGUIDialog.cpp --- a/src/GameGUIDialog.cpp Tue Apr 15 19:29:17 2008 -0400 +++ b/src/GameGUIDialog.cpp Tue Apr 15 21:59:51 2008 -0400 @@ -101,6 +101,11 @@ InGameAllianceScreen::InGameAllianceScre alliance[i]=new OnOffButton(172+xBase, 40+yBase, 20, 20, ALIGN_LEFT, ALIGN_LEFT, (gameGUI->localTeam->allies & otherTeamMask) != 0, ALLIED+i); addWidget(alliance[i]); + + if(gameGUI->game.gameHeader.areAllyTeamsFixed()) + { + alliance[i]->setClickable(false); + } normalVision[i]=new OnOffButton(196+xBase, 40+yBase, 20, 20, ALIGN_LEFT, ALIGN_LEFT, (gameGUI->localTeam->sharedVisionOther & otherTeamMask) != 0, NORMAL_VISION+i); addWidget(normalVision[i]); diff -r 1e6581deb6e9 -r b0c1fbde3b23 src/GameHeader.cpp --- a/src/GameHeader.cpp Tue Apr 15 19:29:17 2008 -0400 +++ b/src/GameHeader.cpp Tue Apr 15 21:59:51 2008 -0400 @@ -36,6 +36,12 @@ void GameHeader::reset() seed = std::time(NULL); //If needed, seed can be fixed, default value, 5489 //seed = 5489; + + for(int i=0; i<32; ++i) + { + allyTeamNumbers[i] = i+1; + } + allyTeamsFixed=true; } @@ -54,6 +60,16 @@ bool GameHeader::load(GAGCore::InputStre stream->readLeaveSection(i); } stream->readLeaveSection(); + if(versionMinor >= 71) + { + stream->readEnterSection("allyTeamNumbers"); + for(int i=0; i<32; ++i) + { + allyTeamNumbers[i] = stream->readUint8("allyTeamNumber"); + } + stream->readLeaveSection(); + allyTeamsFixed = stream->readUint8("allyTeamsFixed"); + } if(versionMinor >= 64) seed = stream->readUint32("seed"); stream->readLeaveSection(); @@ -76,6 +92,13 @@ void GameHeader::save(GAGCore::OutputStr stream->writeLeaveSection(); } stream->writeLeaveSection(); + stream->writeEnterSection("allyTeamNumbers"); + for(int i=0; i<32; ++i) + { + stream->writeUint8(allyTeamNumbers[i], "allyTeamNumber"); + } + stream->writeLeaveSection(); + stream->writeUint8(allyTeamsFixed, "allyTeamsFixed"); stream->writeUint32(seed, "seed"); stream->writeLeaveSection(); } @@ -87,6 +110,16 @@ bool GameHeader::loadWithoutPlayerInfo(G stream->readEnterSection("GameHeader"); gameLatency = stream->readSint32("gameLatency"); orderRate = stream->readUint8("orderRate"); + if(versionMinor >= 71) + { + stream->readEnterSection("allyTeamNumbers"); + for(int i=0; i<32; ++i) + { + allyTeamNumbers[i] = stream->readUint8("allyTeamNumber"); + } + stream->readLeaveSection(); + allyTeamsFixed = stream->readUint8("allyTeamsFixed"); + } if(versionMinor >= 64) seed = stream->readUint32("seed"); stream->readLeaveSection(); @@ -100,6 +133,13 @@ void GameHeader::saveWithoutPlayerInfo(G stream->writeEnterSection("GameHeader"); stream->writeSint32(gameLatency, "gameLatency"); stream->writeUint8(orderRate, "orderRate"); + stream->writeEnterSection("allyTeamNumbers"); + for(int i=0; i<32; ++i) + { + stream->writeUint8(allyTeamNumbers[i], "allyTeamNumber"); + } + stream->writeLeaveSection(); + stream->writeUint8(allyTeamsFixed, "allyTeamsFixed"); stream->writeUint32(seed, "seed"); stream->writeLeaveSection(); } @@ -199,6 +239,34 @@ const BasePlayer& GameHeader::getBasePla +Uint8 GameHeader::getAllyTeamNumber(int teamNumber) +{ + return allyTeamNumbers[teamNumber]; +} + + + +void GameHeader::setAllyTeamNumber(int teamNumber, Uint8 allyTeam) +{ + allyTeamNumbers[teamNumber]=allyTeam; +} + + + +bool GameHeader::areAllyTeamsFixed() +{ + return allyTeamsFixed; +} + + + +void GameHeader::setAllyTeamsFixed(bool fixed) +{ + allyTeamsFixed = fixed; +} + + + Uint32 GameHeader::getRandomSeed() const { return seed; diff -r 1e6581deb6e9 -r b0c1fbde3b23 src/GameHeader.h --- a/src/GameHeader.h Tue Apr 15 19:29:17 2008 -0400 +++ b/src/GameHeader.h Tue Apr 15 21:59:51 2008 -0400 @@ -77,6 +77,18 @@ public: ///Provides access to the base player. n must be between 0 and 31. const BasePlayer& getBasePlayer(const int n) const; + ///Returns the ally-team number for the given team for pre-game alliances + Uint8 getAllyTeamNumber(int teamNumber); + + ///Sets the ally-team number for the given team + void setAllyTeamNumber(int teamNumber, Uint8 allyTeam); + + ///Returns whether allying and de-allying are allowed mid-game + bool areAllyTeamsFixed(); + + ///Sets whether ally-teams are fixed during the game + void setAllyTeamsFixed(bool fixed); + ///Returns the random generator seed thats being used Uint32 getRandomSeed() const; @@ -96,6 +108,12 @@ private: ///Represents the basic player information in the game BasePlayer players[32]; + ///Represents the ally team numbers + Uint8 allyTeamNumbers[32]; + + ///Represents whether the ally-teams are fixed for the whole game, so no allying/unallying can take place + bool allyTeamsFixed; + ///Represents the random seed used for the game Uint32 seed; }; diff -r 1e6581deb6e9 -r b0c1fbde3b23 src/MultiplayerGameScreen.cpp --- a/src/MultiplayerGameScreen.cpp Tue Apr 15 19:29:17 2008 -0400 +++ b/src/MultiplayerGameScreen.cpp Tue Apr 15 21:59:51 2008 -0400 @@ -36,6 +36,7 @@ #include "IRC.h" #include "YOGMessage.h" +#include "CustomGameOtherOptions.h" MultiplayerGameScreen::MultiplayerGameScreen(TabScreen* parent, boost::shared_ptr game, boost::shared_ptr client, boost::shared_ptr ircChat) : TabScreenWindow(parent, Toolkit::getStringTable()->getString("[Game]")), game(game), gameChat(new YOGClientChatChannel(static_cast(-1), client)), ircChat(ircChat) @@ -60,6 +61,10 @@ MultiplayerGameScreen::MultiplayerGameSc addWidget(gameStartWaitingText); gameStartWaitingText->visible = false; + otherOptions = new TextButton(20, 230, 180, 40, ALIGN_RIGHT, ALIGN_TOP, "standard", Toolkit::getStringTable()->getString("[Other Options]"), OTHEROPTIONS); + addWidget(otherOptions); + otherOptions->visible=false; + if(game->getGameJoinCreationState() == MultiplayerGame::HostingGame || game->getGameJoinCreationState() == MultiplayerGame::WaitingForCreateReply) { @@ -150,6 +155,12 @@ void MultiplayerGameScreen::onAction(Wid else if ((par1>=CLOSE_BUTTONS)&&(par1kickPlayer(par1 - CLOSE_BUTTONS); + } + else if(par1 == OTHEROPTIONS) + { + CustomGameOtherOptions settings(game->getGameHeader(), game->getMapHeader()); + int rc = settings.execute(globalContainer->gfx, 40); + game->updateGameHeader(); } } else if (action==BUTTON_STATE_CHANGED) @@ -301,11 +312,13 @@ void MultiplayerGameScreen::updateVisibl { gameStartWaitingText->visible=isActivated(); startButton->visible=false; + otherOptions->visible=false; } else { gameStartWaitingText->visible=false; startButton->visible=isActivated(); + otherOptions->visible=isActivated(); } if(game->isGameReadyToStart()) @@ -313,17 +326,27 @@ void MultiplayerGameScreen::updateVisibl if(game->getGameJoinCreationState() == MultiplayerGame::HostingGame) { if(game->isGameStarting()) + { startButton->visible=false; + otherOptions->visible=true; + } else + { startButton->visible=isActivated(); + otherOptions->visible=isActivated(); + } } else + { startButton->visible=false; + otherOptions->visible=false; + } notReadyText->visible=false; } else { startButton->visible=false; + otherOptions->visible=false; notReadyText->visible=isActivated(); } if(game->getGameJoinCreationState() == MultiplayerGame::HostingGame || game->getGameJoinCreationState() == MultiplayerGame::JoinedGame) diff -r 1e6581deb6e9 -r b0c1fbde3b23 src/MultiplayerGameScreen.h --- a/src/MultiplayerGameScreen.h Tue Apr 15 19:29:17 2008 -0400 +++ b/src/MultiplayerGameScreen.h Tue Apr 15 21:59:51 2008 -0400 @@ -66,10 +66,12 @@ private: { START = 1, CANCEL = 2, - STARTED=11, + STARTED=3, + OTHEROPTIONS=4, COLOR_BUTTONS=32, CLOSE_BUTTONS=64, + ADD_AI = 100 }; @@ -96,6 +98,7 @@ private: Text *text[MAX_NUMBER_OF_PLAYERS]; TextButton *kickButton[MAX_NUMBER_OF_PLAYERS]; Text *percentDownloaded; + TextButton *otherOptions; TextInput *textInput; TextArea *chatWindow; diff -r 1e6581deb6e9 -r b0c1fbde3b23 src/SConscript --- a/src/SConscript Tue Apr 15 19:29:17 2008 -0400 +++ b/src/SConscript Tue Apr 15 21:59:51 2008 -0400 @@ -1,42 +1,44 @@ source_files = Split(""" source_files = Split(""" -AICastor.cpp AI.cpp AIEcho.cpp AINames.cpp -AINicowar.cpp AINull.cpp AINumbi.cpp AIToubib.cpp -AIWarrush.cpp BasePlayer.cpp BaseTeam.cpp BitArray.cpp -Brush.cpp Building.cpp BuildingsTypes.cpp BuildingType.cpp -Bullet.cpp Campaign.cpp CampaignEditor.cpp CampaignMainMenu.cpp -CampaignMenuScreen.cpp CampaignScreen.cpp CampaignSelectorScreen.cpp ChooseMapScreen.cpp -CPUStatisticsManager.cpp CreditScreen.cpp CustomGameScreen.cpp DynamicClouds.cpp -EditorMainMenu.cpp EndGameScreen.cpp Engine.cpp EntityType.cpp -Fatal.cpp FertilityCalculatorDialog.cpp FertilityCalculatorThread.cpp FertilityCalculatorThreadMessage.cpp -Game.cpp GameEvent.cpp GameGUI.cpp GameGUIDefaultAssignManager.cpp -GameGUIDialog.cpp GameGUIGhostBuildingManager.cpp GameGUIKeyActions.cpp GameGUILoadSave.cpp -GameGUIMessageManager.cpp GameGUIToolManager.cpp GameHeader.cpp GameUtilities.cpp -Glob2.cpp Glob2Screen.cpp Glob2Style.cpp GlobalContainer.cpp -GUIGlob2FileList.cpp GUIMapPreview.cpp HeightMapGenerator.cpp IntBuildingType.cpp -IRC.cpp IRCTextMessageHandler.cpp IRCThread.cpp IRCThreadMessage.cpp -KeyboardManager.cpp LANFindScreen.cpp LANGameInformation.cpp LANMenuScreen.cpp -LogFileManager.cpp MainMenuScreen.cpp MapAssembler.cpp Map.cpp -MapEdit.cpp MapEditKeyActions.cpp MapGenerationDescriptor.cpp MapGenerator.cpp -MapHeader.cpp MarkManager.cpp Minimap.cpp MultiplayerGame.cpp -MultiplayerGameEvent.cpp MultiplayerGameEventListener.cpp MultiplayerGameScreen.cpp NetBroadcaster.cpp -NetBroadcastListener.cpp NetConnection.cpp NetConnectionThread.cpp NetConnectionThreadMessage.cpp -NetEngine.cpp NetGamePlayerManager.cpp NetListener.cpp NetMessage.cpp -NetReteamingInformation.cpp NetTestSuite.cpp NewMapScreen.cpp Order.cpp -OverlayAreas.cpp P2PConnection.cpp P2PConnectionEvent.cpp P2PConnectionListener.cpp -P2PInformation.cpp P2PManager.cpp P2PPlayerInformation.cpp PerlinNoise.cpp -Player.cpp Race.cpp Ressource.cpp RessourcesTypes.cpp -ScriptEditorScreen.cpp Sector.cpp Settings.cpp SettingsScreen.cpp -SGSL.cpp SimplexNoise.cpp SoundMixer.cpp Team.cpp -TeamStat.cpp UnitConsts.cpp Unit.cpp UnitEditorScreen.cpp -UnitSkin.cpp UnitsSkins.cpp UnitType.cpp Utilities.cpp -VoiceRecorder.cpp YOGClientChatChannel.cpp YOGClientChatListener.cpp YOGClient.cpp -YOGClientEvent.cpp YOGClientEventListener.cpp YOGClientGameListListener.cpp YOGClientGameListManager.cpp -YOGClientLobbyScreen.cpp YOGClientPlayerListListener.cpp YOGClientPlayerListManager.cpp YOGConsts.cpp - YOGGameInfo.cpp YOGGameResults.cpp YOGLoginScreen.cpp -YOGMessage.cpp YOGPlayerSessionInfo.cpp YOGPlayerStoredInfo.cpp YOGServerAdministratorCommands.cpp -YOGServerAdministrator.cpp YOGServerAdministratorList.cpp YOGServerBannedIPListManager.cpp YOGServerChatChannel.cpp -YOGServerChatChannelManager.cpp YOGServer.cpp YOGServerGame.cpp YOGServerGameLog.cpp -YOGServerMapDistributor.cpp YOGServerPasswordRegistry.cpp YOGServerPlayer.cpp YOGServerPlayerStoredInfoManager.cpp +AICastor.cpp AI.cpp AIEcho.cpp AINames.cpp +AINicowar.cpp AINull.cpp AINumbi.cpp AIToubib.cpp +AIWarrush.cpp BasePlayer.cpp BaseTeam.cpp BitArray.cpp +Brush.cpp Building.cpp BuildingsTypes.cpp BuildingType.cpp +Bullet.cpp Campaign.cpp CampaignEditor.cpp CampaignMainMenu.cpp +CampaignMenuScreen.cpp CampaignScreen.cpp CampaignSelectorScreen.cpp ChooseMapScreen.cpp +CPUStatisticsManager.cpp CreditScreen.cpp CustomGameOtherOptions.cpp CustomGameScreen.cpp +DynamicClouds.cpp EditorMainMenu.cpp EndGameScreen.cpp Engine.cpp +EntityType.cpp Fatal.cpp FertilityCalculatorDialog.cpp FertilityCalculatorThread.cpp +FertilityCalculatorThreadMessage.cpp Game.cpp GameEvent.cpp GameGUI.cpp +GameGUIDefaultAssignManager.cpp GameGUIDialog.cpp GameGUIGhostBuildingManager.cpp GameGUIKeyActions.cpp +GameGUILoadSave.cpp GameGUIMessageManager.cpp GameGUIToolManager.cpp GameHeader.cpp +GameUtilities.cpp Glob2.cpp Glob2Screen.cpp Glob2Style.cpp +GlobalContainer.cpp GUIGlob2FileList.cpp GUIMapPreview.cpp HeightMapGenerator.cpp +IntBuildingType.cpp IRC.cpp IRCTextMessageHandler.cpp IRCThread.cpp +IRCThreadMessage.cpp KeyboardManager.cpp LANFindScreen.cpp LANGameInformation.cpp +LANMenuScreen.cpp LogFileManager.cpp MainMenuScreen.cpp MapAssembler.cpp +Map.cpp MapEdit.cpp MapEditKeyActions.cpp MapGenerationDescriptor.cpp +MapGenerator.cpp MapHeader.cpp MarkManager.cpp Minimap.cpp +MultiplayerGame.cpp MultiplayerGameEvent.cpp MultiplayerGameEventListener.cpp MultiplayerGameScreen.cpp +NetBroadcaster.cpp NetBroadcastListener.cpp NetConnection.cpp NetConnectionThread.cpp +NetConnectionThreadMessage.cpp NetEngine.cpp NetGamePlayerManager.cpp NetListener.cpp +NetMessage.cpp NetReteamingInformation.cpp NetTestSuite.cpp NewMapScreen.cpp +Order.cpp OverlayAreas.cpp P2PConnection.cpp P2PConnectionEvent.cpp +P2PConnectionListener.cpp P2PInformation.cpp P2PManager.cpp P2PPlayerInformation.cpp +PerlinNoise.cpp Player.cpp Race.cpp Ressource.cpp +RessourcesTypes.cpp ScriptEditorScreen.cpp Sector.cpp Settings.cpp +SettingsScreen.cpp SGSL.cpp SimplexNoise.cpp SoundMixer.cpp +Team.cpp TeamStat.cpp UnitConsts.cpp Unit.cpp +UnitEditorScreen.cpp UnitSkin.cpp UnitsSkins.cpp UnitType.cpp +Utilities.cpp VoiceRecorder.cpp YOGClientChatChannel.cpp YOGClientChatListener.cpp +YOGClient.cpp YOGClientEvent.cpp YOGClientEventListener.cpp YOGClientGameListListener.cpp +YOGClientGameListManager.cpp YOGClientLobbyScreen.cpp YOGClientPlayerListListener.cpp YOGClientPlayerListManager.cpp +YOGConsts.cpp YOGGameInfo.cpp YOGGameResults.cpp +YOGLoginScreen.cpp YOGMessage.cpp YOGPlayerSessionInfo.cpp YOGPlayerStoredInfo.cpp +YOGServerAdministratorCommands.cpp YOGServerAdministrator.cpp YOGServerAdministratorList.cpp YOGServerBannedIPListManager.cpp +YOGServerChatChannel.cpp YOGServerChatChannelManager.cpp YOGServer.cpp YOGServerGame.cpp +YOGServerGameLog.cpp YOGServerMapDistributor.cpp YOGServerPasswordRegistry.cpp YOGServerPlayer.cpp +YOGServerPlayerStoredInfoManager.cpp + """) server_source_files = Split(""" diff -r 1e6581deb6e9 -r b0c1fbde3b23 src/Version.h --- a/src/Version.h Tue Apr 15 19:29:17 2008 -0400 +++ b/src/Version.h Tue Apr 15 21:59:51 2008 -0400 @@ -23,7 +23,7 @@ // This is the version of map and savegame format. #define VERSION_MAJOR 0 #define MINIMUM_VERSION_MINOR 58 -#define VERSION_MINOR 70 +#define VERSION_MINOR 71 // version 10 adds script saved in game // version 11 the gamesfiles do saves which building has been seen under fog of war. // version 12 saves map name into SessionGame instead of BaseMap. @@ -84,7 +84,8 @@ // version 67 added checksum to map header // version 68 changed checksum in map header to md5 // version 69 started saving GameGUIDefaultAssignManager -// version 69 added maxUnitWorkingFuture to be saved in Building +// version 70 added maxUnitWorkingFuture to be saved in Building +// version 71 added pre-game alliances in the form of ally-team numbers in GameHeader //This must be updated when there are changes to YOG, MapHeader, GameHeader, BasePlayer, BaseTeam, //NetMessage, and the likes, in parrallel to change of the VERSION_MINOR above # HG changeset patch # User Bradley Arsenault # Date 1208311307 14400 # Node ID 95996ac0a918ee0fe5fe31c8069709e9863bac6f # Parent b0c1fbde3b231b1a4cdaa12d8b7efad45b5b70a9 Performed check_translations.py diff -r b0c1fbde3b23 -r 95996ac0a918 data/texts.ar.txt --- a/data/texts.ar.txt Tue Apr 15 21:59:51 2008 -0400 +++ b/data/texts.ar.txt Tue Apr 15 22:01:47 2008 -0400 @@ -584,6 +584,8 @@ Open Save Menu خيارات [Orange] البرتقال +[Other Options] + [page down] [page up] @@ -846,6 +848,8 @@ Switch to Terrain view [tab] +[Teams Fixed] + [teams] فريق [the barracks is finished] diff -r b0c1fbde3b23 -r 95996ac0a918 data/texts.br.txt --- a/data/texts.br.txt Tue Apr 15 21:59:51 2008 -0400 +++ b/data/texts.br.txt Tue Apr 15 22:01:47 2008 -0400 @@ -586,6 +586,8 @@ Opções Opções [Orange] Laranja +[Other Options] + [page down] page down [page up] @@ -848,6 +850,8 @@ sys req sys req [tab] tab +[Teams Fixed] + [teams] times [the barracks is finished] diff -r b0c1fbde3b23 -r 95996ac0a918 data/texts.ca.txt --- a/data/texts.ca.txt Tue Apr 15 21:59:51 2008 -0400 +++ b/data/texts.ca.txt Tue Apr 15 22:01:47 2008 -0400 @@ -584,6 +584,8 @@ Opcions Opcions [Orange] Taronja +[Other Options] + [page down] [page up] @@ -846,6 +848,8 @@ Piscina [tab] +[Teams Fixed] + [teams] Equips [the barracks is finished] diff -r b0c1fbde3b23 -r 95996ac0a918 data/texts.cz.txt --- a/data/texts.cz.txt Tue Apr 15 21:59:51 2008 -0400 +++ b/data/texts.cz.txt Tue Apr 15 22:01:47 2008 -0400 @@ -584,6 +584,8 @@ Nastavení Nastavení [Orange] Pomarenče +[Other Options] + [page down] [page up] @@ -846,6 +848,8 @@ KoupaliÅ¡tě [tab] +[Teams Fixed] + [teams] hráčů [the barracks is finished] diff -r b0c1fbde3b23 -r 95996ac0a918 data/texts.de.txt --- a/data/texts.de.txt Tue Apr 15 21:59:51 2008 -0400 +++ b/data/texts.de.txt Tue Apr 15 22:01:47 2008 -0400 @@ -576,6 +576,8 @@ Einstellungen Einstellungen [Orange] Orangen +[Other Options] + [page down] [page up] @@ -838,6 +840,8 @@ Schwimmbecken [tab] +[Teams Fixed] + [teams] Mannschaften [the barracks is finished] diff -r b0c1fbde3b23 -r 95996ac0a918 data/texts.dk.txt --- a/data/texts.dk.txt Tue Apr 15 21:59:51 2008 -0400 +++ b/data/texts.dk.txt Tue Apr 15 22:01:47 2008 -0400 @@ -584,6 +584,8 @@ Indstillinger Indstillinger [Orange] Appelsin +[Other Options] + [page down] [page up] @@ -846,6 +848,8 @@ Skift til terring visning [tab] +[Teams Fixed] + [teams] hold [the barracks is finished] diff -r b0c1fbde3b23 -r 95996ac0a918 data/texts.en.txt --- a/data/texts.en.txt Tue Apr 15 21:59:51 2008 -0400 +++ b/data/texts.en.txt Tue Apr 15 22:01:47 2008 -0400 @@ -554,10 +554,6 @@ there are there are [ok] Ok -[Other Options] -Other Options -[Teams Fixed] -Teams Fixed [old islands terrain] old random islands [old random terrain] @@ -582,6 +578,8 @@ Options Options [Orange] Orange +[Other Options] +Other Options [page down] page down [page up] @@ -844,6 +842,8 @@ sys req sys req [tab] tab +[Teams Fixed] +Teams Fixed [teams] teams [the barracks is finished] diff -r b0c1fbde3b23 -r 95996ac0a918 data/texts.es.txt --- a/data/texts.es.txt Tue Apr 15 21:59:51 2008 -0400 +++ b/data/texts.es.txt Tue Apr 15 22:01:47 2008 -0400 @@ -584,6 +584,8 @@ Opciones Opciones [Orange] Naranja +[Other Options] + [page down] [page up] @@ -846,6 +848,8 @@ Alberca de natación [tab] +[Teams Fixed] + [teams] Equipos [the barracks is finished] diff -r b0c1fbde3b23 -r 95996ac0a918 data/texts.eu.txt --- a/data/texts.eu.txt Tue Apr 15 21:59:51 2008 -0400 +++ b/data/texts.eu.txt Tue Apr 15 22:01:47 2008 -0400 @@ -584,6 +584,8 @@ Aukerak Aukerak [Orange] Laranja +[Other Options] + [page down] [page up] @@ -846,6 +848,8 @@ Lurzoru ikuspegira aldatu [tab] +[Teams Fixed] + [teams] talde [the barracks is finished] diff -r b0c1fbde3b23 -r 95996ac0a918 data/texts.fr.txt --- a/data/texts.fr.txt Tue Apr 15 21:59:51 2008 -0400 +++ b/data/texts.fr.txt Tue Apr 15 22:01:47 2008 -0400 @@ -584,6 +584,8 @@ Options Options [Orange] Orange +[Other Options] + [page down] Page suivante [page up] @@ -846,6 +848,8 @@ Sys Req Sys Req [tab] Tab +[Teams Fixed] + [teams] équipes [the barracks is finished] diff -r b0c1fbde3b23 -r 95996ac0a918 data/texts.gr.txt --- a/data/texts.gr.txt Tue Apr 15 21:59:51 2008 -0400 +++ b/data/texts.gr.txt Tue Apr 15 22:01:47 2008 -0400 @@ -586,6 +586,8 @@ Ok Επιλογές [Orange] Πορτοκαλι +[Other Options] + [page down] page down [page up] @@ -848,6 +850,8 @@ sys req sys req [tab] tab +[Teams Fixed] + [teams] ομάδες [the barracks is finished] diff -r b0c1fbde3b23 -r 95996ac0a918 data/texts.hu.txt --- a/data/texts.hu.txt Tue Apr 15 21:59:51 2008 -0400 +++ b/data/texts.hu.txt Tue Apr 15 22:01:47 2008 -0400 @@ -584,6 +584,8 @@ Opciók Opciók [Orange] Narancs +[Other Options] + [page down] [page up] @@ -846,6 +848,8 @@ fejlesztése [tab] +[Teams Fixed] + [teams] csapatok [the barracks is finished] diff -r b0c1fbde3b23 -r 95996ac0a918 data/texts.it.txt --- a/data/texts.it.txt Tue Apr 15 21:59:51 2008 -0400 +++ b/data/texts.it.txt Tue Apr 15 22:01:47 2008 -0400 @@ -576,6 +576,8 @@ Opzioni Opzioni [Orange] Arance +[Other Options] + [page down] PAG giù [page up] @@ -838,6 +840,8 @@ requisiti sistema requisiti sistema [tab] TAB +[Teams Fixed] + [teams] squadre [the barracks is finished] diff -r b0c1fbde3b23 -r 95996ac0a918 data/texts.keys.txt --- a/data/texts.keys.txt Tue Apr 15 21:59:51 2008 -0400 +++ b/data/texts.keys.txt Tue Apr 15 22:01:47 2008 -0400 @@ -288,6 +288,7 @@ [open] [options] [Orange] +[Other Options] [page down] [page up] [Papyrus] @@ -419,6 +420,7 @@ [switch to terrain view] [sys req] [tab] +[Teams Fixed] [teams] [the barracks is finished] [the barracks is under attack] @@ -508,9 +510,7 @@ [workers] [working] [wounded] -[Other Options] [Yes] -[Teams Fixed] [YESTS_CONNECTING] [YESTS_CONNECTION_LOST] [YESTS_CONNECTION_REFUSED_ALREADY_PASSWORD] diff -r b0c1fbde3b23 -r 95996ac0a918 data/texts.nl.txt --- a/data/texts.nl.txt Tue Apr 15 21:59:51 2008 -0400 +++ b/data/texts.nl.txt Tue Apr 15 22:01:47 2008 -0400 @@ -584,6 +584,8 @@ Opties Opties [Orange] Sinaasappelen +[Other Options] + [page down] [page up] @@ -846,6 +848,8 @@ Schakel naar terrein scherm [tab] +[Teams Fixed] + [teams] teams [the barracks is finished] diff -r b0c1fbde3b23 -r 95996ac0a918 data/texts.pl.txt --- a/data/texts.pl.txt Tue Apr 15 21:59:51 2008 -0400 +++ b/data/texts.pl.txt Tue Apr 15 22:01:47 2008 -0400 @@ -584,6 +584,8 @@ Opcje Opcje [Orange] Pomarańcze +[Other Options] + [page down] [page up] @@ -846,6 +848,8 @@ Pływalnia [tab] +[Teams Fixed] + [teams] zespoły [the barracks is finished] diff -r b0c1fbde3b23 -r 95996ac0a918 data/texts.pt.txt --- a/data/texts.pt.txt Tue Apr 15 21:59:51 2008 -0400 +++ b/data/texts.pt.txt Tue Apr 15 22:01:47 2008 -0400 @@ -584,6 +584,8 @@ Opções Opções [Orange] Laranja +[Other Options] + [page down] [page up] @@ -846,6 +848,8 @@ Piscina [tab] +[Teams Fixed] + [teams] times [the barracks is finished] diff -r b0c1fbde3b23 -r 95996ac0a918 data/texts.ro.txt --- a/data/texts.ro.txt Tue Apr 15 21:59:51 2008 -0400 +++ b/data/texts.ro.txt Tue Apr 15 22:01:47 2008 -0400 @@ -584,6 +584,8 @@ OpÅ£iuni OpÅ£iuni [Orange] Portocală +[Other Options] + [page down] [page up] @@ -846,6 +848,8 @@ Piscină [tab] +[Teams Fixed] + [teams] echipe [the barracks is finished] diff -r b0c1fbde3b23 -r 95996ac0a918 data/texts.ru.txt --- a/data/texts.ru.txt Tue Apr 15 21:59:51 2008 -0400 +++ b/data/texts.ru.txt Tue Apr 15 22:01:47 2008 -0400 @@ -580,6 +580,8 @@ Ok Настройки [Orange] Апельсины +[Other Options] + [page down] page down [page up] @@ -842,6 +844,8 @@ sys req sys req [tab] tab +[Teams Fixed] + [teams] команды [the barracks is finished] diff -r b0c1fbde3b23 -r 95996ac0a918 data/texts.si.txt --- a/data/texts.si.txt Tue Apr 15 21:59:51 2008 -0400 +++ b/data/texts.si.txt Tue Apr 15 22:01:47 2008 -0400 @@ -584,6 +584,8 @@ Možnosti Možnosti [Orange] Pomaranča +[Other Options] + [page down] [page up] @@ -846,6 +848,8 @@ Bazen [tab] +[Teams Fixed] + [teams] ekipe [the barracks is finished] diff -r b0c1fbde3b23 -r 95996ac0a918 data/texts.sk.txt --- a/data/texts.sk.txt Tue Apr 15 21:59:51 2008 -0400 +++ b/data/texts.sk.txt Tue Apr 15 22:01:47 2008 -0400 @@ -584,6 +584,8 @@ Nastavenia Nastavenia [Orange] Pomaranč +[Other Options] + [page down] [page up] @@ -846,6 +848,8 @@ Bazén [tab] +[Teams Fixed] + [teams] tímy [the barracks is finished] diff -r b0c1fbde3b23 -r 95996ac0a918 data/texts.sr.txt --- a/data/texts.sr.txt Tue Apr 15 21:59:51 2008 -0400 +++ b/data/texts.sr.txt Tue Apr 15 22:01:47 2008 -0400 @@ -584,6 +584,8 @@ We are very sorry but the name you chose Избори [Orange] Наранџе +[Other Options] + [page down] [page up] @@ -846,6 +848,8 @@ We are very sorry but the name you chose [tab] +[Teams Fixed] + [teams] екипа [the barracks is finished] diff -r b0c1fbde3b23 -r 95996ac0a918 data/texts.sv.txt --- a/data/texts.sv.txt Tue Apr 15 21:59:51 2008 -0400 +++ b/data/texts.sv.txt Tue Apr 15 22:01:47 2008 -0400 @@ -584,6 +584,8 @@ Alternativ Alternativ [Orange] Apelsin +[Other Options] + [page down] [page up] @@ -846,6 +848,8 @@ Byt till Terrängvy [tab] +[Teams Fixed] + [teams] lag [the barracks is finished] diff -r b0c1fbde3b23 -r 95996ac0a918 data/texts.tr.txt --- a/data/texts.tr.txt Tue Apr 15 21:59:51 2008 -0400 +++ b/data/texts.tr.txt Tue Apr 15 22:01:47 2008 -0400 @@ -584,6 +584,8 @@ Secenekler Secenekler [Orange] Portakal +[Other Options] + [page down] [page up] @@ -846,6 +848,8 @@ Yuzme havuzu [tab] +[Teams Fixed] + [teams] takimlar [the barracks is finished] diff -r b0c1fbde3b23 -r 95996ac0a918 data/texts.zh-tw.txt --- a/data/texts.zh-tw.txt Tue Apr 15 21:59:51 2008 -0400 +++ b/data/texts.zh-tw.txt Tue Apr 15 22:01:47 2008 -0400 @@ -584,6 +584,8 @@ Air dmg. 選項 [Orange] 柳橙 +[Other Options] + [page down] [page up] @@ -846,6 +848,8 @@ V: 持鍵以傳送訊息 [tab] +[Teams Fixed] + [teams] 團隊 [the barracks is finished] # HG changeset patch # User Bradley Arsenault # Date 1208312360 14400 # Node ID 3b48041ef5b17ec7bf50857ad96dacbe81640356 # Parent 95996ac0a918ee0fe5fe31c8069709e9863bac6f Fixed small bugs with arranged game broadcast. Reverted to-connect server back to connect to actual yog. diff -r 95996ac0a918 -r 3b48041ef5b1 src/YOGConsts.cpp --- a/src/YOGConsts.cpp Tue Apr 15 22:01:47 2008 -0400 +++ b/src/YOGConsts.cpp Tue Apr 15 22:19:20 2008 -0400 @@ -20,6 +20,6 @@ #include "YOGConsts.h" const Uint16 YOG_SERVER_PORT = 7488; -//const std::string YOG_SERVER_IP = "yog.globulation2.org"; -const std::string YOG_SERVER_IP = "127.0.0.1"; +const std::string YOG_SERVER_IP = "yog.globulation2.org"; +//const std::string YOG_SERVER_IP = "127.0.0.1"; diff -r 95996ac0a918 -r 3b48041ef5b1 src/YOGServer.cpp --- a/src/YOGServer.cpp Tue Apr 15 22:01:47 2008 -0400 +++ b/src/YOGServer.cpp Tue Apr 15 22:19:20 2008 -0400 @@ -116,9 +116,9 @@ void YOGServer::update() { if(t > organizedGameBroadcastTime) { - organizedGameBroadcastTime = t + 30000; + organizedGameBroadcastTime = t + 60000; boost::posix_time::time_duration organized_game_time = boost::posix_time::second_clock::local_time().time_of_day(); - organized_game_time = boost::posix_time::seconds(organized_game_time.total_seconds() % 7200); + organized_game_time = boost::posix_time::seconds(7200 - organized_game_time.total_seconds() % 7200); std::stringstream s; s << "An organized game will occur in "<(organized_game_time.hours())<<" hours and "<(organized_game_time.minutes())<<" minutes. There may be more players on! Feel free to join!"; boost::shared_ptr m(new YOGMessage(s.str(), "server", YOGAdministratorMessage)); # HG changeset patch # User Bradley Arsenault # Date 1208392657 14400 # Node ID 99a131c336268dfa68fb7ec8444acb408eb372a4 # Parent 3b48041ef5b17ec7bf50857ad96dacbe81640356 Changed the mute command so that variable time for mute can be chosen diff -r 3b48041ef5b1 -r 99a131c33626 src/YOGConsts.cpp --- a/src/YOGConsts.cpp Tue Apr 15 22:19:20 2008 -0400 +++ b/src/YOGConsts.cpp Wed Apr 16 20:37:37 2008 -0400 @@ -20,6 +20,6 @@ #include "YOGConsts.h" const Uint16 YOG_SERVER_PORT = 7488; -const std::string YOG_SERVER_IP = "yog.globulation2.org"; -//const std::string YOG_SERVER_IP = "127.0.0.1"; +//const std::string YOG_SERVER_IP = "yog.globulation2.org"; +const std::string YOG_SERVER_IP = "127.0.0.1"; diff -r 3b48041ef5b1 -r 99a131c33626 src/YOGServerAdministratorCommands.cpp --- a/src/YOGServerAdministratorCommands.cpp Tue Apr 15 22:19:20 2008 -0400 +++ b/src/YOGServerAdministratorCommands.cpp Wed Apr 16 20:37:37 2008 -0400 @@ -21,6 +21,7 @@ #include "YOGServer.h" #include "NetMessage.h" #include "YOGServerPlayer.h" +#include "boost/lexical_cast.hpp" std::string YOGServerRestart::getHelpMessage() { @@ -61,7 +62,7 @@ void YOGServerRestart::execute(YOGServer std::string YOGMutePlayer::getHelpMessage() { - return ".mute_player Mutes a player for 10 minutes"; + return ".mute_player