summaryrefslogtreecommitdiff
path: root/src/map/atcommand.c
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2013-09-21 10:59:19 +0200
committerHaru <haru@dotalux.com>2013-09-21 10:59:19 +0200
commit0d12201adecaf21fccfee8e62a2d2a5582535ae3 (patch)
tree950c673626548818c1ea8abd0165541d40192da8 /src/map/atcommand.c
parent51241f66ad6e78cf56b91c41e524c00a1d5abeb2 (diff)
downloadhercules-0d12201adecaf21fccfee8e62a2d2a5582535ae3.tar.gz
hercules-0d12201adecaf21fccfee8e62a2d2a5582535ae3.tar.bz2
hercules-0d12201adecaf21fccfee8e62a2d2a5582535ae3.tar.xz
hercules-0d12201adecaf21fccfee8e62a2d2a5582535ae3.zip
Corrected invalid values assigned to enum homun_type variables
- Fixes a warning in clang-5.0.0 (and a potentially incorrect/undefined behavior of the related code) Signed-off-by: Haru <haru@dotalux.com>
Diffstat (limited to 'src/map/atcommand.c')
-rw-r--r--src/map/atcommand.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/map/atcommand.c b/src/map/atcommand.c
index 8eb3bfd44..fa3108df8 100644
--- a/src/map/atcommand.c
+++ b/src/map/atcommand.c
@@ -6838,27 +6838,26 @@ ACMD(showmobs)
/*==========================================
* homunculus level up [orn]
*------------------------------------------*/
-ACMD(homlevel)
-{
+ACMD(homlevel) {
TBL_HOM * hd;
int level = 0;
enum homun_type htype;
nullpo_retr(-1, sd);
- if ( !message || !*message || ( level = atoi(message) ) < 1 ) {
+ if( !message || !*message || ( level = atoi(message) ) < 1 ) {
clif->message(fd, msg_txt(1253)); // Please enter a level adjustment (usage: @homlevel <number of levels>).
return false;
}
- if ( !homun_alive(sd->hd) ) {
+ if( !homun_alive(sd->hd) ) {
clif->message(fd, msg_txt(1254)); // You do not have a homunculus.
return false;
}
hd = sd->hd;
- if((htype = homun->class2type(hd->homunculus.class_)) == -1) {
+ if( (htype = homun->class2type(hd->homunculus.class_)) == HT_INVALID ) {
ShowError("atcommand_homlevel: invalid homun class %d (player %s)\n", hd->homunculus.class_,sd->status.name);
return false;
}
@@ -6920,12 +6919,12 @@ ACMD(hommutate) {
enum homun_type m_class, m_id;
nullpo_retr(-1, sd);
- if (!homun_alive(sd->hd)) {
+ if( !homun_alive(sd->hd) ) {
clif->message(fd, msg_txt(1254)); // You do not have a homunculus.
return false;
}
- if (!message || !*message) {
+ if( !message || !*message ) {
homun_id = 6048 + (rnd() % 4);
} else {
homun_id = atoi(message);
@@ -6934,7 +6933,7 @@ ACMD(hommutate) {
m_class = homun->class2type(sd->hd->homunculus.class_);
m_id = homun->class2type(homun_id);
- if (m_class != -1 && m_id != -1 && m_class == HT_EVO && m_id == HT_S && sd->hd->homunculus.level >= 99) {
+ if( m_class != HT_INVALID && m_id != HT_INVALID && m_class == HT_EVO && m_id == HT_S && sd->hd->homunculus.level >= 99 ) {
homun->mutate(sd->hd, homun_id);
} else {
clif->emotion(&sd->hd->bl, E_SWT);