# 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