forked from github/server
assert that we do not add new ship types after the per-language lookup is initialized.
This commit is contained in:
parent
dd4bdca72b
commit
6778cbe483
1 changed files with 4 additions and 5 deletions
|
@ -53,8 +53,8 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
selist *shiptypes = NULL;
|
selist *shiptypes = NULL; /* do not use this list for searching*/
|
||||||
static critbit_tree cb_shiptypes;
|
static critbit_tree cb_shiptypes; /* use this trie instead */
|
||||||
|
|
||||||
static local_names *snames;
|
static local_names *snames;
|
||||||
|
|
||||||
|
@ -63,9 +63,7 @@ const ship_type *findshiptype(const char *name, const struct locale *lang)
|
||||||
local_names *sn = snames;
|
local_names *sn = snames;
|
||||||
variant var;
|
variant var;
|
||||||
|
|
||||||
while (sn) {
|
while (sn && sn->lang != lang) {
|
||||||
if (sn->lang == lang)
|
|
||||||
break;
|
|
||||||
sn = sn->next;
|
sn = sn->next;
|
||||||
}
|
}
|
||||||
if (!sn) {
|
if (!sn) {
|
||||||
|
@ -111,6 +109,7 @@ const ship_type *st_find(const char *name) {
|
||||||
|
|
||||||
ship_type *st_get_or_create(const char * name) {
|
ship_type *st_get_or_create(const char * name) {
|
||||||
ship_type * st = st_find_i(name);
|
ship_type * st = st_find_i(name);
|
||||||
|
assert(!snames);
|
||||||
if (!st) {
|
if (!st) {
|
||||||
size_t len;
|
size_t len;
|
||||||
char data[64];
|
char data[64];
|
||||||
|
|
Loading…
Reference in a new issue