Crossfire Server, Trunk
Todo List
Class _change_arch
is this still used somewhere in the maps/code??
Global add_me_cmd (char *buf, int len, socket_struct *ns)
can ns->status not be Ns_Add?
Global add_one_item (object *item, struct_map_info *map)
merge items with the same properties.
Global adj_stealchance (object *op, object *victim, int roll)
rename roll to something more meaningful (check attempt_steal()).
Global adjust_skill_tool (object *who, object *skill, object *skill_tool)
rewrite some.
Global 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).
Global artifact_describe (const artifact *art, const artifactlist *al, int message, int art_name, int separator)
check archetype when loading archetypes, not here
Global ArtifactWrapper::uses (const AssetWrapper *asset, std::string &) const override

handle face_suffix

handle anim_suffix

Global 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().
Global 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.
Global attack_ob_simple (object *op, object *hitter, int base_dam, int base_wc)
fix void return values. Try to remove gotos. Better document when it's called.
Global attempt_recipe (object *caster, object *cauldron, int ability, const recipe *rp, int nbatches, int ignore_cauldron)
check meaning of ability/nbatches.
Global basic_emote (object *op, const char *params, int emotion)
simplify function (indexed array, for instance).
Global 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.
Global can_see_monsterP (mapstruct *m, int x, int y, int dir)
better document, can't figure what it does :)
Global 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?
Global 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).
Global cast_spell (object *op, object *caster, int dir, object *spell_ob, char *stringarg)
return a failure value?
Global cast_wonder (object *op, object *caster, int dir, object *spell_ob)
doesn't it decrease sp without checking?
Global cf_map_insert_object (mapstruct *where, object *op, int x, int y)
merge/replace with cf_object_change_map
Global cf_map_message (mapstruct *m, const char *msg, int color)
add missing parameters.
Global cf_object_forget_spell (object *op, object *sp)
make coherent with do_forget_spell() (string instead of ob).
Global cfapi_map_find_by_archetype_name (int *type,...)
fix archetype instead of string.
Global cfapi_object_give_skill (int *type,...)
seems broken, return value isn't used - fix.
Global change_abil (object *op, object *tmp)
check logic, and things like that. Is the call to fix_object always required?
Global change_attr_value (living *stats, int attr, int8_t value)
check if attr is valid? Checks result valus is valid?
Global check_formulae (void)
check archetypes exist, check coherence (skill present, cauldron ok, and such things), set chance to 0 for combinations
Global 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?
Global check_login (object *op, const char *password)
describe connect/login/logout/disconnect process.
Global check_sacrifice (object *op, const object *improver)
weird logic? use shared string directly, improver isn't really useful.
Global check_trigger (object *op, object *cause)
document properly cause != NULL: something has moved on top of op
Global check_wall (object *op, int x, int y)
use player *instead of object *to show it must be a player?
Global 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?
Global clean_object (object *op)
move to common/object.c ?
Page Client
expand (map info and such)
Global clipped_percent (int64_t a, int64_t b)
Probably belongs in some global utils-type file?
Global command_abil (object *op, const char *params)
use get_other_player_from_name(). Isn't this useless with the command_patch()?
Global command_cast_spell (object *op, const char *params, int cast_now)
present the list nicely instead of comma-separated simply
Global command_create (object *op, const char *params)
enable line breaks in command.
Global Command_Line_Options::pass
describe passes :)
Global command_party (object *op, const char *params)
split in different functions. clean the 'form' mess.
Global command_pickup (object *op, const char *params)
trash old pickup mode, merge with new pickup.
Global command_possess (object *op, const char *params)
fix and reactivate the function, or totally trash.
Global command_skills (object *op, const char *params)
move out of this file as it is used by all players.
Global command_use (object *op, const char *params)

handle multiple ingredients

handle ingredient count, handle batches, and such

Global common_process_projectile (object *op)
Split this function up.
Global confuse_living (object *op, object *hitter, int dam)
vary duration with dam/hitter?
Page Connected items
write about buttons, triggers, ...
Global create_archetype (const char *name)
replace with object_create_arch() which is multi-part aware.
Global 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
Global CREMapInformationManager::browseMaps ()
make nicer report
Global CREMapInformationManager::process (const QString &path)
get from config
Global Crossfire_Object_Say (Crossfire_Object *who, PyObject *args)
fix by wrapping monster_format_say() (or the whole talk structure methods)
Global crypt_string (char const *str, char const *salt)
make thread-safe?
Global describe_item (const object *op, const object *owner, int use_media_tags, StringBuffer *buf)
Check whether owner is really needed.
Global 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.
Global destroy_object (object *op)
trash that function
Page Dialog system
  • update dialog_information when msg changes.
  • have a real regexp parser
