Fixed char_id sql type

This commit is contained in:
Daegaladh 2024-09-09 18:33:33 +02:00
parent 29010fa544
commit 6641fde489
3 changed files with 5 additions and 4 deletions

View File

@ -655,7 +655,7 @@ CREATE TABLE IF NOT EXISTS `guild_storage_log` (
CREATE TABLE IF NOT EXISTS `homunculus` (
`homun_id` int(11) NOT NULL auto_increment,
`char_id` int(11) NOT NULL,
`char_id` int(11) unsigned NOT NULL,
`class` mediumint(9) unsigned NOT NULL default '0',
`prev_class` mediumint(9) NOT NULL default '0',
`name` varchar(24) NOT NULL default '',

View File

@ -1,3 +1,4 @@
ALTER TABLE `homunculus`
CHANGE COLUMN `sp` `sp` INT(11) UNSIGNED NOT NULL DEFAULT '0' AFTER `max_hp`,
CHANGE COLUMN `max_sp` `max_sp` INT(11) UNSIGNED NOT NULL DEFAULT '0' AFTER `sp`;
CHANGE COLUMN `char_id` `char_id` INT(11) UNSIGNED NOT NULL,
CHANGE COLUMN `sp` `sp` INT(11) UNSIGNED NOT NULL DEFAULT '0',
CHANGE COLUMN `max_sp` `max_sp` INT(11) UNSIGNED NOT NULL DEFAULT '0';

View File

@ -175,7 +175,7 @@ bool mapif_homunculus_load(int homun_id, struct s_homunculus* hd)
}
hd->hom_id = homun_id;
Sql_GetData(sql_handle, 1, &data, nullptr); hd->char_id = atoi(data);
Sql_GetData(sql_handle, 1, &data, nullptr); hd->char_id = static_cast<unsigned int>(strtoul(data, nullptr, 10));
Sql_GetData(sql_handle, 2, &data, nullptr); hd->class_ = atoi(data);
Sql_GetData(sql_handle, 3, &data, nullptr); hd->prev_class = atoi(data);
Sql_GetData(sql_handle, 4, &data, &len); safestrncpy(hd->name, data, sizeof(hd->name));