- world.commandDB.cmds[i].arg = arg_string[0];
- copy_tokenized_string(NULL, &world.commandDB.cmds[i].dsc_long, "\n");
+ cmd.arg = arg_string[0];
+ copy_tokenized_string(NULL, &cmd.dsc_long, "\n");
+ uint32_t old_size = i * sizeof(struct Command);
+ uint32_t new_size = old_size + sizeof(struct Command);
+ struct Command * new_cmds = try_malloc(new_size, f_name);
+ memcpy(new_cmds, world.commandDB.cmds, old_size);
+ new_cmds[i] = cmd;
+ free(world.commandDB.cmds);
+ world.commandDB.cmds = new_cmds;