Global did_make_save_item (object *op, int type, object *originator)
check meaning of originator.
Global do_throw (object *op, object *part, object *toss_item, int dir, object *skill)
this messy function should probably be simplified.
Global 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.
Global door_in_square (mapstruct *map, int x, int y)
isn't there a function for that in map.c?
Global doWrite (const archetype *arch, StringBuffer *buf)
check why not included in get_ob_diff
Global draw_onion (char **maze, float *xlocations, float *ylocations, int layers)
explain what locations arrays should be, and the meaning of layers.
Global drop_object (object *op, object *tmp, uint32_t nrof)
shouldn't tmp be NULL if object_was_destroyed returns true?
Global dump_alchemy (void)
use LOG() instead of fprintf?
Global dump_alchemy_costs (void)
should use LOG()
Global dump_artifacts (void)
use LOG() instead of fprintf.
Global dump_gods (void)
use LOG instead of fprintf().
Global 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.
Global esrv_add_spells (player *pl, object *spell)
casting_requirements should be a constant somewhere
Global eventListener (int *type,...)
build from current map's path, probably
Global expand_sight (object *op)
use player *instead of object *to show it must be a player?
Global face_sets::id
Global find_closest_monster (mapstruct *map, int x, int y, RMParms *RP)
shouldn't it search further away?
Global find_doors_in_room (mapstruct *map, int x, int y, RMParms *RP)
couldn't layout be given instead of being computed?
Global find_key (object *pl, object *container, object *door)
document use key modes.
Global find_monster_in_room (mapstruct *map, int x, int y, RMParms *RP)
couldn't the layout be given instead of being calculated?
Global find_random_spell_in_ob (object *ob, const char *skill)
change skill to sstring.
Global 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?)
Global 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?
Global find_style (const char *dirname, const char *stylename, int difficulty)
better document.
Global fire_arch_from_position (object *op, object *caster, int16_t x, int16_t y, int dir, object *spell)
check the note?
Global fire_bow (object *op, object *arrow, int dir, int wc_mod, int16_t sx, int16_t sy)
describe player firing modes.
Global fix_object (object *op)
this function is too long, and should be cleaned / split.
Global fix_tiled_map (void)
use a better filename, try to get the start of the map filenames.
Global fix_walls (mapstruct *map, int x, int y)
investigate possible merge with retrofit_joined_wall() used for random maps
Global fix_weight (void)
is this still useful?
Global food_choice
ugly :(
Global forbid_play (void)
document forbidden stuff.
File gate.cpp
merge GATE and TIMED_GATE object types.
Global 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.
Global get_face_by_id (uint16_t id)
move back to image.c when migrated
Global get_region_by_map (mapstruct *m)
This might need optimising at some point.
Global get_region_struct (void)
free those pointers someday? :)
Global get_spell_by_name (object *op, const char *spell_name)
remove the spelldirect_xxx test?
Global 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
Global 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 ?
Global 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.
Global init_regions (BufferReader *reader, const char *filename)
support multiple region files
Global init_server (void)
fix socket_info.max_filedescriptor hack.
Global init_startup (void)
describe forbid_play() and such restrictions.
Global 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.
Global is_true_undead (object *op)
remove loop on type 44 (was EXPERIENCE)
File item.cpp
put const char *instead of char *when possible.
Global 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
Global knowledge_alchemy_detail (const char *value, StringBuffer *buf)
merge with stuff in readable.c
Global knowledge_alchemy_summary (const char *value, StringBuffer *buf)
merge with stuff in readable.c
Global knowledge_god_detail (const char *item, StringBuffer *buf)
merge with stuff in readable.c
Global knowledge_god_summary (const char *item, StringBuffer *buf)
merge with stuff in readable.c
Global knowledge_message_detail (const char *value, StringBuffer *buf)
merge with stuff in readable.c
Global knowledge_message_summary (const char *value, StringBuffer *buf)
merge with stuff in readable.c
Global knowledge_monster_detail (const char *item, StringBuffer *buf)
merge with stuff in readable.c
Global knowledge_monster_summary (const char *item, StringBuffer *buf)
merge with stuff in readable.c
Global knowledge_write_player_data (const knowledge_player *kp)
rename/backup, stuff like that
Global 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.
Global load_materials (BufferReader *reader, const char *filename)
describe materials and such.
Global 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().
Global 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().
Global lock_and_hide_doors (object **doorlist, mapstruct *map, int opts, RMParms *RP)
document opts. Isn't it part of RP?
Global make_doors (char **maze, float *xlocations, float *ylocations, int layers, int options)
explain what locations arrays should be, and the meaning of layers.
Global make_formula_book (object *book, int level)
this would be better in knowledge.c, except this file is in server, not common...
Global make_list_like (char *input)
use safe string functions.
Global make_square_spiral_layout (int xsize, int ysize, int _unused_option, int _unused_layers)
use function in another file for character searching.
Global make_square_spiral_layout (int xsize, int ysize, int _unused_option, int _unused_layers)
use function in another file for character searching.
Global make_sure_not_seen (const object *op)
what about tiled maps?
Global make_sure_seen (const object *op)
what about tiled maps?
Global 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
Global 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
Global monster_can_hit (object *ob1, object *ob2, rv_vector *rv)
rename to something more clear (is_adjacent?).
Global 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.
Global monster_should_cast_spell (object *spell_ob)
improve logic, take enemy into consideration.
Global monster_use_skill (object *head, object *part, object *pl, int dir)
improve skill logic? Fix comments.
Global msgfile_msg (object *book, size_t booksize)
this would be better in knowledge.c, except this file is in server, not common...
Global npcSay (PyObject *self, PyObject *args)
fix by wrapping monster_format_say() (or the whole talk structure methods)
Global ob_trigger (object *op, object *cause, int state)
check the exact state values/meaning
Global object_add_weight (object *op, signed long weight)
check if mergeable with object_sub_weight().
Global object_can_merge (object *ob1, object *ob2)
check the function at places marked.
Global 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).
Global 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 :)
Global object_get_player_container (object *op)
this function is badly named. Fix patching on the fly.
Global object_insert_in_map (object *op, mapstruct *m, object *originator, int flag)
this function is a mess, and should be cleaned.
Global 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.
Global object_present_in_ob_by_name (int type, const char *str, const object *op)
use add_string() hack to avoid the strcmp?
Global 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.
Global object_sub_weight (object *op, signed long weight)
check if not mergeable with object_add_weight().
Global 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
Global object_update_speed (object *op)
check fixme & todo
Page Objects

