Bug 2825 - Code readability improvements
Status: RESOLVED WONTFIX
Alias: None
Product: Tremulous
Classification: Unclassified
Component: Misc
Version: unspecified
Hardware: All All
: P4 trivial
Assignee: Tremulous Bugs
QA Contact:
URL:
Depends on:
Blocks: 3089
 
Reported: 2006-08-04 08:42 EDT by Martin Doucha
Modified: 2009-10-17 19:55:14 EDT
1 user (show)

See Also:


Attachments
Renamed +buttonX commands and key flag fixes (11.34 KB, patch)
2006-08-04 09:04 EDT, Martin Doucha
Weaponswitch redundancy cleanup version 1 (1.57 KB, patch)
2006-08-09 08:09 EDT, Martin Doucha
Weaponswitch redundancy cleanup version 2 (3.15 KB, patch)
2006-08-09 08:23 EDT, Martin Doucha

Description Martin Doucha 2006-08-04 08:42:44 EDT
Some parts of code need readability improvements that don't fix any serious bugs nor add new features. Post such patches here. Please leave this "bug" open for further patches.
Comment 1 Martin Doucha 2006-08-04 09:04:04 EDT
Created attachment 1013 [details]
Renamed +buttonX commands and key flag fixes

+buttonX command handlers are not very easy to find in the code. For example, how long would it take you to figure out you have to look for BUTTON_GETFLAG in game/* to find +button7 handler which handles alien evolution and using buildables? And how long would it take you to find +evo_use handler when there's a notice you should look for BUTTON_EVO_USE in game/*? This patch does NOT remove the old +buttonX commands so it will not break old configs.
Comment 2 Martin Doucha 2006-08-09 08:09:05 EDT
Created attachment 1016 [details]
Weaponswitch redundancy cleanup version 1

This patch cleans up redundancy in nonblaster weapon lookup. Before bug 2749 was fixed, there had been 3 different places with the same piece of code, now there're 2 places left. This version adds WP_ANY flag (the same value as WP_NONE) that makes G_ForceWeaponChange() select any nonblaster weapon available.
Comment 3 Martin Doucha 2006-08-09 08:23:49 EDT
Created attachment 1017 [details]
Weaponswitch redundancy cleanup version 2

Another version of the previous patch. This version creates a new function G_FindNonBlasterWeapon() that returns the first nonblaster weapon. Redundant code is replaced by calling this function. Choose which version you like.
Comment 4 Tim Angus 2009-10-17 19:55:14 EDT
I doubt any of this applies anymore. The buttons renaming looks like a good idea on paper, but I think it will generate a lot of complaints.