Crossfire Server, Trunk  R20513
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 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).
Global artifact_describe (const artifact *art, const artifactlist *al, int message, int art_name, int separator)
check archetype when loading archetypes, not here
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, 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)

isn't there duplication with remove_special_prayers() for spell removing?

split the check to make this function only actually become follower

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 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_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_active_maps (void)
The check for MAX_OBJECTS_LWM is wrongly placed, and should be moved elsewhere.
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, int check_pass)
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 ?
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 (int64_t a, int64_t b)
Probably belongs in some global utils-type file?
Page Collect process

link to relevant documentation.

write about faces also, and animations

Global colorname []
duplication with common/image
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, char command)
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_prepare (object *op, const char *params)
remove.
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 (ob_methods *context, object *op)
Split this function up.
Global compare_face (const New_Face *a, const New_Face *b)
"bug.111" should be a regular face, alas many places consider face 0 to be that face. This should be fixed at some point.
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 CREMapInformation::copy (const CREMapInformation &other)
clone random maps?
Global CREMapInformationManager::browseMaps ()

clear memory

make nicer report

Global CREMapInformationManager::process (const QString &path)
get from config
Global CREResourcesWindow::deleteQuest (Quest *quest)
doesn't work for some reason, signal issue probably
Global CREResourcesWindow::fillMaps ()
clean at some point - the issue is wrapper's ownership
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[static 1], 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 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 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_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_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_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 (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_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_server (void)
fix socket_info.max_filedescriptor hack.
Global init_startup (void)
describe forbid_play() and such restrictions.
Global is_true_undead (object *op)
remove loop on type 44 (was EXPERIENCE)
File item.c
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.c
  • 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.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_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_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)
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.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_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 ajustment 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 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 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)
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_remove (partylist *party)
clean/simplify the mess.
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)
check if pl is a player, as query_money() expects a player.
File peacemaker.c
Consider merging Peacemaker with Spell Effects
Global pets_control_golem (object *op, int dir)
trash.
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+.
Module 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
Module 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 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.
Global quest_write_player_data (const quest_player *pq)
rename/backup, stuff like that
Global QuestManager::saveQuestFile (const QString &filename)
be smarter
File random_map.c
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.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 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.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, StringBuffer *buf)
why does this also describe a SKILL?
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 runturn (struct CFanimation_struct *animation, long int id, void *parameters)
fix suspicious or missing call
Global scroll_type_apply (ob_methods *context, object *scroll, 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?
File shop.c
isn't there redundance with pay_for_item(), get_payment(), pay_for_amount()?
File spell_attack.c
put parameters in the same order, use same name.
File spell_effect.c
use the same parameter names/orders.
File spell_effect.c
Split the subtype functions into their own file each, and split large functions.
Global spellbook_type_apply (ob_methods *context, 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.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?
File style.c
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 *hitter, object *victim)
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 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 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.