File: convert.txt

package info (click to toggle)
colobot 0.2.2-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 415,560 kB
  • sloc: cpp: 129,246; ansic: 8,872; python: 2,158; sh: 672; awk: 91; xml: 35; makefile: 31
file content (57 lines) | stat: -rw-r--r-- 949 bytes parent folder | download | duplicates (10)
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
extern void object::Convert( )
{
	object p;
	point pConvert;

	p = radar(Converter);
	if ( p == null )
	{
		message("Vous devez d'abord construire un convertisseur");
		return;
	}
	pConvert = p.position;

	while ( true )
	{
		if ( load.category != TitaniumOre )
		{
			p = radar(TitaniumOre);
			if ( p == null )
			{
				message("Minerai pas trouvé");
				return;
			}
			goto(p.position);
			grab();  // prend minerai

			p = radar(Converter);
			if ( p == null )
			{
				message("Convertisseur pas trouvé");
				return;
			}
			goto(p.position);
			drop();  // dépose minerai
			move(-4);
			wait(15);  // attend conversion
			move(4);
			grab();  // prend métal
			move(-4);
		}

		p = radar(SpaceShip);
		if ( p == null )
		{
			message("Vaisseau spatial pas trouvé");
			return;
		}
		goto(p.position);
		drop();  // dépose minerai

		if ( energyCell.energyLevel < 0.25 )
		{
			message("Veuillez changer la pile");
			return;
		}
	}
}