-static void add_win_to_winDB(struct Win * win)
-{
- char * f_name = "add_win_to_winDB()";
- if (world.winDB.ids)
- {
- uint8_t old_ids_size = strlen(world.winDB.ids);
- char * new_ids = try_malloc(old_ids_size + 1 + 1, f_name);
- sprintf(new_ids, "%s%c", world.winDB.ids, win->id);
- free(world.winDB.ids);
- world.winDB.ids = new_ids;
- uint16_t old_wins_size = old_ids_size * sizeof(struct Win);
- uint16_t new_wins_size = old_wins_size + sizeof(struct Win);
- struct Win * new_wins = try_malloc(new_wins_size, f_name);
- memcpy(new_wins, world.winDB.wins, old_wins_size);
- new_wins[old_ids_size] = *win;
- free(world.winDB.wins);
- world.winDB.wins = new_wins;
- return;
- }
- world.winDB.ids = try_malloc(2, f_name);
- sprintf(world.winDB.ids, "%c", win->id);
- world.winDB.wins = try_malloc(sizeof(struct Win), f_name);
- world.winDB.wins[0] = *win;
-}
-
-
-