Crossfire Server, Trunk
Todo List
Class _change_arch
is this still used somewhere in the maps/code??
Member add_me_cmd (char *buf, int len, socket_struct *ns)
can ns->status not be Ns_Add?
Member add_one_item (object *item, struct_map_info *map)
merge items with the same properties.
Member adj_stealchance (object *op, object *victim, int roll)
rename roll to something more meaningful (check attempt_steal()).
Member adjust_skill_tool (object *who, object *skill, object *skill_tool)
rewrite some.
Member animate_turning (object *op)
check if object is really animated?
File arch.cpp
make the functions use the same order for parameters (type first, then name, or the opposite).
Member artifact_describe (const artifact *art, const artifactlist *al, int message, int art_name, int separator)
check archetype when loading archetypes, not here
Member ArtifactWrapper::uses (const AssetWrapper *asset, std::string &) const override

handle face_suffix

handle anim_suffix

Member ArtifactWriter::write (const artifact *item, StringBuffer *buf)
check why not included in get_ob_diff
Page Assets

link to relevant documentation.

Add file extension to the relevant places also.

File attack.cpp
clean functions. Are all parameters required? Seems quite a mess to send damage/wc etc in attack_ob_simple().
Member attack_message (int dam, int type, object *op, object *hitter)
move check for player at function start? this function seems called for everyone. use string safe functions.
Member attack_ob_simple (object *op, object *hitter, int base_dam, int wc)
fix void return values. Try to remove gotos. Better document when it's called.
Member attempt_recipe (object *caster, object *cauldron, int ability, const recipe *rp, int nbatches, int ignore_cauldron)
check meaning of ability/nbatches.
Member basic_emote (object *op, const char *params, int emotion)
simplify function (indexed array, for instance).
Member become_follower (object *op, const object *new_god)
split the check to make this function only actually become follower
File build_map.cpp
document building, forces used to store connection values, ...
File c_object.cpp
clean multiple variations of same stuff (pickup and such), or rename for less confusion.
File c_wiz.cpp
explain item stack, item specifier for commands.
Member can_see_monsterP (mapstruct *m, int x, int y, int dir)
better document, can't figure what it does :)
Member cast_change_ability (object *op, object *caster, object *spell_ob, int dir, int silent)
weird check on duration? since you'll never get there since a force would have been found?
Member cast_heal (object *op, object *caster, object *spell, int dir)
check spurious cure_disease call (shouldn't the spell's level be sent?) and return check value (always 1).
Member cast_spell (object *op, object *caster, int dir, object *spell_ob, char *stringarg)
return a failure value?
Member cast_wonder (object *op, object *caster, int dir, object *spell_ob)
doesn't it decrease sp without checking?
Member cf_map_insert_object (mapstruct *where, object *op, int x, int y)
merge/replace with cf_object_change_map
Member cf_map_message (mapstruct *m, const char *msg, int color)
add missing parameters.
Member cf_object_forget_spell (object *op, object *sp)
make coherent with do_forget_spell() (string instead of ob).
Member cfapi_map_find_by_archetype_name (int *type,...)
fix archetype instead of string.
Member cfapi_object_give_skill (int *type,...)
seems broken, return value isn't used - fix.
Member change_abil (object *op, object *tmp)
check logic, and things like that. Is the call to fix_object always required?
Member change_attr_value (living *stats, int attr, int8_t value)
check if attr is valid? Checks result valus is valid?
Member check_formulae (void)
check archetypes exist, check coherence (skill present, cauldron ok, and such things), set chance to 0 for combinations
Member check_item (object *op, const char *item)
couldn't item be a shared string, and == be used instead of strcmp? The op = op->below is weird - what is it's NULL?
Member check_login (object *op, const char *password)
describe connect/login/logout/disconnect process.
Member check_sacrifice (object *op, const object *improver)
weird logic? use shared string directly, improver isn't really useful.
Member check_trigger (object *op, object *cause)
document properly cause != NULL: something has moved on top of op
Member check_wall (object *op, int x, int y)
use player *instead of object *to show it must be a player?
Member checkdm (object *op, const char *pl_name, const char *pl_passwd, const char *pl_host)
can't name/host be found from op? What is RESTRICTIVE_DM?
Member clean_object (object *op)
move to common/object.c ?
Page Client
expand (map info and such)
Member clipped_percent (int64_t a, int64_t b)
Probably belongs in some global utils-type file?
Member command_abil (object *op, const char *params)
use get_other_player_from_name(). Isn't this useless with the command_patch()?
Member command_cast_spell (object *op, const char *params, int cast_now)
present the list nicely instead of comma-separated simply
Member command_create (object *op, const char *params)
enable line breaks in command.
Member Command_Line_Options::pass
describe passes :)
Member command_party (object *op, const char *params)
split in different functions. clean the 'form' mess.
Member command_pickup (object *op, const char *params)
trash old pickup mode, merge with new pickup.
Member command_possess (object *op, const char *params)
fix and reactivate the function, or totally trash.
Member command_skills (object *op, const char *params)
move out of this file as it is used by all players.
Member command_use (object *op, const char *params)

