Issue with coding

What do you want to see in Armagetron soon? Any new feature ideas? Let's ponder these ground breaking ideas...
User avatar
Z-Man
God & Project Admin
Posts: 11589
Joined: Sun Jan 23, 2005 6:01 pm
Location: Cologne
Contact:

Post by Z-Man »

Ooh, well spotted. Yes, that is indeed likely to cause a crash, because it copies the spawn point list, which is actually supposed to be a non-copyable object.

Using

Code: Select all

gArena & arena = Arena; 
instead should fix the problem.
User avatar
Alpha Centauri
On Lightcycle Grid
Posts: 42
Joined: Wed Jul 09, 2008 8:09 pm
Location: United States
Contact:

Post by Alpha Centauri »

Z-Man wrote:Ooh, well spotted. Yes, that is indeed likely to cause a crash, because it copies the spawn point list, which is actually supposed to be a non-copyable object.
Sounds like a good case for a private copy constructor. :P
Nexus9 server ultra-admin.
User avatar
ivantis
Round Winner
Posts: 269
Joined: Mon Mar 03, 2008 2:33 pm
Contact:

Post by ivantis »

see? i knew z-man would get this one. how was i supposed to know? i didnt write the game...
Image
Image
Image
User avatar
hoop
Round Winner
Posts: 201
Joined: Tue Jul 24, 2007 7:45 am
Contact:

Post by hoop »

ivantis wrote:see? i knew z-man would get this one. how was i supposed to know? i didnt write the game...
You weren't supposed to know that that object should not be copied, but anyway the statement:

Code: Select all

gArena arena = Arena; 
would be totally useless, since you could have just used the global object., it doesn't matter if you're using it inside your fucntion.
Even Z-Man's suggestion

Code: Select all

gArena & arena = Arena; 
doesnt' look useful for me: you are just making an alias for 'arena' ,called 'Arena' :?:

Last thing: if the RESPAWN_PLAYER code is placed in gCycle.cpp, you should put your code there too.
IMO gWinzone.cpp should be modified for other purposes.
User avatar
Z-Man
God & Project Admin
Posts: 11589
Joined: Sun Jan 23, 2005 6:01 pm
Location: Cologne
Contact:

Post by Z-Man »

hoop wrote:Even Z-Man's suggestion

Code: Select all

gArena & arena = Arena; 
doesnt' look useful for me: you are just making an alias for 'arena' ,called 'Arena' :?:
Yes :) It was less to type for me, however.
User avatar
Alpha Centauri
On Lightcycle Grid
Posts: 42
Joined: Wed Jul 09, 2008 8:09 pm
Location: United States
Contact:

Post by Alpha Centauri »

hoop wrote: Even Z-Man's suggestion

Code: Select all

gArena & arena = Arena; 
doesnt' look useful for me: you are just making an alias for 'arena' ,called 'Arena' :?:
Other way around and you have it essentially right.
Nexus9 server ultra-admin.
User avatar
ivantis
Round Winner
Posts: 269
Joined: Mon Mar 03, 2008 2:33 pm
Contact:

Post by ivantis »

its in gWinZone.cpp for a purpose, its for the teleporting zones.
Image
Image
Image
User avatar
hoop
Round Winner
Posts: 201
Joined: Tue Jul 24, 2007 7:45 am
Contact:

Post by hoop »

wow, ok :D
Post Reply