Alright guys, I hope this will help with adding more items to zedit. The original thread is
here
. I will be using planet_name for my example.
Alright, lets get started.
ZEDIT.C
1. Search void zedit_setup
Find this line:
Code:
if (zone_table[OLC_ZNUM(d)].builders)
zone->builders = strdup(zone_table[OLC_ZNUM(d)].builders);
Now under it add:
Code:
++ zone->planet_name = strdup(zone_table[OLC_ZNUM(d)].planet_name);
2. Now search for zedit_save_internally
Find this line of code:
Code:
free(zone_table[OLC_ZNUM(d)].builders);
Under it add:
Code:
++ free(zone_table[OLC_ZNUM(d)].planet_name);
Now scroll just a couple lines down and find this line:
Code:
zone_table[OLC_ZNUM(d)].builders = strdup(OLC_ZONE(d)->builders);
Under it add:
Code:
++ zone_table[OLC_ZNUM(d)].planet_name = strdup(OLC_ZONE(d)->planet_name);
3. Now search for zedit_disp_menu
Find this line:
Code:
"%sM%s) Level Range : %s%s%s\r\n"
Under it add:
Code:
++ "%sO) Planet : %s%s%s\r\n"
Scroll down a couple of lines and find this line:
Code:
grn, nrm, levels_set ? cyn : yel, lev_string,
Under it add:
Code:
++ grn, nrm, yel, OLC_ZONE(d)->planet_name ? OLC_ZONE(d)->planet_name : "None.",
4. Now search zedit_parse
Find this block of code:
Code:
case 'm':
case 'M':
/*** Edit zone level restrictions (sub-menu) ***/
zedit_disp_levels(d);
break;
Under it add:
Code:
case 'o':
case 'O':
/* Edit zone planet. */
write_to_output(d, "Enter planet name : ");
OLC_MODE(d) = ZEDIT_ZONE_PLANET;
break;
Find this block of code:
Code:
case ZEDIT_ZONE_TOP:
/* Parse and add new top room in zone and return to main menu. */
if (OLC_ZNUM(d) == top_of_zone_table)
OLC_ZONE(d)->top = LIMIT(atoi(arg), genolc_zonep_bottom(OLC_ZONE(d)), 32000);
else
OLC_ZONE(d)->top = LIMIT(atoi(arg), genolc_zonep_bottom(OLC_ZONE(d)), genolc_zone_bottom(OLC_ZNUM(d) + 1) - 1);
OLC_ZONE(d)->number = 1;
zedit_disp_menu(d);
break;
Under it add:
Code:
++/*-----------------------------------------------------------------------*/
++ case ZEDIT_ZONE_PLANET:
++ /* Name Planet Zone and return to main menu. */
++ if (genolc_checkstring(d, arg)) {
++ if (OLC_ZONE(d)->planet_name)
++ free(OLC_ZONE(d)->planet_name);
++ else
++ log("SYSERR: OLC: ZEDIT_ZONE_PLANET: no planet list to free!");
++ OLC_ZONE(d)->planet_name = strdup(arg);
++ OLC_ZONE(d)->number = 1;
++ }
++ zedit_disp_menu(d);
++ break;
5. Close Zedit.c
DB.C
6. Search void destroy_db
Find this line
Code:
if (zone_table[cnt].builders)
free(zone_table[cnt].builders);
Under it add:
Code:
++ if (zone_table[cnt].planet_name)
++ free(zone_table[cnt].planet_name);
7. Search for void load_zones
Find this line:
Code:
line_num += get_line(fl, buf);
if ((ptr = strchr(buf, '~')) != NULL) /* take off the '~' if it's there */
*ptr = '\0';
Z.name = strdup(buf);
parse_at(Z.name);
Under it add:
Code:
++ line_num += get_line(fl, buf);
++ if ((ptr = strchr(buf, '~')) != NULL) /* take off the '~' if it's there */
++ *ptr = '\0';
++ Z.planet_name = strdup(buf);
8. Close db.c
DB.H
9. Search zone_data
find this line:
Code:
struct reset_com *cmd; /* command table for reset */
and under it add:
Code:
++ char *planet_name;
10. Close db.h
OASIS.H
11. Search for #define ZEDIT_ZONE_CLAIM and under it add:
Code:
++#define ZEDIT_ZONE_PLANET 27
12. Close oasis.h
GENZON.C
13. Search for create_new_zone
Find this line:
Code:
zone->max_level = -1;
Under it add:
Code:
++ zone->planet_name = strdup("None.");
14. Search int save_zone
Now scroll down and find this line:
Code:
/* Print zone header to file. */
fprintf(zfile, "#%d\n"
"%s~\n"
"%s~\n"
Change it to:
Code:
/* Print zone header to file. */
fprintf(zfile, "#%d\n"
"%s~\n"
"%s~\n"
++ "%s~\n"
Now scroll down a few line and find this:
Code:
(zone_table[zone_num].name && *zone_table[zone_num].name) ? convert_from_tabs(zone_table[zone_num].name) : "undefined",
Under it add:
Code:
++ (zone_table[zone_num].planet_name && *zone_table[zone_num].planet_name) ? zone_table[zone_num].planet_name : "None.",
Now scroll down and find this line again:
Code:
/* Print zone header to file. */
fprintf(zfile, "#%d\n"
"%s~\n"
"%s~\n"
Change it to:
Code:
/* Print zone header to file. */
fprintf(zfile, "#%d\n"
"%s~\n"
"%s~\n"
++ "%s~\n"
Now scroll down a few line and find this:
Code:
(zone_table[zone_num].name && *zone_table[zone_num].name) ? convert_from_tabs(zone_table[zone_num].name) : "undefined",
Under it add:
Code:
++ (zone_table[zone_num].planet_name && *zone_table[zone_num].planet_name) ? zone_table[zone_num].planet_name : "None.",
Hopefully, I got everything right. Remember, I'm using planet_name as an example. Change it to something you want to use.
Thanks to Gahan for pointing me into the right direction. Thanks to Vatiken for being a ghost with a pulse
.