diff options
author | Kenpachi2k13 <3476227+Kenpachi2k13@users.noreply.github.com> | 2020-05-05 01:00:27 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-05 01:00:27 +0200 |
commit | 66607bfbfe197a5fec86dd1efe34a2da80929648 (patch) | |
tree | ed0e97ddc134c82067a436ea3ffd67f2f46be60b /src/plugins/constdb2doc.c | |
parent | 3f6b7497531f9ace331ca74d271898e938245c04 (diff) | |
parent | 944d8489f1bcca93e6b2ff06a159084f064dce12 (diff) | |
download | hercules-66607bfbfe197a5fec86dd1efe34a2da80929648.tar.gz hercules-66607bfbfe197a5fec86dd1efe34a2da80929648.tar.bz2 hercules-66607bfbfe197a5fec86dd1efe34a2da80929648.tar.xz hercules-66607bfbfe197a5fec86dd1efe34a2da80929648.zip |
Merge branch 'master' into configure_newopt
Diffstat (limited to 'src/plugins/constdb2doc.c')
-rw-r--r-- | src/plugins/constdb2doc.c | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/src/plugins/constdb2doc.c b/src/plugins/constdb2doc.c index 3f681ea1a..5d01aa360 100644 --- a/src/plugins/constdb2doc.c +++ b/src/plugins/constdb2doc.c @@ -2,8 +2,8 @@ * This file is part of Hercules. * http://herc.ws - http://github.com/HerculesWS/Hercules * - * Copyright (C) 2016 Hercules Dev Team - * Copyright (C) 2016 Haru <haru@dotalux.com> + * Copyright (C) 2016-2020 Hercules Dev Team + * Copyright (C) 2016 Haru <haru@dotalux.com> * * Hercules is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -22,7 +22,8 @@ /// db/constants.conf -> doc/constants.md generator plugin #include "common/hercules.h" -//#include "common/memmgr.h" +#include "common/db.h" +#include "common/memmgr.h" #include "common/nullpo.h" #include "common/strlib.h" #include "map/itemdb.h" @@ -143,17 +144,26 @@ struct item_data *constdb2doc_itemdb_search(int nameid) void constdb2doc_itemdb(void) { - int i; - nullpo_retv(out_fp); fprintf(out_fp, "## Items (db/"DBPATH"item_db.conf)\n"); - for (i = 0; i < ARRAYLENGTH(itemdb->array); i++) { + for (int i = 0; i < ARRAYLENGTH(itemdb->array); i++) { struct item_data *id = constdb2doc_itemdb_search(i); if (id == NULL || id->name[0] == '\0') continue; fprintf(out_fp, "- `%s`: %d\n", id->name, id->nameid); } + + if (db_size(itemdb->other) > 0) { + struct DBIterator *iter = db_iterator(itemdb->other); + for (struct item_data *itd = dbi_first(iter); dbi_exists(iter); itd = dbi_next(iter)) { + if (itd == &itemdb->dummy) + continue; + fprintf(out_fp, "- `%s`: %d\n", itd->name, itd->nameid); + } + dbi_destroy(iter); + } + fprintf(out_fp, "\n"); } |