Crossfire Server, Branches 1.12  R18729
Todo List
Global _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 add_score (score *new_score)
remove static buffer.
Global add_weight (object *op, signed long weight)
check if mergeable with sub_weight().
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.c
make the functions use the same order for parameters (type first, then name, or the opposite).
File attack.c
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, recipe *rp, int nbatches, int ignore_cauldron)
check meaning of ability/nbatches.
Global basic_emote (object *op, char *params, int emotion)
simplify function (indexed array, for instance).
Global become_follower (object *op, const object *new_god)
isn't there duplication with check_special_prayers() for spell removing?
Global bowtype_t
document.
Global bowtype_t
document.
Global buf_overflow (const char *buf1, const char *buf2, size_t bufsize)
This could maybe overflow. Make sure it doesn't.
File build_map.c
document building, forces used to store connection values, ...
File c_object.c
clean multiple variations of same stuff (pickup and such), or rename for less confusion.
File c_wiz.c
explain item stack, item specifier for commands.
Global calc_item_power (const object *op, int flag)
fix function, and remove unused flag variable.
Global can_hit (object *ob1, object *ob2, rv_vector *rv)
rename to something more clear (is_adjacent?).
Global can_merge (object *ob1, object *ob2)
check the function at places marked.
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_cast_ability (object *caster, object *ctoo, int dir, object *sp, char *flags)
either totally remove or replace by cf_object_cast_spell().
Global cf_object_forget_spell (object *op, object *sp)
make coherent with do_forget_spell() (string instead of ob).
Global cfapi_map_present_arch_by_name (int *type,...)
fix archetype instead of string.
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, sint8 value)
check if attr is valid? Checks result valus is valid?
Global check_active_maps (void)
The check for MAX_OBJECTS_LWM is wrongly placed, and should be moved elsewhere.
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)
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 check_weapon_power (const object *who, int improvs)
remove obsolete code.
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 ?
Global clean_tmp_files (void)
check logic, why is file only removed if map is in memory?
Global clear_los (object *op)
use player *instead of object *to show it must be a player?
Page Client
expand (map info and such)
Global clipped_percent (sint64 a, sint64 b)
Probably belongs in some global utils-type file?
Page Collect process

link to relevant documentation. Add file extension to the relevant places also.

write about faces also, and animations

