summaryrefslogtreecommitdiff
path: root/src/gui/char_server.cpp
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2005-01-08 01:33:53 +0000
committerBjørn Lindeijer <bjorn@lindeijer.nl>2005-01-08 01:33:53 +0000
commitee416a5f3de03a689247a290077e7fdf451e1a23 (patch)
treef456df99f954919ac7a425606df51f010aa4ef2d /src/gui/char_server.cpp
parent4070dda1560bc729c3e272f0a5c03d77391e2661 (diff)
downloadmana-client-ee416a5f3de03a689247a290077e7fdf451e1a23.tar.gz
mana-client-ee416a5f3de03a689247a290077e7fdf451e1a23.tar.bz2
mana-client-ee416a5f3de03a689247a290077e7fdf451e1a23.tar.xz
mana-client-ee416a5f3de03a689247a290077e7fdf451e1a23.zip
Well improved window container and window widgets a bit, and made a start
on support for modal dialogs. Still some issues to work out. Tell me if you experience something unsettling.
Diffstat (limited to 'src/gui/char_server.cpp')
-rw-r--r--src/gui/char_server.cpp42
1 files changed, 21 insertions, 21 deletions
diff --git a/src/gui/char_server.cpp b/src/gui/char_server.cpp
index 4543a829..b042a05a 100644
--- a/src/gui/char_server.cpp
+++ b/src/gui/char_server.cpp
@@ -27,13 +27,14 @@
#include "window.h"
#include "scrollarea.h"
#include "listbox.h"
+#include "ok_dialog.h"
char server[30];
int showServerList = 1;
-ServerSelectDialog::ServerSelectDialog(gcn::Container *parent):
- Window(parent, "Select Server")
+ServerSelectDialog::ServerSelectDialog():
+ Window("Select Server")
{
serverListModel = new ServerListModel();
serverList = new ListBox(serverListModel);
@@ -110,7 +111,7 @@ std::string ServerListModel::getElementAt(int i) {
void char_server() {
- ServerSelectDialog *dialog = new ServerSelectDialog(guiTop);
+ ServerSelectDialog *dialog = new ServerSelectDialog();
state = LOGIN;
@@ -132,7 +133,7 @@ void server_char_server(int serverIndex) {
ret = open_session(iptostring(server_info[serverIndex].address),
server_info[serverIndex].port);
if (ret == SOCKET_ERROR) {
- ok("Error", "Unable to connect to char server");
+ new OkDialog("Error", "Unable to connect to char server");
return;
}
@@ -145,16 +146,16 @@ void server_char_server(int serverIndex) {
WFIFOB(16) = net_b_value(sex);
WFIFOSET(17);
- while((in_size<4)||(out_size>0))flush();
+ while ((in_size<4)||(out_size>0))flush();
RFIFOSKIP(4);
- while(in_size<3)flush();
+ while (in_size<3)flush();
- if(RFIFOW(0)==0x006b) {
+ if (RFIFOW(0)==0x006b) {
while(in_size<RFIFOW(2))flush();
n_character = (RFIFOW(2)-24)/106;
- char_info = (PLAYER_INFO *)malloc(sizeof(PLAYER_INFO)*n_character);
- for(int i=0;i<n_character;i++) {
+ char_info = (PLAYER_INFO *)malloc(sizeof(PLAYER_INFO) * n_character);
+ for (int i = 0; i < n_character; i++) {
char_info[i].id = RFIFOL(24+106*i);
strcpy(char_info[i].name, RFIFOP(24+106*i+74));
char_info[i].hp = RFIFOW(24+106*i+42);
@@ -183,20 +184,19 @@ void server_char_server(int serverIndex) {
RFIFOSKIP(RFIFOW(2));
- } else if(RFIFOW(0)==0x006c) {
- switch(RFIFOB(2)) {
- case 0:
- ok("Error", "Access denied");
- break;
- case 1:
- ok("Error", "Cannot use this ID");
- break;
- default:
- ok("Error", "Rejected from server");
- break;
+ }
+ else if (RFIFOW(0) == 0x006c) {
+ std::string errorStr;
+ switch (RFIFOB(2)) {
+ case 0: errorStr = "Access denied"; break;
+ case 1: errorStr = "Cannot use this ID"; break;
+ default: errorStr = "Rejected from server"; break;
}
+ new OkDialog("Error", errorStr);
RFIFOSKIP(3);
close_session();
- } else ok("Error", "Unknown error");
+ } else {
+ new OkDialog("Error", "Unknown error");
+ }
// Todo: add other packets
}