link to types, flags, ...

write :)

Global parse_args (int argc, char *argv[], int pass)
describe pass.
Global party_send_message (object *op, const char *message)
should be moved to player.c?
Global 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.
Global 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
Global pets_control_golem (object *op, int dir)
Global 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?
Global 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.
Global place_exits (mapstruct *map, char **maze, char *exitstyle, int orientation, RMParms *RP)
add orientations 3-6 or fix previous comment.
Global place_fountain_with_specials (mapstruct *map)
change logic to allocate potion only if success?
Global 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, ...
Global 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).
Global print_los (object *op)
change the command to view another player's LOS?
Global process_players2 (void)
explain why 2 passes for players.
Global push_ob (object *who, int dir, object *pusher)
fix return value which is weird for last case.
Global put_a_monster (object *op, const char *monstername)
there is a multipart-aware archetype conversion function, use it.
Global 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.
Global 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
Global register_all_ob_types (void)
this should probably be moved to a file in the types/ directory, to separate types and server.
Global remove_curse (object *op, object *caster, object *spell)
why is the value set to 0?
Global 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 :)
Global retrofit_joined_wall (mapstruct *the_map, int i, int j, int insert_flag, RMParms *RP)
merge with pick_joined_wall()?
Global 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.
Global runcamera (CFanimation *animation, long int id, void *parameters)
Global runfire (CFanimation *animation, long int id, void *parameters)
Global runstop (CFanimation *animation, long int id, void *parameters)
Global runturn (CFanimation *animation, long int id, void *parameters)
fix suspicious or missing call
Global scroll_type_apply (object *op, object *applier, int aflags)

should handle scroll failure differently if god-like scroll.

Tweak failure parameters.

Global set_attr_value (living *stats, int attr, int8_t value)
check if attr is valid? Check whether value is valid or not.
Global set_block (int x, int y, int bx, int by)
check index for overflow?
Global 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()?
Global slow_living (object *op, object *hitter, int dam)
use dam to change the duration, or remove param
Global 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.
Global spell_mapping [SPELL_MAPPINGS]
is this still required? it's used, but can it happen?
Global 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? :)
Global start_animation (object *who, object *activator, object *event, const char *file, const char *message)
fix memory leaks in case of errors.
Global stop_jump (object *pl)
Is fix_object() required?
File style.cpp
couldn't load_dir() be merged with a function in common library?
Global 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?
Global surround_by_doors (mapstruct *map, char **layout, int x, int y, int opts)
document opts.
Global surround_check (char **maze, int i, int j, int xsize, int ysize)
there is an equivalent function in another layout, merge them together.
Global surround_check (char **maze, int i, int j, int xsize, int ysize)
there is an equivalent function in another layout, merge them together.
Global 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.
Global 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.
Global swap_stat (object *op, int swap_second)
why the reinit of exp/ac/...?
Global teleport (object *teleporter, uint8_t tele_type, object *user)
fix weird return values.
Global 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.
Global thrown_item_effect (object *, object *)
invert parameters for coherence with other functions?
Global time_enum
add owner's speed unit
Global timed_gate_type_process (object *op)
Split function into more managable functions.
Global TreasureLoader::loadTreasure (BufferReader *reader, const std::string &filename)
check if change_name is still used, and remove it if no.
Global trigger_move (object *op, int state)
Global 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?)
Global use_alchemy (object *op)
check if no superflous message when 2 cauldrons on same spot, one unpaid? (shouldn't happen, but well).
Global 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
Global while (1)

fix evil const cast

fix evil const cast

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