Ticket #1705: 0001-ui-birth.c-consistient-stat-skill-adjustments-for-clas.txt

File 0001-ui-birth.c-consistient-stat-skill-adjustments-for-clas.txt, 2.9 KB (added by daniel.santos, 7 years ago)
Line 
1From 9f23b0c066343eaa3537ddf3184cd12485d9419d Mon Sep 17 00:00:00 2001
2From: Daniel Santos <daniel.santos@pobox.com>
3Date: Tue, 20 Nov 2012 07:41:33 -0600
4Subject: ui-birth.c: consistient stat & skill adjustments for class
5
6When selecting a class, the stat adjustments (str, int,etc.) are
7adjusted to include racial adjustments.  However, this is not the case
8for skills hitdie and exp modifier.  This is not just inconsitient, it
9leaves one to play around with the UI and do some math if they want to
10get a better idea of the character they are about to play.
11
12This patch changes that, so the the hiddie, expfact and skills show
13adjustments for both race and class.
14---
15 src/ui-birth.c |   17 ++++++++++++-----
16 1 file changed, 12 insertions(+), 5 deletions(-)
17
18diff --git a/src/ui-birth.c b/src/ui-birth.c
19index 4df2852..7991055 100644
20--- a/src/ui-birth.c
21+++ b/src/ui-birth.c
22@@ -204,8 +204,14 @@ static void birthmenu_display(menu_type *menu, int oid, bool cursor,
23    only defining the display and handler parts). */
24 static const menu_iter birth_iter = { NULL, NULL, birthmenu_display, NULL, NULL };
25 
26-static void skill_help(s16b skills[], int mhp, int exp, int infra)
27+static void skill_help(const s16b r_skills[], const s16b c_skills[], int mhp, int exp, int infra)
28 {
29+       s16b skills[SKILL_MAX];
30+       unsigned i;
31+
32+       for (i = 0; i < SKILL_MAX ; ++i)
33+               skills[i] = (r_skills ? r_skills[i] : 0 ) + (c_skills ? c_skills[i] : 0);
34+
35        text_out_e("Hit/Shoot/Throw: %+d/%+d/%+d\n", skills[SKILL_TO_HIT_MELEE], skills[SKILL_TO_HIT_BOW], skills[SKILL_TO_HIT_THROW]);
36        text_out_e("Hit die: %2d   XP mod: %d%%\n", mhp, exp);
37        text_out_e("Disarm: %+3d   Devices: %+3d\n", skills[SKILL_DISARM], skills[SKILL_DEVICE]);
38@@ -288,7 +294,7 @@ static void race_help(int i, void *db, const region *l)
39        }
40       
41        text_out_e("\n");
42-       skill_help(r->r_skills, r->r_mhp, r->r_exp, r->infra);
43+       skill_help(r->r_skills, NULL, r->r_mhp, r->r_exp, r->infra);
44        text_out_e("\n");
45 
46        for (k = 0; k < OF_MAX; k++)
47@@ -322,6 +328,7 @@ static void class_help(int i, void *db, const region *l)
48        int j;
49        size_t k;
50        struct player_class *c = player_id2class(i);
51+       const struct player_race *r = p_ptr->race;
52        int len = (A_MAX + 1) / 2;
53 
54        int n_flags = 0;
55@@ -341,15 +348,15 @@ static void class_help(int i, void *db, const region *l)
56                const char *name1 = stat_names_reduced[j];
57                const char *name2 = stat_names_reduced[j + len];
58 
59-               int adj1 = c->c_adj[j] + p_ptr->race->r_adj[j];
60-               int adj2 = c->c_adj[j + len] + p_ptr->race->r_adj[j + len];
61+               int adj1 = c->c_adj[j] + r->r_adj[j];
62+               int adj2 = c->c_adj[j + len] + r->r_adj[j + len];
63 
64                text_out_e("%s%+3d  %s%+3d\n", name1, adj1, name2, adj2);
65        }
66 
67        text_out_e("\n");
68       
69-       skill_help(c->c_skills, c->c_mhp, c->c_exp, -1);
70+       skill_help(r->r_skills, c->c_skills, r->r_mhp + c->c_mhp, r->r_exp + c->c_exp, -1);
71 
72        if (c->spell_book == TV_MAGIC_BOOK) {
73                text_out_e("\nLearns arcane magic");
74--
751.7.10.4
76