diff --git a/sql-files/main.sql b/sql-files/main.sql index 386b3aca52..fc65fe2a26 100644 --- a/sql-files/main.sql +++ b/sql-files/main.sql @@ -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 '', diff --git a/sql-files/upgrades/upgrade_20240907.sql b/sql-files/upgrades/upgrade_20240907.sql index 128dc2124d..b746ce1bd9 100644 --- a/sql-files/upgrades/upgrade_20240907.sql +++ b/sql-files/upgrades/upgrade_20240907.sql @@ -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'; diff --git a/src/char/int_homun.cpp b/src/char/int_homun.cpp index 1c4ae8379d..3128afa9c1 100644 --- a/src/char/int_homun.cpp +++ b/src/char/int_homun.cpp @@ -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(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));