handle multiple ingredients

handle ingredient count, handle batches, and such

Member common_process_projectile (object *op)
Split this function up.
Member confuse_living (object *op, object *hitter, int dam)
vary duration with dam/hitter?
Page Connected items
write about buttons, triggers, ...
Member create_archetype (const char *name)
replace with object_create_arch() which is multi-part aware.
Member CREMainWindow::onReportDuplicate ()
  • list animations and faces for artifacts using the 'animation_suffix' and allowed types
  • list use for skill-related actions
  • list things with classes and such
Member CREMapInformationManager::browseMaps ()
make nicer report
Member CREMapInformationManager::process (const QString &path)
get from config
Member Crossfire_Object_Say (Crossfire_Object *who, PyObject *args)
fix by wrapping monster_format_say() (or the whole talk structure methods)
Member crypt_string (char const *str, char const *salt)
make thread-safe?
Member describe_item (const object *op, const object *owner, int use_media_tags, StringBuffer *buf)
Check whether owner is really needed.
Member describe_monster (const object *op, int use_media_tags, StringBuffer *buf)
Rename to describe_living (or equivalent) since called for player too. Fix weird sustenance logic.
Member destroy_object (object *op)
trash that function
Page Dialog system
  • update dialog_information when msg changes.
  • have a real regexp parser
