Override class or create second,

The best and quickest support by a group of top-notch editing specialists, guaranteed!

Moderator: Forum Guards

Override class or create second,

Postby bambi » Wed Jan 11, 12 8:31 pm

Hi Codders!

I have a question, is it better to expand a class or to expand from that class's parent such as,

Code: Select all
class DeusExGameInfo expands GameInfo
   config;


Should I expand from DeusExGameInfo and override all its functions, which I want, or should I just expand from GameInfo?
Last edited by bambi on Wed Jan 11, 12 8:31 pm, edited 1 time in total.
Image
bambi
Regular
 
Posts: 476
Joined: Sun Nov 27, 05 7:26 pm

Postby Gishank » Wed Jan 11, 12 8:36 pm

There's no 'better' way about it, it's purely a matter of choice.

Think of it this way, "AAA.uc" derives from "AAB.uc", AAA.uc has content or modifications in it that you want which the parent "AAB.uc" doesn't have - so you'd use the child "AAB.uc" as the parent so you don't have to do as much work.
Image
Gishank
Forum Super Hero
 
Posts: 4235
Joined: Sun Aug 28, 05 9:17 am
Location: London, England.

Re: Override class or create second,

Postby ~ô¿ô~Nobody~ » Wed Jan 11, 12 9:13 pm

bambi wrote:Hi Codders!
RAWR, It's coders... CODERS!
Anyway.. to your question..


bambi wrote:I have a question, is it better to expand a class or to expand from that class's parent such as,

Code: Select all
class DeusExGameInfo expands GameInfo
   config;


Should I expand from DeusExGameInfo and override all its functions, which I want, or should I just expand from GameInfo?
That depends on what you want to do.
I don't know your intention but in case you want to make a new game type for MP, then extending DeusExGameInfo is not the way.
You should always extend the class that has the most similarities to what you want to do.

If you want to make a game class for a game type that's basically Team deathmatch, you should extend it 'TeamDMGame'.
If it shall be a kind of deathmatch, you should extend it 'Deathmatchgame'.
In case you want to make something very different, you should possibly go up one level in the class hierarchy and extend it DeusExMPGame.

If course, you could also extend your TDM game type from DeusExMPGame for instance, but then you have to write all the team game code by yourself, instead of inheriting it from the existing 'TeamDMGame' game class.


A better but common example would be, if you wanted to make a LAM that shots shrapnel for instance. Coding wise, it will make your life much easier if you extend it the LAM class instead of 'DeusExWeapon' or something similar.. because your class will inherit the grenade code from the LAM and you don't have to write it all on your own.


So yeah, exactly what Klop said! :o
Nobody is perfect...
------------------------------
Longc[A]t wrote:I still think Dae is a russian spambot.

~[A]Daedalus~ wrote:There will be a day when my patience goes away and you, along with all who rant with you, will get banned.

ô¿ô¥[GODZ]¥NOCHANC wrote:I can ban any one I want ANY time I want. You have no rights here.
User avatar
~ô¿ô~Nobody~
Alpha
 
Posts: 2520
Joined: Fri Dec 31, 04 3:20 pm
Location: Proclarush Taonas

Postby bambi » Wed Jan 11, 12 10:06 pm

I understand Nobody.

This project, if I succeed, will inspire the whole dx community.

I'm fixing a very old mod that the owner has given up on. And its a great mod, with features that people are just starting to adopt.

It will be awesome, but its very slow and boring work right now. I have to open class by class and change just a couple letters....

thanks codder
Image
bambi
Regular
 
Posts: 476
Joined: Sun Nov 27, 05 7:26 pm

Postby ~DJ~ » Thu Jan 12, 12 12:00 am

If you don't mind, would you tell us more information about this forgotten mod? :oops:
User avatar
~DJ~
Forum Super Hero
 
Posts: 3766
Joined: Tue May 22, 07 12:23 pm

Postby bambi » Thu Jan 12, 12 12:28 am

Lol. No can do. The more I work on it the more I realize how much work this will take. I'm going to ask Chin to get some maps with this mod on it.

Lets just say there are about 600 classes that I have to manually edit.
Image
bambi
Regular
 
Posts: 476
Joined: Sun Nov 27, 05 7:26 pm

Postby Poor » Thu Jan 12, 12 2:35 am

Notepad++ has a mass replace feature and supports regular expressions (this allows you to do complex find and replaces).
Last edited by Poor on Thu Jan 12, 12 2:36 am, edited 2 times in total.
Poor
Poster
 
Posts: 190
Joined: Tue Jan 04, 11 7:42 pm

Postby bambi » Thu Jan 12, 12 3:21 am

Ok please explain poor, as I'm already running intro trouble using the mass name changing. Some things are getting changed that shouldn't be.
Image
bambi
Regular
 
Posts: 476
Joined: Sun Nov 27, 05 7:26 pm


Return to Editing issues

Who is online

Users browsing this forum: No registered users and 19 guests
cron