Legendary OT User
IntroductionThis thread purpose is to get more people into experimenting with TFS sources.
Most beginners (and plenty of advanced users) prefer using Windows when it comes to running tfs locally.
This is not a disadvantage - most of user friendly tools to build a decent game world are for Windows (don't confuse building with hosting).
In this tutorial you will learn how to move around the code smoothly to make source edits far easier.
Note: I'm using a translated version of MS Visual Studio so the labels may be worded a bit differently in your language.
1. clicking some part of code and pressing alt+enter
This shortcut opens a small menu that contains a plenty of features depending on what you clicked.
Might be helpful when you need to generate a declaration in header file or there is something wrong with the part of your code.
2. hovering over code parts
Hovering over code parts can give you clues such as what the problem is (when underlined red) or what is the variable type (when ok)
3. right click menuThis menu will be your best friend in source edits. It allows you to quickly jump between files to the functions you're looking for.
Even someone who is a complete beginner can move around smoothly using these. Below I will describe what each option does.
1. opens alt+enter menu
2. renames the selected part (variable, type, class name, etc)
3. allows you to view where the thing is defined without leaving the file you're currently editing
5. does a jump to a place where the thing you're checking is declared (usually a header file - .h or first occurence of variable within a function)
6. gives you a list of places where the thing you're checking is being used. Useful to find out what is using the code you're editing.
The results of this action will show in bottom panel and when you click them, you jump to them instantly.
7. similar to previous one - lets you browse the code hierarchy in the bottom panel
8. performs a jump between .cpp and .h files related to each other
9. allows you to add a breakpoint in case you want to pause tfs and do some debugging
4. search feature (ctrl+f)allows you to search text like in browser, checks all files in the project
1. search box
2. toggle search/replace
3. resize the window
4. match case (if enabled, it will only search getArea and ignore things such as GETAREA and getarea)
5. entire words only (with this enabled, it will search for "getArea" only, while results such as "getAreaSomething" will be ignored)
6. the scope of your search
7. (the upper one because I put two by accident) clicking big arrow will move you to next result, clicking a small arrow allows you to choose previous/next/all results
if you clicked all results, they will be displayed in the bottom panel
7. (the lower one) path to file with the result
8. line containing the result
9. tab with the search. Number 1 means that this is the first search you've made in this session.
10. enable regular expressions
5. attaching a debuggerRunning tfs from Visual Studio may result in errors such as failing to load config, but that doesn't mean that you can't attach a debugger.
Start tfs normally, go to Visual Studio top panel -> debugging -> attach to process (or ctrl+alt+P)
Here you can choose tfs executable from the list of active processes and wait for it to reach a breakpoint or crash.
In case of crash, you'll be moved to line of code where it happened.
The attaching menu may look confusing at first, but all you have to do is choosing tfs and confirming.
note: source code must match the executable for it to work
final wordsDon't get discouraged when you decide to make contributions and your code quality gets questioned.
When in doubt, just ask what needs to be corrected or how to contribute.
Every single one of us was figuring out the code convention of tfs repo and how to use git at some point.