Member did_make_save_item (object *op, int type, object *originator)
check meaning of originator.
Member do_throw (object *op, object *part, object *toss_item, int dir, object *skill)
this messy function should probably be simplified.
Member do_tiled_map_picture (struct_map_info *map)
add a field to struct_map_info to remember if pic was updated or not, and update the tiled map only if one map has changed / the pic doesn't exist.
Member door_in_square (mapstruct *map, int x, int y)
isn't there a function for that in map.c?
Member doWrite (const archetype *arch, StringBuffer *buf)
check why not included in get_ob_diff
Member draw_onion (char **maze, float *xlocations, float *ylocations, int layers)
explain what locations arrays should be, and the meaning of layers.
Member drop_object (object *op, object *tmp, uint32_t nrof)
shouldn't tmp be NULL if object_was_destroyed returns true?
Member dump_alchemy (void)
use LOG() instead of fprintf?
Member dump_alchemy_costs (void)
should use LOG()
Member dump_artifacts (void)
use LOG() instead of fprintf.
Member dump_gods (void)
use LOG instead of fprintf().
Member eat_item (object *op, const char *item, uint32_t nrof)
couldn't item be a shared string, and use == instead of strcmp? also, the remove logic is wrong - op->nrof will be 0 after decreat_ob_nr in the 2nd case.
Member esrv_add_spells (player *pl, object *spell)
casting_requirements should be a constant somewhere
Member eventListener (int *type,...)
build from current map's path, probably
Member expand_sight (object *op)
use player *instead of object *to show it must be a player?
Member face_sets::id
remove
Member find_closest_monster (mapstruct *map, int x, int y, RMParms *RP)
shouldn't it search further away?
Member find_doors_in_room (mapstruct *map, int x, int y, RMParms *RP)
couldn't layout be given instead of being computed?
Member find_key (object *pl, object *container, object *door)
document use key modes.
Member find_monster_in_room (mapstruct *map, int x, int y, RMParms *RP)
couldn't the layout be given instead of being calculated?
Member find_random_spell_in_ob (object *ob, const char *skill)
change skill to sstring.
Member find_skill_by_name (object *who, const char *name)
Maybe better selection of skill when choice of multiple skills is in use (highest level may not be the best answer?)
Member find_spot_in_room (mapstruct *map, int x, int y, int *kx, int *ky, RMParms *RP)
couldn't layout be given instead of being computed?
Member find_style (const char *dirname, const char *stylename, int difficulty)
better document.
Member fire_arch_from_position (object *op, object *caster, int16_t x, int16_t y, int dir, object *spell)
check the note?
Member fire_bow (object *op, object *arrow, int dir, int wc_mod, int16_t sx, int16_t sy)
describe player firing modes.
Member fix_object (object *op)
this function is too long, and should be cleaned / split.
Member fix_tiled_map (void)
use a better filename, try to get the start of the map filenames.
Member fix_walls (mapstruct *map, int x, int y)
investigate possible merge with retrofit_joined_wall() used for random maps
Member fix_weight (void)
is this still useful?
Member food_choice
ugly :(
Member forbid_play (void)
document forbidden stuff.
File gate.cpp
merge GATE and TIMED_GATE object types.
Member get_dialog_message (object *op, const char *text, struct_dialog_message **message, struct_dialog_reply **reply)
smarter match, try to find exact before joker (*) one.
Member get_face_by_id (uint16_t id)
move back to image.c when migrated
Member get_region_by_map (mapstruct *m)
This might need optimising at some point.
Member get_region_struct (void)
free those pointers someday? :)
Member get_spell_by_name (object *op, const char *spell_name)
remove the spelldirect_xxx test?
Member get_wall (mapstruct *map, int x, int y)
isn't there a similar function somewhere? put this in a common library? investigate possible merge with retrofit_joined_wall() used for random maps
Member hit_player (object *op, int dam, object *hitter, uint32_t type, int full_hit)
rename to something more meaningful.
Module IN_MEMORY_xxx
rename to IM_xxx ?
Member init_ob_types (ob_methods *base_type)
when migration is complete, the parameter should go, and this function should be called from init_library() instead of init_ob_methods() in server/ob_methods.c.
Member init_regions (BufferReader *reader, const char *filename)
support multiple region files
Member init_server (void)
fix socket_info.max_filedescriptor hack.
Member init_startup (void)
describe forbid_play() and such restrictions.
Member is_identifiable_type (const object *op)
Ideally, this distinction would be meaningless and we'd just always check FLAG_IDENTIFIED, and assume that items that shouldn't ever need to be identified will always have the flag set. In practice we can't reliably make that assumption.
Member is_true_undead (object *op)
remove loop on type 44 (was EXPERIENCE)
File item.cpp
put const char *instead of char *when possible.
Member kill_object (object *op, int dam, object *hitter)
finish commenting what it does exactly.
File knowledge.cpp
  • make knowledge shareable between players
  • more things to keep trace of
