diff options
author | Bardur Arantsson <bardur@scientician.net> | 2018-03-25 20:07:31 +0200 |
---|---|---|
committer | Bardur Arantsson <bardur@scientician.net> | 2018-03-25 20:07:31 +0200 |
commit | bf0ddb1341419740684db08812c3b077d101d25d (patch) | |
tree | fa3b5c1a13c126e5d2c28e6b667cd043350f1f46 /src | |
parent | decd9655b60f7437e58e76b92ff658b639b5f92a (diff) |
Remove 'cptr' typedef
It's time to rip off the band-aid.
Diffstat (limited to 'src')
105 files changed, 583 insertions, 589 deletions
diff --git a/src/birth.cc b/src/birth.cc index e6dffab9..e108985b 100644 --- a/src/birth.cc +++ b/src/birth.cc @@ -149,7 +149,7 @@ static std::string create_random_name() } -void print_desc_aux(cptr txt, int y, int xx) +void print_desc_aux(const char *txt, int y, int xx) { int i = -1, x = xx; @@ -168,7 +168,7 @@ void print_desc_aux(cptr txt, int y, int xx) } } -void print_desc(cptr txt) +void print_desc(const char *txt) { print_desc_aux(txt, 12, 1); } @@ -785,7 +785,7 @@ static void player_outfit_object(int qty, int tval, int sval) /* * Give player a spell book. */ -static void player_outfit_spellbook(cptr spell_name) +static void player_outfit_spellbook(const char *spell_name) { if (auto spell_idx = find_spell(spell_name)) { @@ -810,7 +810,7 @@ static void player_outfit_spellbook(cptr spell_name) static void player_outfit() { // Shorthand names for convenience - cptr class_name = spp_ptr->title; + const char *class_name = spp_ptr->title; auto const &subrace_name = rmp_ptr->title; /* @@ -988,7 +988,7 @@ static void dump_classes(std::vector<u16b> const &classes, int sel, u32b *restri for (int n = 0; n < n_max; n++) { - cptr mod = ""; + const char *mod = ""; char p2 = ')', p1 = ' '; /* Analyze */ @@ -1227,7 +1227,7 @@ static int dump_gods(int sel, int *choice, int max) { int i, j; char buf[80]; - cptr str; + const char *str; /* Clean up */ clear_from(12); diff --git a/src/birth.hpp b/src/birth.hpp index 82bdfcf6..30e90212 100644 --- a/src/birth.hpp +++ b/src/birth.hpp @@ -2,7 +2,7 @@ #include "h-basic.h" -void print_desc_aux(cptr txt, int y, int x); +void print_desc_aux(const char *txt, int y, int x); void save_savefile_names(); bool_ begin_screen(); void player_birth(); diff --git a/src/bldg.cc b/src/bldg.cc index 1e11a16f..bbbf7f10 100644 --- a/src/bldg.cc +++ b/src/bldg.cc @@ -324,7 +324,7 @@ static bool_ gamble_comm(int cmd) char out_val[160], tmp_str[80], again; - cptr p; + const char *p; screen_save(); diff --git a/src/cli_comm.hpp b/src/cli_comm.hpp index 6ae53edc..1269fca8 100644 --- a/src/cli_comm.hpp +++ b/src/cli_comm.hpp @@ -7,7 +7,7 @@ */ struct cli_comm { - cptr comm; /* Extended name of the command. */ - cptr descrip; /* Description of the command. */ + const char *comm; /* Extended name of the command. */ + const char *descrip; /* Description of the command. */ s16b key; /* Key to convert command to. */ }; diff --git a/src/cmd1.cc b/src/cmd1.cc index 8062b4e2..2cc425bd 100644 --- a/src/cmd1.cc +++ b/src/cmd1.cc @@ -561,7 +561,7 @@ static void carried_monster_attack(s16b m_idx, bool_ *fear, bool_ *mdeath, int power = 0; int damage = 0; - cptr act = NULL; + const char *act = NULL; /* Extract the attack infomation */ int effect = r_ptr->blow[ap_cnt].effect; @@ -1055,7 +1055,7 @@ static void incarnate_monster_attack(s16b m_idx, bool_ *fear, bool_ *mdeath, int power = 0; int damage = 0; - cptr act = NULL; + const char *act = NULL; /* Extract the attack infomation */ int effect = r_ptr->blow[ap_cnt].effect; @@ -3021,8 +3021,8 @@ void move_player_aux(int dir, int do_pickup, int run) else if (cave[y][x].feat >= FEAT_ALTAR_HEAD && cave[y][x].feat <= FEAT_ALTAR_TAIL) { - cptr name = f_info[cave[y][x].feat].name; - cptr pref = (is_a_vowel(name[0])) ? "an" : "a"; + const char *name = f_info[cave[y][x].feat].name; + const char *pref = (is_a_vowel(name[0])) ? "an" : "a"; msg_format("You see %s %s.", pref, name); diff --git a/src/cmd2.cc b/src/cmd2.cc index ce459068..0dab2cb6 100644 --- a/src/cmd2.cc +++ b/src/cmd2.cc @@ -2207,7 +2207,7 @@ void do_cmd_rest() /* Prompt for time if needed */ if (command_arg <= 0) { - cptr p = "Rest (0-9999, '*' for HP/SP, '&' as needed): "; + const char *p = "Rest (0-9999, '*' for HP/SP, '&' as needed): "; char out_val[80]; @@ -2641,7 +2641,7 @@ void do_cmd_fire() bool_ fear = FALSE; /* Assume a default death */ - cptr note_dies = " dies."; + const char *note_dies = " dies."; /* Some monsters get "destroyed" */ if ((r_ptr->flags & RF_DEMON) || @@ -3051,7 +3051,7 @@ void do_cmd_throw() bool_ fear = FALSE; /* Assume a default death */ - cptr note_dies = " dies."; + const char *note_dies = " dies."; /* Some monsters get "destroyed" */ if ((r_ptr->flags & RF_DEMON) || @@ -3375,7 +3375,7 @@ void do_cmd_boomerang() bool_ fear = FALSE; /* Assume a default death */ - cptr note_dies = " dies."; + const char *note_dies = " dies."; /* Some monsters get "destroyed" */ if ((r_ptr->flags & RF_DEMON) || diff --git a/src/cmd3.cc b/src/cmd3.cc index 1a47abcb..1215b4ce 100644 --- a/src/cmd3.cc +++ b/src/cmd3.cc @@ -222,7 +222,7 @@ void do_cmd_wield() object_type *i_ptr; - cptr act; + const char *act; char o_name[80]; @@ -1104,7 +1104,7 @@ void do_cmd_locate() * The table of "symbol info" -- each entry is a string of the form * "X:desc" where "X" is the trigger, and "desc" is the "info". */ -static cptr ident_info[] = +static const char *ident_info[] = { " :A dark grid", "!:A potion (or oil)", @@ -1611,7 +1611,7 @@ bool_ do_cmd_sense_grid_mana() /* * Try to add a CLI action. */ -void cli_add(cptr active, cptr trigger, cptr descr) +void cli_add(const char *active, const char *trigger, const char *descr) { s16b num; cli_comm *cli_ptr, *old_ptr; @@ -1647,7 +1647,7 @@ void cli_add(cptr active, cptr trigger, cptr descr) if (strchr(trigger, '\'')) { char temp[80], *t; - cptr s; + const char *s; for (s = trigger, t = temp; ; s++, t++) { /* tokenize() causes each ' to be followed by another character, @@ -1692,7 +1692,7 @@ void cli_add(cptr active, cptr trigger, cptr descr) /* * Get a string using CLI completion. */ -static bool_ get_string_cli(cptr prompt, char *buf, int len) +static bool_ get_string_cli(const char *prompt, char *buf, int len) { bool_ res; diff --git a/src/cmd3.hpp b/src/cmd3.hpp index 97d3e22f..90044671 100644 --- a/src/cmd3.hpp +++ b/src/cmd3.hpp @@ -3,7 +3,7 @@ #include "h-basic.h" void do_cmd_html_dump(); -void cli_add(cptr active, cptr trigger, cptr descr); +void cli_add(const char *active, const char *trigger, const char *descr); void do_cmd_cli(); void do_cmd_cli_help(); void do_cmd_inven(); diff --git a/src/cmd4.cc b/src/cmd4.cc index d2e0416b..8df92781 100644 --- a/src/cmd4.cc +++ b/src/cmd4.cc @@ -260,7 +260,7 @@ void do_cmd_message_one() auto message = messages.at(0); - cptr msg = format("> %s", message.text_with_count().c_str()); + const char *msg = format("> %s", message.text_with_count().c_str()); /* Recall one message XXX XXX XXX */ display_message(0, 0, strlen(msg), message.color, msg); @@ -628,7 +628,7 @@ static void interact_with_options(std::vector<option_type> const &options, char /* * Interact with some options for cheating */ -static void do_cmd_options_cheat(cptr info) +static void do_cmd_options_cheat(const char *info) { // Interact interact_with_options(options->cheat_options, info, interaction_mode_t::READ_WRITE); @@ -665,7 +665,7 @@ s16b toggle_frequency(s16b current) /* * Interact with some options for cheating */ -static void do_cmd_options_autosave(cptr info) +static void do_cmd_options_autosave(const char *info) { char ch; @@ -794,7 +794,7 @@ static void do_cmd_options_autosave(cptr info) /* * Interact with some options */ -void do_cmd_options_aux(int page, cptr info, bool_ read_only) +void do_cmd_options_aux(int page, const char *info, bool_ read_only) { // Scrape together all the options from the relevant page. std::vector<option_type> page_options; @@ -856,7 +856,7 @@ static void do_cmd_options_win() { byte a = TERM_WHITE; - cptr s = angband_term_name[j]; + const char *s = angband_term_name[j]; /* Use color */ if (j == x) a = TERM_L_BLUE; @@ -870,7 +870,7 @@ static void do_cmd_options_win() { byte a = TERM_WHITE; - cptr str = window_flag_desc[i]; + const char *str = window_flag_desc[i]; /* Use color */ if (i == y) a = TERM_L_BLUE; @@ -998,7 +998,7 @@ static void do_cmd_options_win() * Write all current options to the given preference file in the * lib/user directory. Modified from KAmband 1.8. */ -static errr option_dump(cptr fname) +static errr option_dump(const char *fname) { int i, j; @@ -1428,7 +1428,7 @@ void do_cmd_pref() /* * Hack -- append all current macros to the given file */ -static errr macro_dump(cptr fname) +static errr macro_dump(const char *fname) { int i; @@ -1575,7 +1575,7 @@ static void do_cmd_macro_aux_keymap(char *buf) /* * Hack -- append all keymaps to the given file */ -static errr keymap_dump(cptr fname) +static errr keymap_dump(const char *fname) { int i; @@ -1609,7 +1609,7 @@ static errr keymap_dump(cptr fname) /* Dump them */ for (i = 0; i < 256; i++) { - cptr act; + const char *act; /* Loop up the keymap */ act = keymap_act[mode][i]; @@ -1882,7 +1882,7 @@ void do_cmd_macros() /* Query a keymap */ else if (i == '7') { - cptr act; + const char *act; /* Prompt */ prt("Command: Query a keymap", 16, 0); @@ -2553,7 +2553,7 @@ void do_cmd_colors() int gv = angband_color_table[i][2]; int bv = angband_color_table[i][3]; - cptr name = "unknown"; + const char *name = "unknown"; /* Skip non-entries */ if (!kv && !rv && !gv && !bv) continue; @@ -2590,7 +2590,7 @@ void do_cmd_colors() /* Hack -- query until done */ while (1) { - cptr name; + const char *name; /* Clear */ clear_from(10); @@ -2708,7 +2708,7 @@ void do_cmd_version() /* * Array of feeling strings */ -static cptr do_cmd_feeling_text[11] = +static const char *do_cmd_feeling_text[11] = { "Looks like any other level.", "You feel there is something special about this level.", @@ -3328,10 +3328,10 @@ static void plural_aux(char *name) /* "someone of something" */ else if (strstr(name, " of ")) { - cptr aider = strstr(name, " of "); + const char *aider = strstr(name, " of "); char dummy[80]; int i = 0; - cptr ctr = name; + const char *ctr = name; while (ctr < aider) { diff --git a/src/cmd4.hpp b/src/cmd4.hpp index 39f1c16c..27a1e627 100644 --- a/src/cmd4.hpp +++ b/src/cmd4.hpp @@ -25,4 +25,4 @@ void do_cmd_checkquest(); void do_cmd_change_tactic(int i); void do_cmd_change_movement(int i); void do_cmd_time(); -void do_cmd_options_aux(int page, cptr info, bool_ read_only); +void do_cmd_options_aux(int page, const char *info, bool_ read_only); diff --git a/src/cmd5.cc b/src/cmd5.cc index 66246714..657b7f48 100644 --- a/src/cmd5.cc +++ b/src/cmd5.cc @@ -1893,7 +1893,7 @@ bool_ is_ok_spell(s32b spell_idx, s32b pval) /* * Get a spell from a book */ -s32b get_school_spell(cptr do_what, s16b force_book) +s32b get_school_spell(const char *do_what, s16b force_book) { int i, item; s32b spell = -1; diff --git a/src/cmd5.hpp b/src/cmd5.hpp index d25efb73..f70c7932 100644 --- a/src/cmd5.hpp +++ b/src/cmd5.hpp @@ -17,7 +17,7 @@ std::string symbiote_name(bool capitalize); int use_symbiotic_power(int r_idx, bool great); void use_monster_power(int r_idx, bool great); bool_ is_ok_spell(s32b spell_idx, s32b pval); -s32b get_school_spell(cptr do_what, s16b force_book); +s32b get_school_spell(const char *do_what, s16b force_book); void do_cmd_copy_spell(); void cast_school_spell(); std::vector<monster_power const *> extract_monster_powers(monster_race const *r_ptr, bool great); diff --git a/src/cmd6.cc b/src/cmd6.cc index b68f5ad5..0e62c3af 100644 --- a/src/cmd6.cc +++ b/src/cmd6.cc @@ -1609,7 +1609,7 @@ void do_cmd_cure_meat() /* Take a turn */ energy_use = 100; - cptr q = "You soak the meat."; + const char *q = "You soak the meat."; switch (i_ptr->sval) { @@ -3210,7 +3210,7 @@ void do_cmd_read_scroll() screen_save(); /* Get the filename */ - cptr q = format("book-%d.txt", o_ptr->sval); + const char *q = format("book-%d.txt", o_ptr->sval); /* Peruse the help file */ show_file(q, NULL); diff --git a/src/cmd7.cc b/src/cmd7.cc index dc666ea7..bc9cdbff 100644 --- a/src/cmd7.cc +++ b/src/cmd7.cc @@ -238,7 +238,7 @@ static bool_ get_magic_power(int *sn, magic_power *powers, int max_powers, char out_val[160]; - cptr p = "power"; + const char *p = "power"; magic_power spell; @@ -2642,7 +2642,8 @@ void do_cmd_summoner_summon() { int item, x = 1, y = 1, rx, ry, m_idx = 0, i; - cptr q, s; + const char *q; + const char *s; monster_type *m_ptr; diff --git a/src/corrupt.cc b/src/corrupt.cc index df3afbae..3f8a47c6 100644 --- a/src/corrupt.cc +++ b/src/corrupt.cc @@ -25,11 +25,11 @@ struct corruption_type { int modules[3]; /* Modules where this corruption is available; terminated with -1 entry */ byte color; - cptr group; - cptr name; - cptr get_text; - cptr lose_text; /* If NULL, the corruption is NOT removable by any means */ - cptr desc; + const char *group; + const char *name; + const char *get_text; + const char *lose_text; /* If NULL, the corruption is NOT removable by any means */ + const char *desc; s16b depends[5]; /* terminated by a -1 entry */ s16b opposes[5]; /* terminated by a -1 entry */ void (*gain_callback)(); /* callback to invoke when gained */ diff --git a/src/dice.cc b/src/dice.cc index 187bae68..0e2f48e6 100644 --- a/src/dice.cc +++ b/src/dice.cc @@ -13,7 +13,7 @@ void dice_init(dice_type *dice, long base, long num, long sides) dice->sides = sides; } -bool_ dice_parse(dice_type *dice, cptr s) +bool_ dice_parse(dice_type *dice, const char *s) { long base, num, sides; @@ -50,7 +50,7 @@ bool_ dice_parse(dice_type *dice, cptr s) return FALSE; } -void dice_parse_checked(dice_type *dice, cptr s) +void dice_parse_checked(dice_type *dice, const char *s) { bool_ result = dice_parse(dice, s); if (!result) diff --git a/src/dice_fwd.hpp b/src/dice_fwd.hpp index 72b3b5ca..73fcb015 100644 --- a/src/dice_fwd.hpp +++ b/src/dice_fwd.hpp @@ -6,7 +6,7 @@ typedef struct dice_type dice_type; struct dice_type; void dice_init(dice_type *dice, long base, long num, long sides); -bool_ dice_parse(dice_type *dice, cptr s); -void dice_parse_checked(dice_type *dice, cptr s); +bool_ dice_parse(dice_type *dice, const char *s); +void dice_parse_checked(dice_type *dice, const char *s); long dice_roll(dice_type *dice); void dice_print(dice_type *dice, char *buf); diff --git a/src/files.cc b/src/files.cc index b8e980c9..6de1f1a8 100644 --- a/src/files.cc +++ b/src/files.cc @@ -704,9 +704,9 @@ errr process_pref_file_aux(char *buf) * Output: * result */ -static cptr process_pref_file_expr(char **sp, char *fp) +static const char *process_pref_file_expr(char **sp, char *fp) { - cptr v; + const char *v; char *b; char *s; @@ -968,7 +968,7 @@ static cptr process_pref_file_expr(char **sp, char *fp) * We also accept the special "?" and "%" directives, which * allow conditional evaluation and filename inclusion. */ -errr process_pref_file(cptr name) +errr process_pref_file(const char *name) { FILE *fp; @@ -1021,7 +1021,7 @@ errr process_pref_file(cptr name) if ((buf[0] == '?') && (buf[1] == ':')) { char f; - cptr v; + const char *v; char *s; /* Start */ @@ -1082,7 +1082,7 @@ errr process_pref_file(cptr name) * Print long number with header at given row, column * Use the color for the number, not the header */ -static void prt_lnum(cptr header, s32b num, int row, int col, byte color) +static void prt_lnum(const char *header, s32b num, int row, int col, byte color) { int len = strlen(header); char out_val[32]; @@ -1096,8 +1096,8 @@ static void prt_lnum(cptr header, s32b num, int row, int col, byte color) /* * Print number with header at given row, column */ -static void prt_num(cptr header, int num, int row, int col, byte color, - cptr space) +static void prt_num(const char *header, int num, int row, int col, byte color, + const char *space) { int len = strlen(header); char out_val[32]; @@ -1112,7 +1112,7 @@ static void prt_num(cptr header, int num, int row, int col, byte color, /* * Print str with header at given row, column */ -static void prt_str(cptr header, cptr str, int row, int col, byte color) +static void prt_str(const char *header, const char *str, int row, int col, byte color) { int len = strlen(header); char out_val[32]; @@ -1305,7 +1305,7 @@ static byte likert_color = TERM_WHITE; /* * Returns a "rating" of x depending on y */ -static cptr likert(int x, int y) +static const char *likert(int x, int y) { static char dummy[20] = ""; @@ -1394,7 +1394,7 @@ static void display_player_various() int tmp, tmp2, damdice, damsides, dambonus, blows; int xthn, xthb; int xdev, xsav, xstl; - cptr desc; + const char *desc; int i; object_type *o_ptr; @@ -2398,8 +2398,8 @@ std::string describe_player_location() */ int dx = pwx - lwx; int dy = pwy - lwy; - cptr ns = (dy > 0 ? "south" : "north"); - cptr ew = (dx > 0 ? "east" : "west"); + const char *ns = (dy > 0 ? "south" : "north"); + const char *ew = (dx > 0 ? "east" : "west"); dx = (dx < 0 ? -dx : dx); dy = (dy < 0 ? -dy : dy); @@ -2449,7 +2449,7 @@ static bool_ file_character_print_grid_check_row(const char *buf) */ static void file_character_print_grid(FILE *fff, bool_ show_gaps, bool_ show_legend) { - static cptr blank_line = " "; + static const char *blank_line = " "; static char buf[1024]; byte a; char c; @@ -2492,7 +2492,7 @@ static void file_character_print_grid(FILE *fff, bool_ show_gaps, bool_ show_leg static void file_character_print_item(FILE *fff, char label, object_type *obj) { static char o_name[80]; - static cptr paren = ")"; + static const char *paren = ")"; object_desc(o_name, obj, TRUE, 3); fprintf(fff, "%c%s %s\n", label, paren, o_name); @@ -2556,7 +2556,7 @@ static bool_ file_character_check_stores(std::unordered_set<store_type *> *seen_ * XXX XXX XXX Allow the "full" flag to dump additional info, * and trigger its usage from various places in the code. */ -errr file_character(cptr name) +errr file_character(const char *name) { auto const &d_info = game->edit_data.d_info; auto const &wf_info = game->edit_data.wf_info; @@ -2707,7 +2707,7 @@ errr file_character(cptr name) { char desc[80]; - cptr mimic; + const char *mimic; monster_race_desc(desc, p_ptr->body_monster, 0); fprintf(fff, "\n Your body %s %s.", (death ? "was" : "is"), desc); @@ -2925,7 +2925,7 @@ struct hyperlink typedef struct hyperlink hyperlink_type; -static bool_ show_file_aux(cptr name, cptr what, int line) +static bool_ show_file_aux(const char *name, const char *what, int line) { int i, k, x; @@ -2950,7 +2950,7 @@ static bool_ show_file_aux(cptr name, cptr what, int line) FILE *fff = NULL; /* Find this string (if any) */ - cptr find = NULL; + const char *find = NULL; /* Pointer to general buffer in the above */ char *buf; @@ -3318,7 +3318,7 @@ static bool_ show_file_aux(cptr name, cptr what, int line) /* Hilite "h_ptr->shower" */ if (h_ptr->shower[0]) { - cptr str = buf; + const char *str = buf; /* Display matches */ while ((str = strstr(str, h_ptr->shower)) != NULL) @@ -3524,7 +3524,7 @@ void show_string(const char *lines, const char *title, int line) fd_kill(file_name.c_str()); } -void show_file(cptr name, cptr what, int line) +void show_file(const char *name, const char *what, int line) { show_file_aux(name, what, line); } @@ -3581,7 +3581,7 @@ static void cmovie_clean_line(int y, char *abuf, char *cbuf) } /* Take an help file screenshot(yes yes I know..) */ -void help_file_screenshot(cptr name) +void help_file_screenshot(const char *name) { int y, x; int wid, hgt; @@ -3634,7 +3634,7 @@ void help_file_screenshot(cptr name) } /* Take an html screenshot */ -void html_screenshot(cptr name) +void html_screenshot(const char *name) { int y, x; int wid, hgt; @@ -4332,7 +4332,9 @@ static void display_scores_aux(int highscore_fd, int from, int to, int note, hig { int pcs, pr, ps, pc, clev, mlev, cdun, mdun; - cptr gold, when, aged; + const char *gold; + const char *when; + const char *aged; int in_quest; @@ -5210,7 +5212,7 @@ errr get_rnd_line(const char *file_name, char *output) * * Caution: 'linbuf' should be at least 80 byte long. */ -char *get_line(const char* fname, cptr fdir, char *linbuf, int line) +char *get_line(const char* fname, const char *fdir, char *linbuf, int line) { FILE* fp; int i; diff --git a/src/files.hpp b/src/files.hpp index 52b9ae2b..31525a48 100644 --- a/src/files.hpp +++ b/src/files.hpp @@ -7,18 +7,18 @@ #include <string> #include <vector> -void html_screenshot(cptr name); -void help_file_screenshot(cptr name); +void html_screenshot(const char *name); +void help_file_screenshot(const char *name); object_flag_set player_flags(); void wipe_saved(); s16b tokenize(char *buf, s16b num, char **tokens, char delim1, char delim2); void display_player(int mode); std::string describe_player_location(); -errr file_character(cptr name); +errr file_character(const char *name); errr process_pref_file_aux(char *buf); -errr process_pref_file(cptr name); +errr process_pref_file(const char *name); void show_string(const char *lines, const char *title, int line = 0); -void show_file(cptr name, cptr what, int line = 0); +void show_file(const char *name, const char *what, int line = 0); void do_cmd_help(); void process_player_base(); void get_name(); @@ -26,7 +26,7 @@ void do_cmd_suicide(); void autosave_checkpoint(); void close_game(); errr get_rnd_line(const char * file_name, char * output); -char *get_line(const char* fname, cptr fdir, char *linbuf, int line); +char *get_line(const char* fname, const char *fdir, char *linbuf, int line); void race_legends(); void show_highclass(int building); errr get_xtra_line(const char * file_name, monster_type *m_ptr, char * output); diff --git a/src/generate.cc b/src/generate.cc index 331f79a6..324fa5d8 100644 --- a/src/generate.cc +++ b/src/generate.cc @@ -306,7 +306,7 @@ struct dun_data typedef struct level_generator_type level_generator_type; struct level_generator_type { - cptr name; + const char *name; bool_ (*generator)(); struct level_generator_type *next; @@ -317,7 +317,7 @@ static level_generator_type *level_generators = NULL; /* * Add a new generator */ -void add_level_generator(cptr name, bool_ (*generator)()) +void add_level_generator(const char *name, bool_ (*generator)()) { assert(name != nullptr); @@ -2846,7 +2846,7 @@ static void build_type5(int by0, int bx0) int y, x, y1, x1, y2, x2, xval, yval; int tmp, i; - cptr name; + const char *name; bool_ empty = FALSE; bool_ (*old_get_mon_num_hook)(int r_idx); s16b what[64]; @@ -3087,7 +3087,7 @@ static void build_type6(int by0, int bx0) int tmp, what[16]; int i, j, y, x, y1, x1, y2, x2, xval, yval; bool_ empty = FALSE; - cptr name; + const char *name; bool_ (*old_get_mon_num_hook)(int r_idx); /* Try to allocate space for room. If fails, exit */ @@ -8347,7 +8347,7 @@ void generate_cave() { bool_ okay = TRUE; - cptr why = NULL; + const char *why = NULL; /* No effects */ for (i = 0; i < MAX_EFFECTS; i++) diff --git a/src/generate.hpp b/src/generate.hpp index a21ba069..02c18639 100644 --- a/src/generate.hpp +++ b/src/generate.hpp @@ -3,7 +3,7 @@ #include "h-basic.h" bool_ new_player_spot(int branch); -void add_level_generator(cptr name, bool_ (*generator)()); +void add_level_generator(const char *name, bool_ (*generator)()); bool_ level_generate_dungeon(); bool_ generate_fracave(int y0, int x0,int xsize,int ysize,int cutoff,bool_ light,bool_ room); void generate_hmap(int y0, int x0,int xsiz,int ysiz,int grd,int roug,int cutoff); diff --git a/src/gods.cc b/src/gods.cc index 82d8d300..4278fe59 100644 --- a/src/gods.cc +++ b/src/gods.cc @@ -194,7 +194,7 @@ bool_ god_enabled(struct deity_type *deity) } /* Find a god by name */ -int find_god(cptr name) +int find_god(const char *name) { int i; diff --git a/src/gods.hpp b/src/gods.hpp index 2a5f2bb5..5a93c152 100644 --- a/src/gods.hpp +++ b/src/gods.hpp @@ -5,7 +5,7 @@ void inc_piety(int god, s32b amt); void abandon_god(int god); int wisdom_scale(int max); -int find_god(cptr name); +int find_god(const char *name); void follow_god(int god, bool_ silent); bool_ god_enabled(struct deity_type *deity); deity_type *god_at(byte god_idx); diff --git a/src/h-type.h b/src/h-type.h index 4715dd4d..6c62301b 100644 --- a/src/h-type.h +++ b/src/h-type.h @@ -36,14 +36,6 @@ extern "C" { */ - -/*** Special 4 letter names for some standard types ***/ - - -/* A simple pointer (to unmodifiable strings) */ -typedef const char *cptr; - - /* Error codes for function return values */ /* Success = 0, Failure = -N, Problem = +N */ typedef int errr; diff --git a/src/help.cc b/src/help.cc index a3bd4d97..b59a6fcf 100644 --- a/src/help.cc +++ b/src/help.cc @@ -61,7 +61,7 @@ struct triggered_help_type /* Trigger function */ bool_ (*trigger_func)(void *in, void *out); /* Description; NULL terminated */ - cptr desc[DESC_MAX]; + const char *desc[DESC_MAX]; }; /** @@ -70,8 +70,8 @@ struct triggered_help_type typedef struct context_help_type context_help_type; struct context_help_type { - cptr key; /* Lookup key */ - cptr file_name; /* Name of help file */ + const char *key; /* Lookup key */ + const char *file_name; /* Name of help file */ int anchor; /* Anchor in file */ }; @@ -643,7 +643,7 @@ static void show_context_help(context_help_type *context_help) /* * Find context help */ -static context_help_type *find_context_help(context_help_type table[], cptr key) +static context_help_type *find_context_help(context_help_type table[], const char *key) { int i; @@ -681,7 +681,7 @@ void help_class(std::string const &klass) show_context_help(find_context_help(class_table, klass.c_str())); } -void help_god(cptr god) +void help_god(const char *god) { context_help_type *context_help = find_context_help(god_table, god); diff --git a/src/help.hpp b/src/help.hpp index a805a62b..67e701ae 100644 --- a/src/help.hpp +++ b/src/help.hpp @@ -8,6 +8,6 @@ void init_hooks_help(); void help_race(std::string const &race); void help_subrace(std::string const &subrace); void help_class(std::string const &klass); -void help_god(cptr god); +void help_god(const char *god); void help_skill(std::string const &skill); void help_ability(std::string const &ability); diff --git a/src/hook_mon_speak_in.hpp b/src/hook_mon_speak_in.hpp index f3a14338..69f30fa8 100644 --- a/src/hook_mon_speak_in.hpp +++ b/src/hook_mon_speak_in.hpp @@ -4,5 +4,5 @@ struct hook_mon_speak_in { s32b m_idx; - cptr m_name; + const char *m_name; }; diff --git a/src/hooks.cc b/src/hooks.cc index bd2ea905..16bd144d 100644 --- a/src/hooks.cc +++ b/src/hooks.cc @@ -60,7 +60,7 @@ static std::vector<hook_data>::iterator find_hook(std::vector<hook_data> &hooks, }); } -void add_hook_new(int h_idx, hook_func_t hook_func, cptr name, void *data) +void add_hook_new(int h_idx, hook_func_t hook_func, const char *name, void *data) { auto &hooks = hooks_instance()[h_idx]; // Only insert if not already present. diff --git a/src/hooks.hpp b/src/hooks.hpp index 7cf4285b..8d9ad6b8 100644 --- a/src/hooks.hpp +++ b/src/hooks.hpp @@ -4,7 +4,7 @@ typedef bool (*hook_func_t)(void *, void *, void *); -void add_hook_new(int h_idx, hook_func_t hook_func, cptr name, void *data); +void add_hook_new(int h_idx, hook_func_t hook_func, const char *name, void *data); void del_hook_new(int h_idx, hook_func_t hook_func); extern int process_hooks_restart; bool process_hooks_new(int h_idx, void *in, void *out); diff --git a/src/init1.cc b/src/init1.cc index dd5365b8..29135c7a 100644 --- a/src/init1.cc +++ b/src/init1.cc @@ -92,7 +92,7 @@ template <class T> typename std::vector<T>::reference expand_to_fit_index(std::v /* * Monster Blow Methods */ -static cptr r_info_blow_method[] = +static const char *r_info_blow_method[] = { "*", "HIT", @@ -126,7 +126,7 @@ static cptr r_info_blow_method[] = /* * Monster Blow Effects */ -static cptr r_info_blow_effect[] = +static const char *r_info_blow_effect[] = { "*", "HURT", @@ -183,13 +183,13 @@ namespace detail { template <size_t N> struct flag_tie_impl { private: u32b *m_mask; - cptr (&m_flags)[N]; + const char *(&m_flags)[N]; public: - flag_tie_impl(u32b *mask, cptr (&flags)[N]): m_mask(mask), m_flags(flags) { + flag_tie_impl(u32b *mask, const char *(&flags)[N]): m_mask(mask), m_flags(flags) { // Empty } - bool match(cptr flag) { + bool match(const char *flag) { for (unsigned int i = 0; i < N; i++) { if (streq(flag, m_flags[i])) @@ -208,7 +208,7 @@ public: * Tie a flags value pointer and its corresponding array * of text strings. */ -template<size_t N> detail::flag_tie_impl<N> flag_tie(u32b *mask, cptr (&flags)[N]) { +template<size_t N> detail::flag_tie_impl<N> flag_tie(u32b *mask, const char *(&flags)[N]) { static_assert(N <= 32, "Array too large to represent result"); return detail::flag_tie_impl<N>(mask, flags); } @@ -216,7 +216,7 @@ template<size_t N> detail::flag_tie_impl<N> flag_tie(u32b *mask, cptr (&flags)[N /** * Look up flag in array of flags. */ -template<size_t N> bool lookup_flags(cptr) +template<size_t N> bool lookup_flags(const char *) { // Base case: No match return false; @@ -225,7 +225,7 @@ template<size_t N> bool lookup_flags(cptr) /** * Look up flag in array of flags. */ -template<size_t N, typename... Pairs> bool lookup_flags(cptr flag, detail::flag_tie_impl<N> tie, Pairs&&...rest) { +template<size_t N, typename... Pairs> bool lookup_flags(const char *flag, detail::flag_tie_impl<N> tie, Pairs&&...rest) { // Inductive case: Check against current "tie" if (tie.match(flag)) { // Match @@ -245,7 +245,7 @@ template<size_t N, typename... Pairs> bool lookup_flags(cptr flag, detail::flag_ */ static struct { -cptr name; +const char *name; int feat; } d_info_dtypes[] = @@ -638,7 +638,7 @@ static void strappend(char **s, const char *t) * Grab one race flag from a textual string */ static bool_ unknown_shut_up = FALSE; -static errr grab_one_class_flag(u32b *choice, cptr what) +static errr grab_one_class_flag(u32b *choice, const char *what) { auto const &class_info = game->edit_data.class_info; @@ -659,7 +659,7 @@ static errr grab_one_class_flag(u32b *choice, cptr what) return (1); } -static errr grab_one_race_allow_flag(u32b *choice, cptr what) +static errr grab_one_race_allow_flag(u32b *choice, const char *what) { auto const &race_info = game->edit_data.race_info; @@ -683,7 +683,7 @@ static errr grab_one_race_allow_flag(u32b *choice, cptr what) /* * Grab one flag from a textual string */ -static errr grab_one_skill_flag(skill_flag_set *flags, cptr what) +static errr grab_one_skill_flag(skill_flag_set *flags, const char *what) { #define SKF(tier, index, name) \ if (streq(what, #name)) \ @@ -703,7 +703,7 @@ static errr grab_one_skill_flag(skill_flag_set *flags, cptr what) /* * Grab one flag from a textual string */ -static errr grab_one_player_race_flag(player_race_flag_set *flags, cptr what) +static errr grab_one_player_race_flag(player_race_flag_set *flags, const char *what) { #define PR(tier, index, name) \ if (streq(what, #name)) \ @@ -740,7 +740,7 @@ static int get_activation(char *activation) /* * Convert string to object_flag_set value */ -static object_flag_set object_flag_set_from_string(cptr what) +static object_flag_set object_flag_set_from_string(const char *what) { for (auto const flag_meta: object_flags_meta()) { @@ -756,7 +756,7 @@ static object_flag_set object_flag_set_from_string(cptr what) /* * Grab one flag in an object_kind from a textual string */ -static errr grab_object_flag(object_flag_set *flags, cptr what) +static errr grab_object_flag(object_flag_set *flags, const char *what) { if (object_flag_set f = object_flag_set_from_string(what)) { @@ -774,7 +774,7 @@ static errr grab_object_flag(object_flag_set *flags, cptr what) /* * Read skill values */ -static int read_skill_modifiers(skill_modifiers *skill_modifiers, cptr buf) +static int read_skill_modifiers(skill_modifiers *skill_modifiers, const char *buf) { long val, mod; char v, m; @@ -805,7 +805,7 @@ static int read_skill_modifiers(skill_modifiers *skill_modifiers, cptr buf) /* * Read prototype objects */ -static int read_proto_object(std::vector<object_proto> *protos, cptr buf) +static int read_proto_object(std::vector<object_proto> *protos, const char *buf) { int s0, s1, s2, s3, s4; @@ -1902,7 +1902,7 @@ errr init_v_info_txt(FILE *fp) if (buf[0] == 'D') { /* Acquire the text */ - cptr s = buf + 2; + const char *s = buf + 2; /* Append data */ v_ptr->data += s; @@ -1980,7 +1980,7 @@ errr init_v_info_txt(FILE *fp) /* * Grab one flag in an feature_type from a textual string */ -static int grab_one_feature_flag(cptr what, feature_flag_set *flags) +static int grab_one_feature_flag(const char *what, feature_flag_set *flags) { #define FF(tier, index, name) \ if (streq(what, #name)) \ @@ -2170,7 +2170,7 @@ errr init_f_info_txt(FILE *fp) if (buf[0] == 'E') { int side, dice, freq, type; - cptr tmp; + const char *tmp; int i; /* Find the next empty blow slot (if any) */ @@ -3404,7 +3404,7 @@ static ego_flag_set lookup_ego_flag(const char *what) * * We explicitly allow nullptr for the "ego" parameter. */ -static bool_ grab_one_ego_item_flag(object_flag_set *flags, ego_flag_set *ego, cptr what) +static bool_ grab_one_ego_item_flag(object_flag_set *flags, ego_flag_set *ego, const char *what) { /* Lookup as an object_flag */ if (auto f = object_flag_set_from_string(what)) @@ -3974,7 +3974,7 @@ errr init_ra_info_txt(FILE *fp) } -static errr grab_monster_race_flag(monster_race_flag_set *flags, cptr what) +static errr grab_monster_race_flag(monster_race_flag_set *flags, const char *what) { #define RF(tier, index, name) \ if (streq(what, #name)) \ @@ -3996,7 +3996,7 @@ static errr grab_monster_race_flag(monster_race_flag_set *flags, cptr what) /* * Grab one (spell) flag in a monster_race from a textual string */ -static errr grab_one_monster_spell_flag(monster_spell_flag_set *flags, cptr what) +static errr grab_one_monster_spell_flag(monster_spell_flag_set *flags, const char *what) { for (auto const &monster_spell: monster_spells()) { @@ -5008,7 +5008,7 @@ errr init_d_info_txt(FILE *fp) if (buf[0] == 'E') { int side, dice, freq, type; - cptr tmp; + const char *tmp; /* Find the next empty blow slot (if any) */ std::size_t i; @@ -5219,7 +5219,7 @@ errr init_d_info_txt(FILE *fp) /* * Grab one race flag from a textual string */ -static errr grab_one_race_flag(owner_type *ow_ptr, int state, cptr what) +static errr grab_one_race_flag(owner_type *ow_ptr, int state, const char *what) { /* Scan race flags */ unknown_shut_up = TRUE; @@ -5247,7 +5247,7 @@ static errr grab_one_race_flag(owner_type *ow_ptr, int state, cptr what) /* * Grab one store flag from a textual string */ -static errr grab_one_store_flag(store_flag_set *flags, cptr what) +static errr grab_one_store_flag(store_flag_set *flags, const char *what) { #define STF(tier, index, name) \ if (streq(what, #name)) { \ @@ -6531,10 +6531,10 @@ static errr process_dungeon_file_aux(char *buf, int *yval, int *xval, int xvalst /* * Helper function for "process_dungeon_file()" */ -static cptr process_dungeon_file_expr(char **sp, char *fp) +static const char *process_dungeon_file_expr(char **sp, char *fp) { static char pref_tmp_value[8]; - cptr v; + const char *v; char *b; char *s; @@ -6828,7 +6828,7 @@ static cptr process_dungeon_file_expr(char **sp, char *fp) } -errr process_dungeon_file(cptr name, int *yval, int *xval, int ymax, int xmax, bool_ init, bool_ full) +errr process_dungeon_file(const char *name, int *yval, int *xval, int ymax, int xmax, bool_ init, bool_ full) { FILE *fp = 0; @@ -6890,7 +6890,7 @@ errr process_dungeon_file(cptr name, int *yval, int *xval, int ymax, int xmax, b if ((buf[0] == '?') && (buf[1] == ':')) { char f; - cptr v; + const char *v; char *s; /* Start */ diff --git a/src/init1.hpp b/src/init1.hpp index 1c417285..f6105f38 100644 --- a/src/init1.hpp +++ b/src/init1.hpp @@ -24,4 +24,4 @@ errr init_st_info_txt(FILE *fp); errr init_ow_info_txt(FILE *fp); errr init_wf_info_txt(FILE *fp); errr grab_one_dungeon_flag(dungeon_flag_set *flags, const char *str); -errr process_dungeon_file(cptr name, int *yval, int *xval, int ymax, int xmax, bool_ init, bool_ full); +errr process_dungeon_file(const char *name, int *yval, int *xval, int ymax, int xmax, bool_ init, bool_ full); diff --git a/src/init2.cc b/src/init2.cc index 4d2df8f8..3da67db7 100644 --- a/src/init2.cc +++ b/src/init2.cc @@ -240,7 +240,7 @@ s16b error_line; /* * Standard error message text */ -static cptr err_str[9] = +static const char *err_str[9] = { NULL, "parse error", @@ -257,7 +257,7 @@ static cptr err_str[9] = /* * Hack -- take notes on line 23 */ -static void note(cptr str) +static void note(const char *str) { Term_erase(0, 23, 255); Term_putstr(20, 23, -1, TERM_WHITE, str); @@ -484,7 +484,7 @@ template<typename T> static errr init_x_info() { if (err) { /* Error string */ - cptr oops = (((err > 0) && (err < 8)) ? err_str[err] : "unknown"); + const char *oops = (((err > 0) && (err < 8)) ? err_str[err] : "unknown"); /* Oops */ msg_format("Error %d at line %d of '%s'.", err, error_line, T::name); @@ -948,7 +948,7 @@ static void init_guardians() * may or may not be initialised, but the "plog()" and "quit()" * functions are "supposed" to work under any conditions. */ -static void init_angband_aux(cptr why) +static void init_angband_aux(const char *why) { /* Why */ plog(why); diff --git a/src/loadsave.cc b/src/loadsave.cc index 966099fb..b2bfb55d 100644 --- a/src/loadsave.cc +++ b/src/loadsave.cc @@ -51,7 +51,7 @@ static FILE *fff; /* Local savefile ptr */ * * Avoid the top two lines, to avoid interference with "msg_print()". */ -static void note(cptr msg) +static void note(const char *msg) { static int y = 2; @@ -2549,7 +2549,7 @@ bool_ load_player() { errr err = 0; - cptr what = "generic"; + const char *what = "generic"; /* Paranoia */ turn = 0; diff --git a/src/magic_power.hpp b/src/magic_power.hpp index b02c6c14..4a7d37ad 100644 --- a/src/magic_power.hpp +++ b/src/magic_power.hpp @@ -7,9 +7,9 @@ */ struct magic_power { - int min_lev; - int mana_cost; - int fail; - cptr name; - cptr desc; + int min_lev; + int mana_cost; + int fail; + const char *name; + const char *desc; }; diff --git a/src/main-gcu.c b/src/main-gcu.c index ac41272c..f9b475c3 100644 --- a/src/main-gcu.c +++ b/src/main-gcu.c @@ -703,7 +703,7 @@ static errr Term_curs_gcu(int x, int y) /* * Place some text on the screen using an attribute */ -static errr Term_text_gcu(int x, int y, int n, byte a, cptr s) +static errr Term_text_gcu(int x, int y, int n, byte a, const char *s) { term_data *td = (term_data *)(Term->data); @@ -775,7 +775,7 @@ static errr term_data_init_gcu(term_data *td, int rows, int cols, int y, int x) } -static void hook_quit(cptr str) +static void hook_quit(const char *str) { /* Unused */ (void)str; diff --git a/src/main-gtk2.c b/src/main-gtk2.c index c65ae059..232094b8 100644 --- a/src/main-gtk2.c +++ b/src/main-gtk2.c @@ -161,10 +161,10 @@ static bool_ use_backing_store = TRUE; /* * Look up some environment variables to find font name for each window. */ -static cptr get_default_font(int term) +static const char *get_default_font(int term) { char buf[64]; - cptr font_name; + const char *font_name; /* Window specific font name */ strnfmt(buf, 64, "ANGBAND_X11_FONT_%s", angband_term_name[term]); @@ -349,7 +349,7 @@ static errr Term_wipe_gtk(int x, int y, int n) /* * Draw some textual characters. */ -static errr Term_text_gtk(int x, int y, int n, byte a, cptr s) +static errr Term_text_gtk(int x, int y, int n, byte a, const char *s) { term_data *td = (term_data*)(Term->data); @@ -681,7 +681,7 @@ static void save_game_gtk(void) /* * Display message in a modal dialog */ -static void gtk_message(cptr msg) +static void gtk_message(const char *msg) { GtkWidget *dialog, *label, *ok_button; @@ -721,7 +721,7 @@ static void gtk_message(cptr msg) /* * Hook to tell the user something important */ -static void hook_plog(cptr str) +static void hook_plog(const char *str) { /* Warning message */ gtk_message(str); @@ -785,7 +785,7 @@ static void destroy_sub_event_handler( * Load fond specified by an XLFD fontname and * set up related term_data members */ -static void load_font(term_data *td, cptr fontname) +static void load_font(term_data *td, const char *fontname) { GdkFont *old = td->font; @@ -1472,7 +1472,7 @@ static void free_menu_paths(void) * Find widget corresponding to path name * return NULL on error */ -static GtkWidget *get_widget_from_path(cptr path) +static GtkWidget *get_widget_from_path(const char *path) { GtkItemFactory *item_factory; GtkWidget *widget; @@ -1497,7 +1497,7 @@ static GtkWidget *get_widget_from_path(cptr path) /* * Enable/disable a menu item */ -void enable_menu_item(cptr path, bool_ enabled) +void enable_menu_item(const char *path, bool_ enabled) { GtkWidget *widget; @@ -1519,7 +1519,7 @@ void enable_menu_item(cptr path, bool_ enabled) /* * Check/uncheck a menu item. The item should be of the GtkCheckMenuItem type */ -void check_menu_item(cptr path, bool_ checked) +void check_menu_item(const char *path, bool_ checked) { GtkWidget *widget; @@ -1745,7 +1745,7 @@ static void add_menu_update_callbacks() static void init_gtk_window(term_data *td, int i) { GtkWidget *menu_bar = NULL, *box; - cptr font; + const char *font; bool_ main_window = (i == 0) ? TRUE : FALSE; @@ -1878,7 +1878,7 @@ static void init_gtk_window(term_data *td, int i) /* * To be hooked into quit(). See z-util.c */ -static void hook_quit(cptr str) +static void hook_quit(const char *str) { /* Free menu paths dynamically allocated */ free_menu_paths(); diff --git a/src/main-sdl.c b/src/main-sdl.c index e22461c5..7d309c13 100644 --- a/src/main-sdl.c +++ b/src/main-sdl.c @@ -182,7 +182,7 @@ typedef struct _term_data term_data; struct _term_data { term t; /* the term structure, defined in z-term.h */ - cptr name; /* name of this term sub-window */ + const char *name; /* name of this term sub-window */ unsigned int rows, cols; /* row/column count */ SDL_Rect rect; /* the bounding rectangle for the entire box; @@ -263,7 +263,7 @@ void dumpWindowSettings(void); /* SDL Quitting function... declare a few functions first.*/ void killFontAndAlphabet(void); -static void sdl_quit(cptr string) +static void sdl_quit(const char *string) { printf("sdl_quit called.\n"); printf("message: %s\n",string); @@ -1623,7 +1623,7 @@ static errr term_data_init(term_data *td, int i) { term *t = &(td->t); char env_var[80]; - cptr val; + const char *val; /***** load position, size information */ diff --git a/src/main-win.c b/src/main-win.c index 6fd12297..e210da5f 100644 --- a/src/main-win.c +++ b/src/main-win.c @@ -318,7 +318,7 @@ struct _term_data { term t; - cptr s; + const char *s; HWND w; @@ -347,9 +347,9 @@ struct _term_data bool_ bizarre; - cptr font_want; + const char *font_want; - cptr font_file; + const char *font_file; HFONT font_id; @@ -434,24 +434,24 @@ static HWND hwndSaver; /* * Full path to ANGBAND.INI */ -static cptr ini_file = NULL; +static const char *ini_file = NULL; /* * Name of application */ -static cptr AppName = "ANGBAND"; +static const char *AppName = "ANGBAND"; /* * Name of sub-window type */ -static cptr AngList = "AngList"; +static const char *AngList = "AngList"; /* * Directory names */ -static cptr ANGBAND_DIR_XTRA_FONT; -static cptr ANGBAND_DIR_XTRA_GRAF; -static cptr ANGBAND_DIR_XTRA_HELP; +static const char *ANGBAND_DIR_XTRA_FONT; +static const char *ANGBAND_DIR_XTRA_GRAF; +static const char *ANGBAND_DIR_XTRA_HELP; /* @@ -525,9 +525,9 @@ static byte ignore_key_list[] = { /* * Hack -- given a pathname, point at the filename */ -static cptr extract_file_name(cptr s) +static const char *extract_file_name(const char *s) { - cptr p; + const char *p; /* Start at the end */ p = s + strlen(s) - 1; @@ -588,7 +588,7 @@ static char *analyze_font(char *path, int *wp, int *hp) /* * Check for existance of a file */ -static bool_ check_file(cptr s) +static bool_ check_file(const char *s) { char path[1024]; @@ -637,7 +637,7 @@ static bool_ check_file(cptr s) /* * Check for existance of a directory */ -static bool_ check_dir(cptr s) +static bool_ check_dir(const char *s) { int i; @@ -694,7 +694,7 @@ static bool_ check_dir(cptr s) /* * Validate a file */ -static void validate_file(cptr s) +static void validate_file(const char *s) { /* Verify or fail */ if (!check_file(s)) @@ -707,7 +707,7 @@ static void validate_file(cptr s) /* * Validate a directory */ -static void validate_dir(cptr s) +static void validate_dir(const char *s) { /* Verify or fail */ if (!check_dir(s)) @@ -784,7 +784,7 @@ static void term_getsize(term_data *td) /* * Write the "prefs" for a single term */ -static void save_prefs_aux(term_data *td, cptr sec_name) +static void save_prefs_aux(term_data *td, const char *sec_name) { char buf[1024]; @@ -860,7 +860,7 @@ static void save_prefs(void) /* * Load the "prefs" for a single term */ -static void load_prefs_aux(term_data *td, cptr sec_name) +static void load_prefs_aux(term_data *td, const char *sec_name) { char tmp[1024]; @@ -1066,7 +1066,7 @@ static void term_window_resize(term_data *td) * * Note that the "font name" must be capitalized!!! */ -static errr term_force_font(term_data *td, cptr path) +static errr term_force_font(term_data *td, const char *path) { int i; @@ -2994,7 +2994,7 @@ WPARAM wParam, LPARAM lParam) /* * Display warning message (see "z-util.c") */ -static void hack_plog(cptr str) +static void hack_plog(const char *str) { /* Give a warning */ if (str) @@ -3008,7 +3008,7 @@ static void hack_plog(cptr str) /* * Display error message and quit (see "z-util.c") */ -static void hack_quit(cptr str) +static void hack_quit(const char *str) { /* Give a warning */ if (str) @@ -3035,7 +3035,7 @@ static void hack_quit(cptr str) /* * Display warning message (see "z-util.c") */ -static void hook_plog(cptr str) +static void hook_plog(const char *str) { /* Warning */ if (str) @@ -3049,7 +3049,7 @@ static void hook_plog(cptr str) /* * Display error message and quit (see "z-util.c") */ -static void hook_quit(cptr str) +static void hook_quit(const char *str) { int i; diff --git a/src/main-x11.c b/src/main-x11.c index d6acc989..dc686043 100644 --- a/src/main-x11.c +++ b/src/main-x11.c @@ -404,7 +404,7 @@ struct infofnt { XFontStruct *info; - cptr name; + const char *name; s16b wid; s16b twid; @@ -603,7 +603,7 @@ static errr type_string(char *str, unsigned int len) * * Return -1 if no Display given, and none can be opened. */ -static errr Metadpy_init_2(Display *dpy, cptr name) +static errr Metadpy_init_2(Display *dpy, const char *name) { metadpy *m = Metadpy; @@ -708,7 +708,7 @@ static errr Metadpy_do_beep(void) /* * Set the name (in the title bar) of Infowin */ -static errr Infowin_set_name(cptr name) +static errr Infowin_set_name(const char *name) { Status st; XTextProperty tp; @@ -897,7 +897,7 @@ static errr Infowin_wipe(void) * Pairs of values, first is texttual name, second is the string * holding the decimal value that the operation corresponds to. */ -static cptr opcode_pairs[] = +static const char *opcode_pairs[] = { "cpy", "3", "xor", "6", @@ -933,7 +933,7 @@ static cptr opcode_pairs[] = * 0-15: if 'str' is a valid Operation * -1: if 'str' could not be parsed */ -static int Infoclr_Opcode(cptr str) +static int Infoclr_Opcode(const char *str) { register int i; @@ -1094,7 +1094,7 @@ static errr Infofnt_prepare(XFontStruct *info) * Inputs: * name: The name of the requested Font */ -static errr Infofnt_init_data(cptr name) +static errr Infofnt_init_data(const char *name) { XFontStruct *info; @@ -1140,7 +1140,7 @@ static errr Infofnt_init_data(cptr name) /* * Standard Text */ -static errr Infofnt_text_std(int x, int y, cptr str, int len) +static errr Infofnt_text_std(int x, int y, const char *str, int len) { int i; @@ -1203,7 +1203,7 @@ static errr Infofnt_text_std(int x, int y, cptr str, int len) /* * Painting where text would be */ -static errr Infofnt_text_non(int x, int y, cptr str, int len) +static errr Infofnt_text_non(int x, int y, const char *str, int len) { int w, h; @@ -2198,7 +2198,7 @@ static errr Term_curs_x11(int x, int y) /* * Draw some textual characters. */ -static errr Term_text_x11(int x, int y, int n, byte a, cptr s) +static errr Term_text_x11(int x, int y, int n, byte a, const char *s) { /* Draw the text */ Infoclr_set(clr[a]); @@ -2221,9 +2221,9 @@ static errr term_data_init(term_data *td, int i) { term *t = &td->t; - cptr name = angband_term_name[i]; + const char *name = angband_term_name[i]; - cptr font; + const char *font; int x = 0; int y = 0; @@ -2238,7 +2238,7 @@ static errr term_data_init(term_data *td, int i) char buf[80]; - cptr str; + const char *str; int val; @@ -2477,7 +2477,7 @@ errr init_x11(int argc, char *argv[]) { int i; - cptr dpy_name = ""; + const char *dpy_name = ""; int num_term = 1; diff --git a/src/main.cc b/src/main.cc index c0ac3826..a1db8493 100644 --- a/src/main.cc +++ b/src/main.cc @@ -25,7 +25,7 @@ * * Close down, then fall back into "quit()". */ -static void quit_hook(cptr s) +static void quit_hook(const char *s) { int j; @@ -96,7 +96,7 @@ static void init_file_paths_with_env() char path[1024]; /* Get the environment variable */ - cptr tail = getenv("TOME_PATH"); + const char *tail = getenv("TOME_PATH"); /* Use the angband_path, or a default */ strcpy(path, tail ? tail : DEFAULT_PATH); diff --git a/src/martial_arts.hpp b/src/martial_arts.hpp index 1f2f0cbe..a744c902 100644 --- a/src/martial_arts.hpp +++ b/src/martial_arts.hpp @@ -7,12 +7,12 @@ */ struct martial_arts { - cptr desc; /* A verbose attack description */ - int min_level; /* Minimum level to use */ - int chance; /* Chance of 'success' */ - int dd; /* Damage dice */ - int ds; /* Damage sides */ - s16b effect; /* Special effects */ - s16b power; /* Special effects power */ + const char *desc; /* A verbose attack description */ + int min_level; /* Minimum level to use */ + int chance; /* Chance of 'success' */ + int dd; /* Damage dice */ + int ds; /* Damage sides */ + s16b effect; /* Special effects */ + s16b power; /* Special effects power */ }; diff --git a/src/melee1.cc b/src/melee1.cc index 35b76638..b09a1e11 100644 --- a/src/melee1.cc +++ b/src/melee1.cc @@ -108,7 +108,7 @@ static int check_hit(int power, int level) /* * Hack -- possible "insult" messages */ -static cptr desc_insult[] = +static const char *desc_insult[] = { "insults you!", "insults your mother!", @@ -125,7 +125,7 @@ static cptr desc_insult[] = /* * Hack -- possible "insult" messages */ -static cptr desc_moan[] = +static const char *desc_moan[] = { "seems sad about something.", "asks if you have seen his dogs.", @@ -253,7 +253,7 @@ bool_ carried_make_attack_normal(int r_idx) int power = 0; int damage = 0; - cptr act = NULL; + const char *act = NULL; /* Extract the attack infomation */ int effect = r_ptr->blow[ap_cnt].effect; @@ -1255,7 +1255,7 @@ bool_ make_attack_normal(int m_idx, byte divis) int power = 0; int damage = 0; - cptr act = NULL; + const char *act = NULL; /* Extract the attack infomation */ int effect = m_ptr->blow[ap_cnt].effect; diff --git a/src/melee2.cc b/src/melee2.cc index f2bea5a7..891b643d 100644 --- a/src/melee2.cc +++ b/src/melee2.cc @@ -61,7 +61,7 @@ * Based on mon_take_hit... all monster attacks on * other monsters should use */ -bool_ mon_take_hit_mon(int s_idx, int m_idx, int dam, bool_ *fear, cptr note) +bool_ mon_take_hit_mon(int s_idx, int m_idx, int dam, bool_ *fear, const char *note) { monster_type *m_ptr = &m_list[m_idx], *s_ptr = &m_list[s_idx]; @@ -893,7 +893,7 @@ static void monst_bolt_monst(int m_idx, int y, int x, int typ, int dam_hp) } -static void monster_msg(cptr fmt, ...) +static void monster_msg(const char *fmt, ...) { va_list vp; @@ -912,7 +912,7 @@ static void monster_msg(cptr fmt, ...) monster_msg_simple(buf); } -void monster_msg_simple(cptr s) +void monster_msg_simple(const char *s) { auto &messages = game->messages; @@ -4714,7 +4714,7 @@ static bool_ monst_attack_monst(int m_idx, int t_idx) int power = 0; int damage = 0; - cptr act = NULL; + const char *act = NULL; /* Extract the attack infomation */ int effect = m_ptr->blow[ap_cnt].effect; diff --git a/src/melee2.hpp b/src/melee2.hpp index d5106850..ab4658b5 100644 --- a/src/melee2.hpp +++ b/src/melee2.hpp @@ -4,7 +4,7 @@ #include "monster_type_fwd.hpp" extern int monst_spell_monst_spell; -bool_ mon_take_hit_mon(int s_idx, int m_idx, int dam, bool_ *fear, cptr note); +bool_ mon_take_hit_mon(int s_idx, int m_idx, int dam, bool_ *fear, const char *note); void mon_handle_fear(monster_type *m_ptr, int dam, bool_ *fear); int check_hit2(int power, int level, int ac); void process_monsters(); diff --git a/src/messages.cc b/src/messages.cc index 071dc66e..df578e31 100644 --- a/src/messages.cc +++ b/src/messages.cc @@ -22,7 +22,7 @@ message const &Messages::at(int age) const return buffer.at(i); } -void Messages::add(cptr msg, byte color) +void Messages::add(const char *msg, byte color) { assert(msg != nullptr); add(std::string(msg), color); diff --git a/src/messages.hpp b/src/messages.hpp index 0443a6c8..fe2c99b1 100644 --- a/src/messages.hpp +++ b/src/messages.hpp @@ -41,7 +41,7 @@ public: /** * Add a message. */ - void add(cptr msg, byte color); + void add(const char *msg, byte color); /** * Add a message. diff --git a/src/mimic.cc b/src/mimic.cc index 7dcc3933..350245d3 100644 --- a/src/mimic.cc +++ b/src/mimic.cc @@ -25,10 +25,10 @@ typedef struct mimic_form_type mimic_form_type; struct mimic_form_type { int modules[3]; /* Modules where this mimicry form is available; terminated with a -1 entry */ - cptr name; /* Name of mimicry form */ - cptr obj_name; /* Object mimicry form name */ - cptr desc; /* Description */ - cptr realm; /* Realm of mimicry */ + const char *name; /* Name of mimicry form */ + const char *obj_name; /* Object mimicry form name */ + const char *desc; /* Description */ + const char *realm; /* Realm of mimicry */ bool_ limit; /* If true, the form is not available except through special means */ byte level; byte rarity; @@ -618,7 +618,7 @@ static mimic_form_type *get_mimic_form(int mf_idx) /* * Find a mimic by name */ -s16b resolve_mimic_name(cptr name) +s16b resolve_mimic_name(const char *name) { for (s16b i = 0; i < MIMIC_FORMS_MAX; i++) { @@ -666,7 +666,7 @@ s16b find_random_mimic_shape(byte level, bool_ limit) /* * Get mimic name */ -cptr get_mimic_name(s16b mf_idx) +const char *get_mimic_name(s16b mf_idx) { return get_mimic_form(mf_idx)->name; } @@ -674,7 +674,7 @@ cptr get_mimic_name(s16b mf_idx) /* * Get mimic object name */ -cptr get_mimic_object_name(s16b mf_idx) +const char *get_mimic_object_name(s16b mf_idx) { return get_mimic_form(mf_idx)->obj_name; } diff --git a/src/mimic.hpp b/src/mimic.hpp index 4ce9a6e8..8a3635cb 100644 --- a/src/mimic.hpp +++ b/src/mimic.hpp @@ -1,9 +1,9 @@ #include "h-basic.h" -s16b resolve_mimic_name(cptr name); +s16b resolve_mimic_name(const char *name); s16b find_random_mimic_shape(byte level, bool_ limit); -cptr get_mimic_name(s16b mf_idx); -cptr get_mimic_object_name(s16b mf_idx); +const char *get_mimic_name(s16b mf_idx); +const char *get_mimic_object_name(s16b mf_idx); byte get_mimic_level(s16b mf_idx); s32b get_mimic_random_duration(s16b mf_idx); byte calc_mimic(); diff --git a/src/module_type.hpp b/src/module_type.hpp index 1b75d84c..59a459ce 100644 --- a/src/module_type.hpp +++ b/src/module_type.hpp @@ -10,7 +10,7 @@ struct module_type /* Metadata about the module: author, description, etc. */ struct { /* Module name */ - cptr name; + const char *name; /* Module version number */ struct { @@ -21,18 +21,18 @@ struct module_type /* Module author */ struct { - cptr name; - cptr email; + const char *name; + const char *email; } author; /* Module description */ - cptr desc; + const char *desc; /* Save file tag */ - cptr save_file_tag; + const char *save_file_tag; /* Module directory */ - cptr module_dir; + const char *module_dir; } meta; /* Random artifact generation chances */ diff --git a/src/modules.cc b/src/modules.cc index 85f4f577..41ab4e81 100644 --- a/src/modules.cc +++ b/src/modules.cc @@ -47,7 +47,7 @@ using std::chrono::milliseconds; /* * Check and create if needed the directory dirpath */ -bool_ private_check_user_directory(cptr dirpath) +bool_ private_check_user_directory(const char *dirpath) { /* Is this used anywhere else in *bands? */ struct stat stat_buf; @@ -84,7 +84,7 @@ bool_ private_check_user_directory(cptr dirpath) } } -static void module_reset_dir_aux(char **dir, cptr new_path) +static void module_reset_dir_aux(char **dir, const char *new_path) { char buf[1024]; @@ -99,7 +99,7 @@ static void module_reset_dir_aux(char **dir, cptr new_path) quit(format("Unable to create module dir %s\n", *dir)); } -static void module_reset_dir(cptr dir, cptr new_path) +static void module_reset_dir(const char *dir, const char *new_path) { char **d = 0; char buf[1025]; @@ -217,7 +217,7 @@ static void activate_module(int module_idx) static void init_module(module_type *module_ptr) { /* Set up module directories? */ - cptr dir = module_ptr->meta.module_dir; + const char *dir = module_ptr->meta.module_dir; if (dir) { module_reset_dir("core", dir); module_reset_dir("data", dir); @@ -238,10 +238,10 @@ bool module_savefile_loadable(std::string const &tag) } /* Did the player force a module on command line */ -cptr force_module = NULL; +const char *force_module = NULL; /* Find module index by name. Returns -1 if matching module not found */ -int find_module(cptr name) +int find_module(const char *name) { int i = 0; @@ -363,7 +363,7 @@ bool_ select_module() return (FALSE); } -static bool_ dleft(byte c, cptr str, int y, int o) +static bool_ dleft(byte c, const char *str, int y, int o) { int i = strlen(str); int x = 39 - (strlen(str) / 2) + o; @@ -398,7 +398,7 @@ static bool_ dleft(byte c, cptr str, int y, int o) return FALSE; } -static bool_ dright(byte c, cptr str, int y, int o) +static bool_ dright(byte c, const char *str, int y, int o) { int n = strlen(str); // Conversion to int to avoid warnings int x = 39 - (n / 2) + o; @@ -432,9 +432,9 @@ static bool_ dright(byte c, cptr str, int y, int o) typedef struct intro_text intro_text; struct intro_text { - bool_ (*drop_func)(byte, cptr, int, int); + bool_ (*drop_func)(byte, const char *, int, int); byte color; - cptr text; + const char *text; int y0; int x0; }; diff --git a/src/modules.hpp b/src/modules.hpp index 867955c9..ed76224f 100644 --- a/src/modules.hpp +++ b/src/modules.hpp @@ -9,6 +9,6 @@ void tome_intro(); void theme_intro(); s16b *theme_race_status(int r_idx); void init_hooks_module(); -int find_module(cptr name); -bool_ private_check_user_directory(cptr dirpath); -extern cptr force_module; +int find_module(const char *name); +bool_ private_check_user_directory(const char *dirpath); +extern const char *force_module; diff --git a/src/monster1.cc b/src/monster1.cc index 50c8c548..2147893c 100644 --- a/src/monster1.cc +++ b/src/monster1.cc @@ -24,8 +24,8 @@ /* * Pronoun arrays, by gender. */ -static cptr wd_he[3] = { "it", "he", "she" }; -static cptr wd_his[3] = { "its", "his", "her" }; +static const char *wd_he[3] = { "it", "he", "she" }; +static const char *wd_his[3] = { "its", "his", "her" }; /* @@ -55,14 +55,15 @@ static void roff_aux(std::shared_ptr<monster_race const> r_ptr) int m, n, r; - cptr p, q; + const char *p; + const char *q; bool_ breath = FALSE; bool_ magic = FALSE; - int vn = 0; + int vn = 0; byte color[64]; - cptr vp[64]; + const char *vp[64]; /* Shorthand */ auto const flags = r_ptr->flags; @@ -824,7 +825,7 @@ static void roff_aux(std::shared_ptr<monster_race const> r_ptr) /* How aware is it? */ { - cptr act; + const char *act; if (r_ptr->sleep > 200) { diff --git a/src/monster2.cc b/src/monster2.cc index 939f4c2d..b009683f 100644 --- a/src/monster2.cc +++ b/src/monster2.cc @@ -356,7 +356,7 @@ std::shared_ptr<monster_race> race_info_idx(int r_idx, int ego) return nr_ptr; } -static cptr horror_desc[MAX_HORROR] = +static const char *horror_desc[MAX_HORROR] = { "abominable", "abysmal", @@ -383,7 +383,7 @@ static cptr horror_desc[MAX_HORROR] = "unspeakable", }; -static cptr funny_desc[MAX_FUNNY] = +static const char *funny_desc[MAX_FUNNY] = { "silly", "hilarious", @@ -413,7 +413,7 @@ static cptr funny_desc[MAX_FUNNY] = "preposterous", }; -static cptr funny_comments[MAX_COMMENT] = +static const char *funny_comments[MAX_COMMENT] = { "Wow, cosmic, man!", "Rad!", @@ -1218,7 +1218,7 @@ void monster_desc(char *desc, monster_type *m_ptr, int mode) /* Assume simple result */ - cptr res = "it"; + const char *res = "it"; /* Brute force: split on the possibilities */ switch (kind | (mode & 0x07)) @@ -3581,7 +3581,7 @@ bool_ multiply_monster(int m_idx, bool_ charm, bool_ clone) * Technically should attempt to treat "Beholder"'s as jelly's */ bool_ hack_message_pain_may_silent = FALSE; -void message_pain_hook(cptr message, cptr name) +void message_pain_hook(const char *message, const char *name) { std::string buf; buf += name; diff --git a/src/monster2.hpp b/src/monster2.hpp index ddd0b6bc..fc0b7b3d 100644 --- a/src/monster2.hpp +++ b/src/monster2.hpp @@ -9,7 +9,7 @@ s32b monster_exp(s16b level); void monster_set_level(int m_idx, int level); s32b modify_aux(s32b a, s32b b, char mod); -void monster_msg_simple(cptr s); +void monster_msg_simple(const char *s); bool_ mego_ok(monster_race const *r_ptr, int ego); void monster_check_experience(int m_idx, bool_ silent); void monster_gain_exp(int m_idx, u32b exp, bool_ silent); diff --git a/src/monster_power.hpp b/src/monster_power.hpp index 440d5ba1..3ff2d0b0 100644 --- a/src/monster_power.hpp +++ b/src/monster_power.hpp @@ -9,8 +9,8 @@ */ struct monster_power { - u32b monster_spell_index; - cptr name; /* Name of it */ - int mana; /* Mana needed */ - bool_ great; /* Need the use of great spells */ + u32b monster_spell_index; + const char *name; /* Name of it */ + int mana; /* Mana needed */ + bool_ great; /* Need the use of great spells */ }; diff --git a/src/move_info_type.hpp b/src/move_info_type.hpp index 5f8aa3d8..b6385266 100644 --- a/src/move_info_type.hpp +++ b/src/move_info_type.hpp @@ -11,5 +11,5 @@ struct move_info_type s16b to_search; s16b to_stealth; s16b to_percep; - cptr name; + const char *name; }; diff --git a/src/object1.cc b/src/object1.cc index 4b6f5f34..f1755139 100644 --- a/src/object1.cc +++ b/src/object1.cc @@ -1750,7 +1750,7 @@ void object_desc_store(char *buf, object_type *o_ptr, int pref, int mode) * Determine the "Activation" (if any) for an artifact * Return a string, or NULL for "no activation" */ -cptr item_activation(object_type *o_ptr) +const char *item_activation(object_type *o_ptr) { auto const &a_info = game->edit_data.a_info; auto const &e_info = game->edit_data.e_info; @@ -1822,7 +1822,7 @@ static void check_first(bool_ *first) /* * Display the damage done with a multiplier */ -void output_dam(object_type *o_ptr, int mult, int mult2, cptr against, cptr against2, bool_ *first) +void output_dam(object_type *o_ptr, int mult, int mult2, const char *against, const char *against2, bool_ *first) { int dam; @@ -1913,7 +1913,7 @@ void display_weapon_damage(object_type *o_ptr) /* * Display the ammo damage done with a multiplier */ -void output_ammo_dam(object_type *o_ptr, int mult, int mult2, cptr against, cptr against2, bool_ *first) +void output_ammo_dam(object_type *o_ptr, int mult, int mult2, const char *against, const char *against2, bool_ *first) { int dam; object_type *b_ptr = &p_ptr->inventory[INVEN_BOW]; @@ -2067,7 +2067,7 @@ static void describe_device(object_type *o_ptr) * Print the level something was found on * */ -static cptr object_out_desc_where_found(s16b level, s16b dungeon) +static const char *object_out_desc_where_found(s16b level, s16b dungeon) { auto const &d_info = game->edit_data.d_info; auto const &wf_info = game->edit_data.wf_info; @@ -2107,7 +2107,7 @@ bool_ object_out_desc(object_type *o_ptr, FILE *fff, bool_ trim_down, bool_ wait auto const &st_info = game->edit_data.st_info; auto const &a_info = game->edit_data.a_info; - cptr vp[64]; + const char *vp[64]; byte vc[64]; int vn; @@ -3343,9 +3343,9 @@ s16b wield_slot(object_type const *o_ptr) /* * Return a string mentioning how a given item is carried */ -static cptr mention_use(int i) +static const char *mention_use(int i) { - cptr p; + const char *p; /* Examine the location */ switch (i) @@ -3446,9 +3446,9 @@ static cptr mention_use(int i) * Return a string describing how a given item is being worn. * Currently, only used for items in the equipment, not inventory. */ -cptr describe_use(int i) +const char *describe_use(int i) { - cptr p = nullptr; + const char *p = nullptr; switch (i) { @@ -4082,7 +4082,7 @@ void toggle_inven_equip() * * The item can be negative to mean "item on floor". */ -bool_ verify(cptr prompt, int item) +bool_ verify(const char *prompt, int item) { char o_name[80]; @@ -4367,7 +4367,7 @@ static void show_floor(int y, int x, object_filter_t const &filter) * This version of get_item() is called by get_item() when * the easy_floor is on. */ -static bool_ get_item_floor(int *cp, cptr pmt, cptr str, int mode, object_filter_t const &filter, select_by_name_t const &select_by_name) +static bool_ get_item_floor(int *cp, const char *pmt, const char *str, int mode, object_filter_t const &filter, select_by_name_t const &select_by_name) { char n1 = 0, n2 = 0, which = ' '; @@ -5082,7 +5082,7 @@ static bool_ get_item_floor(int *cp, cptr pmt, cptr str, int mode, object_filter * We always erase the prompt when we are done, leaving a blank line, * or a warning message, if appropriate, if no items are available. */ -bool_ get_item(int *cp, cptr pmt, cptr str, int mode, object_filter_t const &filter, select_by_name_t const &select_by_name) +bool_ get_item(int *cp, const char *pmt, const char *str, int mode, object_filter_t const &filter, select_by_name_t const &select_by_name) { automatizer_create = FALSE; return get_item_floor(cp, pmt, str, mode, filter, select_by_name); @@ -5447,8 +5447,8 @@ void py_pickup_floor(int pickup) else { /* Prompt for the item to pick up */ - cptr q = "Get which item? "; - cptr s = "You have no room in your pack for any of the items here."; + const char *q = "Get which item? "; + const char *s = "You have no room in your pack for any of the items here."; int item; if (get_item(&item, q, s, (USE_FLOOR), item_tester_hook_getable)) { diff --git a/src/object1.hpp b/src/object1.hpp index 93ee2e9a..12e9772d 100644 --- a/src/object1.hpp +++ b/src/object1.hpp @@ -14,7 +14,7 @@ void object_pickup(int this_o_idx); void apply_set(s16b a_idx, s16b set_idx); bool_ takeoff_set(s16b a_idx, s16b set_idx); bool_ wield_set(s16b a_idx, s16b set_idx, bool_ silent); -bool_ verify(cptr prompt, int item); +bool_ verify(const char *prompt, int item); void flavor_init(); void reset_visuals(); boost::optional<int> object_power(object_type *o_ptr); @@ -29,14 +29,14 @@ bool_ object_out_desc(object_type *o_ptr, FILE *fff, bool_ trim_down, bool_ wait char index_to_label(int i); s16b wield_slot_ideal(object_type const *o_ptr, bool_ ideal); s16b wield_slot(object_type const *o_ptr); -cptr describe_use(int i); +const char *describe_use(int i); void display_inven(); void display_equip(); void show_inven_full(); void show_equip_full(); void toggle_inven_equip(); -bool_ get_item(int *cp, cptr pmt, cptr str, int mode, object_filter_t const &filter = object_filter::True(), select_by_name_t const &select_by_name = select_by_name_t()); -cptr item_activation(object_type *o_ptr); +bool_ get_item(int *cp, const char *pmt, const char *str, int mode, object_filter_t const &filter = object_filter::True(), select_by_name_t const &select_by_name = select_by_name_t()); +const char *item_activation(object_type *o_ptr); void py_pickup_floor(int pickup); void object_gain_level(object_type *o_ptr); byte object_attr(object_type const *o_ptr); diff --git a/src/object2.cc b/src/object2.cc index ffb225ea..cd2854af 100644 --- a/src/object2.cc +++ b/src/object2.cc @@ -5664,7 +5664,7 @@ s16b inven_takeoff(int item, int amt, bool_ force_drop) object_type *o_ptr; - cptr act; + const char *act; char o_name[80]; diff --git a/src/option_type.hpp b/src/option_type.hpp index 4d8a7a51..fe1316b0 100644 --- a/src/option_type.hpp +++ b/src/option_type.hpp @@ -25,10 +25,10 @@ struct option_type /** * Textual name. */ - cptr o_text; + const char *o_text; /** * Textual description */ - cptr o_desc; + const char *o_desc; }; diff --git a/src/player_type.hpp b/src/player_type.hpp index 696a7016..e09f82b9 100644 --- a/src/player_type.hpp +++ b/src/player_type.hpp @@ -332,7 +332,7 @@ struct player_type struct spellbinder spellbinder; - cptr mimic_name = nullptr; + const char *mimic_name = nullptr; char tactic = '\0'; /* from 128-4 "extremely coward" to, 128+4 "berserker" */ char movement = '\0'; /* base movement way */ diff --git a/src/powers.cc b/src/powers.cc index 913810fd..8496e2e6 100644 --- a/src/powers.cc +++ b/src/powers.cc @@ -145,7 +145,8 @@ static void power_activate(int power) object_type *q_ptr; object_type forge; int ii = 0, ij = 0; - cptr q, s; + const char *q; + const char *s; int x, y; cave_type *c_ptr; @@ -601,7 +602,8 @@ static void power_activate(int power) int item, x, y, d; object_type *o_ptr; - cptr q, s; + const char *q; + const char *s; /* Get an item */ q = "Awaken which monster? "; diff --git a/src/q_fireprof.cc b/src/q_fireprof.cc index abe4c1b5..bb7b54c3 100644 --- a/src/q_fireprof.cc +++ b/src/q_fireprof.cc @@ -30,8 +30,8 @@ struct fireproof_settings { byte tval; /* tval of object to use. */ byte sval; /* sval of object to use. */ - cptr tval_name; /* descriptive name of tval */ - cptr tval_name_plural; /* descriptive name of tval (plural) */ + const char *tval_name; /* descriptive name of tval */ + const char *tval_name_plural; /* descriptive name of tval (plural) */ s32b total_points; /* total number of points awarded */ }; diff --git a/src/q_god.cc b/src/q_god.cc index 4643cd6e..58ae525f 100644 --- a/src/q_god.cc +++ b/src/q_god.cc @@ -234,7 +234,7 @@ static std::string make_directions(bool feel_it) int home2_y, home2_x; const char *home1 = NULL; const char *home2 = NULL; - cptr feel_it_str = feel_it ? ", I can feel it.'" : "."; + const char *feel_it_str = feel_it ? ", I can feel it.'" : "."; std::string dir_string; get_home_coordinates( @@ -1090,7 +1090,7 @@ static bool quest_god_char_dump_hook(void *, void *in_, void *) { int relics = cquest_relics_found; char relics_text[128]; - cptr append_text = ""; + const char *append_text = ""; snprintf(relics_text, sizeof(relics_text), "%d", relics); diff --git a/src/randart.cc b/src/randart.cc index f91f766a..a05c98cb 100644 --- a/src/randart.cc +++ b/src/randart.cc @@ -134,7 +134,7 @@ static long ltotal[S_WORD + 1][S_WORD + 1]; * probability tables which are used later on for letter selection. It * relies on the ASCII character set. */ -void build_prob(cptr learn) +void build_prob(const char *learn) { int c_prev, c_cur, c_next; diff --git a/src/randart.hpp b/src/randart.hpp index 6f91f36d..07bcd218 100644 --- a/src/randart.hpp +++ b/src/randart.hpp @@ -3,6 +3,6 @@ #include "h-basic.h" #include "object_type_fwd.hpp" -void build_prob(cptr learn); +void build_prob(const char *learn); bool_ create_artifact(object_type *o_ptr, bool_ a_scroll, bool_ get_name); bool_ artifact_scroll(); diff --git a/src/school_type.hpp b/src/school_type.hpp index 7a5702b4..1c1703bc 100644 --- a/src/school_type.hpp +++ b/src/school_type.hpp @@ -5,7 +5,7 @@ struct school_type { - cptr name; /* Name */ + const char *name; /* Name */ s16b skill; /* Skill used for that school */ bool_ spell_power; /* Does spell power affect spells in this school? */ bool_ sorcery; /* Does Sorcery affect this school? */ diff --git a/src/skills.cc b/src/skills.cc index f52af2c9..c46c61e0 100644 --- a/src/skills.cc +++ b/src/skills.cc @@ -121,7 +121,7 @@ static void decrease_skill(int i, s16b *invest) * Given the name of a skill, returns skill index or -1 if no * such skill is found */ -s16b find_skill(cptr needle) +s16b find_skill(const char *needle) { auto const &s_descriptors = game->edit_data.s_descriptors; @@ -139,7 +139,7 @@ s16b find_skill(cptr needle) return -1; } -s16b find_skill_i(cptr needle) +s16b find_skill_i(const char *needle) { auto const &s_descriptors = game->edit_data.s_descriptors; @@ -351,7 +351,7 @@ static void print_skills(std::vector<skill_entry> const &table, int sel, int sta int j; int wid, hgt; - cptr keys; + const char *keys; Term_clear(); Term_get_size(&wid, &hgt); @@ -745,7 +745,7 @@ s16b get_melee_skill() return (0); } -cptr get_melee_name() +const char *get_melee_name() { return melee_names[get_melee_skill()]; } @@ -1503,7 +1503,7 @@ void do_get_new_skill() /* Ok we oppose, so be sure */ if (oppose) { - cptr msg; + const char *msg; /* * Because this is SO critical a question, we must flush @@ -1557,7 +1557,7 @@ void do_get_new_skill() * Given the name of an ability, returns ability index or -1 if no * such ability is found */ -s16b find_ability(cptr name) +s16b find_ability(const char *name) { auto const &ab_info = game->edit_data.ab_info; @@ -1697,7 +1697,7 @@ static void print_abilities(const std::vector<std::size_t> &table, int sel, int int i, j; int wid, hgt; - cptr keys; + const char *keys; Term_clear(); Term_get_size(&wid, &hgt); diff --git a/src/skills.hpp b/src/skills.hpp index 8b1437d9..166aae4e 100644 --- a/src/skills.hpp +++ b/src/skills.hpp @@ -6,13 +6,13 @@ /* Skill functions */ void dump_skills(FILE *fff); -s16b find_skill(cptr name); -s16b find_skill_i(cptr name); +s16b find_skill(const char *name); +s16b find_skill_i(const char *name); s16b get_skill(int skill); s16b get_skill_scale(int skill, u32b scale); void do_cmd_skill(); void do_cmd_activate_skill(); -cptr get_melee_name(); +const char *get_melee_name(); s16b get_melee_skills(); s16b get_melee_skill(); bool_ forbid_gloves(); @@ -21,7 +21,7 @@ void compute_skills(s32b *v, s32b *m, std::size_t i); void select_default_melee(); void do_get_new_skill(); void init_skill(s32b value, s32b mod, std::size_t i); -s16b find_ability(cptr name); +s16b find_ability(const char *name); void dump_abilities(FILE *fff); void do_cmd_ability(); void apply_level_abilities(int level); diff --git a/src/spell_type.cc b/src/spell_type.cc index 6cf6e35b..db021b9c 100644 --- a/src/spell_type.cc +++ b/src/spell_type.cc @@ -19,7 +19,7 @@ */ struct spell_type { - cptr name; /* Name */ + const char *name; /* Name */ byte skill_level; /* Required level (to learn) */ std::vector<std::string> m_description; /* List of strings */ @@ -53,7 +53,7 @@ struct spell_type public: - spell_type(cptr _name) + spell_type(const char *_name) : name(_name) , skill_level(0) , m_description() @@ -246,7 +246,7 @@ void spell_type_set_castable_while_confused(spell_type *spell, bool_ value) spell->castable_while_confused = value; } -void spell_type_describe(spell_type *spell, cptr line) +void spell_type_describe(spell_type *spell, const char *line) { assert(spell != NULL); @@ -258,7 +258,7 @@ void spell_type_add_school(spell_type *spell, s32b school_idx) school_idx_add_new(spell, school_idx); } -void spell_type_set_device_charges(spell_type *spell, cptr charges_s) +void spell_type_set_device_charges(spell_type *spell, const char *charges_s) { assert(spell != NULL); @@ -272,7 +272,7 @@ void spell_type_add_device_allocation(spell_type *spell, struct device_allocatio spell->m_device_allocation.push_back(a); } -spell_type *spell_type_new(cptr name) +spell_type *spell_type_new(const char *name) { spell_type *spell = new spell_type(name); assert(spell != NULL); @@ -291,7 +291,7 @@ casting_result spell_type_produce_effect(spell_type *spell) return spell->effect_func(); } -cptr spell_type_name(spell_type *spell) +const char *spell_type_name(spell_type *spell) { assert(spell != NULL); @@ -390,7 +390,7 @@ bool_ spell_type_inertia(spell_type *spell, s32b *difficulty, s32b *delay) return TRUE; } -cptr spell_type_info(spell_type *spell) +const char *spell_type_info(spell_type *spell) { assert(spell != NULL); diff --git a/src/spell_type.hpp b/src/spell_type.hpp index 43758103..7353bc84 100644 --- a/src/spell_type.hpp +++ b/src/spell_type.hpp @@ -56,18 +56,18 @@ void spell_type_set_difficulty(spell_type *spell, byte skill_level, s32b failure void spell_type_set_mana(spell_type *spell, s32b min, s32b max); void spell_type_set_castable_while_blind(spell_type *spell, bool_ value); void spell_type_set_castable_while_confused(spell_type *spell, bool_ value); -void spell_type_describe(spell_type *spell, cptr line); +void spell_type_describe(spell_type *spell, const char *line); void spell_type_add_school(spell_type *spell, s32b school_idx); -void spell_type_set_device_charges(spell_type *spell, cptr charges_s); +void spell_type_set_device_charges(spell_type *spell, const char *charges_s); void spell_type_add_device_allocation(spell_type *spell, device_allocation *a); -spell_type *spell_type_new(cptr name); +spell_type *spell_type_new(const char *name); int spell_type_produce_effect_lasting(spell_type *spell); casting_result spell_type_produce_effect(spell_type *spell); -cptr spell_type_name(spell_type *spell); +const char *spell_type_name(spell_type *spell); int spell_type_skill_level(spell_type *spell); long spell_type_roll_charges(spell_type *spell); struct device_allocation *spell_type_device_allocation(spell_type *spell, byte tval); @@ -80,7 +80,7 @@ std::vector<s32b> const spell_type_get_schools(spell_type *spell); bool_ spell_type_inertia(spell_type *spell, s32b *difficulty, s32b *delay); s32b spell_type_failure_rate(spell_type *spell); s16b spell_type_casting_stat(spell_type *spell); -cptr spell_type_info(spell_type *spell); +const char *spell_type_info(spell_type *spell); void spell_type_mana_range(spell_type *spell, struct range_type *range); bool_ spell_type_dependencies_satisfied(spell_type *spell); void spell_type_description_foreach(spell_type *spell, std::function<void (std::string const &text)>); diff --git a/src/spells1.cc b/src/spells1.cc index 64a8a9c7..55a200bd 100644 --- a/src/spells1.cc +++ b/src/spells1.cc @@ -1224,7 +1224,7 @@ void spellbinder_trigger() * the game when he dies, since the "You die." message is shown before * setting the player to "dead". */ -void take_hit(int damage, cptr hit_from) +void take_hit(int damage, const char *hit_from) { object_type *o_ptr = &p_ptr->inventory[INVEN_CARRY]; int old_chp = p_ptr->chp; @@ -1468,7 +1468,7 @@ void take_hit(int damage, cptr hit_from) /* Decrease player's sanity. This is a copy of the function above. */ -void take_sanity_hit(int damage, cptr hit_from) +void take_sanity_hit(int damage, const char *hit_from) { int old_csane = p_ptr->csane; @@ -1921,7 +1921,7 @@ static int minus_ac() /* * Hurt the player with Acid */ -void acid_dam(int dam, cptr kb_str) +void acid_dam(int dam, const char *kb_str) { int inv = (dam < 30) ? 1 : (dam < 60) ? 2 : 3; @@ -1951,7 +1951,7 @@ void acid_dam(int dam, cptr kb_str) /* * Hurt the player with electricity */ -void elec_dam(int dam, cptr kb_str) +void elec_dam(int dam, const char *kb_str) { int inv = (dam < 30) ? 1 : (dam < 60) ? 2 : 3; @@ -1980,7 +1980,7 @@ void elec_dam(int dam, cptr kb_str) /* * Hurt the player with Fire */ -void fire_dam(int dam, cptr kb_str) +void fire_dam(int dam, const char *kb_str) { int inv = (dam < 30) ? 1 : (dam < 60) ? 2 : 3; @@ -2009,7 +2009,7 @@ void fire_dam(int dam, cptr kb_str) /* * Hurt the player with Cold */ -void cold_dam(int dam, cptr kb_str) +void cold_dam(int dam, const char *kb_str) { int inv = (dam < 30) ? 1 : (dam < 60) ? 2 : 3; @@ -3753,7 +3753,7 @@ static bool_ project_o(int who, int r, int y, int x, int dam, int typ) bool_ plural = FALSE; bool_ do_kill = FALSE; - cptr note_kill = NULL; + const char *note_kill = NULL; /* Acquire object */ object_type * o_ptr = &o_list[this_o_idx]; @@ -3949,7 +3949,7 @@ static bool_ project_o(int who, int r, int y, int x, int dam, int typ) case GF_RAISE_DEMON: { auto r_ptr = &r_info[o_ptr->pval2]; - cptr name; + const char *name; if (o_ptr->tval != TV_CORPSE) break; @@ -4150,10 +4150,10 @@ bool_ project_m(int who, int r, int y, int x, int dam, int typ) char m_name[80]; /* Assume no note */ - cptr note = NULL; + const char *note = NULL; /* Assume a default death */ - cptr note_dies = " dies."; + const char *note_dies = " dies."; /* Nobody here */ @@ -6780,7 +6780,7 @@ static bool_ project_p(int who, int r, int y, int x, int dam, int typ, int a_rad char killer[80]; /* Hack -- messages */ - cptr act = NULL; + const char *act = NULL; /* Player is not here */ @@ -8715,7 +8715,7 @@ static void describe_attack_fully(int type, char* r) std::string name_spell(random_spell const *s_ptr) { char buff[30]; - cptr buff2 = "???"; + const char *buff2 = "???"; if (s_ptr->proj_flags & PROJECT_STOP && s_ptr->radius == 0) { diff --git a/src/spells1.hpp b/src/spells1.hpp index ec8f2cc9..ab721e01 100644 --- a/src/spells1.hpp +++ b/src/spells1.hpp @@ -16,12 +16,12 @@ void teleport_player_to(int ny, int nx); void teleport_monster_to(int m_idx, int ny, int nx); void teleport_player_level(); void recall_player(int d, int f); -void take_hit(int damage, cptr kb_str); -void take_sanity_hit(int damage, cptr hit_from); -void acid_dam(int dam, cptr kb_str); -void elec_dam(int dam, cptr kb_str); -void fire_dam(int dam, cptr kb_str); -void cold_dam(int dam, cptr kb_str); +void take_hit(int damage, const char *kb_str); +void take_sanity_hit(int damage, const char *hit_from); +void acid_dam(int dam, const char *kb_str); +void elec_dam(int dam, const char *kb_str); +void fire_dam(int dam, const char *kb_str); +void cold_dam(int dam, const char *kb_str); bool_ dec_stat(int stat, int amount, int mode); bool_ res_stat(int stat, bool_ full); bool_ apply_disenchant(int mode); diff --git a/src/spells2.cc b/src/spells2.cc index cb84fa74..2ed9bbcf 100644 --- a/src/spells2.cc +++ b/src/spells2.cc @@ -230,7 +230,7 @@ void explosive_rune() /* * Array of stat "descriptions" */ -static cptr desc_stat_pos[] = +static const char *desc_stat_pos[] = { "strong", "smart", @@ -244,7 +244,7 @@ static cptr desc_stat_pos[] = * Array of long descriptions of stat */ -static cptr long_desc_stat[] = +static const char *long_desc_stat[] = { "strength", "intelligence", @@ -257,7 +257,7 @@ static cptr long_desc_stat[] = /* * Array of stat "descriptions" */ -static cptr desc_stat_neg[] = +static const char *desc_stat_neg[] = { "weak", "stupid", @@ -772,7 +772,7 @@ static int report_magics_aux(int dur) } } -static cptr report_magic_durations[] = +static const char *report_magic_durations[] = { "for a short time", "for a little while", @@ -791,7 +791,7 @@ void report_magics() char Dummy[80]; - cptr info[128]; + const char *info[128]; int info2[128]; if (p_ptr->blind) @@ -1191,7 +1191,7 @@ template<typename P> static bool detect_monsters_fn(int radius, P p) { /* * Detect all (string) monsters on current panel */ -static bool_ detect_monsters_string(cptr chars, int rad) +static bool_ detect_monsters_string(const char *chars, int rad) { auto predicate = [chars](monster_race *r_ptr) -> bool { return strchr(chars, r_ptr->d_char); @@ -1700,7 +1700,8 @@ bool_ enchant_spell(int num_hit, int num_dam, int num_ac, int num_pval) int item; bool_ okay = FALSE; char o_name[80]; - cptr q, s; + const char *q; + const char *s; /* Assume enchant weapon */ @@ -2642,7 +2643,7 @@ void aggravate_monsters(int who) /* * Generic genocide race selection */ -static bool get_genocide_race(cptr msg, char *typ) +static bool get_genocide_race(const char *msg, char *typ) { int i, j; cave_type *c_ptr; diff --git a/src/spells3.cc b/src/spells3.cc index 916ff503..21ebe1bf 100644 --- a/src/spells3.cc +++ b/src/spells3.cc @@ -1631,7 +1631,7 @@ typedef struct geo_summon geo_summon; struct geo_summon { s16b feat; s16b skill_idx; - cptr *summon_names; + const char **summon_names; }; geo_summon *geomancy_find_summon(geo_summon summons[], int feat) @@ -1648,7 +1648,7 @@ geo_summon *geomancy_find_summon(geo_summon summons[], int feat) return NULL; } -int geomancy_count_elements(cptr *elements) +int geomancy_count_elements(const char **elements) { int i; for (i = 0; elements[i] != NULL; i++) @@ -1662,25 +1662,25 @@ casting_result geomancy_elemental_minion() int dir = 0; int x = 0, y = 0; geo_summon *summon_ptr = NULL; - cptr earth_summons[] = { + const char *earth_summons[] = { "Earth elemental", "Xorn", "Xaren", NULL }; - cptr air_summons[] = { + const char *air_summons[] = { "Air elemental", "Ancient blue dragon", "Great Storm Wyrm", "Sky Drake", NULL }; - cptr fire_summons[] = { + const char *fire_summons[] = { "Fire elemental", "Ancient red dragon", NULL }; - cptr water_summons[] = { + const char *water_summons[] = { "Water elemental", "Water troll", "Water demon", @@ -1730,7 +1730,7 @@ casting_result geomancy_elemental_minion() } else { - cptr *names = summon_ptr->summon_names; + const char **names = summon_ptr->summon_names; int max = get_skill_scale(summon_ptr->skill_idx, geomancy_count_elements(names)); int r_idx = test_monster_name(names[rand_int(max)]); @@ -2228,7 +2228,7 @@ casting_result meta_spellbinder() { struct trigger { int idx; - cptr desc; + const char *desc; }; struct trigger triggers[] = { { SPELLBINDER_HP75, "75% HP", }, diff --git a/src/spells4.cc b/src/spells4.cc index ca010627..33b2b24e 100644 --- a/src/spells4.cc +++ b/src/spells4.cc @@ -59,7 +59,7 @@ static bool_ uses_piety_to_cast(int s) } /** Describe what type of energy the spell uses for casting */ -cptr get_power_name(s32b s) +const char *get_power_name(s32b s) { return uses_piety_to_cast(s) ? "piety" : "mana"; } @@ -413,13 +413,13 @@ static std::string spell_school_name(spell_type *spell) return buf.str(); } -int print_spell(cptr label_, byte color, int y, s32b s) +int print_spell(const char *label_, byte color, int y, s32b s) { s32b level; bool_ na; spell_type *spell = spell_at(s); - cptr spell_info = spell_type_info(spell); - cptr label = (label_ == NULL) ? "" : label_; + const char *spell_info = spell_type_info(spell); + const char *label = (label_ == NULL) ? "" : label_; char level_str[8] = "n/a"; char buf[128]; diff --git a/src/spells4.hpp b/src/spells4.hpp index 02cdc3ce..c0f7a736 100644 --- a/src/spells4.hpp +++ b/src/spells4.hpp @@ -35,7 +35,7 @@ void init_school_books(); school_book *school_books_at(int sval); void school_book_add_spell(school_book *school_book, s32b spell_idx); void random_book_setup(s16b sval, s32b spell_idx); -int print_spell(cptr label, byte color, int y, s32b s); +int print_spell(const char *label, byte color, int y, s32b s); int school_book_length(int sval); int spell_x(int sval, int spell_idx, int i); bool_ school_book_contains_spell(int sval, s32b spell_idx); diff --git a/src/spells5.cc b/src/spells5.cc index 09d1815b..53d7b8b2 100644 --- a/src/spells5.cc +++ b/src/spells5.cc @@ -12,7 +12,7 @@ static s16b school_spells_count = 0; static struct spell_type *school_spells[SCHOOL_SPELLS_MAX]; -static spell_type *spell_new(s32b *index, cptr name) +static spell_type *spell_new(s32b *index, const char *name) { assert(school_spells_count < SCHOOL_SPELLS_MAX); @@ -24,7 +24,7 @@ static spell_type *spell_new(s32b *index, cptr name) return spell; } -static cptr no_info() +static const char *no_info() { return ""; } @@ -37,7 +37,7 @@ spell_type *spell_at(s32b index) return school_spells[index]; } -boost::optional<int> find_spell(cptr name) +boost::optional<int> find_spell(const char *name) { int i; diff --git a/src/spells5.hpp b/src/spells5.hpp index 7c07b6a8..fb557f85 100644 --- a/src/spells5.hpp +++ b/src/spells5.hpp @@ -8,4 +8,4 @@ void school_spells_init(); struct spell_type *spell_at(s32b index); s16b get_random_spell(s16b random_type, int lev); s16b get_random_stick(byte tval, int level); -boost::optional<int> find_spell(cptr name); +boost::optional<int> find_spell(const char *name); diff --git a/src/spells6.cc b/src/spells6.cc index 37d251a6..110f8e9c 100644 --- a/src/spells6.cc +++ b/src/spells6.cc @@ -50,7 +50,7 @@ school_type *school_at(int index) return &schools[index]; } -static void school_init(school_type *school, cptr name, s16b skill) +static void school_init(school_type *school, const char *name, s16b skill) { assert(school != NULL); @@ -64,7 +64,7 @@ static void school_init(school_type *school, cptr name, s16b skill) school->deity_idx = -1; } -static school_type *school_new(s32b *school_idx, cptr name, s16b skill) +static school_type *school_new(s32b *school_idx, const char *name, s16b skill) { assert(schools_count < SCHOOLS_MAX); @@ -77,7 +77,7 @@ static school_type *school_new(s32b *school_idx, cptr name, s16b skill) return school; } -static school_type *sorcery_school_new(s32b *school_idx, cptr name, s16b skill) +static school_type *sorcery_school_new(s32b *school_idx, const char *name, s16b skill) { school_type *school = school_new(school_idx, name, skill); school->spell_power = TRUE; diff --git a/src/squelch/condition.cc b/src/squelch/condition.cc index 259d93e7..43802c41 100644 --- a/src/squelch/condition.cc +++ b/src/squelch/condition.cc @@ -110,7 +110,7 @@ std::shared_ptr<Condition> Condition::parse_condition(jsoncons::json const &cond return nullptr; } - cptr type_s = condition_json.get("type").as<cptr>(); + const char *type_s = condition_json.get("type").as<const char *>(); if (!type_s) { msg_print("Missing/invalid 'type' in condition"); @@ -187,7 +187,7 @@ bool NameCondition::is_match(object_type *o_ptr) const std::shared_ptr<Condition> NameCondition::from_json(jsoncons::json const &j) { - cptr s = j.get("name").as<cptr>(); + const char *s = j.get("name").as<const char *>(); if (!s) { @@ -222,7 +222,7 @@ bool ContainCondition::is_match(object_type *o_ptr) const std::shared_ptr<Condition> ContainCondition::from_json(jsoncons::json const &j) { - cptr s = j.get("contain").as<cptr>(); + const char *s = j.get("contain").as<const char *>(); if (!s) { @@ -490,7 +490,7 @@ bool StatusCondition::is_match(object_type *o_ptr) const std::shared_ptr<Condition> StatusCondition::from_json(jsoncons::json const &j) { - cptr s = j.get("status").as<cptr>(); + const char *s = j.get("status").as<const char *>(); if (!s) { @@ -531,7 +531,7 @@ bool RaceCondition::is_match(object_type *o_ptr) const std::shared_ptr<Condition> RaceCondition::from_json(jsoncons::json const &j) { - cptr s = j.get("race").as<cptr>(); + const char *s = j.get("race").as<const char *>(); if (!s) { @@ -565,7 +565,7 @@ bool SubraceCondition::is_match(object_type *o_ptr) const std::shared_ptr<Condition> SubraceCondition::from_json(jsoncons::json const &j) { - cptr s = j.get("subrace").as<cptr>(); + const char *s = j.get("subrace").as<const char *>(); if (!s) { @@ -599,7 +599,7 @@ bool ClassCondition::is_match(object_type *o_ptr) const std::shared_ptr<Condition> ClassCondition::from_json(jsoncons::json const &j) { - cptr s = j.get("class").as<cptr>(); + const char *s = j.get("class").as<const char *>(); if (!s) { @@ -635,7 +635,7 @@ bool InscriptionCondition::is_match(object_type *o_ptr) const std::shared_ptr<Condition> InscriptionCondition::from_json(jsoncons::json const &j) { - cptr s = j.get("inscription").as<cptr>(); + const char *s = j.get("inscription").as<const char *>(); if (!s) { @@ -777,7 +777,7 @@ std::shared_ptr<Condition> SkillCondition::from_json(jsoncons::json const &j) } int max = max_j.as_int(); - auto s = j.get("name").as<cptr>(); + auto s = j.get("name").as<const char *>(); if (!s) { msg_print("Missing/invalid 'name' property"); @@ -863,7 +863,7 @@ bool AbilityCondition::is_match(object_type *) const std::shared_ptr<Condition> AbilityCondition::from_json(jsoncons::json const &j) { - cptr a = j.get("ability").as<cptr>(); + const char *a = j.get("ability").as<const char *>(); if (!a) { diff --git a/src/squelch/rule.cc b/src/squelch/rule.cc index e35b3ce1..c528bf8d 100644 --- a/src/squelch/rule.cc +++ b/src/squelch/rule.cc @@ -151,17 +151,17 @@ std::shared_ptr<Rule> Rule::parse_rule(jsoncons::json const &rule_json) // Convert attributes action_type action; - if (!action_mapping().parse((cptr) rule_action_s, &action)) + if (!action_mapping().parse(rule_action_s, &action)) { msg_format("Invalid rule action '%s'", rule_action_s); return nullptr; } - int module_idx = find_module((cptr) rule_module_s); + int module_idx = find_module(rule_module_s); if (module_idx < 0) { msg_format("Skipping rule for unrecognized module '%s'", - (cptr) rule_module_s); + rule_module_s); return nullptr; } diff --git a/src/squelch/tree_printer.cc b/src/squelch/tree_printer.cc index 0dbceec9..f065c10b 100644 --- a/src/squelch/tree_printer.cc +++ b/src/squelch/tree_printer.cc @@ -53,9 +53,9 @@ void TreePrinter::scroll_right() { m_write_off_x--; } -void TreePrinter::write(uint8_t color, cptr line) +void TreePrinter::write(uint8_t color, const char *line) { - cptr p = line; + const char *p = line; for (p = line; *p != '\0'; p++) { diff --git a/src/squeltch.cc b/src/squeltch.cc index f55739d6..0f22ddc6 100644 --- a/src/squeltch.cc +++ b/src/squeltch.cc @@ -249,10 +249,10 @@ static void rename_rule(Rule *rule) void do_cmd_automatizer() { int active = ACTIVE_LIST; - cptr keys; - cptr keys2; - cptr keys3; - std::vector<cptr> rule_names; + const char *keys; + const char *keys2; + const char *keys3; + std::vector<const char *> rule_names; if (!automatizer_enabled) { diff --git a/src/store.cc b/src/store.cc index 664ba289..3f1bc583 100644 --- a/src/store.cc +++ b/src/store.cc @@ -62,7 +62,7 @@ #define MAX_COMMENT_1 6 -static cptr comment_1[MAX_COMMENT_1] = +static const char *comment_1[MAX_COMMENT_1] = { "Okay.", "Fine.", @@ -74,7 +74,7 @@ static cptr comment_1[MAX_COMMENT_1] = #define MAX_COMMENT_4A 4 -static cptr comment_4a[MAX_COMMENT_4A] = +static const char *comment_4a[MAX_COMMENT_4A] = { "Enough! You have abused me once too often!", "Arghhh! I have had enough abuse for one day!", @@ -84,7 +84,7 @@ static cptr comment_4a[MAX_COMMENT_4A] = #define MAX_COMMENT_4B 4 -static cptr comment_4b[MAX_COMMENT_4B] = +static const char *comment_4b[MAX_COMMENT_4B] = { "Leave my store!", "Get out of my sight!", @@ -128,7 +128,7 @@ static void say_comment_4() #define MAX_COMMENT_7A 4 -static cptr comment_7a[MAX_COMMENT_7A] = +static const char *comment_7a[MAX_COMMENT_7A] = { "Arrgghh!", "You moron!", @@ -138,7 +138,7 @@ static cptr comment_7a[MAX_COMMENT_7A] = #define MAX_COMMENT_7B 4 -static cptr comment_7b[MAX_COMMENT_7B] = +static const char *comment_7b[MAX_COMMENT_7B] = { "Darn!", "You fiend!", @@ -148,7 +148,7 @@ static cptr comment_7b[MAX_COMMENT_7B] = #define MAX_COMMENT_7C 4 -static cptr comment_7c[MAX_COMMENT_7C] = +static const char *comment_7c[MAX_COMMENT_7C] = { "Cool!", "You've made my day!", @@ -158,7 +158,7 @@ static cptr comment_7c[MAX_COMMENT_7C] = #define MAX_COMMENT_7D 4 -static cptr comment_7d[MAX_COMMENT_7D] = +static const char *comment_7d[MAX_COMMENT_7D] = { "Yippee!", "I think I'll retire!", @@ -1661,7 +1661,7 @@ void display_store() /* * Get the ID of a store item and return its value -RAK- */ -static int get_stock(int *com_val, cptr pmt, int i, int j) +static int get_stock(int *com_val, const char *pmt, int i, int j) { char command; @@ -1731,10 +1731,10 @@ static int get_stock(int *com_val, cptr pmt, int i, int j) * * @return TRUE if 'yes' was selected, otherwise returns FALSE. */ -static bool_ prompt_yesno(cptr prompt) +static bool_ prompt_yesno(const char *prompt) { - cptr allowed = "yn\r\n"; - cptr yes = "y\r\n"; + const char *allowed = "yn\r\n"; + const char *yes = "y\r\n"; char buf[128]; bool_ ret; @@ -2451,7 +2451,8 @@ void store_sell() bool museum = bool(st_info[st_ptr->st_idx].flags & STF_MUSEUM); /* Prepare prompt */ - cptr q, s; + const char *q; + const char *s; if (cur_store_num == STORE_HOME) { q = "Drop which item? "; diff --git a/src/tables.cc b/src/tables.cc index 15b8c105..bc983a6f 100644 --- a/src/tables.cc +++ b/src/tables.cc @@ -1057,7 +1057,7 @@ s32b player_exp[PY_MAX_LEVEL] = /* * Hack -- the "basic" color names (see "TERM_xxx") */ -cptr color_names[16] = +const char *color_names[16] = { "Dark", "White", @@ -1081,7 +1081,7 @@ cptr color_names[16] = /* * Abbreviations of healthy stats */ -cptr stat_names[6] = +const char *stat_names[6] = { "STR", "INT", "WIS", "DEX", "CON", "CHR" }; @@ -1089,7 +1089,7 @@ cptr stat_names[6] = /* * Abbreviations of damaged stats */ -cptr stat_names_reduced[6] = +const char *stat_names_reduced[6] = { "Str", "Int", "Wis", "Dex", "Con", "Chr" }; @@ -1109,7 +1109,7 @@ cptr stat_names_reduced[6] = * The "ctrl-g" command (or pseudo-command) should perhaps grab a snapshot * of the main screen into any interested windows. */ -cptr window_flag_desc[32] = +const char *window_flag_desc[32] = { "Display inven/equip", "Display equip/inven", @@ -1147,7 +1147,7 @@ cptr window_flag_desc[32] = /* Names used for random artifact name generation */ -cptr artifact_names_list = +const char *artifact_names_list = "adanedhel\n" "adurant\n" "aeglos\n" @@ -1773,15 +1773,6 @@ martial_arts ma_blows[MAX_MA] = { "You hit %s with a Crushing Blow.", 48, 35, 20, 12, MA_STUN, 18 }, }; -/* - * cptr desc; A verbose attack description - * int min_level; Minimum level to use - * int chance; Chance of 'success - * int dd; Damage dice - * int ds; Damage sides - * s16b effect; Special effects - * s16b power; Special effects power - */ martial_arts bear_blows[MAX_BEAR] = { { "You claw %s.", 1, 0, 3, 4, MA_STUN, 4 }, diff --git a/src/tables.hpp b/src/tables.hpp index 38cc1d7b..bd23b069 100644 --- a/src/tables.hpp +++ b/src/tables.hpp @@ -48,10 +48,10 @@ extern byte adj_con_mhp[]; extern byte blows_table[12][12]; extern byte extract_energy[300]; extern s32b player_exp[PY_MAX_LEVEL]; -extern cptr color_names[16]; -extern cptr stat_names[6]; -extern cptr stat_names_reduced[6]; -extern cptr window_flag_desc[32]; +extern const char *color_names[16]; +extern const char *stat_names[6]; +extern const char *stat_names_reduced[6]; +extern const char *window_flag_desc[32]; extern martial_arts bear_blows[MAX_BEAR]; extern martial_arts ma_blows[MAX_MA]; extern magic_power mindcraft_powers[MAX_MINDCRAFT_POWERS]; @@ -63,13 +63,13 @@ extern tactic_info_type tactic_info[9]; extern activation activation_info[MAX_T_ACT]; extern inscription_info_type inscription_info[MAX_INSCRIPTIONS]; std::vector<flags_group> const &flags_groups(); -extern cptr artifact_names_list; +extern const char *artifact_names_list; extern monster_power monster_powers[MONSTER_POWERS_MAX]; extern tval_desc tvals[]; extern tval_desc tval_descs[]; extern between_exit between_exits[MAX_BETWEEN_EXITS]; extern int month_day[9]; -extern cptr month_name[9]; +extern const char *month_name[9]; extern cli_comm *cli_info; extern int cli_total; extern quest_type quest[MAX_Q_IDX]; diff --git a/src/tactic_info_type.hpp b/src/tactic_info_type.hpp index 4cb330f4..371ccf6d 100644 --- a/src/tactic_info_type.hpp +++ b/src/tactic_info_type.hpp @@ -12,5 +12,5 @@ struct tactic_info_type s16b to_ac; s16b to_stealth; s16b to_saving; - cptr name; + const char *name; }; diff --git a/src/town_type.hpp b/src/town_type.hpp index 0b903138..d7779425 100644 --- a/src/town_type.hpp +++ b/src/town_type.hpp @@ -11,7 +11,7 @@ */ struct town_type { - cptr name = nullptr; + const char *name = nullptr; seed_t seed = seed_t::system(); /* Seed for RNG */ diff --git a/src/util.cc b/src/util.cc index 8f08d3ef..6040a4e1 100644 --- a/src/util.cc +++ b/src/util.cc @@ -94,11 +94,11 @@ std::string user_name() * But leading tilde symbols must be handled in a special way * Replace "~/" by the home directory of the current user */ -errr path_parse(char *buf, int max, cptr file) +errr path_parse(char *buf, int max, const char *file) { - cptr u, s; - struct passwd *pw; - + const char *u; + const char *s; + struct passwd *pw; /* Assume no result */ buf[0] = '\0'; @@ -154,7 +154,7 @@ errr path_parse(char *buf, int max, cptr file) * This requires no special processing on simple machines, * except for verifying the size of the filename. */ -errr path_parse(char *buf, int max, cptr file) +errr path_parse(char *buf, int max, const char *file) { /* Accept the filename */ strnfmt(buf, max, "%s", file); @@ -180,7 +180,7 @@ errr path_parse(char *buf, int max, cptr file) * Note that this function yields a path which must be "parsed" * using the "parse" function above. */ -errr path_build(char *buf, int max, cptr path, cptr file) +errr path_build(char *buf, int max, const char *path, const char *file) { /* Special file */ if (file[0] == '~') @@ -218,7 +218,7 @@ errr path_build(char *buf, int max, cptr path, cptr file) /* * Hack -- replacement for "fopen()" */ -FILE *my_fopen(cptr file, cptr mode) +FILE *my_fopen(const char *file, const char *mode) { char buf[1024]; @@ -336,7 +336,7 @@ errr my_fgets(FILE *fff, char *buf, unsigned long n) /* * Hack -- attempt to delete a file */ -errr fd_kill(cptr file) +errr fd_kill(const char *file) { char buf[1024]; @@ -354,7 +354,7 @@ errr fd_kill(cptr file) /* * Hack -- attempt to move a file */ -errr fd_move(cptr file, cptr what) +errr fd_move(const char *file, const char *what) { char buf[1024]; char aux[1024]; @@ -381,7 +381,7 @@ errr fd_move(cptr file, cptr what) * Note that we assume that the file should be "binary" * */ -int fd_make(cptr file, int mode) +int fd_make(const char *file, int mode) { char buf[1024]; @@ -401,7 +401,7 @@ return (open(buf, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, mode)); * * Note that we assume that the file should be "binary" */ -int fd_open(cptr file, int flags) +int fd_open(const char *file, int flags) { char buf[1024]; @@ -475,7 +475,7 @@ errr fd_read(int fd, char *buf, unsigned long n) /* * Hack -- Attempt to write data to a file descriptor */ -errr fd_write(int fd, cptr buf, unsigned long n) +errr fd_write(int fd, const char *buf, unsigned long n) { /* Verify the fd */ if (fd < 0) return ( -1); @@ -615,15 +615,15 @@ static int dehex(char c) } -static void trigger_text_to_ascii(char **bufptr, cptr *strptr) +static void trigger_text_to_ascii(char **bufptr, const char **strptr) { char *s = *bufptr; - cptr str = *strptr; + const char *str = *strptr; bool_ mod_status[MAX_MACRO_MOD]; int i, len = 0; int shiftstatus = 0; - cptr key_code; + const char *key_code; if (macro_template == NULL) return; @@ -713,7 +713,7 @@ static void trigger_text_to_ascii(char **bufptr, cptr *strptr) * parsing "\xFF" into a (signed) char. Whoever thought of making * the "sign" of a "char" undefined is a complete moron. Oh well. */ -void text_to_ascii(char *buf, cptr str) +void text_to_ascii(char *buf, const char *str) { char *s = buf; @@ -838,13 +838,13 @@ void text_to_ascii(char *buf, cptr str) } -bool_ trigger_ascii_to_text(char **bufptr, cptr *strptr) +static bool_ trigger_ascii_to_text(char **bufptr, const char **strptr) { char *s = *bufptr; - cptr str = *strptr; + const char *str = *strptr; char key_code[100]; int i; - cptr tmp; + const char *tmp; if (macro_template == NULL) return FALSE; @@ -903,7 +903,7 @@ bool_ trigger_ascii_to_text(char **bufptr, cptr *strptr) /* * Hack -- convert a string into a printable form */ -void ascii_to_text(char *buf, cptr str) +void ascii_to_text(char *buf, const char *str) { char *s = buf; @@ -1011,7 +1011,7 @@ static bool_ macro__use[256]; /* * Find the macro (if any) which exactly matches the given pattern */ -int macro_find_exact(cptr pat) +int macro_find_exact(const char *pat) { int i; @@ -1039,7 +1039,7 @@ int macro_find_exact(cptr pat) /* * Find the first macro (if any) which contains the given pattern */ -static int macro_find_check(cptr pat) +static int macro_find_check(const char *pat) { int i; @@ -1067,7 +1067,7 @@ static int macro_find_check(cptr pat) /* * Find the first macro (if any) which contains the given pattern and more */ -static int macro_find_maybe(cptr pat) +static int macro_find_maybe(const char *pat) { int i; @@ -1098,7 +1098,7 @@ static int macro_find_maybe(cptr pat) /* * Find the longest macro (if any) which starts with the given pattern */ -static int macro_find_ready(cptr pat) +static int macro_find_ready(const char *pat) { int i, t, n = -1, s = -1; @@ -1144,7 +1144,7 @@ static int macro_find_ready(cptr pat) * with some kind of "powerful keymap" ability, but this might make it hard * to change the "roguelike" option from inside the game. XXX XXX XXX */ -errr macro_add(cptr pat, cptr act) +errr macro_add(const char *pat, const char *act) { int n; @@ -1275,7 +1275,8 @@ static char inkey_aux() char ch; - cptr pat, act; + const char *pat; + const char *act; char buf[1024]; @@ -1413,7 +1414,7 @@ static char inkey_aux() * trigger any macros, and cannot be bypassed by the Borg. It is used * in Angband to handle "keymaps". */ -static cptr inkey_next = NULL; +static const char *inkey_next = NULL; bool_ inkey_flag = FALSE; @@ -1702,7 +1703,7 @@ static void msg_flush(int x) } /* Display a message */ -void display_message(int x, int y, int split, byte color, cptr t) +void display_message(int x, int y, int split, byte color, const char *t) { int i = 0, j = 0; @@ -1756,7 +1757,7 @@ void display_message(int x, int y, int split, byte color, cptr t) * XXX XXX XXX Note that "msg_print(NULL)" will clear the top line * even if no messages are pending. This is probably a hack. */ -void cmsg_print(byte color, cptr msg) +void cmsg_print(byte color, const char *msg) { auto &messages = game->messages; @@ -1892,7 +1893,7 @@ void cmsg_print(byte color, std::string const &msg) } /* Hack -- for compatibility and easy sake */ -void msg_print(cptr msg) +void msg_print(const char *msg) { cmsg_print(TERM_WHITE, msg); } @@ -1943,7 +1944,7 @@ void screen_load() /* * Display a formatted message, using "vstrnfmt()" and "msg_print()". */ -void msg_format(cptr fmt, ...) +void msg_format(const char *fmt, ...) { va_list vp; @@ -1962,7 +1963,7 @@ void msg_format(cptr fmt, ...) cmsg_print(TERM_WHITE, buf); } -void cmsg_format(byte color, cptr fmt, ...) +void cmsg_format(byte color, const char *fmt, ...) { va_list vp; @@ -1981,7 +1982,7 @@ void cmsg_format(byte color, cptr fmt, ...) cmsg_print(color, buf); } -void c_put_str(byte attr, cptr str, int row, int col) +void c_put_str(byte attr, const char *str, int row, int col) { Term_putstr(col, row, -1, attr, str); } @@ -1991,7 +1992,7 @@ void c_put_str(byte attr, std::string const &str, int row, int col) Term_putstr(col, row, -1, attr, str.c_str()); } -void put_str(cptr str, int row, int col) +void put_str(const char *str, int row, int col) { Term_putstr(col, row, -1, TERM_WHITE, str); } @@ -2006,7 +2007,7 @@ void put_str(std::string const &str, int row, int col) * Display a string on the screen using an attribute, and clear * to the end of the line. */ -void c_prt(byte attr, cptr str, int row, int col) +void c_prt(byte attr, const char *str, int row, int col) { /* Clear line, position cursor */ Term_erase(col, row, 255); @@ -2020,7 +2021,7 @@ void c_prt(byte attr, std::string const &s, int row, int col) c_prt(attr, s.c_str(), row, col); } -void prt(cptr str, int row, int col) +void prt(const char *str, int row, int col) { c_prt(TERM_WHITE, str, row, col); } @@ -2044,7 +2045,7 @@ void prt(std::string const &s, int row, int col) * This function will correctly handle any width up to the maximum legal * value of 256, though it works best for a standard 80 character width. */ -void text_out_to_screen(byte a, cptr str) +void text_out_to_screen(byte a, const char *str) { int x, y; @@ -2052,7 +2053,7 @@ void text_out_to_screen(byte a, cptr str) int wrap; - cptr s; + const char *s; /* Obtain the size */ @@ -2154,7 +2155,7 @@ void text_out_to_screen(byte a, cptr str) * You must be careful to end all file output with a newline character * to "flush" the stored line position. */ -void text_out_to_file(byte a, cptr str) +void text_out_to_file(byte a, const char *str) { /* Current position on the line */ static int pos = 0; @@ -2163,7 +2164,7 @@ void text_out_to_file(byte a, cptr str) int wrap = 75; /* Current location within "str" */ - cptr s = str; + const char *s = str; /* Unused parameter */ a; @@ -2268,7 +2269,7 @@ void text_out_to_file(byte a, cptr str) * Output text to the screen or to a file depending on the selected * text_out hook. */ -void text_out(cptr str) +void text_out(const char *str) { text_out_c(TERM_WHITE, str); } @@ -2283,7 +2284,7 @@ void text_out(std::string const &str) * Output text to the screen (in color) or to a file depending on the * selected hook. */ -void text_out_c(byte a, cptr str) +void text_out_c(byte a, const char *str) { text_out_hook(a, str); } @@ -2525,7 +2526,7 @@ bool_ askfor_aux_with_completion(char *buf, int len) * * We clear the input, and return FALSE, on "ESCAPE". */ -bool_ get_string(cptr prompt, char *buf, int len) +bool_ get_string(const char *prompt, char *buf, int len) { bool_ res; @@ -2553,7 +2554,7 @@ bool_ get_string(cptr prompt, char *buf, int len) * * Note that "[y/n]" is appended to the prompt. */ -bool_ get_check(cptr prompt) +bool_ get_check(const char *prompt) { int i; @@ -2596,7 +2597,7 @@ bool_ get_check(cptr prompt) * * Returns TRUE unless the character is "Escape" */ -bool_ get_com(cptr prompt, char *command) +bool_ get_com(const char *prompt, char *command) { /* Paranoia XXX XXX XXX */ msg_print(NULL); @@ -2623,7 +2624,7 @@ bool_ get_com(cptr prompt, char *command) * * Hack -- allow "command_arg" to specify a quantity */ -s32b get_quantity(cptr prompt, s32b max) +s32b get_quantity(const char *prompt, s32b max) { s32b amt; int aamt; @@ -2763,7 +2764,7 @@ void request_command(int shopping) int mode; - cptr act; + const char *act; /* Keymap mode */ @@ -3078,9 +3079,9 @@ int get_keymap_dir(char ch) int mode; - cptr act; + const char *act; - cptr s; + const char *s; /* Already a direction? */ @@ -3338,7 +3339,7 @@ void strlower(char *buf) * must exactly match (look out for commas and the like!), or else 0 is * returned. Case doesn't matter. -GSN- */ -int test_monster_name(cptr name) +int test_monster_name(const char *name) { auto const &r_info = game->edit_data.r_info; @@ -3353,7 +3354,7 @@ int test_monster_name(cptr name) return (0); } -int test_mego_name(cptr needle) +int test_mego_name(const char *needle) { const auto &re_info = game->edit_data.re_info; @@ -3374,7 +3375,7 @@ int test_mego_name(cptr needle) * must exactly match (look out for commas and the like!), or else -1 is * returned. Case doesn't matter. -DG- */ -int test_item_name(cptr needle) +int test_item_name(const char *needle) { auto const &k_info = game->edit_data.k_info; @@ -3463,7 +3464,7 @@ std::string get_player_race_name(int pr, int ps) /* * Ask to select an item in a list */ -int ask_menu(cptr ask, const std::vector<std::string> &items) +int ask_menu(const char *ask, const std::vector<std::string> &items) { int ret = -1, i, start = 0; char c; @@ -3540,7 +3541,7 @@ int ask_menu(cptr ask, const std::vector<std::string> &items) /* * Determine if string "t" is a prefix of string "s" */ -bool_ prefix(cptr s, cptr t) +bool_ prefix(const char *s, const char *t) { /* Paranoia */ if (!s || !t) @@ -3590,7 +3591,7 @@ void draw_box(int y, int x, int h, int w) /* * Displays a scrollable boxed list with a selected item */ -void display_list(int y, int x, int h, int w, cptr title, std::vector<std::string> const &list, std::size_t begin, std::size_t sel, byte sel_color) +void display_list(int y, int x, int h, int w, const char *title, std::vector<std::string> const &list, std::size_t begin, std::size_t sel, byte sel_color) { draw_box(y, x, h, w); c_put_str(TERM_L_BLUE, title, y, x + ((w - strlen(title)) / 2)); @@ -7,12 +7,12 @@ extern "C" { #endif -errr path_build(char *buf, int max, cptr path, cptr file); +errr path_build(char *buf, int max, const char *path, const char *file); void bell(); -errr macro_add(cptr pat, cptr act); -int macro_find_exact(cptr pat); +errr macro_add(const char *pat, const char *act); +int macro_find_exact(const char *pat); char inkey(); -void prt(cptr str, int row, int col); +void prt(const char *str, int row, int col); #ifdef __cplusplus } // extern "C" diff --git a/src/util.hpp b/src/util.hpp index 05439c22..b8adf0e0 100644 --- a/src/util.hpp +++ b/src/util.hpp @@ -12,57 +12,57 @@ bool input_box(std::string const &text, int y, int x, std::string *buf, std::siz std::string input_box_auto(std::string const &title, std::size_t max); bool input_box_auto(std::string const &prompt, std::string *buf, std::size_t max); void draw_box(int y, int x, int h, int w); -void display_list(int y, int x, int h, int w, cptr title, std::vector<std::string> const &list, std::size_t begin, std::size_t sel, byte sel_color); +void display_list(int y, int x, int h, int w, const char *title, std::vector<std::string> const &list, std::size_t begin, std::size_t sel, byte sel_color); std::string get_player_race_name(int pr, int ps); std::string get_day(s32b day); s32b bst(s32b what, s32b t); -FILE *my_fopen(cptr file, cptr mode); +FILE *my_fopen(const char *file, const char *mode); errr my_fgets(FILE *fff, char *buf, unsigned long n); errr my_fclose(FILE *fff); -errr fd_kill(cptr file); -errr fd_move(cptr file, cptr what); -int fd_make(cptr file, int mode); -int fd_open(cptr file, int flags); +errr fd_kill(const char *file); +errr fd_move(const char *file, const char *what); +int fd_make(const char *file, int mode); +int fd_open(const char *file, int flags); errr fd_seek(int fd, unsigned long n); errr fd_read(int fd, char *buf, unsigned long n); -errr fd_write(int fd, cptr buf, unsigned long n); +errr fd_write(int fd, const char *buf, unsigned long n); errr fd_close(int fd); void flush(); void flush_on_failure(); void move_cursor(int row, int col); -void text_to_ascii(char *buf, cptr str); -void ascii_to_text(char *buf, cptr str); +void text_to_ascii(char *buf, const char *str); +void ascii_to_text(char *buf, const char *str); char inkey_scan(); -void display_message(int x, int y, int split, byte color, cptr t); -void cmsg_print(byte color, cptr msg); +void display_message(int x, int y, int split, byte color, const char *t); +void cmsg_print(byte color, const char *msg); void cmsg_print(byte color, std::string const &msg); -void msg_print(cptr msg); -void cmsg_format(byte color, cptr fmt, ...); -void msg_format(cptr fmt, ...); +void msg_print(const char *msg); +void cmsg_format(byte color, const char *fmt, ...); +void msg_format(const char *fmt, ...); void screen_save(); void screen_load(); -void c_put_str(byte attr, cptr str, int row, int col); +void c_put_str(byte attr, const char *str, int row, int col); void c_put_str(byte attr, std::string const &str, int row, int col); -void put_str(cptr str, int row, int col); +void put_str(const char *str, int row, int col); void put_str(std::string const &s, int row, int col); -void c_prt(byte attr, cptr str, int row, int col); +void c_prt(byte attr, const char *str, int row, int col); void c_prt(byte attr, std::string const &s, int row, int col); void prt(std::string const &s, int row, int col); -void text_out_to_screen(byte a, cptr str); -void text_out_to_file(byte a, cptr str); -void text_out(cptr str); +void text_out_to_screen(byte a, const char *str); +void text_out_to_file(byte a, const char *str); +void text_out(const char *str); void text_out(std::string const &str); -void text_out_c(byte a, cptr str); +void text_out_c(byte a, const char *str); void text_out_c(byte a, std::string const &str); void clear_from(int row); -int ask_menu(cptr ask, const std::vector<std::string> &items); +int ask_menu(const char *ask, const std::vector<std::string> &items); bool askfor_aux(std::string *buf, std::size_t max_len); bool_ askfor_aux(char *buf, int len); bool_ askfor_aux_with_completion(char *buf, int len); -bool_ get_string(cptr prompt, char *buf, int len); -bool_ get_check(cptr prompt); -bool_ get_com(cptr prompt, char *command); -s32b get_quantity(cptr prompt, s32b max); +bool_ get_string(const char *prompt, char *buf, int len); +bool_ get_check(const char *prompt); +bool_ get_com(const char *prompt, char *command); +s32b get_quantity(const char *prompt, s32b max); extern char request_command_ignore_keymaps[MAX_IGNORE_KEYMAPS]; extern bool_ request_command_inven_mode; void request_command(int shopping); @@ -70,9 +70,9 @@ bool_ is_a_vowel(int ch); int get_keymap_dir(char ch); byte count_bits(u32b array); void strlower(char *buf); -int test_monster_name(cptr name); -int test_mego_name(cptr name); -int test_item_name(cptr name); +int test_monster_name(const char *name); +int test_mego_name(const char *name); +int test_item_name(const char *name); char msg_box_auto(std::string const &title); timer_type *new_timer(void (*callback)(), s32b delay); int get_keymap_mode(); @@ -83,6 +83,6 @@ void get_count(int number, int max); bool in_bounds(int y, int x); bool in_bounds2(int y, int x); bool panel_contains(int y, int x); -errr path_parse(char *buf, int max, cptr file); +errr path_parse(char *buf, int max, const char *file); void pause_line(int row); std::string user_name(); diff --git a/src/variable.cc b/src/variable.cc index 280fcaa3..39f05e57 100644 --- a/src/variable.cc +++ b/src/variable.cc @@ -133,7 +133,7 @@ FILE *text_out_file = NULL; * Hack -- function hook to output (colored) text to the * screen or to a file. */ -void (*text_out_hook)(byte a, cptr str) = text_out_to_screen; +void (*text_out_hook)(byte a, const char *str) = text_out_to_screen; /* @@ -385,15 +385,15 @@ int wildc2i[256]; /* * Default texts for feature information. */ -cptr DEFAULT_FEAT_TEXT = "a wall blocking your way"; -cptr DEFAULT_FEAT_TUNNEL = "You cannot tunnel through that."; -cptr DEFAULT_FEAT_BLOCK = DEFAULT_FEAT_TEXT; +const char *DEFAULT_FEAT_TEXT = "a wall blocking your way"; +const char *DEFAULT_FEAT_TUNNEL = "You cannot tunnel through that."; +const char *DEFAULT_FEAT_BLOCK = DEFAULT_FEAT_TEXT; /* * Hack -- The special Angband "System Suffix" * This variable is used to choose an appropriate "pref-xxx" file */ -cptr ANGBAND_SYS = "xxx"; +const char *ANGBAND_SYS = "xxx"; /* * Path name: The main "lib" directory @@ -612,7 +612,7 @@ s16b last_teleportation_x = -1; /* * The current game module */ -cptr game_module; +const char *game_module; s32b game_module_idx; s32b VERSION_MAJOR; s32b VERSION_MINOR; diff --git a/src/variable.h b/src/variable.h index 6d6e5775..de3bded9 100644 --- a/src/variable.h +++ b/src/variable.h @@ -6,7 +6,7 @@ extern "C" { #endif -extern cptr ANGBAND_SYS; +extern const char *ANGBAND_SYS; extern char *ANGBAND_DIR_SAVE; extern char *ANGBAND_DIR_DATA; extern char *ANGBAND_DIR_EDIT; diff --git a/src/variable.hpp b/src/variable.hpp index 52256ab6..a984e39f 100644 --- a/src/variable.hpp +++ b/src/variable.hpp @@ -83,7 +83,7 @@ extern bool_ hack_mind; extern bool_ is_autosave; extern int artifact_bias; extern FILE *text_out_file; -extern void (*text_out_hook)(byte a, cptr str); +extern void (*text_out_hook)(byte a, const char *str); extern int text_out_indent; extern s16b feeling; extern s16b rating; @@ -137,9 +137,9 @@ extern player_race_mod const *rmp_ptr; extern player_class const *cp_ptr; extern player_spec const *spp_ptr; extern int wildc2i[256]; -extern cptr DEFAULT_FEAT_TEXT; -extern cptr DEFAULT_FEAT_TUNNEL; -extern cptr DEFAULT_FEAT_BLOCK; +extern const char *DEFAULT_FEAT_TEXT; +extern const char *DEFAULT_FEAT_TUNNEL; +extern const char *DEFAULT_FEAT_BLOCK; extern char *ANGBAND_DIR; extern char *ANGBAND_DIR_MODULES; extern char *ANGBAND_DIR_CORE; @@ -175,7 +175,7 @@ extern effect_type effects[MAX_EFFECTS]; extern bool_ automatizer_enabled; extern s16b last_teleportation_y; extern s16b last_teleportation_x; -extern cptr game_module; +extern const char *game_module; extern s32b game_module_idx; extern s32b VERSION_MAJOR; extern s32b VERSION_MINOR; diff --git a/src/wizard2.cc b/src/wizard2.cc index ac0610b1..6caccd78 100644 --- a/src/wizard2.cc +++ b/src/wizard2.cc @@ -154,7 +154,7 @@ static void wiz_create_named_art() object_type forge; object_type *q_ptr; int i, a_idx; - cptr p = "Number of the artifact: "; + const char *p = "Number of the artifact: "; char out_val[80] = ""; if (!get_string(p, out_val, 4)) return; @@ -507,7 +507,7 @@ static char head[4] = { 'a', 'A', '0', ':' }; * Trims characters from the beginning until it fits in the space * before the next row or the edge of the screen. */ -static void wci_string(cptr string, int num) +static void wci_string(const char *string, int num) { int row = 2 + (num % 20), col = 30 * (num / 20); int ch = head[num / 20] + (num % 20), max_len = 0; @@ -538,7 +538,7 @@ static int wiz_create_itemtype() int num, max_num; int tval; - cptr tval_desc2; + const char *tval_desc2; char ch; /* Clear screen */ @@ -631,7 +631,7 @@ static int wiz_create_itemtype() */ static void wiz_tweak_item(object_type *o_ptr) { - cptr p; + const char *p; char tmp_val[80]; /* Extract the flags */ @@ -839,7 +839,7 @@ static void wiz_statistics(object_type *o_ptr) object_type forge; object_type *q_ptr; - cptr q = "Rolls: %ld, Matches: %ld, Better: %ld, Worse: %ld, Other: %ld"; + const char *q = "Rolls: %ld, Matches: %ld, Better: %ld, Worse: %ld, Other: %ld"; /* XXX XXX XXX Mega-Hack -- allow multiple artifacts */ if (artifact_p(o_ptr)) @@ -858,7 +858,7 @@ static void wiz_statistics(object_type *o_ptr) /* Interact */ while (TRUE) { - cptr pmt = "Roll for [n]ormal, [g]ood, or [e]xcellent treasure? "; + const char *pmt = "Roll for [n]ormal, [g]ood, or [e]xcellent treasure? "; /* Display item */ wiz_display_item(o_ptr); @@ -1220,7 +1220,7 @@ static void wiz_create_item_2() { auto const &k_info = game->edit_data.k_info; - cptr p = "Number of the object :"; + const char *p = "Number of the object :"; char out_val[80] = ""; if (!get_string(p, out_val, 4)) return; diff --git a/src/xtra1.cc b/src/xtra1.cc index a039e0cf..cd164b8c 100644 --- a/src/xtra1.cc +++ b/src/xtra1.cc @@ -177,7 +177,7 @@ s16b modify_stat_value(int value, int amount) /* * Print character info at given row, column in a 13 char field */ -static void prt_field(cptr info, int row, int col) +static void prt_field(const char *info, int row, int col) { /* Dump 13 spaces to clear */ c_put_str(TERM_WHITE, " ", row, col); @@ -296,7 +296,7 @@ static void prt_stat(int stat) */ static void prt_title() { - cptr p = ""; + const char *p = ""; /* Mimic shape */ if (p_ptr->mimic_form) diff --git a/src/xtra2.cc b/src/xtra2.cc index 8f240c63..b1a9854e 100644 --- a/src/xtra2.cc +++ b/src/xtra2.cc @@ -151,9 +151,9 @@ static bool_ set_simple_field( s16b *p_field, s16b v, byte activate_color, - cptr activate_msg, + const char *activate_msg, byte deactivate_color, - cptr deactivate_msg) + const char *deactivate_msg) { bool_ notice = FALSE; @@ -2072,7 +2072,7 @@ void lose_exp(s32b amount) */ int get_coin_type(std::shared_ptr<monster_race const> r_ptr) { - cptr name = r_ptr->name; + const char *name = r_ptr->name; /* Analyze "coin" monsters */ if (r_ptr->d_char == '$') @@ -2186,7 +2186,7 @@ void place_corpse(monster_type *m_ptr) * Check if monster race is in a given list. The list * must be NULL-terminated. */ -static bool_ monster_race_in_list_p(monster_type *m_ptr, cptr races[]) +static bool_ monster_race_in_list_p(monster_type *m_ptr, const char *races[]) { int i=0; for (i=0; races[i] != NULL; i++) @@ -2208,7 +2208,7 @@ static void monster_death_gods(int m_idx, monster_type *m_ptr) { /* TODO: This should really be a racial flag which can be added to the r_info file. */ - cptr DWARVES[] = { + const char *DWARVES[] = { "Petty-dwarf", "Petty-dwarf mage", "Dark dwarven warrior", @@ -2218,7 +2218,7 @@ static void monster_death_gods(int m_idx, monster_type *m_ptr) "Dwarven warrior", NULL, }; - cptr UNIQUE_DWARVES[] = { + const char *UNIQUE_DWARVES[] = { "Nar, the Dwarf", "Naugladur, Lord of Nogrod", "Telchar the Smith", @@ -2245,7 +2245,7 @@ static void monster_death_gods(int m_idx, monster_type *m_ptr) if (p_ptr->pgod == GOD_ULMO) { /* He doesn't like it if you kill these monsters */ - cptr MINOR_RACES[] = { + const char *MINOR_RACES[] = { "Swordfish", "Barracuda", "Globefish", @@ -2276,7 +2276,7 @@ static void monster_death_gods(int m_idx, monster_type *m_ptr) NULL, }; /* These monsters earn higher penalties */ - cptr MAJOR_RACES[] = { + const char *MAJOR_RACES[] = { "Seahorse", "Aquatic elven warrior", "Aquatic elven mage", @@ -2298,7 +2298,7 @@ static void monster_death_gods(int m_idx, monster_type *m_ptr) if (p_ptr->pgod == GOD_MANDOS) { - cptr MINOR_BONUS_RACES[] = { + const char *MINOR_BONUS_RACES[] = { "Vampire", "Master vampire", "Oriental vampire", @@ -2312,12 +2312,12 @@ static void monster_death_gods(int m_idx, monster_type *m_ptr) "Elder vampire", NULL, }; - cptr MAJOR_BONUS_RACES[] = { + const char *MAJOR_BONUS_RACES[] = { "Vampire elf", "Thuringwethil, the Vampire Messenger", NULL, }; - cptr MINOR_PENALTY[] = { + const char *MINOR_PENALTY[] = { "Dark elf", "Dark elven druid", "Eol, the Dark Elf", @@ -2330,7 +2330,7 @@ static void monster_death_gods(int m_idx, monster_type *m_ptr) "Dark elven sorcerer", NULL, }; - cptr MEDIUM_PENALTY[] = { + const char *MEDIUM_PENALTY[] = { "Glorfindel of Rivendell", "Finrod Felagund", "Thranduil, King of the Wood Elves", @@ -2340,7 +2340,7 @@ static void monster_death_gods(int m_idx, monster_type *m_ptr) "Elven archer", NULL, }; - cptr MAJOR_PENALTY[] = { + const char *MAJOR_PENALTY[] = { "Child spirit", "Young spirit", "Mature spirit", @@ -2973,7 +2973,7 @@ void monster_death(int m_idx) * monster worth more than subsequent monsters. This would also need * to induce changes in the monster recall code. */ -bool_ mon_take_hit(int m_idx, int dam, bool_ *fear, cptr note) +bool_ mon_take_hit(int m_idx, int dam, bool_ *fear, const char *note) { monster_type *m_ptr = &m_list[m_idx]; auto const r_idx = m_ptr->r_idx; @@ -3556,7 +3556,7 @@ void resize_window() /* * Monster health description */ -static cptr look_mon_desc(int m_idx) +static const char *look_mon_desc(int m_idx) { bool_ living = TRUE; @@ -3837,8 +3837,8 @@ static std::vector<point> target_set_prepare(int mode) } -bool_ target_object(int y, int x, int mode, cptr info, bool_ *boring, - object_type *o_ptr, char *out_val, cptr *s1, cptr *s2, cptr *s3, +bool_ target_object(int y, int x, int mode, const char *info, bool_ *boring, + object_type *o_ptr, char *out_val, const char **s1, const char **s2, const char **s3, int *query) { char o_name[80]; @@ -3893,7 +3893,7 @@ bool_ target_object(int y, int x, int mode, cptr info, bool_ *boring, * * This function must handle blindness/hallucination. */ -static int target_set_aux(int y, int x, int mode, cptr info_) +static int target_set_aux(int y, int x, int mode, const char *info_) { auto const &d_info = game->edit_data.d_info; auto const &st_info = game->edit_data.st_info; @@ -3905,7 +3905,9 @@ static int target_set_aux(int y, int x, int mode, cptr info_) cave_type *c_ptr = &cave[y][x]; - cptr s1, s2, s3; + const char *s1; + const char *s2; + const char *s3; bool_ boring; @@ -3944,7 +3946,7 @@ static int target_set_aux(int y, int x, int mode, cptr info_) /* Hack -- hallucination */ if (p_ptr->image) { - cptr name = "something strange"; + const char *name = "something strange"; /* Display a message */ sprintf(out_val, "%s%s%s%s [%s]", s1, s2, s3, name, info.c_str()); @@ -4031,7 +4033,7 @@ static int target_set_aux(int y, int x, int mode, cptr info_) /* Normal */ else { - cptr mstat; + const char *mstat; switch (m_ptr->status) { @@ -4709,7 +4711,7 @@ bool_ get_aim_dir(int *dp) char command; - cptr p; + const char *p; if (repeat_pull(dp)) { diff --git a/src/xtra2.hpp b/src/xtra2.hpp index a69de037..47fc3a78 100644 --- a/src/xtra2.hpp +++ b/src/xtra2.hpp @@ -66,7 +66,7 @@ void gain_exp(s32b amount); void lose_exp(s32b amount); int get_coin_type(std::shared_ptr<monster_race const> r_ptr); void monster_death(int m_idx); -bool_ mon_take_hit(int m_idx, int dam, bool_ *fear, cptr note); +bool_ mon_take_hit(int m_idx, int dam, bool_ *fear, const char *note); bool_ change_panel(int dy, int dx); void verify_panel(); bool_ target_okay(); diff --git a/src/z-form.c b/src/z-form.c index cffa1d4b..ec68f74f 100644 --- a/src/z-form.c +++ b/src/z-form.c @@ -92,7 +92,7 @@ * Append the character "c". * Do not use the "+" or "0" flags. * - * Format("%s", cptr s) + * Format("%s", const char *s) * Append the string "s". * Do not use the "+" or "0" flags. * Note that a "NULL" value of "s" is converted to the empty string. @@ -177,9 +177,9 @@ * the given buffer to a length of zero, and return a "length" of zero. * The contents of "buf", except for "buf[0]", may then be undefined. */ -unsigned int vstrnfmt(char *buf, unsigned int max, cptr fmt, va_list vp) +unsigned int vstrnfmt(char *buf, unsigned int max, const char *fmt, va_list vp) { - cptr s; + const char *s; /* The argument is "long" */ bool_ do_long; @@ -499,10 +499,10 @@ unsigned int vstrnfmt(char *buf, unsigned int max, cptr fmt, va_list vp) /* String */ case 's': { - cptr arg; + const char *arg; /* Access next argument */ - arg = va_arg(vp, cptr); + arg = va_arg(vp, const char *); /* Hack -- convert NULL to EMPTY */ if (!arg) arg = ""; @@ -556,7 +556,7 @@ unsigned int vstrnfmt(char *buf, unsigned int max, cptr fmt, va_list vp) * Do a vstrnfmt (see above) into a (growable) static buffer. * This buffer is usable for very short term formatting of results. */ -static char *vformat(cptr fmt, va_list vp) +static char *vformat(const char *fmt, va_list vp) { static char *format_buf = NULL; static size_t format_len = 0; @@ -605,7 +605,7 @@ static char *vformat(cptr fmt, va_list vp) /* * Do a vstrnfmt (see above) into a buffer of a given size. */ -unsigned int strnfmt(char *buf, unsigned int max, cptr fmt, ...) +unsigned int strnfmt(char *buf, unsigned int max, const char *fmt, ...) { unsigned int len; @@ -633,7 +633,7 @@ unsigned int strnfmt(char *buf, unsigned int max, cptr fmt, ...) * Note that the buffer is (technically) writable, but only up to * the length of the string contained inside it. */ -char *format(cptr fmt, ...) +char *format(const char *fmt, ...) { char *res; va_list vp; @@ -657,7 +657,7 @@ char *format(cptr fmt, ...) /* * Vararg interface to quit() */ -void quit_fmt(cptr fmt, ...) +void quit_fmt(const char *fmt, ...) { char *res; va_list vp; diff --git a/src/z-form.h b/src/z-form.h index 96369891..160b39de 100644 --- a/src/z-form.h +++ b/src/z-form.h @@ -21,16 +21,16 @@ extern "C" { /**** Available Functions ****/ /* Format arguments into given bounded-length buffer */ -unsigned int vstrnfmt(char *buf, unsigned int max, cptr fmt, va_list vp); +unsigned int vstrnfmt(char *buf, unsigned int max, const char *fmt, va_list vp); /* Simple interface to "vstrnfmt()" */ -unsigned int strnfmt(char *buf, unsigned int max, cptr fmt, ...); +unsigned int strnfmt(char *buf, unsigned int max, const char *fmt, ...); /* Simple interface to "vformat()" */ -char *format(cptr fmt, ...); +char *format(const char *fmt, ...); /* Vararg interface to "quit()", using "format()" */ -void quit_fmt(cptr fmt, ...); +void quit_fmt(const char *fmt, ...); #ifdef __cplusplus } /* extern "C" */ diff --git a/src/z-term.c b/src/z-term.c index b38fc150..922a0e8e 100644 --- a/src/z-term.c +++ b/src/z-term.c @@ -420,7 +420,7 @@ void Term_queue_char(int x, int y, byte a, char c) * a valid location, so the first "n" characters of "s" can all be added * starting at (x,y) without causing any illegal operations. */ -void Term_queue_chars(int x, int y, int n, byte a, cptr s) +void Term_queue_chars(int x, int y, int n, byte a, const char *s) { int x1 = -1, x2 = -1; @@ -985,7 +985,7 @@ errr Term_addch(byte a, char c) * positive value, future calls to either function will * return negative ones. */ -errr Term_addstr(int n, byte a, cptr s) +errr Term_addstr(int n, byte a, const char *s) { int k; @@ -1040,7 +1040,7 @@ errr Term_putch(int x, int y, byte a, char c) /* * Move to a location and, using an attr, add a string */ -errr Term_putstr(int x, int y, int n, byte a, cptr s) +errr Term_putstr(int x, int y, int n, byte a, const char *s) { errr res; diff --git a/src/z-term.h b/src/z-term.h index f3836045..588945be 100644 --- a/src/z-term.h +++ b/src/z-term.h @@ -148,7 +148,7 @@ struct term errr (*curs_hook)(int x, int y); - errr (*text_hook)(int x, int y, int n, byte a, cptr s); + errr (*text_hook)(int x, int y, int n, byte a, const char *s); void (*resize_hook)(); @@ -223,16 +223,16 @@ extern term *Term; errr Term_xtra(int n, int v); void Term_queue_char(int x, int y, byte a, char c); -void Term_queue_chars(int x, int y, int n, byte a, cptr s); +void Term_queue_chars(int x, int y, int n, byte a, const char *s); errr Term_fresh(); errr Term_set_cursor(int v); errr Term_gotoxy(int x, int y); errr Term_draw(int x, int y, byte a, char c); errr Term_addch(byte a, char c); -errr Term_addstr(int n, byte a, cptr s); +errr Term_addstr(int n, byte a, const char *s); errr Term_putch(int x, int y, byte a, char c); -errr Term_putstr(int x, int y, int n, byte a, cptr s); +errr Term_putstr(int x, int y, int n, byte a, const char *s); errr Term_erase(int x, int y, int n); errr Term_clear(); errr Term_redraw(); diff --git a/src/z-util.c b/src/z-util.c index 0304a1da..397f5e23 100644 --- a/src/z-util.c +++ b/src/z-util.c @@ -10,7 +10,7 @@ /* * Determine if string "t" is equal to string "t" */ -bool_ streq(cptr a, cptr b) +bool_ streq(const char *a, const char *b) { if ((a == NULL) && (b == NULL)) { return TRUE; } if (a == NULL) { return FALSE; } @@ -22,7 +22,7 @@ bool_ streq(cptr a, cptr b) /* * Determine if string "t" is a suffix of string "s" */ -bool_ suffix(cptr s, cptr t) +bool_ suffix(const char *s, const char *t) { int tlen = strlen(t); int slen = strlen(s); @@ -61,13 +61,13 @@ void capitalize(char *s) /* * Redefinable "plog" action */ -void (*plog_aux)(cptr) = NULL; +void (*plog_aux)(const char *) = NULL; /* * Print (or log) a "warning" message (ala "perror()") * Note the use of the (optional) "plog_aux" hook. */ -void plog(cptr str) +void plog(const char *str) { /* Use the "alternative" function if possible */ if (plog_aux) (*plog_aux)(str); @@ -81,7 +81,7 @@ void plog(cptr str) /* * Redefinable "quit" action */ -void (*quit_aux)(cptr) = NULL; +void (*quit_aux)(const char *) = NULL; /* * Exit (ala "exit()"). If 'str' is NULL, do "exit(0)". @@ -89,7 +89,7 @@ void (*quit_aux)(cptr) = NULL; * Otherwise, plog() 'str' and exit with an error code of -1. * But always use 'quit_aux', if set, before anything else. */ -void quit(cptr str) +void quit(const char *str) { /* Attempt to use the aux function */ if (quit_aux) (*quit_aux)(str); diff --git a/src/z-util.h b/src/z-util.h index d2fa79dc..f33c1d97 100644 --- a/src/z-util.h +++ b/src/z-util.h @@ -13,27 +13,27 @@ extern "C" { /* Aux functions */ -extern void (*plog_aux)(cptr); -extern void (*quit_aux)(cptr); +extern void (*plog_aux)(const char *); +extern void (*quit_aux)(const char *); /**** Available Functions ****/ /* Test equality, prefix, suffix */ -bool_ streq(cptr s, cptr t); -bool_ prefix(cptr s, cptr t); -bool_ suffix(cptr s, cptr t); +bool_ streq(const char *s, const char *t); +bool_ prefix(const char *s, const char *t); +bool_ suffix(const char *s, const char *t); /* Capitalize the first letter of string. Ignores whitespace at the start of string. */ void capitalize(char *s); /* Print an error message */ -void plog(cptr str); +void plog(const char *str); /* Exit, with optional message */ -void quit(cptr str); +void quit(const char *str); #ifdef __cplusplus |