Global colorname []
duplication with common/image
Global command_abil (object *op, char *params)
use get_other_player_from_name(). Isn't this useless with the command_patch()?
Global command_create (object *op, char *params)
enable line breaks in command.
Global Command_Line_Options::pass
describe passes :)
Global command_party (object *op, char *params)
split in different functions. clean the 'form' mess.
Global command_pickup (object *op, char *params)
trash old pickup mode, merge with new pickup.
Global command_possess (object *op, char *params)
fix and reactivate the function, or totally trash.
Global command_prepare (object *op, char *params)
remove.
Global command_skills (object *op, char *params)
move out of this file as it is used by all players.
Global common_process_projectile (ob_methods *context, object *op)
Split this function up.
Returns
METHOD_ERROR if op is not in a map, otherwise METHOD_OK
Global compute_path (object *source, object *target, int default_dir)
cache path, smart ajustment and such things to not compute all the time ; try directions randomly.
Page Connected items
write about buttons, triggers, ...
Global control_golem (object *op, int dir)
trash.
Global copy_object_with_inv (object *src_ob, object *dest_ob)
replace with a function in common library (there is certainly one).
Global create_archetype (const char *name)
replace with object_create_arch() which is multi-part aware.
Global crypt_string (char *str, char *salt)
make thread-safe?
Global describe_item (const object *op, const object *owner, char *retbuf, size_t size)
Check whether owner is really needed. Use safe string functions. Check spurious food logic.
Global describe_monster (const object *op, char *retbuf, size_t size)
Rename to describe_living (or equivalent) since called for player too. Use safe string functions. Fix weird sustenance logic.
Global describe_shop (const object *op)
is return value meaningful?
Global destroy_object (object *op)
doesn't free_object() handle inventory?
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 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 nrof)
shouldn't tmp be NULL if 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 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 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 find_archetype (const char *name)
replace by try_find_archetype() when suitable and trash warn_archetypes.
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_plugin_command (char *cmd, object *op)
remove static buffer.
Global find_random_spell_in_ob (object *ob, const char *skill)
change skill to sstring.
Global find_recipe (recipelist *fl, int formula, object *ingredients)
document parameters.
Global find_skill_by_name (object *who, const char *name)
check if name shouldn't be made a shared string.
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, sint16 x, sint16 y, int dir, object *spell)
check the note?
Global fire_bow (object *op, object *arrow, int dir, int wc_mod, sint16 sx, sint16 sy)
describe player firing modes.
Global fix_container (object *container)
This is unusued, should it be used somewhere?
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 (struct mapdef *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 forbid_play (void)
document forbidden stuff.
File gate.c
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_multi_size (object *ob, int *sx, int *sy, int *hx, int *hy)
either check for sx/sy everywhere or remove the check :)
Global get_owner (object *op)
a side effect of this function is to clean owner chain for not existing anymore owner. This is not the place to do such a cleaning
Global get_player_container (object *op)
this function is badly named. Fix patching on the fly.
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_score (char *bp)
make thread-safe, remove static stuff.
Global get_spell_by_name (object *op, const char *spell_name)
remove the spelldirect_xxx test?
Global get_split_ob (object *orig_ob, uint32 nr, char *err, size_t size)
handle case orig_ob->nrof == 0 (meaning 1).
Global get_wall (struct mapdef *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 type, int full_hit)
rename to something more meaningful.
Group 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_startup (void)
describe forbid_play() and such restrictions.
Global insert_multisquare_ob_in_map (object *new_obj, mapstruct *map)
there probably is a function in the common library for that, so remove this one.
Global insert_ob_in_map (object *op, mapstruct *m, object *originator, int flag)
this function is a mess, and should be cleaned.
File item.c
put const char *instead of char *when possible.
Global item_matched_string (object *pl, object *op, const char *name)
is the player->contr->count hack used?? Try to reduce buffers/calls to query_ functions.
Global kill_object (object *op, int dam, object *hitter, int type)
finish commenting what it does exactly.
Global kill_player (object *op)
describe battleground.
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).
Global leave (player *pl, int draw_exit)
check for pl != NULL should include the 'left the game', just in case (or remove it?)
Global living
fix comment, living is used for many things :) also fix comments for fields (should probably be in a separate file).
Global living
fix comment, living is used for many things :) also fix comments for fields (should probably be in a separate file).
File living.c
make "stat"/"attr" coherent.
Global load_and_link_tiled_map (mapstruct *orig_map, int tile_num)
check ready_map_name() 's return value, which can be NULL?
Global load_materials (void)
describe materials and such.
Global load_temporary_map (mapstruct *m)
check spurious logic for load_map_header failure (shouldn't it return m?)
Global load_treasure (FILE *fp, int *line)

check if change_name is still used, and remove it if no.

Global lock_and_hide_doors (object **doorlist, mapstruct *map, int opts, RMParms *RP)
document opts. Isn't it part of RP?
Global lookup_god_by_name (const char *name)
couldn't == be used for comparison, if name is a shared string?
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_list_like (char *input)
use safe string functions.
Global make_square_spiral_layout (int xsize, int ysize)
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_redraw_cmd (char *buf, int len, player *pl)
remove
Group MAP_xxx
remove map_block
File mapper.c
  • 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
  • make the equipment page use templates
  • 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)
Global monster_should_cast_spell (object *monster, 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 name_to_material (const char *name)
why use a break?
Global need_identify (const object *op)
either remove this function, or fix comment above :)
Global ob_trigger (object *op, object *cause, int state)
check the exact state values/meaning
Page Objects

link to types, flags, ...

write :)

Global parse_args (int argc, char *argv[], int pass)
describe pass.
Global pay_for_amount (uint64 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)
check if pl is a player, as query_money() expects a player.
File peacemaker.c
Consider merging Peacemaker with Spell Effects
Global petmode_t
document.
Global petmode_t
document.
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, mapstruct *style_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.c
describe login/creation functions/cycles.
Page Players
write :) obj::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+.
Group plugin_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
Group plugin_rhg
  • make more parameters vary based on maps
  • add exits to all towns
