Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Organization: the deprecation of the player class #34721

Closed
KorGgenT opened this issue Oct 13, 2019 · 1 comment · Fixed by #51081
Closed

Organization: the deprecation of the player class #34721

KorGgenT opened this issue Oct 13, 2019 · 1 comment · Fixed by #51081
Labels
[C++] Changes (can be) made in C++. Previously named `Code` Code: Infrastructure / Style / Static Analysis Code internal infrastructure and style Organization General development organization issues (P5 - Long-term) Long-term WIP, may stay on the list for a while.

Comments

@KorGgenT
Copy link
Member

KorGgenT commented Oct 13, 2019

This is an organizational issue to keep track of the progress of the deprecation of the player class in favor of using Character, npc, and avatar. The main purpose to create this issue (as I have been working on this project off and on for months) is to make it more transparent, and for the possibility of others to hop on and do one thing or two. And also to make it apparent that the player class should no longer get members added to it for any reason whatsoever.

The general idea is this: things should be moved to Character if the member is used for both npc and avatar. It should be moved to avatar if the member is a player-character-only function (like guis or dealing only with g->u or some such). Similarly it should be moved to npc if it has to do with AI.

The following list is in order in where it appears in player.h:

  • normalize()
  • process_effects()
  • hardcoded_effects()
  • vomit_mod()
  • in_sleep_state()
  • can_mount()
  • mount_creature()
  • basic_symbol_color
  • visible_mutations()
  • short_description_parts()
  • short_description()
  • print_info()
  • disp_info()
  • process_turn()
  • recalc_speed_bonus()
  • action_taken()
  • update_morale()
  • apply_persistent_morale()
  • update_bodytemp()
  • bodytemp_color()
  • run_cost()
  • swim_speed()
  • update_body_wetness()
  • update_body()
  • update_stomach()
  • update_needs()
  • calc_needs_rates()
  • update_vitamins()
  • regen()
  • enforce_minimum_healing()
  • update_stamina()
  • check_needs_extreme()
  • is_hibernating()
  • has_conflicting_trait()
  • has_opposite_trait()
  • has_lower_trait()
  • has_higher_trait()
  • has_same_type_trait()
  • crossed_threshold()
  • purifiable()
  • get_category_dream()
  • in_climate_control()
  • introduce_into_anesthesia()
  • has_active_optcloak()
  • add_bionic()
  • remove_bionic()
  • bionics_adjusted_skill()
  • bionics_pl_skill()
  • can_install_bionics()
  • install_bionics()
  • perform_install()
  • bionics_install_failure()
  • can_uninstall_bionic()
  • uninstall_bionic()
  • bionics_uninstall_failure()
  • has_enough_anesth()
  • power_bionics()
  • power_mutations()
  • activate_bionic()
  • deactivate_bionic()
  • burn_fuel()
  • process_bionic()
  • remove_random_bionic()
  • clear_bionics()
  • num_bionics()
  • amount_of_storage_bionics()
  • bionic_at_index()
  • bionic_by_invlet()
  • active_light()
  • sight_range()
  • unimpaired_range()
  • overmap_los()
  • overmap_sight_range()
  • clairvoyance()
  • sight_impaired()
  • handle_melee_wear()
  • unarmed_attack()
  • avoid_trap()
  • has_alarm_clock()
  • has_watch()
  • sees()
  • get_hostile_creatures()
  • get_visible_creatures()
  • get_targetable_creatures()
  • sees_with_infrared()
  • attitude_to()
  • pause()
  • set_movement_mode()
  • movement_mode_is()
  • cycle_move_mode()
  • reset_move_mode()
  • toggle_run_mode()
  • toggle_crouch_mode()
  • ma_static_effects()
  • ma_onmove_effects()
  • ma_onpause_effects()
  • ma_onhit_effects()
  • ma_onattack_effects()
  • ma_ondodge_effects()
  • ma_onblock_effects()
  • ma_ongethit_effects()
  • ma_onmiss_effects()
  • ma_oncrift_effects()
  • ma_onkill_effects()
  • has_mabuff()
  • has_martialart()
  • add_martialart()
  • can_autolearn()
  • martialart_use_message()
  • mabuff_tohit_bonus()
  • mabuff_dodge_bonus()
  • mabuff_block_bonus()
  • mabuff_speed_bonus()
  • mabuff_damage_mult()
  • mabuff_damage_bonus()
  • mabuff_attack_cost_penalty()
  • mabuff_attack_cost_mult()
  • is_throw_immune()
  • stability_roll()
  • is_quiet()
  • is_stealthy()
  • can_melee()
  • dgging()
  • is_on_ground()
  • is_dead_state()
  • is_elec_immune()
  • is_immune_effect()
  • is_immune_damage()
  • is_rad_immune()
  • has_miss_recovery_tec()
  • get_miss_recovery_tec()
  • has_grab_break_tec()
  • get_grab_break_tec()
  • can_grab_break()
  • can_miss_recovery()
  • can_leg_block()
  • can_arm_block()
  • can_limb_block()
  • is_force_unarmed()
  • best_shield()
  • melee_attack()
  • get_weapon_dispersion()
  • handle_gun_damage()
  • recoil_vehicle()
  • recoil_total()
  • gun_engagement_moves()
  • fire_gun()
  • reach_attack()
  • block_hit()
  • on_dodge()
  • on_hit()
  • bonus_damage()
  • get_hit_base()
  • hit_roll()
  • crit_chance()
  • scored_crit()
  • attack_speed()
  • get_hit_weapon()
  • weapon_value()
  • gun_value()
  • melee_value()
  • unarmed_value()
  • roll_all_damage()
  • roll_bash_damage()
  • roll_cut_damage()
  • roll_stab_damage()
  • get_all_techniques()
  • has_technique()
  • pick_technique()
  • perform_technique()
  • perform_special_attacks()
  • mutation_attacks()
  • melee_special_effects()
  • get_dodge_base()
  • get_dodge()
  • dodge_roll()
  • get_melee()
  • add_miss_reason()
  • clear_miss_reason()
  • get_miss_reason()
  • uncanny_dodge()
  • climbing_cost()
  • throw_item()
  • read_speed()
  • rust_rate()
  • talk_skill()
  • intimidation()
  • immune_to()
  • deal_damage()
  • reduce_healing_effects()
  • apply_damage()
  • mod_pain()
  • set_pain()
  • get_perceived_pain()
  • cough()
  • add_pain_msg()
  • mod_painkiller()
  • set_painkiller()
  • get_painkiller()
  • knock_back_to()
  • fall_damage_mod()
  • impact()
  • hp_percentage()
  • get_sick()
  • get_radio_items()
  • get_artifact_items()
  • add_addiction()
  • rem_addiction()
  • has_addiction()
  • addiction_level()
  • siphon()
  • suffer()
  • irradiate()
  • mend()
  • sound_hallu()
  • drench()
  • apply_wetness_morale()
  • drink_from_hands()
  • consume()
  • consume_item()
  • allergy_type()
  • eat()
  • modify_health()
  • modify_stimulation()
  • modify_addiction()
  • modify_morale()
  • can_eat()
  • will_eat()
  • get_cbm_rechargeable_with()
  • get_aquirable_energy()
  • stomach_capacity()
  • kcal_for()
  • nutrition_for()
  • fun_for()
  • book_fun_for()
  • get_consumable_from()
  • get_hunger_description()
  • get_pain_description()
  • vitamins_from()
  • vitamin_rate()
  • vitamins_mod()
  • vitamin_get()
  • vitamin_set()
  • metabolic_rate()
  • consume_effect()
  • rooted_message()
  • rooted()
  • get_lift_assist()
  • list_ammo()
  • select_ammo()
  • can_lift()
  • can_wear()
  • can_takeoff()
  • can_wield()
  • can_unwield()
  • can_consume()
  • can_estimate_rot()
  • is_wielding()
  • wield()
  • unwield()
  • pick_style()
  • can_reload()
  • dispose_item()
  • mend_item()
  • item_reload_cost()
  • item_wear_cost()
  • wear()
  • wear_item()
  • change_side()
  • get_dependent_worn_items()
  • takeoff()
  • drop()
  • add_or_drop_with_msg()
  • unload()
  • wield_contents()
  • store()
  • sort_armor()
  • use()
  • use_wielded()
  • invoke_item()
  • reassign_item()
  • consume_charges()
  • gunmod_remove()
  • gunmod_add()
  • gunmod_installation_odds()
  • toolmod_add()
  • fun_to_read()
  • has_identified()
  • try_to_sleep()
  • base_comfort_value()
  • sleep_spot()
  • can_sleep()
  • fall_asleep()
  • is_snuggling()
  • time_point last_sleep_check
  • bool bio_soporific_powered_at_last_sleep_check
  • fine_detail_vision_mod()
  • rate_action_use()
  • rate_action_wear()
  • rate_action_change_side()
  • rate_action_eat()
  • rate_action_takeoff()
  • rate_action_reload()
  • rate_action_unload()
  • rate_action_mend()
  • rate_action_disassemble()
  • add_faction_warning()
  • current_warnings_fac()
  • beyond_final_warning()
  • warmth()
  • bonus_item_warmth()
  • get_armor_bash()
  • get_armor_cut()
  • get_armor_bash_base()
  • get_armor_cut_base()
  • get_env_resist()
  • get_armor_acid()
  • get_armor_fire()
  • get_armor_type()
  • wearing_something_on()
  • natural_attack_restricted_on()
  • is_wearing_shoes()
  • is_wearing_helmet()
  • head_cloth_encumbrance()
  • footwear_factor()
  • armwear_factor()
  • shoe_type_count()
  • get_wind_resistance()
  • get_pain_penalty()
  • kcal_speed_penalty()
  • thirst_speed_penalty()
  • adjust_for_focus()
  • practice()
  • handle_skill_warning()
  • assign_activity()
  • has_activity()
  • cancel_activity()
  • resume_backlog_activity()
  • get_morale_level()
  • add_morale()
  • has_morale()
  • rem_morale()
  • clear_morale()
  • has_morale_to_read()
  • check_and_recover_morale()
  • on_worn_item_transform()
  • weapname()
  • power_rating()
  • speed_rating()
  • all_items_with_flag()
  • process_active_items()
  • reduce_charges()
  • invlet_to_position()
  • can_interface_armor()
  • get_combat_style()
  • inv_dump()
  • place_corpse()
  • covered_with_flag()
  • is_waterproof()
  • use_amount()
  • use_charges_if_avail()
  • use_charges()
  • has_charges()
  • amount_worn()
  • leak_level()
  • item_with_best_of_quality()
  • crush_frozen_liquid()
  • has_item_with_flag()
  • has_mission_item()
  • has_gun_for_ammo()
  • has_magazine_for_ammo()
  • has_weapon()
  • has_recipe()
  • knows_recipe()
  • learn_recipe()
  • exceeds_recipe_requirement()
  • has_recipe_requirements()
  • can_decomp_learn()
  • studied_all_recipes()
  • get_learned_recipes()
  • get_recipes_from_books()
  • get_available_recipes()
  • get_books_for_recipe()
  • morale_crafting_speed_multiplier()
  • lighting_craft_speed_multiplier()
  • crafting_speed_multiplier()
  • available_assistant_count()
  • base_time_to_craft()
  • expected_time_to_craft()
  • get_eligible_containers_for_crafting()
  • has_morale_to_craft()
  • can_make()
  • can_start_craft()
  • making_would_work()
  • craft()
  • recraft()
  • long_craft()
  • make_craft()
  • make_all_craft()
  • start_craft()
  • crafting_success_roll()
  • complete_craft()
  • can_continue_craft()
  • get_crafting_helpers()
  • get_num_crafting_helpers()
  • craft_skill_gain()
  • can_disassemble()
  • disassemble()
  • disassemble_all()
  • complete_disassemble()
  • crafting_inventory()
  • invalidate_crafting_inventory()
  • select_item_component()
  • consume_items()
  • select_tool_component()
  • craft_consume_tools()
  • consume_tools()
  • set_destination()
  • clear_destination()
  • has_distant_destination()
  • has_destination()
  • has_destination_activity()
  • start_destination_activity()
  • get_auto_move_route()
  • get_next_auto_move_direction()
  • defer_move()
  • shift_destination()
  • forced_dismount()
  • dismount()
  • start_hauling()
  • stop_hauling()
  • is_hauling()
  • global_square_location()
  • global_sm_location()
  • global_omt_location()
  • posx()
  • posy()
  • posz()
  • setx()
  • sety()
  • setz()
  • setpos()
  • tripoint view_offset
  • bool in_vehicle
  • bool controlling_vehicle
  • tripoint_grab_point
  • bool hauling
  • player_activity activity
  • std::list<player_activity> backlog
  • cata::optional destination_point
  • int volume
  • const profession *prof
  • start_location_id start_location
  • time_point next_climate_control_check
  • bool last_climate_control_ret
  • int tank_plut
  • int reactor_plut
  • int slow_rad
  • double recoil
  • std::weak_ptr last_target
  • cata::optional last_target_pos
  • item_location ammo_location
  • int scent
  • int dodges_left
  • int blocks_left
  • int stim
  • int cash
  • int movecounter
  • bool death_drops
  • std::array<int, num_bp> temp_cur, frostbite_timer, temp_conv, drench_capacity, body_wetness
  • temp_equalizer()
  • int focus_pool
  • std::vector<matype_id> ma_styles
  • matype_id style_selected
  • bool keep_hands_free
  • bool reach_attacking
  • bool manual_examine
  • std::vector addictions
  • std::vector<mtype_id> starting_pets
  • make_craft_with_command()
  • pimpl<craft_command> last_craft
  • recipe_id lastrecipe
  • int last_batch
  • itype_id lastconsumed
  • get_used_bionic_slots()
  • get_total_bionics_slots()
  • get_free_bionics_slots()
  • bionic_installation_issues()
  • std::set<character_id> follower_ids
  • mod_stat()
  • is_underwater()
  • set_underwater()
  • is_hallucination()
  • environmental_revert_effect()
  • is_invisible()
  • is_deaf()
  • can_hear()
  • hearing_ability()
  • visibility()
  • get_size()
  • get_hp()
  • get_hp_max()
  • get_stamina_max()
  • burn_move_stamina()
  • add_msg_if_player()
  • add_msg_if_player_or_npc()
  • add_msg_player_or_say()
  • knows_trap()
  • add_known_trap()
  • search_surroundings()
  • do_skill_rust()
  • get_overlay_ids()
  • spores()
  • blossoms()
  • on_mutation_gain()
  • on_mutation_loss()
  • on_stat_change()
  • on_item_wear()
  • on_item_takeoff()
  • on_worn_item_washed()
  • on_effect_int_change()
  • print_encumbrance()
  • print_health()
  • query_yn()
  • has_enough_charges()
  • get_pathfinding_settings()
  • get_path_avoid()
  • disarm()
  • get_targeting_data()
  • set_targeting_data()
  • std::set camps
  • known_magic magic
  • tripoint position
  • std::map<tripoint, std::string> known_traps
  • process_one_effect()
  • valid_aoe_technique()
  • is_visible_in_range()
  • can_use_floor_warmth()
  • floor_bedding_warmth()
  • floor_item_warmth()
  • floor_warmth()
  • bodytemp_modifier_traits()
  • bodytemp_modifier_traits_floor()
  • temp_corrected_by_climate_control()
  • blood_loss()
  • activate_mutation()
  • deactivate_mutation()
  • has_fire()
  • use_fire()
  • can_feed_battery_with()
  • can_feed_ractor_with()
  • can_feed_furnace_with()
  • feed_battery_with()
  • feed_reactor_with()
  • feed_furnace_with()
  • feed_bionic_with()
  • can_consume_as_iw()
  • consume_med()
  • react_to_felt_pain()
  • int pkill
  • player_movemode move_mode
  • std::vector auto_move_route
  • player_activity destination_activity
  • cata::optional next_expected_position
  • std::map<faction_id, std::pair<int, time_point>> warning_record
  • inventory cached_inventory
  • int cached_moves
  • time_point cached_time
  • tripoint cached_position
  • struct weighted_int_liststd::string melee_miss_reasons
  • pimpl<player_morale> morale
  • std::shared_ptr<targeting_data> tdata
  • std::map<vitamin_id, int> vitamin_levels
  • mutable pimpl<recipe_subset> learned_recipes
  • mutable decltype( _skills ) valid_autolearn_skills
  • std::unordered_map<point, time_duration> overmap_time

After moving all of these functions, the player class should be made virtual, and then changing the parameters of functions from player shall commence.

Some additional notes, after compiling this list:
These things would go quite well into their own classes:

  • collection of bionics and associated functions
  • collection of mutations and associated functions
  • collection of martial arts and associated functions
@KorGgenT KorGgenT added Organization General development organization issues [C++] Changes (can be) made in C++. Previously named `Code` Code: Infrastructure / Style / Static Analysis Code internal infrastructure and style (P5 - Long-term) Long-term WIP, may stay on the list for a while. labels Oct 13, 2019
@Ramza13 Ramza13 mentioned this issue Nov 2, 2019
@KorGgenT KorGgenT added this to the 0.F milestone Jan 9, 2020
@ZhilkinSerg
Copy link
Contributor

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[C++] Changes (can be) made in C++. Previously named `Code` Code: Infrastructure / Style / Static Analysis Code internal infrastructure and style Organization General development organization issues (P5 - Long-term) Long-term WIP, may stay on the list for a while.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants