Ticket #749 (new task)

Opened 20 months ago

Last modified 4 months ago

A uniform way to access player knowledge of player state

Reported by: stefanor@… Owned by:
Milestone: 3.1.3 Keywords: cleanup
Cc:

Description

In the trunk at the time of writing, you can examine a red worm mass to find out if you are wearing unidentified fire resistance equipment. There's currently code in files.c to extract known resistances, but it's interwoven with the code for displaying the ability tables and thus of no use. One solution (stolen from Crawl) is to add a bool known_only parameter to calc_bonuses; I'd like a second opinion before implementing this. Side benefit: we can get rid of p_ptr->state.dis_to_h and friends.

Attachments

Change History

Changed 20 months ago by Kenneth 'Bessarion' Boyd

The resistance, etc. booleans are all computed fields; there's no savefile effect from adding more fields. What's painful is using record fields instead of arrays.

Zaiband 3.0.10 alpha is going to handle this (as part of the ID-inference code) by explicitly tracking the known boolean status. The initial field conversion in player_type was to:

s16b stat_use[A_MAX];	/**< Current modified stats */
s16b stat_top[A_MAX];	/**< Maximal modified stats */

/*** Extracted fields ***/

s16b stat_add[A_MAX];	/**< Equipment stat bonuses */
s16b stat_ind[A_MAX];	/**< Indexes into stat tables */

bool immune[MAX_IMMUNE];	/**< Immunity list */
bool resist[MAX_RESIST];	/**< Resistance list */
bool sustain[A_MAX];/**< Keep strength, etc. (cf. stat_index enumeration) */

with supporting new enum in defines.h

/**
 * Indexes of the various boolean resists/specials
 *
 * \sa
 */
enum resist_index {[[BR]]
	r_acid = 0,	/**< Resist acid */
	r_elec,		/**< Resist lightning */
	r_fire,		/**< Resist fire */
	r_cold,		/**< Resist cold */
	r_pois,		/**< Resist poison */

	r_fear,		/**< Resist fear */
	r_lite,		/**< Resist light */
	r_dark,		/**< Resist darkness */
	r_blind,	/**< Resist blindness */
	r_confu,	/**< Resist confusion */
	r_sound,	/**< Resist sound */
	r_shard,	/**< Resist shards */
	r_nexus,	/**< Resist nexus */
	r_nethr,	/**< Resist nether */
	r_chaos,	/**< Resist chaos */
	r_disen,	/**< Resist disenchant */

	p_slow_digest,	/**< Slower digestion */
	p_ffall,	/**< Feather falling */
	p_lite,		/**< Permanent light */
	p_regenerate,	/**< Regeneration */
	p_telepathy,	/**< Telepathy */
	p_see_inv,	/**< See invisible */
	p_free_act,	/**< Free action */
	p_hold_life,	/**< Hold life */

	p_impact,	/**< Earthquake blows */
	p_aggravate,	/**< Aggravate monsters */
	p_teleport,	/**< Random teleporting */
	p_exp_drain,	/**< Experience draining */

	p_bless_blade	/* Blessed blade */
};

/**
 * total number of various boolean resists/specials
 *
 * \sa ::resist_index
 */
#define MAX_RESIST (p_bless_blade+1)

/**
 * total number of various boolean immunities
 *
 * \sa ::resist_index
 */
#define MAX_IMMUNE (r_cold+1)

This change did incur some source code size bloat.

I'm indifferent as to whether to use a known-only boolean parameter, or just explicitly store the known state of the flags as well. (Zaiband is going to go with explicitly storing the known state of the flags, but that may not be reasonable for V).

Changed 20 months ago by takkaria

some of the work done in r1174

Changed 13 months ago by takkaria

  • milestone changed from 3.1.1 beta to 3.1.2 beta

Changed 13 months ago by magnate

  • keywords cleanup added

Changed 4 months ago by valentino

Freddi Kryuger (the angel. Freddy Krueger) http://unnovetis.website.org personage Nightmare on street Elm , Freddi http://unnovetis001.website.org against Dzheysona and multiple comics. The Incarnate men in image with been partially burnt before muscles and boneshttp://unnovetis002.website.org by person, in red sweater in dark-green strip and brown hat. Carries the glove with http://unnovetis003.website.org sharp metallic blade on tip finger.Has an ability to kill in VWVappear in the dreams.

Changed 4 months ago by sergey

1) Advisable buy the in zone .com. The Zone .org and .net too possible not to throw with count if in .com http://unnovetis4.website.org no good have not found. 2) Avoid in name mentionings concrete medicine. It is impossible use the брендовые of the trademarks..http://unnovetis5.website.org The Examples в: buy-cheap-levitra.com, cheap-viagra-online.com. If register such then http://unnovetis6.website.org on the first patter their will wait суспенд (blocking ). In the same way not advisable register the домены with http://unnovetis7.website.org using the words: drug and pharma.

Changed 4 months ago by german

You do not know, what is an additional earnings in or what earn webmoney, http://unnovetis8.website.org have a no presentations, what is a removed work on house, then, as You already could guess, this site will answer these questions. http://unnovetis9.website.org The Site is dedicated to earnings in network. This hard, but even so such pleasing http://unnovetis10.website.org and glad deal, particularly when see the fruits to its activity. Remote work the present opening our age became through internet and became available each, who has an http://unnovetis11.website.org access онлайн and free time.

Add/Change #749 (A uniform way to access player knowledge of player state)

Author



Action
as new
Next status will be 'confirmed'
 
Note: See TracTickets for help on using tickets.