Commit cae09cca authored by progs's avatar progs

* Corrections un peu partout. Normalement y a plus de plantages.


git-svn-id: svn://svn.gna.org/svn/menareants/trunk@211 6832cf7c-ce15-0410-9f4e-c008ec2580bf
parent 70af5e0c
2006-02-12 Romain Bignon <progs@headfucking.net>
* Corrections un peu partout. Normalement y a plus de plantages.
2006-02-08 Romain Bignon <progs@headfucking.net>
* lib/Outils.h (MyFree): Macro qui utilise delete sur un pointeur et qui l'assigne à 0.
* Utilisation de Doxygen.
2006-01-15 Romain Bignon <progs@headfucking.net>
......
......@@ -6,4 +6,7 @@ AUTOMAKE_OPTIONS = foreign
doxygen:
@cd src && /usr/bin/doxygen && cd ../server && /usr/bin/doxygen && cd ../lib && /usr/bin/doxygen && cd ..
@echo "Created code documentation in `pwd`/doc"
\ No newline at end of file
@echo "Created code documentation in `pwd`/doc"
clean-generic:
-rm -f .#* *~
\ No newline at end of file
......@@ -521,8 +521,6 @@ install-strip:
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
......@@ -599,6 +597,9 @@ uninstall-info: uninstall-info-recursive
doxygen:
@cd src && /usr/bin/doxygen && cd ../server && /usr/bin/doxygen && cd ../lib && /usr/bin/doxygen && cd ..
@echo "Created code documentation in `pwd`/doc"
clean-generic:
-rm -f .#* *~
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:
......@@ -3,10 +3,7 @@ Note: Lire le fichier DEVELOPPEURS pour participer
À faire:
* En cours
-client: TROUVER LA PAIRE DE BUG :
> Lorsqu'on join une partie déjà créée, et que le joueur en face part et rejoin, si on touche au spinedit ça crash.
> Lorsqu'on créé une partie, dès qu'un mec join puis part ça crash.
-client: Utiliser une fonction pour redimentionner le Memo dans GameInfosForm quand on ajoute/del un player (voir papier).
-client: Valeurs interdites dans le TSpinEdit (places prises).
-client: Avancer dans les paramètres de la partie.
* Urgent
......
<html>
<head>
<title>Documentation of Europa Conquest</title>
</head>
<body>
<h1>Doxygen documentation</h1>
<ul>
<li><a href="lib/index.html">Library</a>
<li><a href="game/index.html">Game</a>
<li><a href="server/index.html">Server</a>
</ul>
</body>
</html>
......@@ -21,9 +21,10 @@
#include "Channels.h"
#include "Outils.h"
#include "Debug.h"
/********************************************************************************************
* ECBPlayer *
* ECBPlayer *
********************************************************************************************/
ECBPlayer::ECBPlayer(ECBChannel *_chan, bool _owner)
......@@ -68,12 +69,14 @@ bool ECBChannel::AddPlayer(ECBPlayer* pl)
bool ECBChannel::RemovePlayer(ECBPlayer* pl, bool use_delete)
{
for (PlayerIterator it = players.begin(); it != players.end(); )
for (BPlayerVector::iterator it = players.begin(); it != players.end(); )
{
//printf("ss - %p (%s) vs %p\n", *it, (*it)->GetNick(), pl);
printf("ss - %p s %p\n", *it, pl);
if (*it == pl)
{
if(use_delete)
delete pl;
delete pl;
it = players.erase(it);
return true;
}
......@@ -83,6 +86,7 @@ bool ECBChannel::RemovePlayer(ECBPlayer* pl, bool use_delete)
return false;
}
/** \attention Lors de rajouts de modes, modifier API paragraphe 4. Modes */
const char* ECBChannel::ModesStr() const
{
......@@ -106,8 +110,7 @@ const char* ECBChannel::ModesStr() const
const char* ECBChannel::PlayerList()
{
std::string list = "";
#if 1
for(PlayerIterator it=players.begin(); it != players.end(); it++)
for(BPlayerVector::iterator it=players.begin(); it != players.end(); it++)
{
if(!list.empty()) list += " ";
if((*it)->IsOwner())
......@@ -120,20 +123,5 @@ const char* ECBChannel::PlayerList()
list += (*it)->GetNick();
}
#else
for(uint i=0; i<players.size();i++)
{
if(!list.empty()) list += " ";
if(players[i]->IsOwner())
list += "@";
if(players[i]->Ready())
list += "!";
/* Informe de la place et de la couleur */
list += TypToStr(players[i]->Place()) + "," + TypToStr(players[i]->Color()) + ",";
list += players[i]->GetNick();
}
#endif
return list.c_str();
}
......@@ -26,7 +26,7 @@
#include <vector>
/********************************************************************************************
* ECBPlayer *
* ECBPlayer *
********************************************************************************************/
class ECBChannel;
......@@ -34,7 +34,7 @@ class ECBChannel;
class ECBMap;
/** Base class of Player/
* There if informations about a player whose are used by server and client.
* There are informations about a player whose are used by server and client.
*
* \attention This is a \a virtual class !
*/
......@@ -87,7 +87,7 @@ public:
/** Is player ready ? */
bool Ready() const { return ready; }
/** Set player. */
void SetReady(bool r = true) { ready = r; }
......@@ -99,12 +99,10 @@ protected:
unsigned int color;
bool ready;
};
typedef std::vector<ECBPlayer*> PlayerVector;
typedef PlayerVector::iterator PlayerIterator;
typedef std::vector<ECBPlayer*> BPlayerVector;
/********************************************************************************************
* ECBChannel *
* ECBChannel *
********************************************************************************************/
/** Base class of a Channel.
......@@ -118,7 +116,7 @@ public:
/** @param _name name of channel */
ECBChannel(std::string _name);
~ECBChannel() {}
virtual ~ECBChannel() {}
/** Define state of game */
enum e_state {
......@@ -137,8 +135,24 @@ public:
/** Return channel name. */
const char* GetName() const { return name.c_str(); }
/* A propos des etats de la partie */
e_state State() const { return state; } /**< Return state of game. */
bool IsInGame() const { return (state >= PLAYING); } /**< Check if channel is in game. */
bool Joinable() const { return (state == WAITING); } /**< Check if channel is joinable. */
void SetState(e_state s) { state = s; } /**< Define state. */
/* Limite maximale pour entrer dans le chan */
unsigned int GetLimite() const { return limite; } /**< Return user limit of channel. */
void SetLimite(unsigned int l) { limite = l; } /**< Define user limit of channel. */
/** Return MAP \attention ECBMap n'existe pas encore ! */
ECBMap *Map() const { return map; }
/** Define the map \attention ECBMap n'existe pas encore ! */
void SetMap(ECBMap *m) { map = m; }
/** Return player list in the channel. */
PlayerVector Players() const { return players; }
BPlayerVector Players() const { return players; }
/** Add a player. */
bool AddPlayer(ECBPlayer*);
......@@ -170,30 +184,13 @@ public:
*/
const char* ModesStr() const;
/* A propos des etats de la partie */
e_state State() const { return state; } /**< Return state of game. */
bool IsInGame() const { return (state >= PLAYING); } /**< Check if channel is in game. */
bool Joinable() const { return (state == WAITING); } /**< Check if channel is joinable. */
void SetState(e_state s) { state = s; } /**< Define state. */
/* Limite maximale pour entrer dans le chan */
unsigned int GetLimite() const { return limite; } /**< Return user limit of channel. */
void SetLimite(unsigned int l) { limite = l; } /**< Define user limit of channel. */
/** Return MAP \attention ECBMap n'existe pas encore ! */
ECBMap *Map() const { return map; }
/** Define the map \attention ECBMap n'existe pas encore ! */
void SetMap(ECBMap *m) { map = m; }
/* Variables privées */
protected:
BPlayerVector players;
std::string name;
PlayerVector players;
e_state state;
unsigned int limite;
ECBMap *map;
};
#endif /* ECLIB_CHANNELS_H */
noinst_LIBRARIES=libeuroconq.a
libeuroconq_a_SOURCES=Outils.cpp Channels.cpp Debug.cpp
clean-generic:
-rm -f .#* *~
\ No newline at end of file
......@@ -328,8 +328,6 @@ install-strip:
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
......@@ -396,6 +394,9 @@ uninstall-am: uninstall-info-am
mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \
uninstall-am uninstall-info-am
clean-generic:
-rm -f .#* *~
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:
/* src/Outils.h- Header of Outils.cpp
*
* Copyright (C) 2005 Romain Bignon <Progs@headfucking.net>
* Copyright (C) 2005-2006 Romain Bignon <Progs@headfucking.net>
*
* 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
......@@ -62,4 +62,14 @@ std::string TypToStr( const T & Value )
return oss.str();
}
/** Free and set pointer to 0 */
#define MyFree(p) do { delete (p); (p) = 0; } while(0)
/*
inline void MyFree(void *p)
{
delete &p;
p = 0;
}
*/
#endif
......@@ -27,7 +27,7 @@
#include "Main.h"
#include <cstdarg>
std::vector<EChannel*> ChanList;
ChannelVector ChanList;
/********************************************************************************************
* Commandes *
......@@ -134,7 +134,7 @@ int SETCommand::Exec(TClient *cl, std::vector<std::string> parv)
uint color = StrToTyp<uint>(parv[j++]);
if(color > 0)
{
PlayerIterator it;
BPlayerVector::iterator it;
for(it = sender->Channel()->Players().begin();
it != sender->Channel()->Players().end() && (*it)->Color() != color;
it++);
......@@ -164,7 +164,7 @@ int SETCommand::Exec(TClient *cl, std::vector<std::string> parv)
sender->Channel()->GetLimite());
break;
}
PlayerIterator it;
BPlayerVector::iterator it;
for(it = sender->Channel()->Players().begin();
it != sender->Channel()->Players().end() && (*it)->Place() != place;
it++);
......@@ -232,7 +232,7 @@ int JOICommand::Exec(TClient *cl, std::vector<std::string> parv)
EChannel* chan = NULL;
ECPlayer* pl;
for(ChannelIterator it=ChanList.begin(); it != ChanList.end(); it++)
for(ChannelVector::iterator it=ChanList.begin(); it != ChanList.end(); it++)
if(!strcasecmp((*it)->GetName(), nom))
{
chan = *it;
......@@ -251,7 +251,7 @@ int JOICommand::Exec(TClient *cl, std::vector<std::string> parv)
{
vDebug(W_WARNING, "Le client essaye de joindre un salon en jeu", VSName(chan->GetName())
VSName(cl->GetNick()) VIName(chan->State()));
return cl->exit(app.rpl(ECServer::ERR));
return cl->sendrpl(app.rpl(ECServer::CANTJOIN));
}
if(chan->GetLimite() && chan->NbPlayers() >= chan->GetLimite())
return cl->sendrpl(app.rpl(ECServer::CANTJOIN));
......@@ -292,7 +292,7 @@ int LEACommand::Exec(TClient *cl, std::vector<std::string> parv)
*/
int LSPCommand::Exec(TClient *cl, std::vector<std::string> parv)
{
for(ChannelIterator it=ChanList.begin(); it != ChanList.end(); it++)
for(ChannelVector::iterator it=ChanList.begin(); it != ChanList.end(); it++)
if((*it)->Joinable())
cl->sendrpl(app.rpl(ECServer::GLIST), (*it)->GetName(), (*it)->NbPlayers(),
(*it)->GetLimite());
......@@ -327,7 +327,7 @@ EChannel::EChannel(std::string _name)
EChannel::~EChannel()
{
for (ChannelIterator it = ChanList.begin(); it != ChanList.end(); )
for (ChannelVector::iterator it = ChanList.begin(); it != ChanList.end(); )
{
if (*it == this)
{
......@@ -341,14 +341,15 @@ EChannel::~EChannel()
void EChannel::NeedReady()
{
for(PlayerIterator it=players.begin(); it != players.end(); it++)
for(BPlayerVector::iterator it=players.begin(); it != players.end(); it++)
(*it)->SetReady(false);
return;
}
ECPlayer *EChannel::GetPlayer(const char* nick)
{
for(PlayerIterator it=players.begin(); it != players.end(); it++)
for(BPlayerVector::iterator it=players.begin(); it != players.end(); it++)
if((dynamic_cast<ECPlayer*> (*it))->Client() && !strcasecmp((*it)->GetNick(), nick))
return ((ECPlayer*) (*it));
return NULL;
......@@ -356,9 +357,10 @@ ECPlayer *EChannel::GetPlayer(const char* nick)
ECPlayer *EChannel::GetPlayer(TClient *cl)
{
for(PlayerIterator it=players.begin(); it != players.end(); it++)
for(BPlayerVector::iterator it=players.begin(); it != players.end(); it++)
if((dynamic_cast<ECPlayer*> (*it))->Client() == cl)
return ((ECPlayer*) (*it));
return NULL;
}
......@@ -377,7 +379,7 @@ int EChannel::sendto_players(ECPlayer* one, const char* pattern, ...)
buf[len] = 0;
va_end(vl);
for(PlayerIterator it=players.begin(); it != players.end(); it++)
for(BPlayerVector::iterator it=players.begin(); it != players.end(); it++)
{
if(!(dynamic_cast<ECPlayer*> (*it))->Client() || *it == one) continue;
......
......@@ -70,6 +70,7 @@ public:
protected:
TClient *client;
};
typedef std::vector<ECPlayer> PlayerVector;
/********************************************************************************************
* EChannel *
......@@ -109,14 +110,14 @@ public:
/** Get a player structure with his client structure. */
ECPlayer *GetPlayer(TClient *cl);
/* Variables prives */
protected:
};
typedef std::vector<EChannel*>::iterator ChannelIterator;
typedef std::vector<EChannel*> ChannelVector;
extern std::vector<EChannel*> ChanList;
extern ChannelVector ChanList;
#endif /* ECLIB_CHANNELS_H */
#endif /* ECD_CHANNELS_H */
......@@ -15,3 +15,6 @@ euroconqserver_LDADD =$(top_srcdir)/lib/libeuroconq.a
install-data-local:
$(INSTALL_DATA) euroconqd.conf /etc/euroconqd.conf
clean-generic:
-rm -f .#* *~
......@@ -362,8 +362,6 @@ install-strip:
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
......@@ -434,6 +432,9 @@ uninstall-am: uninstall-binPROGRAMS uninstall-info-am
install-data-local:
$(INSTALL_DATA) euroconqd.conf /etc/euroconqd.conf
clean-generic:
-rm -f .#* *~
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:
......@@ -267,10 +267,13 @@ void TClient::Free()
EChannel *c;
if(pl && (c = pl->Channel())) /* Le fait partir du chan */
{
c->RemovePlayer(pl, true);
c->sendto_players(0, app.rpl(ECServer::LEAVE), nick, "");
if(!c->NbPlayers())
delete c;
else
{
c->RemovePlayer(pl, true);
c->sendto_players(0, app.rpl(ECServer::LEAVE), nick, "");
}
}
close(fd);
......
......@@ -20,6 +20,7 @@
*/
#include "Channels.h"
#include "Debug.h"
/********************************************************************************************
* EPlayer *
......@@ -35,10 +36,10 @@ ECPlayer::ECPlayer(const char* _nick, EChannel *_chan, bool _owner, bool _isme)
* EChannel *
********************************************************************************************/
ECPlayer *EChannel::GetPlayer(const char* nick) const
ECPlayer *EChannel::GetPlayer(const char* nick)
{
for(unsigned int i=0;i<players.size();i++)
if(!strcasecmp(((ECPlayer *)players[i])->GetNick(), nick))
return ((ECPlayer *)players[i]);
return NULL;
BPlayerVector::iterator it;
for(it=players.begin(); it != players.end() && strcasecmp((*it)->GetNick(),nick); it++);
return (it == players.end() ? 0 : (dynamic_cast<ECPlayer*>(*it)));
}
......@@ -42,7 +42,7 @@ public:
* @param nick nickname of user who joined channel.
* @param chan channel struct.
* @param owner if player is an owner or not.
* @param IsMe specifie if this player is me.
* @param IsMe say if this player is me.
*/
ECPlayer(const char* nick, EChannel* chan, bool owner, bool IsMe);
......@@ -58,7 +58,7 @@ public:
/** Get nick of client. */
virtual const char* GetNick() const { return nick.c_str(); }
/** Is this player is me ? */
/** Is this player me ? */
bool IsMe() const { return isme; }
/* Variables prives */
......@@ -66,6 +66,7 @@ protected:
std::string nick;
bool isme;
};
typedef std::vector<ECPlayer*> PlayerVector;
/********************************************************************************************
* EChannel *
......@@ -92,7 +93,7 @@ public:
public:
/** Get a player in channel by his nickname. */
ECPlayer* GetPlayer(const char* nick) const;
ECPlayer* GetPlayer(const char* nick);
/* Variables prives */
protected:
......
......@@ -41,7 +41,6 @@ public:
virtual ~EC_ACommand() {}
typedef std::vector<ECPlayer*> PlayerList;
typedef std::vector<ECPlayer*>::iterator PlayerIterator;
typedef std::vector<std::string> ParvList;
virtual int Exec(PlayerList players, EC_Client *me, ParvList parv) = 0;
......
......@@ -117,7 +117,7 @@ int SETCommand::Exec(PlayerList players, EC_Client *me, ParvList parv)
case 'A': me->Player()->Channel()->SetState(EChannel::ANIMING); break;
case '!':
if(!players.size()) { Debug(W_DESYNCH|W_SEND, "+/-! sans sender"); break; }
for(PlayerIterator it=players.begin(); it != players.end(); it++)
for(PlayerList::iterator it=players.begin(); it != players.end(); it++)
(*it)->SetReady(add);
break;
case 'o':
......@@ -164,7 +164,6 @@ int PLSCommand::Exec(PlayerList players, EC_Client *me, ParvList parv)
{
if(!me->Player()) return Debug(W_DESYNCH|W_SEND, "Reception d'un PLS sans tre dans un chan");
JOINED = true;
for(ParvList::iterator parvi=(parv.begin()+1); parvi!=parv.end(); parvi++)
{
const char *nick = (*parvi).c_str();
......@@ -208,6 +207,7 @@ int PLSCommand::Exec(PlayerList players, EC_Client *me, ParvList parv)
}
if(GameInfosForm)
GameInfosForm->RecalcMemo();
JOINED = true;
return 0;
}
......@@ -227,6 +227,7 @@ int JOICommand::Exec(PlayerList players, EC_Client *me, ParvList parv)
{ /* C'est moi qui join */
EChannel *c = new EChannel(parv[1]);
me->SetPlayer(new ECPlayer(parv[0].c_str(), c, false, true));
printf("me add - %p\n", me->Player());
}
else
{ /* C'est un user qui rejoin le chan */
......@@ -260,18 +261,20 @@ int LEACommand::Exec(PlayerList players, EC_Client *me, ParvList parv)
* un avenir des "services" qui pourraient "hacker" (plusieurs
* dparts ?) ou alors pour une eventuelle IA du serveur)
*/
for(PlayerIterator playersi=players.begin(); playersi != players.end(); playersi++)
for(PlayerList::iterator playersi=players.begin(); playersi != players.end();)
{
if((*playersi)->IsMe())
{
delete me->Player()->Channel();
me->ClrPlayer(); /* <=> me->pl = 0 */
JOINED = false;
return 0;
}
else
{
if(GameInfosForm)
{
GameInfosForm->Players->Hide();
GameInfosForm->Chat->AddItem("*** " + std::string((*playersi)->GetNick()) +
" quitte la partie", green_color);
for(std::vector<TComponent*>::iterator it=GameInfosForm->Players->GetList().begin();
......@@ -279,25 +282,26 @@ int LEACommand::Exec(PlayerList players, EC_Client *me, ParvList parv)
it++)
{
TPlayerLine *pline = dynamic_cast<TPlayerLine*>(*it);
if(!pline)
{ /* Il ne devrait PAS tre possible que la liste contienne un element nul */
vDebug(W_ERR|W_SEND, "La liste contient un element vide", VPName(*it));
if(!pline) /* Ce n'est pas un TPlayerLine */
continue;
}
/** \todo En revanche, il devrait (et il y aurra) des elements qui ne seront
* *pas* des TPlayerLine. Il faut donc arriver trouver le type de *it.
*/
printf("p - %s\n", pline->Player()->GetNick());
if(pline->Player() == (*playersi))
{
if(!GameInfosForm->Players->RemoveLine(*it))
Debug(W_ERR|W_SEND, "LEA: Impossible de supprimer la ligne de l'user");
throw ECExcept(VPName(*it) VPName(*playersi), "Player-line introuvable");
GameInfosForm->RecalcMemo();
break;
}
}
GameInfosForm->Players->Show();
}
if(me->Player()->Channel()->RemovePlayer((*playersi), true))
playersi = players.erase(playersi);
else
{
vDebug(W_DESYNCH|W_SEND, "LEA - Impossible de supprimer un player", VPName(*playersi));
playersi++;
}
me->Player()->Channel()->RemovePlayer((*playersi), true);
}
}
return 0;
......@@ -328,8 +332,7 @@ bool EuroConqApp::GameInfos(const char *cname)
WAIT_EVENT(JOINED, i);
if(!JOINED)
{
delete GameInfosForm;
GameInfosForm = 0;
MyFree(GameInfosForm);
return false;
}
......@@ -369,14 +372,14 @@ bool EuroConqApp::GameInfos(const char *cname)
default: break;
}
break;
case SDL_MOUSEBUTTONUP:
case SDL_MOUSEBUTTONDOWN:
GameInfosForm->Chat->Clic( event.button.x, event.button.y);
if(GameInfosForm->MyPosition &&
GameInfosForm->MyPosition->Clic(event.button.x, event.button.y))
client->sendrpl(client->rpl(EC_Client::SET),
("+p " + TypToStr(GameInfosForm->MyPosition->Value())).c_str());
break;
case SDL_MOUSEBUTTONDOWN:
/* break;
case SDL_MOUSEBUTTONDOWN:*/
GameInfosForm->SendMessage->Clic(event.button.x, event.button.y);
if(GameInfosForm->RetourButton->Test(event.button.x, event.button.y))
eob = true;
......@@ -415,14 +418,16 @@ bool EuroConqApp::GameInfos(const char *cname)
}
catch(TECExcept &e)
{
delete GameInfosForm;
GameInfosForm = NULL;
MyFree(GameInfosForm);
client->sendrpl(client->rpl(EC_Client::LEAVE));
throw;
}
delete GameInfosForm;
GameInfosForm = NULL;
MyFree(GameInfosForm);
client->sendrpl(client->rpl(EC_Client::LEAVE));
WAIT_EVENT(!JOINED, i);
return true;
}
......@@ -505,8 +510,7 @@ void EuroConqApp::ListGames()
if(timer.time_elapsed(true) > 60) refresh = true; /* VRITABLE minute */
} while(!eob && client->IsConnected());
delete ListGameForm;
ListGameForm = NULL;
MyFree(ListGameForm);
return;
}
......@@ -517,13 +521,14 @@ void EuroConqApp::ListGames()
TGameInfosForm::TGameInfosForm()
: TForm()
{
Chat = AddComponent(new TMemo(75,325,300,200,30));
Chat = AddComponent(new TMemo(60,325,315,200,30));
SendMessage = AddComponent(new TEdit(75,530,300, MAXBUFFER-20));
SendMessage = AddComponent(new TEdit(60,530,315, MAXBUFFER-20));
PretButton = AddComponent(new TButtonText(600,400, 100,49, "Pret"));
RetourButton = AddComponent(new TButtonText(600,450,100,49, "Retour"));
Players = AddComponent(new TList(50, 30));
Players = AddComponent(new TList(60, 60));
Players->AddLine(new TPlayerLineHeader);
SetBackground(Resources::Menuscreen());
......@@ -541,8 +546,8 @@ TGameInfosForm::~TGameInfosForm()
void TGameInfosForm::RecalcMemo()
{
Chat->SetXY(75, Players->GetHeight()+20);
Chat->SetHeight(525-Players->GetHeight()-20); /* On dfinit une jolie taille */
Chat->SetXY(60, Players->GetY() + Players->GetHeight());
Chat->SetHeight(528-Players->GetHeight()-Players->GetX()); /* On dfinit une jolie taille */
}
/********************************************************************************************
......@@ -589,10 +594,18 @@ TPlayerLine::~TPlayerLine()
if(position) delete position;
}
void TPlayerLine::SetXY (uint px, uint py)
{
TComponent::SetXY(px, py);
if(position)
position->SetXY(px+210, py);
}
void TPlayerLine::Init()
{
assert(pl);
if(position) delete position;
position = new TSpinEdit("", x+155, y, 50, 0, pl->Channel()->NbPlayers(), 1, 0);
position = new TSpinEdit("", x+210, y, 50, 0, pl->Channel()->NbPlayers(), 1, 0);
position->Init();
}
......@@ -604,7 +617,44 @@ void TPlayerLine::Draw(uint souris_x, uint souris_y)
big_font.WriteLeft(x, y, "OK", pl->Ready() ? red_color : gray_color);
if(pl->IsOwner())
big_font.WriteLeft(x+40, y, "*", red_color);
big_font.WriteLeft(x+55, y, pl->GetNick(), black_color);
big_font.WriteLeft(x+50, y, "*", red_color);
big_font.WriteLeft(x+65, y, pl->GetNick(), black_color);
position->Draw(souris_x, souris_y);
}
/********************************************************************************************