Member knowledge_alchemy_detail (const char *value, StringBuffer *buf)
merge with stuff in readable.c
Member knowledge_alchemy_summary (const char *value, StringBuffer *buf)
merge with stuff in readable.c
Member knowledge_god_detail (const char *item, StringBuffer *buf)
merge with stuff in readable.c
Member knowledge_god_summary (const char *item, StringBuffer *buf)
merge with stuff in readable.c
Member knowledge_message_detail (const char *value, StringBuffer *buf)
merge with stuff in readable.c
Member knowledge_message_summary (const char *value, StringBuffer *buf)
merge with stuff in readable.c
Member knowledge_monster_detail (const char *item, StringBuffer *buf)
merge with stuff in readable.c
Member knowledge_monster_summary (const char *item, StringBuffer *buf)
merge with stuff in readable.c
Member knowledge_write_player_data (const knowledge_player *kp)
rename/backup, stuff like that
Member layoutgen (RMParms *RP)
use an array for name/style mapping. Refactor to call only one function for each (will make it easier to override later on).
File living.cpp
make "stat"/"attr" coherent.
Member load_materials (BufferReader *reader, const char *filename)
describe materials and such.
Member load_object_from_reader (BufferReader *reader, object *op, int map_flags)
loading is inefficient because of bufferreader_get_line(), check use of yy_scan_buffer().
Member load_object_from_reader (BufferReader *reader, object *op, int map_flags, bool arch_init, bool artifact_init)
loading is inefficient because of bufferreader_get_line(), check use of yy_scan_buffer().
Member lock_and_hide_doors (object **doorlist, mapstruct *map, int opts, RMParms *RP)
document opts. Isn't it part of RP?
Member make_doors (char **maze, float *xlocations, float *ylocations, int layers, int options)
explain what locations arrays should be, and the meaning of layers.
Member make_formula_book (object *book, int level)
this would be better in knowledge.c, except this file is in server, not common...
Member make_list_like (char *input)
use safe string functions.
Member make_square_spiral_layout (int xsize, int ysize, int _unused_option, int _unused_layers)
use function in another file for character searching.
Member make_square_spiral_layout (int xsize, int ysize, int _unused_option, int _unused_layers)
use function in another file for character searching.
Member make_sure_not_seen (const object *op)
what about tiled maps?
Member make_sure_seen (const object *op)
what about tiled maps?
Member map_newmap_cmd (socket_struct *ns)
remove once clients don't try to use this - server closes connection on invalid client.
File mapper.cpp
  • split this file in multiple ones for easier maintenance
  • add missing documentation on variables / functions
  • add command line argument for large / small picture size
  • add maximum width/height for small picture
  • add slaying information to maps themselves
  • shop catalog
  • treasure list use
Page Maps
  • link plugin API, random map documentation, directory information
  • check save_map() flags and meaning
Member matches (const char *exp, const char *text)
better * handling (incorrect now, will match even if trailing chars)
Module module_citylife
  • define spawn points/zones for other towns
  • vary NPCs based on time of day
  • define "objectives" to go to
  • make NPCs pause when player talks to them
Module module_rhg
  • make more parameters vary based on maps
  • add exits to all towns
Member monster_can_hit (object *ob1, object *ob2, rv_vector *rv)
rename to something more clear (is_adjacent?).
Member monster_compute_path (object *source, object *target, int default_dir)
cache path, smart adjustment and such things to not compute all the time ; try directions randomly.
Member monster_should_cast_spell (object *spell_ob)
improve logic, take enemy into consideration.
Member monster_use_skill (object *head, object *part, object *pl, int dir)
improve skill logic? Fix comments.
Member msgfile_msg (object *book, size_t booksize)
this would be better in knowledge.c, except this file is in server, not common...
Member npcSay (PyObject *self, PyObject *args)
fix by wrapping monster_format_say() (or the whole talk structure methods)
Member ob_trigger (object *op, object *cause, int state)
check the exact state values/meaning
Member object_add_weight (object *op, signed long weight)
check if mergeable with object_sub_weight().
Member object_can_merge (object *ob1, object *ob2)
check the function at places marked.
Member object_copy_with_inv (const object *src_ob, object *dest_ob, bool update_speed)
replace with a function in common library (there is certainly one).
Member object_get_multi_size (const object *ob, int *sx, int *sy, int *hx, int *hy)
either check for sx/sy everywhere or remove the check :)
Member object_get_player_container (object *op)
this function is badly named. Fix patching on the fly.
Member object_insert_in_map (object *op, mapstruct *m, object *originator, int flag)
this function is a mess, and should be cleaned.
Member object_matches_string (object *pl, object *op, const char *name)
is the player->contr->count hack used?? Try to reduce buffers/calls to query_ functions.
Member object_present_in_ob_by_name (int type, const char *str, const object *op)
use add_string() hack to avoid the strcmp?
Member object_remove (object *op)
this function is a piece of overbloated crap or at lest look like need cleanup it does to much different things.
Member object_sub_weight (object *op, signed long weight)
check if not mergeable with object_add_weight().
Member object_update (object *op, int action)
this function should be renamed to something like object_update_map, object_update is a too general term Also it might be worth moving it to map.c
Member object_update_speed (object *op)
check fixme & todo
Page Objects

