summaryrefslogtreecommitdiffstats
path: root/src/CBot/idees.txt
blob: 3f335da4aae5e7a6d24f43c8a9886030d3ff3ab1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
for managing instances of a class.

the object being created with CBotVar :: Create (name, pClasse)
    is to keep as is, outside the vars on the stack

    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.


    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) {}

    pResult in this case is a pointer CBotTypPtClass
    when he found the robot concerned, it must make

    pResult-> SetPointeur (InstanceDeLaClassObject);

    this operation increments the reference

    -

    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:
    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