translations plus small fixes
parent
ca254d70b6
commit
fd6147bea0
|
@ -13,18 +13,20 @@
|
|||
// *
|
||||
// * You should have received a copy of the GNU General Public License
|
||||
// * along with this program. If not, see http://www.gnu.org/licenses/.///////////////////////////////////////////////////////////////////////
|
||||
// compilation des diverses instructions
|
||||
// toutes les routines Compile sont statiques
|
||||
// et retournent un object selon ce qui a été trouvé comme instruction
|
||||
// Compilation of various instructions
|
||||
// Compile all routines are static
|
||||
// And return an object according to what was found as instruction
|
||||
|
||||
// principe de compilation:
|
||||
// les routines Compile retournent un objet de la classe correspondant à l'opération trouvée
|
||||
// il s'agit toujours d'une classe fille de CBotInstr.
|
||||
// ( les objets CBotInstr ne sont jamais utilisés directement )
|
||||
// Compiler principle:
|
||||
// compile the routines return an object of the class corresponding to the operation found
|
||||
// This is always a subclass of CBotInstr.
|
||||
// (CBotInstr objects are never used directly)
|
||||
|
||||
|
||||
// Compiles if the routine returns NULL is that the statement is false
|
||||
// Or misunderstood.
|
||||
// The error is then on the stack CBotCStack :: Isok () is FALSE
|
||||
|
||||
// si la routine Compile retourne NULL, c'est que l'instruction est fausse
|
||||
// ou incomprise.
|
||||
// L'erreur se trouve alors sur la pile CBotCStack::IsOk() est FALSE
|
||||
|
||||
|
||||
#include "CBot.h"
|
||||
|
|
|
@ -1346,9 +1346,7 @@ public:
|
|||
|
||||
void SetIdent(long n);
|
||||
|
||||
static
|
||||
CBotVarClass*
|
||||
CBotVarClass::Find(long id);
|
||||
static CBotVarClass* Find(long id);
|
||||
|
||||
|
||||
// CBotVar* GivMyThis();
|
||||
|
@ -1599,8 +1597,8 @@ private:
|
|||
CBotToken m_openblk;
|
||||
CBotToken m_closeblk;
|
||||
public:
|
||||
CBotFunction::CBotFunction();
|
||||
CBotFunction::~CBotFunction();
|
||||
CBotFunction();
|
||||
~CBotFunction();
|
||||
static
|
||||
CBotFunction* Compile(CBotToken* &p, CBotCStack* pStack, CBotFunction* pFunc, BOOL bLocal = TRUE);
|
||||
static
|
||||
|
|
|
@ -1,39 +1,41 @@
|
|||
pour la gestion des instances d'une classe.
|
||||
|
||||
l'objet créé actuellement avec CBotVar::Create(nom, pClasse)
|
||||
est a conserver tel quel, en dehors des vars sur la pile
|
||||
for managing instances of a class.
|
||||
|
||||
il faut un autre type de variable pour garder les pointeurs
|
||||
CBotTypPtClass par exemple
|
||||
the object being created with CBotVar :: Create (name, pClasse)
|
||||
is to keep as is, outside the vars on the stack
|
||||
|
||||
L'instance de la classe doit avoir un compteur d'utilisation
|
||||
qui est le nombre d'objet de classe CBotTypPtClass qui y réfèrent.
|
||||
Le compteur est décrémenté lorsque le pointeur est détruit,
|
||||
l'objet supprimé lorsqu'il n'y a plus de pointeurs.
|
||||
we need another type of variable to keep the pointers
|
||||
For example CBotTypPtClass
|
||||
|
||||
The instance of the class must have a usage count
|
||||
which is the number of class object to which they refer CBotTypPtClass.
|
||||
The counter is decremented when the pointer is destroyed,
|
||||
be deleted when there is more pointers.
|
||||
|
||||
|
||||
Dans le cas des robots, Daniel crée une instance de sa classe "Object"
|
||||
et peut retourner des pointeurs à cette instance par des routines genre FindRobot()
|
||||
In the case of robots, Daniel creates an instance of class "Object"
|
||||
and can return pointers to this proceeding by routines such FindRobot ()
|
||||
|
||||
Object FindRobot(int n) { }
|
||||
Object FindRobot (int n) {}
|
||||
|
||||
pResult dans ce cas est un pointeur CBotTypPtClass
|
||||
lorsqu'il a trouvé le robot concerné, il lui faudra faire
|
||||
pResult in this case is a pointer CBotTypPtClass
|
||||
when he found the robot concerned, it must make
|
||||
|
||||
pResult->SetPointeur(InstanceDeLaClassObject);
|
||||
pResult-> SetPointeur (InstanceDeLaClassObject);
|
||||
|
||||
cette opération incrémente le compteur des références
|
||||
this operation increments the reference
|
||||
|
||||
--
|
||||
-
|
||||
|
||||
lorsque le robot est détruit, l'instance de la classe Object correspondant
|
||||
est détruit également.
|
||||
s'il reste des pointeurs à cet objet, et l'on risque la planté
|
||||
when the robot is destroyed, the instance of the Object class corresponding
|
||||
is also destroyed.
|
||||
if there are pointers to that object, and we planted the risk
|
||||
|
||||
solution 1:
|
||||
garder non pas le pointeur à l'objet directement, mais
|
||||
un index dans une tables de pointeurs
|
||||
Solution 1:
|
||||
not keep the pointer to the object directly, but
|
||||
an index into a table of pointers
|
||||
|
||||
Solution 2:
|
||||
not destroy the object when there imédiatement pointers
|
||||
but marked as virtually destroyed
|
||||
|
||||
solution 2:
|
||||
ne pas détruire l'objet imédiatement lorsqu'il reste des pointeurs
|
||||
mais le marqué comme virtuellement détruit
|
Loading…
Reference in New Issue