-
Notifications
You must be signed in to change notification settings - Fork 762
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hercules Ultimate Storage System #2724
Conversation
from ci, look like shadow variable |
Windows compile fine for now, will be checking linux warnings and errors soon. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
some checks probably already added in last commit, but i checked commit by commit from start
In my opinion the Xcode upgrade should not be part of this PR since it's not required. |
Ok, will remove it, I had just migrated it from old code to new code |
ab0a8dc
to
772ff5e
Compare
14871b7
to
274ec5b
Compare
@4144 @Kenpachi2k13 can you review again? |
src/map/clif.c
Outdated
return; | ||
} | ||
|
||
nullpo_retv(stor); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this nullpo probably need move into if
block, because after if
block, stor is non null
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
src/map/clif.c
Outdated
struct storage_data *stor = storage->ensure(sd, sd->storage.current); | ||
if (stor != NULL) | ||
storage->get(sd, stor, item_index, item_amount); | ||
} else if(sd->state.storage_flag == STORAGE_FLAG_GUILD) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be else if (sd->...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
src/map/intif.c
Outdated
if ((stor = storage->ensure(sd, RFIFOW(fd, 8))) == NULL) | ||
return; | ||
|
||
Assert_retv(stor != NULL); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
here stor
is not null
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
src/map/intif.c
Outdated
if ((stor = storage->ensure(sd, storage_id)) == NULL) | ||
return; | ||
|
||
Assert_retv(stor != NULL); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and here stor
is not null
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
nice bro |
Anyone currently using this on their server? |
@dastgirp you can complete this? |
dreams come true :D? |
src/map/unit.c
Outdated
@@ -2875,8 +2875,7 @@ static int unit_free(struct block_list *bl, enum clr_type clrtype) | |||
sd->combo_count = 0; | |||
/* [Ind/Hercules] */ | |||
if( sd->sc_display_count ) { | |||
int i; | |||
for(i = 0; i < sd->sc_display_count; i++) { | |||
for(int i = 0; i < sd->sc_display_count; i++) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing space after for
and the curly brackets could be removed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
src/map/unit.c
Outdated
@@ -2891,11 +2890,18 @@ static int unit_free(struct block_list *bl, enum clr_type clrtype) | |||
} | |||
VECTOR_CLEAR(sd->channels); | |||
VECTOR_CLEAR(sd->script_queues); | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any reason for this empty line?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no, might be due to merge from old commit to here
@@ -95,37 +97,105 @@ static void do_reconnect_storage(void) | |||
gstorage->db->foreach(gstorage->db, storage->reconnect_sub); | |||
} | |||
|
|||
/** | |||
* Get a storage id by its name (through @commands etc...) | |||
* @param[in] storage_name pointer to the storage name char array. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please separate the description and the parameter list with an empty comment line.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
|
||
/** | ||
* Get storage with a particular ID from a player. | ||
* @param[in] sd pointer to map session data. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please separate the description and the parameter list with an empty comment line.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
src/map/storage.c
Outdated
int i = 0; | ||
struct storage_data *stor = NULL; | ||
|
||
nullpo_retr(NULL, sd); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do the NULL
pointer check prior to declaring/initialising the variables.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
src/char/mapif.c
Outdated
* @param fd [in] file/socket descriptor. | ||
* @return 1 on success, 0 on failure. | ||
*/ | ||
static int mapif_parse_AccountStorageSave(int fd) | ||
{ | ||
int payload_size = RFIFOW(fd, 2) - 8, account_id = RFIFOL(fd, 4); | ||
int payload_size = RFIFOW(fd, 2) - 10, account_id = RFIFOL(fd, 4); | ||
short storage_id = RFIFOW(fd, 8); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
short storage_id = RFIFOW(fd, 8); | |
int storage_id = RFIFOW(fd, 8); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is of 2 bytes, only, but as I see other are using int, changed it. done
|
||
return 1; | ||
} | ||
|
||
/** | ||
* Sends an acknowledgement for the save | ||
* status of the account storage. | ||
* @packet 0x3808 [out] <account_id>.L <save_flag>.B | ||
* @packet 0x3808 [out] <account_id>.L <storage_id>.W <save_flag>.B | ||
* @param fd [in] File/Socket Descriptor. | ||
* @param account_id [in] Account ID of the storage in question. | ||
* @param flag [in] Save flag, true for success and false for failure. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add parameter storage_id
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
src/char/int_storage.c
Outdated
bool *matched_p = NULL; | ||
int *delete = NULL; | ||
int total_deletes = 0, total_updates = 0, total_inserts = 0; | ||
int total_changes = 0; | ||
int cp_size = 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix variable scopes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
sql-files/main.sql
Outdated
@@ -947,6 +948,7 @@ INSERT IGNORE INTO `sql_updates` (`timestamp`) VALUES (1588301040); -- 2020-05-0 | |||
CREATE TABLE IF NOT EXISTS `storage` ( | |||
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT, | |||
`account_id` INT UNSIGNED NOT NULL DEFAULT '0', | |||
`storage_id` INT(11) UNSIGNED NOT NULL DEFAULT '1', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
`storage_id` INT(11) UNSIGNED NOT NULL DEFAULT '1', | |
`storage_id` INT UNSIGNED NOT NULL DEFAULT '1', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
-- 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 `storage` ADD `storage_id` INT(11) UNSIGNED NOT NULL DEFAULT '1' AFTER `account_id`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ALTER TABLE `storage` ADD `storage_id` INT(11) UNSIGNED NOT NULL DEFAULT '1' AFTER `account_id`; | |
ALTER TABLE `storage` ADD `storage_id` INT UNSIGNED NOT NULL DEFAULT '1' AFTER `account_id`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
@dastgirp something about that? |
@Kenpachi2k13 updated to latest commit and made all changes that were mentioned by you. |
look like compilation errors in all or most jobs |
was problem with scope, fixed it. |
@dastgirp Can you complete this? Seems to be having conflicts again... =( |
It was already completed but for some reason not merged, |
By the way, quick question, is there a particular reason why you began storage IDs at 1 instead of 0 and did not made a default storage ID? (ie. When no storage ID is specified, default to 0 and open the basic storage)?Just curious, no need to rewrite anything on my account 😅As for milestones and etc I don't know, GitHub said it was waiting for @Kenpachi2k13 to review but I don't know if that's true or not =/But it might be related to why the PR has no tags and wasn't merged already?
|
@@ -11372,10 +11372,30 @@ static BUILDIN(gettimestr) | |||
static BUILDIN(openstorage) | |||
{ | |||
struct map_session_data *sd = script->rid2sd(st); | |||
if (sd == NULL) | |||
int storage_id = script_getnum(st, 2); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not making this optional, as you need to have a storage 1 configured (SQL, for example) and considering it would improve compatibility?
int storage_id = script_getnum(st, 2); | |
int storage_id = script_hasdata(st, 2) ? script_getnum(st, 2) : 1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Having this as optional is a way, but it won't tell others something is wrong.
Specifying storage id is better as it's clear that storage 1 will be used.
You can have any id you want, (even remove the Id 1), so having this optional would make it more confusing
Does anyone have any news about? |
It was already completed but for some reason not merged, If it is going to be merged in next cycle, I can fix the conflicts again, but without confirmation, it would just keep on conflicting with every new release, so, I won't be fixing conflict as of now until confirmation is received or some changes are requested.
It's officially on hold, I believe.
…-- Sent from Yandex.Mail for mobile
12:10, July 1, 2021, Bruno Silva ***@***.***>:
Does anyone have any news about?
—You are receiving this because you commented.Reply to this email directly, view it on GitHub, or unsubscribe.
|
Any news about this? |
One day it will become a reality. Lol. |
@dastgirp @MishimaHaruna can we have a definitive merging window and finish this? |
Four years already :'( |
Pull Request Prelude
Changes Proposed
Design
Implementation of the Hercules Ultimate Storage System
Storages can now be created through a configuration file that describes their attributes.
Example storage configuration:
Additional storages are handled with dynamic arrays that will save a tonne of memory when created, as opposed to a design in which they were implemented using fixed length arrays. In simple terms, a storage of 600 items would approximately cost the same amount of memory as 600 storages with 1 item each.
They are saved in the same storage database (SQL) as the original separating them by a storage identifier.
An infinite number of storages can be created, there are no limits.
The current design implementation only allow saving/loading of approximately 1600 items per storage due to packet size limits.
PS. Make sure you apply SQL upgrades for this patch!
Access Modes
Storage access modes can be set through the
openstorage
builtin command.Default storage mode : STORAGE_ACCESS_ALL
Script Commands
Changed:
openstorage(<storage_id>{, <storage_mode>})
Issues addressed: