User Tools

Site Tools


arma:config:common_errors

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
arma:config:common_errors [2009-04-26 14:49]
snakeman created common_errors initial page.
arma:config:common_errors [2009-04-26 15:40] (current)
Line 2: Line 2:
  
 ArmA common errors in configs which you should and need to avoid at all cost. ArmA common errors in configs which you should and need to avoid at all cost.
 +
 +===== Changing the inheritance of existing classes =====
  
 For example on many many addons (even in BIS material) you'll see this [[arma:​arma.rpt|arma.rpt]] error: For example on many many addons (even in BIS material) you'll see this [[arma:​arma.rpt|arma.rpt]] error:
Line 7: Line 9:
 Updating base class ->​MGunCore,​ by ca\weapons\config.bin/​cfgWeapons/​MGun/​ Updating base class ->​MGunCore,​ by ca\weapons\config.bin/​cfgWeapons/​MGun/​
 </​code>​ </​code>​
-You can avoid this error by not changing ​the MGun class, instead using your own new class by inheriting ​from this MGun directly.+This happens because an addon changes the inheritance of a class that has already been defined. In the example above, 
 +BIS themselves does this in the ''​Addons\weapons.pbo''​ addon, where the basic class ''​MGun''​ is altered from 
 +having no parent ​class to having the class ''​MGunCore''​ as the parent. 
 + 
 +The warning is printed like this: 
 + 
 +''​Updating base class //​OldClass//​->​**//​NewClass//​**, ​by \path\to\the\config.bin/​CfgSomeClass/​**Classname**''​ 
 + 
 +This means that ''​**Classname**''​ was changed ​from being based on the old base class (''//​OldClass//''​) to the new base class (''​**//​NewClass//​**''​). 
 + 
 +(In the ''​MGun''​ [[arma:arma.rpt|arma.rpt]] error example, ''//​OldClass//''​ was empty, ie ''​MGun''​ did not have a parent class.) 
 + 
 +How do you avoid this warning? It's simple: **don'​t change the inheritance of existing classes** 
  
-These are few examples how its done.+===== Altering existing classes ===== 
 +Sometimes you see addons that not only alters the inheritance of existing BIS classes, but then proceeds to make changes to the classes themselves. 
 +An example of this can be seen below:
  
 Bad config: Bad config:
 <code cpp> <code cpp>
- class MGunCore; +class MGunCore; 
- class MGun: MGunCore +class MGun: MGunCore 
-+
- displayName = "​MyCoolGun";​ + displayName = "​MyCoolGun";​ 
- };+};
 </​code>​ </​code>​
 +That's just bad form. What you should do instead is create your own machine gun class and let it inherit from the existing BIS class.
  
 Good config: Good config:
 <code cpp> <code cpp>
- class MGun; +class MGun; 
- class TAG_MGun: MGun +class TAG_MGun: MGun 
-+
- displayName = "​MyCoolGun";​ + displayName = "​MyCoolGun";​ 
- };+};
 </​code>​ </​code>​
  
-Other common errors:+===== Other common errors ​=====
 <​code>​ <​code>​
 Updating base class ->​Default,​ by ca\anims\characters\config.bin/​CfgMovesBasic/​DefaultDie/​ Updating base class ->​Default,​ by ca\anims\characters\config.bin/​CfgMovesBasic/​DefaultDie/​
arma/config/common_errors.1240757380.txt.gz · Last modified: 2009-04-26 14:49 by snakeman