File plugins.c
describe "wrappers" for functions, conventions used (parameters + return value).
Global present_in_ob_by_name (int type, const char *str, const object *op)
use add_string() hack to avoid the strcmp?
Global print_los (object *op)
change the command to view another player's LOS?
Global process_object (object *op)
remove unused return value?
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.
File random_map.c
explain process, layout signs (# C < > ) and such. Use constants/defines for spot types.
Global read_line (char *buffer, int size, FILE *file)
remove spaces at line start/end.
File readable.c
replace message type with defines/enums & such things.
Page Regions
describe
Global register_all_ob_types (void)
this should probably be moved to a file in the types/ directory, to separate types and server.
Global rejoin_modes []
document that
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?
Global remove_ob (object *op)
this function is a piece of overbloated crap or at lest look like need cleanup it does to much different things.
Global remove_party (partylist *target_party)
clean/simplify the mess.
File request.c
smoothing should be automatic for latest clients. Remove some stuff we can assume is always on. fix comments for this file.
File resurrection.c
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, char *buf, size_t size)
Use safe string functions. Check if really ring/amulet?
File room_gen_spiral.c
Check if MAX_FINE can't be removed.
Global runcamera (struct CFanimation_struct *animation, long int id, void *parameters)
fix
Global runfire (struct CFanimation_struct *animation, long int id, void *parameters)
fix
Global runstop (struct CFanimation_struct *animation, long int id, void *parameters)
fix
Global scroll_type_apply (ob_methods *context, object *op, object *applier, int aflags)

should handle scroll failure differently if god-like scroll.

Tweak failure parameters.

Global send_class_info (socket_struct *ns, char *params)
finish writing
Global send_race_info (socket_struct *ns, char *params)
finish writing
Global set_attr_value (living *stats, int attr, sint8 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_owner (object *op, object *owner)
replace owner serching loop with a call to get_owner()?
Global set_sound_cmd (char *buf, int len, socket_struct *ns)
remove once clients don't try to use this - server closes connection on invalid client.
File shop.c
isn't there redundance with pay_for_item(), get_payment(), pay_for_amount()?
Global snprintf (char *dest, int max, const char *format,...)
try to do something better than abort()?
File spell_attack.c
put parameters in the same order, use same name.
File spell_effect.c
Split the subtype functions into their own file each, and split large functions.
File spell_effect.c
use the same parameter names/orders.
Global spellbook_type_apply (ob_methods *context, object *lighter, 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.
Global spool (char *bp, const char *error)
make thread-safe. is this function really useful?
File square_spiral.c
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?
Global strrstr (const char *haystack, const char *needle)
isn't there another function (porting.c?) for that?
Global strtol (register char *str, char **ptr, register int base)
check weird -+ handling (missing break?)
File style.c
couldn't load_dir() be merged with a function in common library?
Global sub_weight (object *op, signed long weight)
check if not mergeable with add_weight().
Global subtract_player_exp (object *op, sint64 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 **layout, int i, int j, int Xsize, int Ysize)
there is an equivalent function in another layout, merge them together.
Global surround_check (char **layout, 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 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 (ob_methods *context, object *op)
Split function into more managable functions.
Global trigger_move (object *op, int state)
document?
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 update_ob_speed (object *op)
check fixme & todo
Global update_object (object *op, int action)
this function should be renamed to something like update_object_map, update_object is a too general term Also it might be worth moving it to map.c
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.
Global usekeytype
document.
Page Various topics
explain why spells have who/caster/spell_ob, things like that
Global write_note (object *pl, object *item, const char *msg, object *skill)
assert() instead of simple check.
Global write_parameters_to_string (char *buf, int xsize_n, int ysize_n, const char *wallstyle_n, const char *floorstyle_n, const char *monsterstyle_n, const char *treasurestyle_n, const char *layoutstyle_n, const char *decorstyle_n, const char *doorstyle_n, const char *exitstyle_n, const char *final_map_n, const char *exit_on_final_map_n, const char *this_map_n, int layoutoptions1_n, int layoutoptions2_n, int layoutoptions3_n, int symmetry_n, int dungeon_depth_n, int dungeon_level_n, int difficulty_n, int difficulty_given_n, int decoroptions_n, int orientation_n, int origin_x_n, int origin_y_n, int random_seed_n, int treasureoptions_n, float difficulty_increase)
remove this and replace with calls to write_map_parameters_to_string().
Global write_tiled_map_page (struct_map_info *map)
: do a real page, with the various levels, maps and such.