• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!
  • 2026 staff recruitment is open! Check it out and consider applying!

Djarek cast system TFS 1.2

Itutorial

Legendary OT User
Joined
Dec 23, 2014
Messages
2,461
Solutions
68
Reaction score
1,123
While trying to add this cast system to the sources I found that in protocolgame.cpp it says to add this line

ProtocolGame::LiveCastsMap ProtocolGame::liveCasts;

It doesn't show where to add it though. It look like at the top of the code under the #includes but this creates an error.

It shows to edit this code at the top of protocolgame.cpp

Code:
ProtocolGame::ProtocolGame(Connection_ptr connection) :
-    Protocol(connection),
-    player(nullptr),
-    eventConnect(0),
-    challengeTimestamp(0),
-    version(CLIENT_VERSION_MIN),
-    challengeRandom(0),
-    debugAssertSent(false),
-    acceptPackets(false)
-{
-    //
-}

This code isn't in protocolgame.cpp. Then it says to add ProtocolGame::LiveCastsMap ProtocolGame::liveCasts; right after it. So where should I put it?

Nvm figured it out forgot to add the new cpp files to visual studio


So I got it compiled but when I try to connect to an account nothing happens. If I try to connect without user/pass it debugs. Anyone know of problems like this for TFS 1.2 1.98 and this system?
 
Last edited by a moderator:
Nvm figured it out forgot to add the new cpp files to visual studio


So I got it compiled but when I try to connect to an account nothing happens. If I try to connect without user/pass it debugs. Anyone know of problems like this for TFS 1.2 1.98 and this system?

Are you sure you added the files correct?
You also have to remember that there could have been alot of changes to the source code since Djarek last updated it.

So take a look in protocollogin and protocolgame and if needed compare the files with WinMerge.
 

So I used this one and while compiling I get this error:

Error C2665 'createTask': none of the 2 overloads could convert all the argument types (compiling source file ..\src\protocolgame.cpp)


Heres the code.

Code:
template <typename Callable, typename... Args>
        void addGameTask(Callable function, Args&&... args) {
            g_dispatcher.addTask(createTask(std::bind(function, &g_game, std::forward<Args>(args)...)));
        }
 
You added something wrong, I'm using this system and it works fine without any fixes ;P
 
So I used this one and while compiling I get this error:

Error C2665 'createTask': none of the 2 overloads could convert all the argument types (compiling source file ..\src\protocolgame.cpp)


Heres the code.

Code:
template <typename Callable, typename... Args>
        void addGameTask(Callable function, Args&&... args) {
            g_dispatcher.addTask(createTask(std::bind(function, &g_game, std::forward<Args>(args)...)));
        }

C++ can have multiple same-named functions;
C++:
bool Class::function(bool, std::string)
bool Class::function(std::string, bool)

You are missing the function with the correct variables for that function name, do as @Thexamx said and re-check everything
 
I dont think the cast system is up-to-date with TFS source code anymore. Which could be causing the problem.
 
I dont think the cast system is up-to-date with TFS source code anymore. Which could be causing the problem.

Correct it's not up to date;
This branch has conflicts that must be resolved
Only those with write access to this repository can merge pull requests.
Conflicting files
src/protocolgame.cpp
src/protocolgame.h

But check the files again, compare them or hire someone to fix it for you.
 
Guys, i assume my cast currently have a bug and i can't really work on it right now, so maybe someone could fix the datarace as it's really a risk of server-crash.
 
Guys, i assume my cast currently have a bug and i can't really work on it right now, so maybe someone could fix the datarace as it's really a risk of server-crash.

Is it confirmed? I can only find 1 message about it in the PR.
@Thexamx are you hosting a server with it? Player count? Experienced that crash?
 
Well, i fixed it for him privately on windows while another error still occurs on linux which i can't really look deep onto it until someone with more experience does. I waited for djarek & rainsalt to respond giving a tip or whatever to fix it.
Yes, the issue occurred when logging out because of datarace.

--- edit
For the conflicts, i guess it's because the rule violation or whatever was added extra to the protocolgame, the solution is to just merge them, but in fact in protocolgamebase and NOT protocolgame.
 
Last edited:
Well, i fixed it for him privately on windows while another error still occurs on linux which i can't really look deep onto it until someone with more experience does. I waited for djarek & rainsalt to respond giving a tip or whatever to fix it.
Yes, the issue occurred when logging out because of datarace.

--- edit
For the conflicts, i guess it's because the rule violation or whatever was added extra to the protocolgame, the solution is to just merge them, but in fact in protocolgamebase and NOT protocolgame.

If you don't have the code can you ask him to do a WinMerge and upload the "fix"?
 
I will merge the code as soon as possible! The problem still remains in linux, i will try to take a look on it as soon as i prepare my linux server.
 
I will merge the code as soon as possible! The problem still remains in linux, i will try to take a look on it as soon as i prepare my linux server.
What do you mean?
I'm using this cast system on my linux, ubuntu 14.04. Everything compiles fine ;p
 
What do you mean?
I'm using this cast system on my linux, ubuntu 14.04. Everything compiles fine ;p

Post the "Windows fix" in the PR and then try to test it out on his Linux server.

It seems like the compilation isn't the problem, it's crashing.
I can't say more since I don't have good description or "bug fix" but because of this thread I wouldn't use this system on a live server.

When he updates the PR and this thread we might be able to help him out :p
 

Similar threads

Replies
1
Views
435
Back
Top