summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2009-02-26 22:22:22 +0100
committerIra Rice <irarice@gmail.com>2009-03-05 17:22:19 -0700
commit448d9076137fc5dde666a90820992a34a945cbf7 (patch)
treeee8d478fbced980a0ea868e9a7810ca56c49fe97 /src
parenta79d05b01d4a2dc639e6d3a5b7ddd508e64d3511 (diff)
downloadmana-client-448d9076137fc5dde666a90820992a34a945cbf7.tar.gz
mana-client-448d9076137fc5dde666a90820992a34a945cbf7.tar.bz2
mana-client-448d9076137fc5dde666a90820992a34a945cbf7.tar.xz
mana-client-448d9076137fc5dde666a90820992a34a945cbf7.zip
Got rid of Sint{8,16,32} and Uint32 for being ID
Using unsigned rarely makes sense, especially when the server doesn't use it either. Other uses of unsigned should be reviewed. In all other cases, int is the fastest integer type on any architecture. Using 8 or 16 bits can basically only be a memory optimization.
Diffstat (limited to 'src')
-rw-r--r--src/being.cpp2
-rw-r--r--src/being.h12
-rw-r--r--src/beingmanager.cpp16
-rw-r--r--src/beingmanager.h14
-rw-r--r--src/floor_item.cpp8
-rw-r--r--src/floor_item.h18
-rw-r--r--src/flooritemmanager.cpp8
-rw-r--r--src/flooritemmanager.h7
-rw-r--r--src/gui/inventorywindow.cpp1
-rw-r--r--src/gui/inventorywindow.h2
-rw-r--r--src/gui/popupmenu.cpp66
-rw-r--r--src/gui/popupmenu.h2
-rw-r--r--src/localplayer.cpp2
-rw-r--r--src/localplayer.h4
-rw-r--r--src/monster.cpp2
-rw-r--r--src/monster.h2
-rw-r--r--src/net/beinghandler.cpp6
-rw-r--r--src/net/buysellhandler.cpp8
-rw-r--r--src/net/chathandler.cpp2
-rw-r--r--src/net/equipmenthandler.cpp6
-rw-r--r--src/net/inventoryhandler.cpp6
-rw-r--r--src/net/itemhandler.cpp2
-rw-r--r--src/net/npchandler.cpp2
-rw-r--r--src/net/playerhandler.cpp22
-rw-r--r--src/net/skillhandler.cpp8
-rw-r--r--src/net/tradehandler.cpp6
-rw-r--r--src/npc.cpp4
-rw-r--r--src/npc.h6
28 files changed, 122 insertions, 122 deletions
diff --git a/src/being.cpp b/src/being.cpp
index cebf6d1c..312904ad 100644
--- a/src/being.cpp
+++ b/src/being.cpp
@@ -179,7 +179,7 @@ void Being::setSprite(int slot, int id, std::string color)
mSpriteColors[slot] = color;
}
-void Being::setSpeech(const std::string &text, Uint32 time)
+void Being::setSpeech(const std::string &text, int time)
{
mSpeech = text;
diff --git a/src/being.h b/src/being.h
index 7fd0c7ef..49f95662 100644
--- a/src/being.h
+++ b/src/being.h
@@ -165,7 +165,7 @@ class Being : public Sprite
* @param text The text that should appear.
* @param time The amount of time the text should stay in milliseconds.
*/
- void setSpeech(const std::string &text, Uint32 time = 500);
+ void setSpeech(const std::string &text, int time = 500);
/**
* Puts a damage bubble above this being.
@@ -282,12 +282,12 @@ class Being : public Sprite
/**
* Gets the sprite id.
*/
- Uint32 getId() const { return mId; }
+ int getId() const { return mId; }
/**
* Sets the sprite id.
*/
- void setId(Uint32 id) { mId = id; }
+ void setId(int id) { mId = id; }
/**
* Sets the map the being is on
@@ -416,7 +416,7 @@ class Being : public Sprite
*/
void internalTriggerEffect(int effectId, bool sfx, bool gfx);
- Uint32 mId; /**< Unique sprite id */
+ int mId; /**< Unique sprite id */
Uint16 mWalkSpeed; /**< Walking speed */
Uint8 mDirection; /**< Facing direction */
Map *mMap; /**< Map on which this being resides */
@@ -437,8 +437,8 @@ class Being : public Sprite
Text *mText;
Uint16 mHairStyle, mHairColor;
Gender mGender;
- Uint32 mSpeechTime;
- Sint32 mPx, mPy; /**< Pixel coordinates */
+ int mSpeechTime;
+ int mPx, mPy; /**< Pixel coordinates */
Uint16 mStunMode; /**< Stun mode; zero if not stunned */
StatusEffects mStatusEffects; /**< Bitset of active status effects */
diff --git a/src/beingmanager.cpp b/src/beingmanager.cpp
index d6d71a91..0cf783d8 100644
--- a/src/beingmanager.cpp
+++ b/src/beingmanager.cpp
@@ -65,7 +65,7 @@ void BeingManager::setPlayer(LocalPlayer *player)
mBeings.push_back(player);
}
-Being* BeingManager::createBeing(Uint32 id, Uint16 job)
+Being *BeingManager::createBeing(int id, Uint16 job)
{
Being *being;
@@ -97,7 +97,7 @@ void BeingManager::destroyBeing(Being *being)
delete being;
}
-Being* BeingManager::findBeing(Uint32 id)
+Being *BeingManager::findBeing(int id)
{
for (BeingIterator i = mBeings.begin(); i != mBeings.end(); i++)
{
@@ -109,7 +109,7 @@ Being* BeingManager::findBeing(Uint32 id)
return NULL;
}
-Being* BeingManager::findBeing(Uint16 x, Uint16 y, Being::Type type)
+Being *BeingManager::findBeing(int x, int y, Being::Type type)
{
beingFinder.x = x;
beingFinder.y = y;
@@ -120,7 +120,7 @@ Being* BeingManager::findBeing(Uint16 x, Uint16 y, Being::Type type)
return (i == mBeings.end()) ? NULL : *i;
}
-Being* BeingManager::findBeingByPixel(Uint16 x, Uint16 y)
+Being *BeingManager::findBeingByPixel(int x, int y)
{
BeingIterator itr = mBeings.begin();
BeingIterator itr_end = mBeings.end();
@@ -146,7 +146,7 @@ Being* BeingManager::findBeingByPixel(Uint16 x, Uint16 y)
return NULL;
}
-Being* BeingManager::findBeingByName(std::string name, Being::Type type)
+Being *BeingManager::findBeingByName(std::string name, Being::Type type)
{
for (BeingIterator i = mBeings.begin(); i != mBeings.end(); i++)
{
@@ -159,7 +159,7 @@ Being* BeingManager::findBeingByName(std::string name, Being::Type type)
return NULL;
}
-Beings& BeingManager::getAll()
+Beings &BeingManager::getAll()
{
return mBeings;
}
@@ -200,7 +200,7 @@ void BeingManager::clear()
}
}
-Being* BeingManager::findNearestLivingBeing(Uint16 x, Uint16 y, int maxdist,
+Being *BeingManager::findNearestLivingBeing(int x, int y, int maxdist,
Being::Type type)
{
Being *closestBeing = NULL;
@@ -227,7 +227,7 @@ Being* BeingManager::findNearestLivingBeing(Uint16 x, Uint16 y, int maxdist,
return (maxdist >= dist) ? closestBeing : NULL;
}
-Being* BeingManager::findNearestLivingBeing(Being *aroundBeing, int maxdist,
+Being *BeingManager::findNearestLivingBeing(Being *aroundBeing, int maxdist,
Being::Type type)
{
Being *closestBeing = NULL;
diff --git a/src/beingmanager.h b/src/beingmanager.h
index 32ba6242..472e2c83 100644
--- a/src/beingmanager.h
+++ b/src/beingmanager.h
@@ -50,7 +50,7 @@ class BeingManager
/**
* Create a being and add it to the list of beings.
*/
- Being *createBeing(Uint32 id, Uint16 job);
+ Being *createBeing(int id, Uint16 job);
/**
* Remove a Being.
@@ -60,13 +60,13 @@ class BeingManager
/**
* Return a specific id Being.
*/
- Being* findBeing(Uint32 id);
- Being* findBeingByPixel(Uint16 x, Uint16 y);
+ Being *findBeing(int id);
+ Being *findBeingByPixel(int x, int y);
/**
* Returns a being at specific coordinates.
*/
- Being* findBeing(Uint16 x, Uint16 y, Being::Type type = Being::UNKNOWN);
+ Being *findBeing(int x, int y, Being::Type type = Being::UNKNOWN);
/**
* Returns a being nearest to specific coordinates.
@@ -77,13 +77,13 @@ class BeingManager
* no being is returned.
* @param type The type of being to look for.
*/
- Being* findNearestLivingBeing(Uint16 x, Uint16 y, int maxdist,
+ Being *findNearestLivingBeing(int x, int y, int maxdist,
Being::Type type = Being::UNKNOWN);
/**
* Finds a being by name and (optionally) by type.
*/
- Being* findBeingByName(std::string name, Being::Type type = Being::UNKNOWN);
+ Being *findBeingByName(std::string name, Being::Type type = Being::UNKNOWN);
/**
* Returns a being nearest to another being.
@@ -91,7 +91,7 @@ class BeingManager
* \param maxdist maximal distance. If minimal distance is larger,
* no being is returned
*/
- Being* findNearestLivingBeing(Being *aroundBeing, int maxdist,
+ Being *findNearestLivingBeing(Being *aroundBeing, int maxdist,
Being::Type type = Being::UNKNOWN);
/**
diff --git a/src/floor_item.cpp b/src/floor_item.cpp
index 232c1aee..82506f8f 100644
--- a/src/floor_item.cpp
+++ b/src/floor_item.cpp
@@ -27,11 +27,7 @@
#include "resources/image.h"
-FloorItem::FloorItem(unsigned int id,
- unsigned int itemId,
- unsigned short x,
- unsigned short y,
- Map *map):
+FloorItem::FloorItem(int id, int itemId, int x, int y, Map *map):
mId(id),
mX(x),
mY(y),
@@ -52,7 +48,7 @@ FloorItem::~FloorItem()
delete mItem;
}
-unsigned int FloorItem::getItemId() const
+int FloorItem::getItemId() const
{
return mItem->getId();
}
diff --git a/src/floor_item.h b/src/floor_item.h
index 8485172c..0972a983 100644
--- a/src/floor_item.h
+++ b/src/floor_item.h
@@ -43,11 +43,7 @@ class FloorItem : public Sprite
/**
* Constructor.
*/
- FloorItem(unsigned int id,
- unsigned int itemId,
- unsigned short x,
- unsigned short y,
- Map *map);
+ FloorItem(int id, int itemId, int x, int y, Map *map);
/**
* Destructor.
@@ -57,22 +53,22 @@ class FloorItem : public Sprite
/**
* Returns instance id of this item.
*/
- unsigned int getId() const { return mId; }
+ int getId() const { return mId; }
/**
* Returns the item id.
*/
- unsigned int getItemId() const;
+ int getItemId() const;
/**
* Returns the x coordinate.
*/
- unsigned short getX() const { return mX; }
+ int getX() const { return mX; }
/**
* Returns the y coordinate.
*/
- unsigned short getY() const { return mY; }
+ int getY() const { return mY; }
/**
* Returns the pixel y coordinate.
@@ -89,8 +85,8 @@ class FloorItem : public Sprite
void draw(Graphics *graphics, int offsetX, int offsetY) const;
private:
- unsigned int mId;
- unsigned short mX, mY;
+ int mId;
+ int mX, mY;
Item *mItem;
Sprites::iterator mSpriteIterator;
Map *mMap;
diff --git a/src/flooritemmanager.cpp b/src/flooritemmanager.cpp
index dbb93526..97b3ca5b 100644
--- a/src/flooritemmanager.cpp
+++ b/src/flooritemmanager.cpp
@@ -30,8 +30,7 @@ FloorItemManager::~FloorItemManager()
clear();
}
-FloorItem* FloorItemManager::create(unsigned int id, unsigned int itemId,
- unsigned short x, unsigned short y, Map *map)
+FloorItem* FloorItemManager::create(int id, int itemId, int x, int y, Map *map)
{
FloorItem *floorItem = new FloorItem(id, itemId, x, y, map);
mFloorItems.push_back(floorItem);
@@ -50,7 +49,7 @@ void FloorItemManager::clear()
mFloorItems.clear();
}
-FloorItem* FloorItemManager::findById(unsigned int id)
+FloorItem *FloorItemManager::findById(int id)
{
FloorItemIterator i;
for (i = mFloorItems.begin(); i != mFloorItems.end(); i++)
@@ -64,8 +63,7 @@ FloorItem* FloorItemManager::findById(unsigned int id)
return NULL;
}
-FloorItem* FloorItemManager::findByCoordinates(unsigned short x,
- unsigned short y)
+FloorItem *FloorItemManager::findByCoordinates(int x, int y)
{
FloorItemIterator i;
for (i = mFloorItems.begin(); i != mFloorItems.end(); i++)
diff --git a/src/flooritemmanager.h b/src/flooritemmanager.h
index 5ff8fe5c..1a6e8e0a 100644
--- a/src/flooritemmanager.h
+++ b/src/flooritemmanager.h
@@ -33,15 +33,14 @@ class FloorItemManager
public:
~FloorItemManager();
- FloorItem* create(unsigned int id, unsigned int itemId,
- unsigned short x, unsigned short y, Map *map);
+ FloorItem* create(int id, int itemId, int x, int y, Map *map);
void destroy(FloorItem *item);
void clear();
- FloorItem* findById(unsigned int id);
- FloorItem* findByCoordinates(unsigned short x, unsigned short y);
+ FloorItem* findById(int id);
+ FloorItem* findByCoordinates(int x, int y);
private:
typedef std::list<FloorItem*> FloorItems;
diff --git a/src/gui/inventorywindow.cpp b/src/gui/inventorywindow.cpp
index e8457337..347c36ac 100644
--- a/src/gui/inventorywindow.cpp
+++ b/src/gui/inventorywindow.cpp
@@ -39,6 +39,7 @@
#include "../inventory.h"
#include "../item.h"
+#include "../localplayer.h"
#include "../resources/iteminfo.h"
diff --git a/src/gui/inventorywindow.h b/src/gui/inventorywindow.h
index a46a3fbb..83e98687 100644
--- a/src/gui/inventorywindow.h
+++ b/src/gui/inventorywindow.h
@@ -28,7 +28,7 @@
#include "window.h"
-#include "../localplayer.h"
+#include "../inventory.h"
class Item;
class ItemContainer;
diff --git a/src/gui/popupmenu.cpp b/src/gui/popupmenu.cpp
index 7f82d1b5..ebaba977 100644
--- a/src/gui/popupmenu.cpp
+++ b/src/gui/popupmenu.cpp
@@ -30,6 +30,7 @@
#include "windowcontainer.h"
#include "../being.h"
+#include "../beingmanager.h"
#include "../floor_item.h"
#include "../item.h"
#include "../localplayer.h"
@@ -48,7 +49,7 @@ extern std::string tradePartnerName;
PopupMenu::PopupMenu():
Window(),
- mBeing(NULL),
+ mBeingId(0),
mFloorItem(NULL),
mItem(NULL)
{
@@ -66,16 +67,16 @@ PopupMenu::PopupMenu():
void PopupMenu::showPopup(int x, int y, Being *being)
{
- mBeing = being;
+ mBeingId = being->getId();
mBrowserBox->clearRows();
- switch (mBeing->getType())
+ switch (being->getType())
{
case Being::PLAYER:
{
- // Players can be traded with. Later also attack, follow and
+ // Players can be traded with. Later also follow and
// add as buddy will be options in this menu.
- const std::string &name = mBeing->getName();
+ const std::string &name = being->getName();
mBrowserBox->addRow(strprintf(_("@@trade|Trade With %s@@"), name.c_str()));
mBrowserBox->addRow(strprintf(_("@@attack|Attack %s@@"), name.c_str()));
@@ -144,45 +145,56 @@ void PopupMenu::showPopup(int x, int y, FloorItem *floorItem)
void PopupMenu::handleLink(const std::string& link)
{
+ Being *being = beingManager->findBeing(mBeingId);
+
+ if (!being)
+ {
+ mBeingId = 0;
+ mFloorItem = NULL;
+ mItem = NULL;
+ setVisible(false);
+ return;
+ }
+
// Talk To action
- if (link == "talk" && mBeing && mBeing->getType() == Being::NPC &&
+ if (link == "talk" && being && being->getType() == Being::NPC &&
current_npc == 0)
{
- dynamic_cast<NPC*>(mBeing)->talk();
+ dynamic_cast<NPC*>(being)->talk();
}
// Trade action
- else if (link == "trade" && mBeing && mBeing->getType() == Being::PLAYER)
+ else if (link == "trade" && being && being->getType() == Being::PLAYER)
{
- player_node->trade(mBeing);
- tradePartnerName = mBeing->getName();
+ player_node->trade(being);
+ tradePartnerName = being->getName();
}
// Attack action
- else if (link == "attack" && mBeing && mBeing->getType() == Being::PLAYER)
+ else if (link == "attack" && being && being->getType() == Being::PLAYER)
{
- player_node->attack(mBeing, true);
+ player_node->attack(being, true);
}
- else if (link == "unignore" && mBeing && mBeing->getType() == Being::PLAYER)
+ else if (link == "unignore" && being && being->getType() == Being::PLAYER)
{
- player_relations.setRelation(mBeing->getName(), PlayerRelation::NEUTRAL);
+ player_relations.setRelation(being->getName(), PlayerRelation::NEUTRAL);
}
- else if (link == "ignore" && mBeing && mBeing->getType() == Being::PLAYER)
+ else if (link == "ignore" && being && being->getType() == Being::PLAYER)
{
- player_relations.setRelation(mBeing->getName(), PlayerRelation::IGNORED);
+ player_relations.setRelation(being->getName(), PlayerRelation::IGNORED);
}
- else if (link == "disregard" && mBeing &&
- mBeing->getType() == Being::PLAYER)
+ else if (link == "disregard" && being &&
+ being->getType() == Being::PLAYER)
{
- player_relations.setRelation(mBeing->getName(), PlayerRelation::DISREGARDED);
+ player_relations.setRelation(being->getName(), PlayerRelation::DISREGARDED);
}
- else if (link == "friend" && mBeing && mBeing->getType() == Being::PLAYER)
+ else if (link == "friend" && being && being->getType() == Being::PLAYER)
{
- player_relations.setRelation(mBeing->getName(), PlayerRelation::FRIEND);
+ player_relations.setRelation(being->getName(), PlayerRelation::FRIEND);
}
/*
@@ -193,12 +205,12 @@ void PopupMenu::handleLink(const std::string& link)
/*
// Add Buddy action
- else if ((link == "buddy") && mBeing && mBeing->isPlayer())
+ else if ((link == "buddy") && being && being->isPlayer())
{
if (!buddyWindow->isVisible())
buddyWindow->setVisible(true);
- buddyWindow->addBuddy(mBeing->getName());
+ buddyWindow->addBuddy(being->getName());
}*/
// Pick Up Floor Item action
@@ -241,12 +253,12 @@ void PopupMenu::handleLink(const std::string& link)
{
new ItemAmountWindow(AMOUNT_ITEM_DROP, inventoryWindow, mItem);
}
- else if (link == "party-invite" && mBeing &&
- mBeing->getType() == Being::PLAYER)
+ else if (link == "party-invite" && being &&
+ being->getType() == Being::PLAYER)
{
MessageOut outMsg(player_node->getNetwork());
outMsg.writeInt16(CMSG_PARTY_INVITE);
- outMsg.writeInt32(mBeing->getId());
+ outMsg.writeInt32(being->getId());
}
// Unknown actions
@@ -257,7 +269,7 @@ void PopupMenu::handleLink(const std::string& link)
setVisible(false);
- mBeing = NULL;
+ mBeingId = 0;
mFloorItem = NULL;
mItem = NULL;
}
diff --git a/src/gui/popupmenu.h b/src/gui/popupmenu.h
index c62014f9..89152751 100644
--- a/src/gui/popupmenu.h
+++ b/src/gui/popupmenu.h
@@ -67,7 +67,7 @@ class PopupMenu : public Window, public LinkHandler
private:
BrowserBox* mBrowserBox;
- Being* mBeing;
+ int mBeingId;
FloorItem* mFloorItem;
Item *mItem;
diff --git a/src/localplayer.cpp b/src/localplayer.cpp
index 2607b460..76d13a4b 100644
--- a/src/localplayer.cpp
+++ b/src/localplayer.cpp
@@ -318,7 +318,7 @@ void LocalPlayer::walk(unsigned char dir)
return;
}
- Sint16 dx = 0, dy = 0;
+ int dx = 0, dy = 0;
if (dir & UP)
dy--;
if (dir & DOWN)
diff --git a/src/localplayer.h b/src/localplayer.h
index 0ae99bb0..2fb8c615 100644
--- a/src/localplayer.h
+++ b/src/localplayer.h
@@ -228,8 +228,8 @@ class LocalPlayer : public Player
Uint8 mAttr[6];
Uint8 mAttrUp[6];
- Sint16 ATK, MATK, DEF, MDEF, HIT, FLEE;
- Sint16 ATK_BONUS, MATK_BONUS, DEF_BONUS, MDEF_BONUS, FLEE_BONUS;
+ int ATK, MATK, DEF, MDEF, HIT, FLEE;
+ int ATK_BONUS, MATK_BONUS, DEF_BONUS, MDEF_BONUS, FLEE_BONUS;
Uint16 mStatPoint, mSkillPoint;
Uint16 mStatsPointsToAttribute;
diff --git a/src/monster.cpp b/src/monster.cpp
index f5687ef6..61c867e9 100644
--- a/src/monster.cpp
+++ b/src/monster.cpp
@@ -34,7 +34,7 @@
static const int NAME_X_OFFSET = 16;
static const int NAME_Y_OFFSET = 16;
-Monster::Monster(Uint32 id, Uint16 job, Map *map):
+Monster::Monster(int id, Uint16 job, Map *map):
Being(id, job, map),
mText(0)
{
diff --git a/src/monster.h b/src/monster.h
index 776a215b..12297373 100644
--- a/src/monster.h
+++ b/src/monster.h
@@ -31,7 +31,7 @@ class Text;
class Monster : public Being
{
public:
- Monster(Uint32 id, Uint16 job, Map *map);
+ Monster(int id, Uint16 job, Map *map);
~Monster();
diff --git a/src/net/beinghandler.cpp b/src/net/beinghandler.cpp
index 71369031..4ff303ab 100644
--- a/src/net/beinghandler.cpp
+++ b/src/net/beinghandler.cpp
@@ -65,14 +65,14 @@ BeingHandler::BeingHandler(bool enableSync):
void BeingHandler::handleMessage(MessageIn *msg)
{
- Uint32 id;
+ int id;
Uint16 job, speed;
Uint16 headTop, headMid, headBottom;
Uint16 shoes, gloves, cape, misc1, misc2;
Uint16 weapon, shield;
Uint16 gmstatus;
- Sint16 param1;
- Sint8 type;
+ int param1;
+ int type;
Being *srcBeing, *dstBeing;
int hairStyle, hairColor;
diff --git a/src/net/buysellhandler.cpp b/src/net/buysellhandler.cpp
index e9255540..5b8f0b68 100644
--- a/src/net/buysellhandler.cpp
+++ b/src/net/buysellhandler.cpp
@@ -78,10 +78,10 @@ void BuySellHandler::handleMessage(MessageIn *msg)
for (int k = 0; k < n_items; k++)
{
- Sint32 value = msg->readInt32();
+ int value = msg->readInt32();
msg->readInt32(); // DCvalue
msg->readInt8(); // type
- Sint16 itemId = msg->readInt16();
+ int itemId = msg->readInt16();
buyDialog->addItem(itemId, value);
}
break;
@@ -97,8 +97,8 @@ void BuySellHandler::handleMessage(MessageIn *msg)
for (int k = 0; k < n_items; k++)
{
- Sint16 index = msg->readInt16();
- Sint32 value = msg->readInt32();
+ int index = msg->readInt16();
+ int value = msg->readInt32();
msg->readInt32(); // OCvalue
Item *item = player_node->getInventory()->getItem(index);
diff --git a/src/net/chathandler.cpp b/src/net/chathandler.cpp
index 6717f515..185ce7d8 100644
--- a/src/net/chathandler.cpp
+++ b/src/net/chathandler.cpp
@@ -61,7 +61,7 @@ void ChatHandler::handleMessage(MessageIn *msg)
Being *being;
std::string chatMsg;
std::string nick;
- Sint16 chatMsgLength;
+ int chatMsgLength;
switch (msg->getId())
{
diff --git a/src/net/equipmenthandler.cpp b/src/net/equipmenthandler.cpp
index fe158198..9a6f424e 100644
--- a/src/net/equipmenthandler.cpp
+++ b/src/net/equipmenthandler.cpp
@@ -49,9 +49,9 @@ EquipmentHandler::EquipmentHandler()
void EquipmentHandler::handleMessage(MessageIn *msg)
{
- Sint32 itemCount;
- Sint16 index, equipPoint, itemId;
- Sint8 type;
+ int itemCount;
+ int index, equipPoint, itemId;
+ int type;
int mask, position;
Item *item;
Inventory *inventory = player_node->getInventory();
diff --git a/src/net/inventoryhandler.cpp b/src/net/inventoryhandler.cpp
index be128609..b0511080 100644
--- a/src/net/inventoryhandler.cpp
+++ b/src/net/inventoryhandler.cpp
@@ -62,9 +62,9 @@ InventoryHandler::InventoryHandler()
void InventoryHandler::handleMessage(MessageIn *msg)
{
- Sint32 number;
- Sint16 index, amount, itemId, equipType, arrow;
- Sint16 identified, cards[4], itemType;
+ int number;
+ int index, amount, itemId, equipType, arrow;
+ int identified, cards[4], itemType;
Inventory *inventory = player_node->getInventory();
Inventory *storage = player_node->getStorage();
diff --git a/src/net/itemhandler.cpp b/src/net/itemhandler.cpp
index e38be454..d9d84248 100644
--- a/src/net/itemhandler.cpp
+++ b/src/net/itemhandler.cpp
@@ -42,7 +42,7 @@ void ItemHandler::handleMessage(MessageIn *msg)
{
Uint32 id;
Uint16 x, y;
- Sint16 itemId;
+ int itemId;
switch (msg->getId())
{
diff --git a/src/net/npchandler.cpp b/src/net/npchandler.cpp
index 1067a57e..1161bc36 100644
--- a/src/net/npchandler.cpp
+++ b/src/net/npchandler.cpp
@@ -51,7 +51,7 @@ NPCHandler::NPCHandler()
void NPCHandler::handleMessage(MessageIn *msg)
{
- Uint32 id;
+ int id;
switch (msg->getId())
{
diff --git a/src/net/playerhandler.cpp b/src/net/playerhandler.cpp
index ffeb3fab..232cf075 100644
--- a/src/net/playerhandler.cpp
+++ b/src/net/playerhandler.cpp
@@ -166,8 +166,8 @@ void PlayerHandler::handleMessage(MessageIn *msg)
player_node->mY = y;
logger->log("Adjust scrolling by %d:%d",
- (int)scrollOffsetX,
- (int)scrollOffsetY);
+ (int) scrollOffsetX,
+ (int) scrollOffsetY);
viewport->scrollBy(scrollOffsetX, scrollOffsetY);
}
@@ -175,7 +175,7 @@ void PlayerHandler::handleMessage(MessageIn *msg)
case SMSG_PLAYER_STAT_UPDATE_1:
{
- Sint16 type = msg->readInt16();
+ int type = msg->readInt16();
Uint32 value = msg->readInt32();
switch (type)
@@ -303,10 +303,10 @@ void PlayerHandler::handleMessage(MessageIn *msg)
case SMSG_PLAYER_STAT_UPDATE_3:
{
- Sint32 type = msg->readInt32();
- Sint32 base = msg->readInt32();
- Sint32 bonus = msg->readInt32();
- Sint32 total = base + bonus;
+ int type = msg->readInt32();
+ int base = msg->readInt32();
+ int bonus = msg->readInt32();
+ int total = base + bonus;
switch (type) {
case 0x000d: player_node->mAttr[LocalPlayer::STR] = total;
@@ -327,9 +327,9 @@ void PlayerHandler::handleMessage(MessageIn *msg)
case SMSG_PLAYER_STAT_UPDATE_4:
{
- Sint16 type = msg->readInt16();
- Sint8 fail = msg->readInt8();
- Sint8 value = msg->readInt8();
+ int type = msg->readInt16();
+ int fail = msg->readInt8();
+ int value = msg->readInt8();
if (fail != 1)
break;
@@ -406,7 +406,7 @@ void PlayerHandler::handleMessage(MessageIn *msg)
case SMSG_PLAYER_ARROW_MESSAGE:
{
- Sint16 type = msg->readInt16();
+ int type = msg->readInt16();
switch (type) {
case 0:
diff --git a/src/net/skillhandler.cpp b/src/net/skillhandler.cpp
index 8ef37101..be757d7c 100644
--- a/src/net/skillhandler.cpp
+++ b/src/net/skillhandler.cpp
@@ -52,14 +52,14 @@ void SkillHandler::handleMessage(MessageIn *msg)
for (int k = 0; k < skillCount; k++)
{
- Sint16 skillId = msg->readInt16();
+ int skillId = msg->readInt16();
msg->readInt16(); // target type
msg->readInt16(); // unknown
- Sint16 level = msg->readInt16();
- Sint16 sp = msg->readInt16();
+ int level = msg->readInt16();
+ int sp = msg->readInt16();
msg->readInt16(); // range
std::string skillName = msg->readString(24);
- Sint8 up = msg->readInt8();
+ int up = msg->readInt8();
if (level != 0 || up != 0)
{
diff --git a/src/net/tradehandler.cpp b/src/net/tradehandler.cpp
index 98f26cbd..fd772d01 100644
--- a/src/net/tradehandler.cpp
+++ b/src/net/tradehandler.cpp
@@ -141,8 +141,8 @@ void TradeHandler::handleMessage(MessageIn *msg)
case SMSG_TRADE_ITEM_ADD:
{
- Sint32 amount = msg->readInt32();
- Sint16 type = msg->readInt16();
+ int amount = msg->readInt32();
+ int type = msg->readInt16();
msg->readInt8(); // identified flag
msg->readInt8(); // attribute
msg->readInt8(); // refine
@@ -167,7 +167,7 @@ void TradeHandler::handleMessage(MessageIn *msg)
tradeWindow->receivedOk(true);
return;
}
- Sint16 quantity = msg->readInt16();
+ int quantity = msg->readInt16();
switch (msg->readInt8())
{
diff --git a/src/npc.cpp b/src/npc.cpp
index 92ef4d82..c9250415 100644
--- a/src/npc.cpp
+++ b/src/npc.cpp
@@ -34,12 +34,12 @@
#include "resources/npcdb.h"
bool NPC::mTalking = false;
-Uint32 current_npc = 0;
+int current_npc = 0;
static const int NAME_X_OFFSET = 15;
static const int NAME_Y_OFFSET = 30;
-NPC::NPC(Uint32 id, Uint16 job, Map *map, Network *network):
+NPC::NPC(int id, Uint16 job, Map *map, Network *network):
Player(id, job, map), mNetwork(network)
{
NPCInfo info = NPCDB::get(job);
diff --git a/src/npc.h b/src/npc.h
index e1bf9737..137cd5f5 100644
--- a/src/npc.h
+++ b/src/npc.h
@@ -23,8 +23,6 @@
#ifndef NPC_H
#define NPC_H
-#include <SDL_types.h>
-
#include "player.h"
class Network;
@@ -34,7 +32,7 @@ class Text;
class NPC : public Player
{
public:
- NPC(Uint32 id, Uint16 job, Map *map, Network *network);
+ NPC(int id, Uint16 job, Map *map, Network *network);
~NPC();
@@ -55,6 +53,6 @@ class NPC : public Player
Text *mName;
};
-extern Uint32 current_npc;
+extern int current_npc;
#endif