diff options
author | AnnieRuru <jeankof@ymail.com> | 2015-12-16 13:16:41 +0800 |
---|---|---|
committer | Haru <haru@dotalux.com> | 2016-01-05 15:34:45 +0100 |
commit | f836b4a752de8fd6702fab541a5be25fbd26c0e2 (patch) | |
tree | 29cd65058022f903bb45e265150dfdd6490caf77 | |
parent | 7d69fa553131b44752f6b7ea0087617f885b8b8a (diff) | |
download | hercules-f836b4a752de8fd6702fab541a5be25fbd26c0e2.tar.gz hercules-f836b4a752de8fd6702fab541a5be25fbd26c0e2.tar.bz2 hercules-f836b4a752de8fd6702fab541a5be25fbd26c0e2.tar.xz hercules-f836b4a752de8fd6702fab541a5be25fbd26c0e2.zip |
Fix battle config Hp/Sp overflow value
- client can't handle value over 21474836
- SQL also can't save value over 16777215 due to mediumint unsigned
Closes #965 as merged
Signed-off-by: Haru <haru@dotalux.com>
-rw-r--r-- | sql-files/main.sql | 11 | ||||
-rw-r--r-- | sql-files/upgrades/2015-12-16--12-57.sql | 26 | ||||
-rw-r--r-- | src/map/battle.c | 6 |
3 files changed, 35 insertions, 8 deletions
diff --git a/sql-files/main.sql b/sql-files/main.sql index 7adac433d..042722b7c 100644 --- a/sql-files/main.sql +++ b/sql-files/main.sql @@ -1,7 +1,7 @@ -- This file is part of Hercules. -- http://herc.ws - http://github.com/HerculesWS/Hercules -- --- Copyright (C) 2012-2015 Hercules Dev Team +-- Copyright (C) 2012-2016 Hercules Dev Team -- Copyright (C) Athena Dev Teams -- -- Hercules is free software: you can redistribute it and/or modify @@ -152,10 +152,10 @@ CREATE TABLE IF NOT EXISTS `char` ( `INT` SMALLINT(4) UNSIGNED NOT NULL DEFAULT '0', `dex` SMALLINT(4) UNSIGNED NOT NULL DEFAULT '0', `luk` SMALLINT(4) UNSIGNED NOT NULL DEFAULT '0', - `max_hp` MEDIUMINT(8) UNSIGNED NOT NULL DEFAULT '0', - `hp` MEDIUMINT(8) UNSIGNED NOT NULL DEFAULT '0', - `max_sp` MEDIUMINT(6) UNSIGNED NOT NULL DEFAULT '0', - `sp` MEDIUMINT(6) UNSIGNED NOT NULL DEFAULT '0', + `max_hp` INT(9) UNSIGNED NOT NULL DEFAULT '0', + `hp` INT(9) UNSIGNED NOT NULL DEFAULT '0', + `max_sp` INT(9) UNSIGNED NOT NULL DEFAULT '0', + `sp` INT(9) UNSIGNED NOT NULL DEFAULT '0', `status_point` INT(11) UNSIGNED NOT NULL DEFAULT '0', `skill_point` INT(11) UNSIGNED NOT NULL DEFAULT '0', `option` INT(11) NOT NULL DEFAULT '0', @@ -822,6 +822,7 @@ INSERT IGNORE INTO `sql_updates` (`timestamp`) VALUES (1414975503); -- 2014-11-0 INSERT IGNORE INTO `sql_updates` (`timestamp`) VALUES (1435860840); -- 2015-07-02--18-14.sql INSERT IGNORE INTO `sql_updates` (`timestamp`) VALUES (1436360978); -- 2015-07-08--13-08.sql INSERT IGNORE INTO `sql_updates` (`timestamp`) VALUES (1440688342); -- 2015-08-27--20-42.sql +INSERT IGNORE INTO `sql_updates` (`timestamp`) VALUES (1450241859); -- 2015-12-16--12-57.sql INSERT IGNORE INTO `sql_updates` (`timestamp`) VALUES (1450367880); -- 2015-12-17--15-58.sql -- diff --git a/sql-files/upgrades/2015-12-16--12-57.sql b/sql-files/upgrades/2015-12-16--12-57.sql new file mode 100644 index 000000000..cc9ce799e --- /dev/null +++ b/sql-files/upgrades/2015-12-16--12-57.sql @@ -0,0 +1,26 @@ +#1450241859 + +-- This file is part of Hercules. +-- http://herc.ws - http://github.com/HerculesWS/Hercules +-- +-- Copyright (C) 2015-2016 Hercules Dev Team +-- +-- Hercules is free software: you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation, either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see <http://www.gnu.org/licenses/>. + +ALTER TABLE `char` MODIFY COLUMN `max_hp` INT(9) NOT NULL DEFAULT '0'; +ALTER TABLE `char` MODIFY COLUMN `max_sp` INT(9) NOT NULL DEFAULT '0'; +ALTER TABLE `char` MODIFY COLUMN `hp` INT(9) NOT NULL DEFAULT '0'; +ALTER TABLE `char` MODIFY COLUMN `sp` INT(9) NOT NULL DEFAULT '0'; + +INSERT INTO `sql_updates` (`timestamp`) VALUES (1450241859); diff --git a/src/map/battle.c b/src/map/battle.c index 7ceefcf49..201cd6a00 100644 --- a/src/map/battle.c +++ b/src/map/battle.c @@ -2,7 +2,7 @@ * This file is part of Hercules. * http://herc.ws - http://github.com/HerculesWS/Hercules * - * Copyright (C) 2012-2015 Hercules Dev Team + * Copyright (C) 2012-2016 Hercules Dev Team * Copyright (C) Athena Dev Teams * * Hercules is free software: you can redistribute it and/or modify @@ -6925,8 +6925,8 @@ static const struct battle_data { { "max_walk_speed", &battle_config.max_walk_speed, 300, 100, 100*DEFAULT_WALK_SPEED, }, { "max_lv", &battle_config.max_lv, 99, 0, MAX_LEVEL, }, { "aura_lv", &battle_config.aura_lv, 99, 0, INT_MAX, }, - { "max_hp", &battle_config.max_hp, 32500, 100, 1000000000, }, - { "max_sp", &battle_config.max_sp, 32500, 100, 1000000000, }, + { "max_hp", &battle_config.max_hp, 1000000, 100, 21474836, }, + { "max_sp", &battle_config.max_sp, 1000000, 100, 21474836, }, { "max_cart_weight", &battle_config.max_cart_weight, 8000, 100, 1000000, }, { "max_parameter", &battle_config.max_parameter, 99, 10, 10000, }, { "max_baby_parameter", &battle_config.max_baby_parameter, 80, 10, 10000, }, |