Game Development Community

Defaults.cs

by Tim Heldna · in Torque Game Engine · 07/06/2006 (8:52 am) · 6 replies

example\common\defaults.cs

In 1.4, the above file seems to be brute forcing certain pref values when it shouldn't be.

Certain changes I make in my options GUI aren't being saved.

Upon exiting and re-entering a game they get overwritten with the values in common\defaults.cs.

So any pref information stored in client\prefs.cs is being overwritten with the default prefs set in common\defaults.cs.

If I stop common\defaults.cs from executing everything works perfectly.

Is this the right way of fixing this or will this break something that I haven't come across yet? I don't see how that file is needed anyhow when you already have a client\defaults.cs.

Please explain.

#1
07/06/2006 (9:55 am)
Are you certain that's what's happening? Because yes you don't need the default.cs if you have a prefs file, the default is what's there before the prefs file is written. I do remember some bugs with some kinds of data being loaded on GUI elements in 1.4 (like why the player name doesn't get reloaded properly on the server selection menu anymore).
#2
07/06/2006 (10:06 am)
Quote:
Are you certain that's what's happening?
Without a single doubt.

Quote:
the player name doesn't get reloaded properly on the server selection menu anymore
This problem stems from a problem in guiTextEditCtrl.cc, in 1.4.

I have fixed this problem which is when I noticed that every time I exited and re-started my game my player name was reset to "fresh meat".

Common\defaults.cs is where the value is incorrectly overwriting the $pref::Player::Name value in any and all pref files!

You do not need common\defaults.cs as this task is being performed in client\defaults.cs

It seems that the common\defaults.cs file was added by mistake by GG with the new creator setup in 1.4.
#3
08/08/2006 (7:13 pm)
There isn't an example/common/defaults.cs in TGE 1.4 (nor has there ever been according to our SVN logs).
#4
08/09/2006 (12:26 am)
Trust me, it's there.

Why else would you have?
//-----------------------------------------------------------------------------
// Load up defaults console values.

//exec("./defaults.cs");

//-----------------------------------------------------------------------------
Inside of example/common/main.cs

The example/common/defaults.cs file isn't there to begin with, it is generated. I'm not sure when and where it happens, perhaps running a dedicated server is the culprit. Either way, every time I delete the file it magically reappears.

You should look into this more thoroughly, please.
#5
08/09/2006 (2:43 am)
Hey tim -

i didn't know that a defaults.cs was generated!

typically defaults.cs is exec'd before prefs.cs, and thus prefs.cs overrides defaults.cs.
maybe try blowing away *.dso in the entire project ?

also, if your above quote is accurate,
it seems to be 100% no-ops.
which, yeah, seems weird.
#6
08/09/2006 (7:49 am)
Something is definitely wrong.

Launch a fresh virgin install of TGE 1.4 and type in a player name. Now quit, and restart. Where did your player name go? It's now blank?

Ok, so this stems from several bugs in guiTextEditCtrl.cc.

Here's a resource with a community fix.

Fix for guiTextEditCtrl.cc

I know two things for certain.

1) example/common/main.cs is trying to execute a default.cs file when it shouldn't be. Regardless of whether the default.cs file is there or not, that line shouldn't be there.

2) Some bugs in guiTextEditCtrl.cc are contributing to the problem.

As to why I'm seeing the file and no-one else is? Only two things come to mind.

1) Either someone else on my team noticed the console warning and just copy / pasted the starter.fps/client/defaults.cs file in there to alleviate console spam.

2) I'm performing a unique series of events that results in the file being generated.