link to types, flags, ...

write :)

Member parse_args (int argc, char *argv[], int pass)
describe pass.
Member party_send_message (object *op, const char *message)
should be moved to player.c?
Member pay_for_amount (uint64_t to_pay, object *pl)
check if pl is a player, as query_money() expects that. Check if fix_object() call is required.
Member pay_for_item (object *op, object *pl, uint64_t reduction)
check if pl is a player, as query_money() expects a player.
File peacemaker.cpp
Consider merging Peacemaker with Spell Effects
Member pets_control_golem (object *op, int dir)
trash.
Member pick_joined_wall (object *the_wall, char **layout, int i, int j, RMParms *RP)
check if there isn't an equivalent function in the building code, merge?
Member place_chest (int treasureoptions, int x, int y, mapstruct *map, int n_treasures, RMParms *RP)
document treasureoptions. Clean parameters. Check meaning of chest hp's field.
Member place_exits (mapstruct *map, char **maze, char *exitstyle, int orientation, RMParms *RP)
add orientations 3-6 or fix previous comment.
Member place_fountain_with_specials (mapstruct *map)
change logic to allocate potion only if success?
Member place_treasure (mapstruct *map, char **layout, char *treasure_style, int treasureoptions, RMParms *RP)
flags for treasureoptions.
File player.cpp
describe login/creation functions/cycles.
Page Players
write :) object::contr and such, event loop, login/logout process, ...
Member players_on_map (mapstruct *m, int show_all)
this doesn't take into account transports. Should be removed when mapstruct::players is valid.
File plugin.h
link to plugin stuff when the documentation exists in doxygen form :) remove commented things line 329+.
File plugins.cpp
describe "wrappers" for functions, conventions used (parameters + return value).
Member print_los (object *op)
change the command to view another player's LOS?
Member process_players2 (void)
explain why 2 passes for players.
Member push_ob (object *who, int dir, object *pusher)
fix return value which is weird for last case.
Member put_a_monster (object *op, const char *monstername)
there is a multipart-aware archetype conversion function, use it.
Member quest_write_player_data (const quest_player *pq)
rename/backup, stuff like that
File random_map.cpp
Explain process, layout signs (#, C, <, >) and such. Use constants for common spot types.
Member read_line (char *buffer, int size, FILE *file)
remove spaces at line start/end.
File readable.cpp
replace message type with defines/enums & such things.
Page Regions
describe
Member register_all_ob_types (void)
this should probably be moved to a file in the types/ directory, to separate types and server.
Member remove_curse (object *op, object *caster, object *spell)
why is the value set to 0?
Member remove_force (object *op)
rename to move_force?
File request.cpp
smoothing should be automatic for latest clients. Remove some stuff we can assume is always on. fix comments for this file.
File resurrection.cpp
document permanent death and death :)
Member retrofit_joined_wall (mapstruct *the_map, int i, int j, int insert_flag, RMParms *RP)
merge with pick_joined_wall()?
Member ring_desc (const object *op, int use_media_tags, StringBuffer *buf)
why does this also describe a SKILL?
File room_gen_spiral.cpp
Check if MAX_FINE can't be removed.
Member runcamera (CFanimation *animation, long int id, void *parameters)
fix
Member runfire (CFanimation *animation, long int id, void *parameters)
fix
Member runstop (CFanimation *animation, long int id, void *parameters)
fix
Member runturn (CFanimation *animation, long int id, void *parameters)
fix suspicious or missing call
Member scroll_type_apply (object *op, object *applier, int aflags)

