Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cast system #2007

Closed
wants to merge 1 commit into from
Closed

Cast system #2007

wants to merge 1 commit into from

Conversation

Milice
Copy link

@Milice Milice commented Nov 24, 2016

Hopefully this cast system will be acceptable.

Hopefully this cast system will be acceptable.
@login12
Copy link

login12 commented Nov 24, 2016

Awesome!!!!
Great job man!
Thanks alot for this contribute

@testing..

@login12
Copy link

login12 commented Nov 24, 2016

if someone enter on cast this got name, spectator 1, and other ppl enter got name spectator2. But if spectator 1 leave and enter again, he got name spectator 2 too, resulting in 2 ppls with name spectator2.
^ because it i got crash.

If someone enter with specator 1 name... and get ban or something and other other ppl, then he enter like spectator 1 and CRASH.

solution: maybe put this for no reset, for spectator 1, and still counting spectator 1,2,3,4,5,... at cast restarts.

suggestion:
maybe count viewers on character list IN CAST, replace wordlist can be good.. ordering most viewers and less viewers
:)

}

if(command == "commands") {
player->sendChannelMessage("", "Available commands:", TALKTYPE_CHANNEL_O, CHANNEL_CAST, false);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Data race on the player object.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for pointing this out, do you have any tip on how i SHOULD handle these things to not data race? Thank you.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The rule is that most (if not all) parse* functions are run in the networking thread. You would either need to add some kind of synchronization mechanism to Player (e.g. mutex) or run a function in the dispatcher.

if(recvbyte == 0x64) {
sendCancelWalk();
}
sendMoveCreature(player, player->getPosition(), player->getTile()->getStackposOfCreature(spectator, player->getCreature()), player->getPosition(), player->getTile()->getStackposOfCreature(spectator, player->getCreature()), false);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Data race on the player object.

@@ -105,7 +105,7 @@ struct Skill {

typedef std::map<uint32_t, uint32_t> MuteCountMap;

static constexpr int32_t PLAYER_MAX_SPEED = 1500;
static constexpr int32_t PLAYER_MAX_SPEED = 5000;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixing this, forgot to revert from my local test.

@@ -1260,6 +1300,7 @@ class Player final : public Creature, public Cylinder
int32_t offlineTrainingSkill = -1;
int32_t offlineTrainingTime = 0;
int32_t idleTime = 0;
uint32_t spectatorCount = 0;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the point of this variable?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Variable removed. Thank you for pointing this out.

@@ -1182,6 +1218,9 @@ class Player final : public Creature, public Cylinder
std::map<uint32_t, int32_t> storageMap;

std::vector<OutfitEntry> outfits;
std::vector<ProtocolSpectator*> spectators;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Storing raw pointers to objects managed by shared_ptr is a bad idea IMO.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Modified to store a shared_ptr, thanks.

@@ -865,6 +1003,20 @@ void ProtocolGame::parseSay(NetworkMessage& msg)
return;
}

if(channelId == CHANNEL_CAST && player->isLiveCasting()) {
InstantSpell* instantSpell = g_spells->getInstantSpell(text);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Data race on g_spells.

@@ -865,6 +1003,20 @@ void ProtocolGame::parseSay(NetworkMessage& msg)
return;
}

if(channelId == CHANNEL_CAST && player->isLiveCasting()) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Data race on the player object.

player->sendChannelMessage("", ss.str(), TALKTYPE_CHANNEL_O, CHANNEL_CAST);
}
spectator->client.reset();
spectator = nullptr;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Memory leak of spectator?

@totolol123
Copy link

What is the differences related to @djarek cast system?

@marksamman marksamman mentioned this pull request Nov 26, 2016
@login12
Copy link

login12 commented Dec 10, 2016

any progress? bugs has been fixeds?

@DamianDEB
Copy link

login12
better ways use otx with works cast and some new system like a unjustified frags window
minimal work fix and have good engine tfs is so far to be good
https://github.com/mattyx14/otxserver/tree/otxserv3/path_10_9

Database* db = Database::getInstance();

std::ostringstream query;
query << "UPDATE `players_online` SET `cast_password` = '" << db->escapeString(password) << "' WHERE `player_id` = '" << getGUID() <<"';";
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I am not wrong, you should change:
cast_password = '" << db->escapeString(password) << "'
to:
cast_password = " << db->escapeString(password) << "
Getting SQL errors when I use a password.

Copy link

@DamianDEB DamianDEB Dec 27, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes in !cast (password) get error in console in !cast and connect to spect get debug and crash server this code its crappy ...

CREATE TABLE IF NOT EXISTS players_online (
player_id int(11) NOT NULL,
cast_password varchar(30) DEFAULT NULL,
cast_spectators smallint(5) NOT NULL DEFAULT '0',
PRIMARY KEY (player_id)
) ENGINE=MEMORY;

missing " , "

@Cjaker
Copy link

Cjaker commented Dec 28, 2016

I found a problem, if u enter in cast with 2+ ppl and u have monsters/creatures in screen he debug.

(i think is anything type move creature idk).

@DamianDEB
Copy link

Eternal-Scripts on tfs 1,2 or 1,3? on my 1.2 this system crash after spec connect to caster

@Fluppix
Copy link

Fluppix commented Jan 5, 2017

Working good with normal client but cause crash if I login as spectator with OTClient. Anyone can confirm this?

@MatheusGrilo
Copy link

MatheusGrilo commented Mar 20, 2017

I don't know if you are still working on this, but:
1st open a live cast;
2nd enter in this cast as spectator;
3rd close the client of spectator (X button).

TFS Crash.

@WibbenZ WibbenZ closed this Dec 20, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

10 participants