Server Help Forum Index Server Help
Community forums for Subgame, ASSS, and bots
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   StatisticsStatistics   RegisterRegister 
 ProfileProfile   Login to check your private messagesLogin to check your private messages   LoginLogin (SSL) 

Server Help | ASSS Wiki (0) | Shanky.com
PlayerAction/ShipChange problems

 
Post new topic   Reply to topic Printable version
 View previous topic  Problem with asss 1.1.2 Post :: Post Zone is Red?  View next topic  
Author Message
Smong
Server Help Squatter


Joined: 1043048991
Posts: 0x91E
Offline

PostPosted: Wed Sep 17, 2003 4:38 pm    Post subject: PlayerAction/ShipChange problems Reply to topic Reply with quote

I'm posting this in the bugs forum (feel free to move it somewhere more appropriate like server suggestions -MGB) as I believe more functionality could be squeezed out of these functions. Any ideas on work arounds are appreciated too.

core.h PlayerActionFunc(Player *p, int action, Arena *arena);
When action is PA_LEAVEARENA (and the player quit the server), p has already been freed (attempting p->p_ship will crash the server). How about this being called just before p is freed?
I want to know how to find out the last person that left the arena and preferably what ship they were in too (I'm working on some events, and if it's a duel and someone decides to quit, I won't be able to know if it was them or someone in spec).

game.h ShipChangeFunc(Player *p, int newship, int newfreq);
newship is the same as p->p_ship (not surprisingly), however oldship would be a better argument. The alternative I guess is to allocate some player data holding info on their ship, and only update that info once I've finished handling ShipChange() in my module. If each module that wanted this sort of info did that, then there would be loads of duplicate info stored in the extra player data.
Back to top
View users profile Send private message Add User to Ignore List Visit posters website MSN Messenger
Grelminar
Creator of Asss


Joined: Feb 26 2003
Posts: 378
Offline

PostPosted: Thu Sep 18, 2003 1:13 am    Post subject: Reply to topic Reply with quote

Your first point is just wrong. The player struct isn't freed until much later.

As for finding the last person to leave the arena, you'll have to figure it out yourself, by handling the PA_LEAVEARENA event.

About the parameters to ShipChangeFunc, I agree having the old ship and freq would be useful. I can do one of three things: add two more parameters for the old ship/freq, change the two existing paramaters to mean the old ship/freq, or leave their meanings alone and leave p->p_ship/freq set to the old ones when the callback is invoked. Any preference?
Back to top
View users profile Send private message Add User to Ignore List Send email Visit posters website
Smong
Server Help Squatter


Joined: 1043048991
Posts: 0x91E
Offline

PostPosted: Thu Sep 18, 2003 2:46 am    Post subject: Reply to topic Reply with quote

To keep it backwards compatible and keep the meaning of the prototype it is probably best to leave p->p_ship/freq set to the old ones, thanks.
Back to top
View users profile Send private message Add User to Ignore List Visit posters website MSN Messenger
Dr Brain
Flip-flopping like a wind surfer


Age:39
Gender:Gender:Male
Joined: Dec 01 2002
Posts: 3502
Location: Hyperspace
Offline

PostPosted: Thu Sep 18, 2003 9:37 am    Post subject: Reply to topic Reply with quote

I personally would keep the p->p_ship and freq always up to date, and pass in the old freq and ship into the function.

If it were me.
_________________
Hyperspace Owner

Smong> so long as 99% deaths feel lame it will always be hyperspace to me
Back to top
View users profile Send private message Add User to Ignore List AIM Address Yahoo Messenger MSN Messenger
Mine GO BOOM
Hunch Hunch
What What
Hunch Hunch<br>What What


Age:42
Gender:Gender:Male
Joined: Aug 01 2002
Posts: 3615
Location: Las Vegas
Offline

PostPosted: Thu Sep 18, 2003 5:49 pm    Post subject: Reply to topic Reply with quote

Smong wrote:
To keep it backwards compatible...


Don't need to keep it backwards compatiable if almost nothing except some testing servers are using it. Its not that hard to recompile something like this, when maybe 10 people are working with it actively.

I'd think keeping an OldFreq/Ship is nice, as I've found it useful when dealing with games and such. Plus, its only 3 bytes (short + char).
Back to top
View users profile Send private message Add User to Ignore List Send email
Smong
Server Help Squatter


Joined: 1043048991
Posts: 0x91E
Offline

PostPosted: Fri Sep 19, 2003 1:47 pm    Post subject: Reply to topic Reply with quote

OK, pass in the old freq and ship, I'm not too bothered, so long as it gets fixed in the official distro.
Back to top
View users profile Send private message Add User to Ignore List Visit posters website MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    Server Help Forum Index -> ASSS Questions All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum
View online users | View Statistics | View Ignored List


Software by php BB © php BB Group
Server Load: 66 page(s) served in previous 5 minutes.

phpBB Created this page in 0.729228 seconds : 28 queries executed (97.4%): GZIP compression disabled