should handle scroll failure differently if god-like scroll.

Tweak failure parameters.

Member set_attr_value (living *stats, int attr, int8_t value)
check if attr is valid? Check whether value is valid or not.
Member set_block (int x, int y, int bx, int by)
check index for overflow?
Member set_variable (object *op, const char *buf)

document return value.

document return value.

File shop.cpp
isn't there redundance with pay_for_item(), get_payment(), pay_for_amount()?
Member skill_messages [MAX_SKILLS]
added through add_string, so should be cleared at some point.
Member slow_living (object *op, object *hitter, int dam)
use dam to change the duration, or remove param
Member sp_params
remove when C++ & lambdas
File spell_attack.cpp
put parameters in the same order, use same name.
File spell_effect.cpp
use the same parameter names/orders.
File spell_effect.cpp
Split the subtype functions into their own file each, and split large functions.
Member spell_mapping [SPELL_MAPPINGS]
is this still required? it's used, but can it happen?
Member spellbook_type_apply (object *book, object *applier, int aflags)

handle failure differently for praying/magic.

split into multiple functions

File spellist.h
only used in the documentation, the variable is also defined in init.c. So fix documentation and trash.
File square_spiral.cpp
what does that look like? :)
Member start_animation (object *who, object *activator, object *event, const char *file, const char *message)
fix memory leaks in case of errors.
Member stop_jump (object *pl)
Is fix_object() required?
File style.cpp
couldn't load_dir() be merged with a function in common library?
Member subtract_player_exp (object *op, int64_t exp, const char *skill, int flag)
check whether flag is necessary, can't it be only based on skill==null?
Member surround_by_doors (mapstruct *map, char **layout, int x, int y, int opts)
document opts.
Member surround_check (char **maze, int i, int j, int xsize, int ysize)
there is an equivalent function in another layout, merge them together.
Member surround_check (char **maze, int i, int j, int xsize, int ysize)
there is an equivalent function in another layout, merge them together.
Member surround_flag (char **layout, int i, int j, RMParms *RP)
merge with surround_flag2() and friends, check if such a function doesn't exist in other files.
Member surround_flag2 (char **layout, int i, int j, RMParms *RP)
merge with surround_flag() and friends, check if such a function doesn't exist in other files.
Member swap_stat (object *op, int swap_second)
why the reinit of exp/ac/...?
Member teleport (object *teleporter, uint8_t tele_type, object *user)
fix weird return values.
Member tempnam_secure (const char *dir, const char *pfx, char **filename)
Maybe adding some ifdef for non-UNIX? I don't have any such system around to test with.
Member thrown_item_effect (object *, object *)
invert parameters for coherence with other functions?
Member time_enum
add owner's speed unit
Member timed_gate_type_process (object *op)
Split function into more managable functions.
Member TreasureLoader::loadTreasure (BufferReader *reader, const std::string &filename)
check if change_name is still used, and remove it if no.
Member trigger_move (object *op, int state)
document?
Member update_all_los (const mapstruct *map, int x, int y)
check if this couldn't be simplified, especially tiling (isn't there a function somewhere that could help?)
Member use_alchemy (object *op)
check if no superflous message when 2 cauldrons on same spot, one unpaid? (shouldn't happen, but well).
Member use_oratory (object *pl, int dir, object *skill)
check if can't be simplified, code looks duplicated.
Page Various topics
explain why spells have who/caster/spell_ob, things like that
Member while (1)

fix evil const cast

fix evil const cast

Member write_note (object *pl, object *item, const char *msg)
assert() instead of simple check.
Member write_tiled_map_page (struct_map_info *map)
: do a real page, with the various levels, maps and such.