summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2005-09-08 22:48:48 +0000
committerBjørn Lindeijer <bjorn@lindeijer.nl>2005-09-08 22:48:48 +0000
commitb3a64dc0c6db8c2f2a6faf5e3d2cd11c81713114 (patch)
tree1e06f3964ddb677888b63b4e7265188925492674 /src
parent0ba846818fcfd01142c0c615adc487e342e5f243 (diff)
downloadmana-client-b3a64dc0c6db8c2f2a6faf5e3d2cd11c81713114.tar.gz
mana-client-b3a64dc0c6db8c2f2a6faf5e3d2cd11c81713114.tar.bz2
mana-client-b3a64dc0c6db8c2f2a6faf5e3d2cd11c81713114.tar.xz
mana-client-b3a64dc0c6db8c2f2a6faf5e3d2cd11c81713114.zip
Removed inclusion of malloc.h header as it doens't seem necessary and was
problematic on FreeBSD.
Diffstat (limited to 'src')
-rw-r--r--src/game.cpp6
-rw-r--r--src/graphics.h13
-rw-r--r--src/gui/char_server.cpp29
-rw-r--r--src/main.cpp3
-rw-r--r--src/net/win2linux.h3
5 files changed, 36 insertions, 18 deletions
diff --git a/src/game.cpp b/src/game.cpp
index 80cec17d..45bc4dce 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -924,7 +924,8 @@ void do_input()
}
}
- if (joy[JOY_BTN1]) {
+ if (joy[JOY_BTN1])
+ {
unsigned short x = player_node->x;
unsigned short y = player_node->y;
int id = find_floor_item_by_cor(x, y);
@@ -936,7 +937,8 @@ void do_input()
WFIFOSET(6);
}
}
- else if (joy[JOY_BTN2] && action_time) {
+ else if (joy[JOY_BTN2] && action_time)
+ {
if (player_node->action == Being::STAND)
action(2, 0);
else if (player_node->action == Being::SIT)
diff --git a/src/graphics.h b/src/graphics.h
index f62662f7..6bd32ec2 100644
--- a/src/graphics.h
+++ b/src/graphics.h
@@ -72,9 +72,16 @@ class Graphics : public gcn::SDLGraphics {
* @return <code>true</code> if the image was blitted properly
* <code>false</code> otherwise.
*/
- virtual bool drawImage(Image *image, int srcX, int srcY, int dstX, int dstY, int width, int height);
-
- virtual void drawImagePattern(Image *image, int x, int y, int w, int h);
+ virtual bool
+ drawImage(Image *image,
+ int srcX, int srcY,
+ int dstX, int dstY,
+ int width, int height);
+
+ virtual void
+ drawImagePattern(Image *image,
+ int x, int y,
+ int w, int h);
/**
* Draws a rectangle using images. 4 corner images, 4 side images and 1
diff --git a/src/gui/char_server.cpp b/src/gui/char_server.cpp
index 268cb8bd..24e58c5c 100644
--- a/src/gui/char_server.cpp
+++ b/src/gui/char_server.cpp
@@ -162,14 +162,17 @@ void char_server() {
delete dialog;
}
-void server_char_server(int serverIndex) {
+void server_char_server(int serverIndex)
+{
int ret;
state = LOGIN;
const char *ipstring = iptostring(server_info[serverIndex].address);
// Connect to char server
ret = open_session(ipstring, server_info[serverIndex].port);
- if (ret == SOCKET_ERROR) {
+
+ if (ret == SOCKET_ERROR)
+ {
std::string str = std::string("Unable to connect to char server ") +
std::string(ipstring);
new OkDialog("Error", str);
@@ -185,16 +188,20 @@ 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();
- if (RFIFOW(0) == 0x006b) {
- while(in_size < RFIFOW(2))flush();
+ 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++)
+ {
int n = 24 + 106 * i;
char_info[i].id = RFIFOL(n);
strcpy(char_info[i].name, RFIFOP(n + 74));
@@ -217,6 +224,7 @@ void server_char_server(int serverIndex) {
char_info[i].hair_color = RFIFOW(n + 70);
char_info[i].weapon = RFIFOW(n + 56);
}
+
state = CHAR_SELECT;
logger->log("CharServer: Player: %s (Packet ID: %x, Length: %d)",
@@ -225,7 +233,8 @@ void server_char_server(int serverIndex) {
RFIFOSKIP(RFIFOW(2));
}
- else if (RFIFOW(0) == 0x006c) {
+ else if (RFIFOW(0) == 0x006c)
+ {
std::string errorStr;
switch (RFIFOB(2)) {
case 0: errorStr = "Access denied"; break;
@@ -235,7 +244,9 @@ void server_char_server(int serverIndex) {
new OkDialog("Error", errorStr);
RFIFOSKIP(3);
close_session();
- } else {
+ }
+ else
+ {
new OkDialog("Error", "Unknown error");
}
// Todo: add other packets
diff --git a/src/main.cpp b/src/main.cpp
index 84e8b73a..7633df71 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -254,7 +254,8 @@ void init_engine()
// Try to set the desired video mode
- if (!graphics->setVideoMode(width, height, bpp, fullscreen, hwaccel)) {
+ if (!graphics->setVideoMode(width, height, bpp, fullscreen, hwaccel))
+ {
std::cerr << "Couldn't set " << width << "x" << height << "x" <<
bpp << " video mode: " << SDL_GetError() << std::endl;
exit(1);
diff --git a/src/net/win2linux.h b/src/net/win2linux.h
index 71737a58..1371f4d9 100644
--- a/src/net/win2linux.h
+++ b/src/net/win2linux.h
@@ -1,8 +1,5 @@
#include <stdio.h>
#include <stdlib.h>
-#ifndef MACOSX
-#include <malloc.h>
-#endif
#include <string.h>
#include <sys/socket.h>
#include <netinet/in.h>