summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-05-31 14:06:22 +0000
committerskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-05-31 14:06:22 +0000
commit8f6123730efe4fb57d9895e032967fefb0a00d40 (patch)
treefc46c25ff9d7d99aed5ff04ed48221009cf47a97
parent54dad80936720297e048dd8faf33d0147ebed9ae (diff)
downloadhercules-8f6123730efe4fb57d9895e032967fefb0a00d40.tar.gz
hercules-8f6123730efe4fb57d9895e032967fefb0a00d40.tar.bz2
hercules-8f6123730efe4fb57d9895e032967fefb0a00d40.tar.xz
hercules-8f6123730efe4fb57d9895e032967fefb0a00d40.zip
- Removed typedef bool from socket.h and included cbasetypes.c instead.
- Cleaned up and corrected the calculation of hit/flee/cri/lucky dodge in status_calc_bl. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@6890 54d463be-8e91-2dee-dedb-b68131a5f0ec
-rw-r--r--Changelog-Trunk.txt4
-rw-r--r--src/common/socket.h30
-rw-r--r--src/map/status.c48
3 files changed, 29 insertions, 53 deletions
diff --git a/Changelog-Trunk.txt b/Changelog-Trunk.txt
index ae8f59fcc..9325c9ee3 100644
--- a/Changelog-Trunk.txt
+++ b/Changelog-Trunk.txt
@@ -4,6 +4,10 @@ AS OF SVN REV. 5091, WE ARE NOW USING TRUNK. ALL UNTESTED BUGFIXES/FEATURES GO
IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
2006/05/31
+ * Removed typedef bool from socket.h and included cbasetypes.c instead.
+ [Skotlex]
+ * Cleaned up and corrected the calculation of hit/flee/cri/lucky dodge in
+ status_calc_bl. [Skotlex]
* [Improved]:
- SQL upgrade file for the new loginlog. Thanks to ultramage. [Lance]
* [Fixed]:
diff --git a/src/common/socket.h b/src/common/socket.h
index ba27e34a8..a6a0fb191 100644
--- a/src/common/socket.h
+++ b/src/common/socket.h
@@ -16,6 +16,7 @@
#endif
#include <time.h>
#include "malloc.h"
+#include "cbasetypes.h"
extern time_t last_tick;
extern time_t stall_time;
@@ -121,41 +122,12 @@ extern struct socket_data *session[FD_SETSIZE];
extern int fd_max;
-
-
-
-
-/////////////////////////////
-// for those still not building c++
-#ifndef __cplusplus
-//////////////////////////////
-
-// boolean types for C
-typedef int bool;
-#define false (1==0)
-#define true (1==1)
-
-//////////////////////////////
-#endif // not cplusplus
-//////////////////////////////
-
-
-
//////////////////////////////////
// some checking on sockets
extern bool session_isValid(int fd);
extern bool session_isActive(int fd);
//////////////////////////////////
-
-
-
-
-
-
-
-
-
// Function prototype declaration
int make_listen_port(int);
diff --git a/src/map/status.c b/src/map/status.c
index 48212875d..51f49ecda 100644
--- a/src/map/status.c
+++ b/src/map/status.c
@@ -2498,54 +2498,54 @@ void status_calc_bl(struct block_list *bl, unsigned long flag)
}
if(flag&SCB_HIT) {
- status->hit = b_status->hit - b_status->dex + status->dex;
- status->hit = status_calc_hit(bl, sc, status->hit);
+ if (status->dex == b_status->dex)
+ status->hit = status_calc_hit(bl, sc, b_status->hit);
+ else
+ status->hit = status_calc_hit(bl, sc, b_status->hit +(status->dex - b_status->dex));
}
if(flag&SCB_FLEE) {
- status->flee = b_status->flee - b_status->agi + status->agi;
- status->flee = status_calc_flee(bl, sc, status->flee);
+ if (status->agi == b_status->agi)
+ status->flee = status_calc_flee(bl, sc, b_status->flee);
+ else
+ status->flee = status_calc_flee(bl, sc, b_status->flee +(status->agi - b_status->agi));
}
if(flag&SCB_DEF)
status->def = status_calc_def(bl, sc, b_status->def);
if(flag&SCB_DEF2) {
- status->def2 = status->vit;
- temp = b_status->def2 - b_status->vit;
- if (temp)
- status->def2+=temp;
- status->def2 = status_calc_def2(bl, sc, status->def2);
+ if (status->vit == b_status->vit)
+ status->def2 = status_calc_def2(bl, sc, b_status->def2);
+ else
+ status->def2 = status_calc_def2(bl, sc, b_status->def2 + (status->vit - b_status->vit));
}
if(flag&SCB_MDEF)
status->mdef = status_calc_mdef(bl, sc, b_status->mdef);
if(flag&SCB_MDEF2) {
- status->mdef2 = status->int_ + (status->vit>>1);
- temp = b_status->mdef2 -(b_status->int_ + (b_status->vit>>1));
- if (temp)
- status->mdef2+=temp;
- status->mdef2 = status_calc_mdef2(bl, sc, status->mdef2);
+ if (status->int_ == b_status->int_ && status->vit == b_status->vit)
+ status->mdef2 = status_calc_mdef2(bl, sc, b_status->mdef2);
+ else
+ status->mdef2 = status_calc_mdef2(bl, sc, b_status->mdef2 +(status->int_ - b_status->int_) +((status->vit - b_status->vit)>>1));
}
if(flag&SCB_SPEED)
status->speed = status_calc_speed(bl, sc, b_status->speed);
if(flag&SCB_CRI && b_status->cri) {
- status->cri = status->luk*3 + 10;
- temp = b_status->cri - (b_status->luk*3 + 10);
- if (temp)
- status->cri += temp;
- status->cri = status_calc_critical(bl, sc, status->cri);
+ if (status->luk == b_status->luk)
+ status->cri = status_calc_critical(bl, sc, b_status->cri);
+ else
+ status->cri = status_calc_critical(bl, sc, b_status->cri + 3*(status->luk - b_status->luk));
}
if(flag&SCB_FLEE2 && b_status->flee2) {
- status->flee2 = status->luk + 10;
- temp = b_status->flee2 - b_status->flee2 + 10;
- if (temp)
- status->flee2 += temp;
- status->flee2 = status_calc_flee2(bl, sc, status->flee2);
+ if (status->luk == b_status->luk)
+ status->flee2 = status_calc_flee2(bl, sc, b_status->flee2);
+ else
+ status->flee2 = status_calc_flee2(bl, sc, b_status->flee2 +(status->luk - b_status->luk));
}
if(flag&SCB_ATK_ELE) {