Methapolis
0.27
Main Page
Packages
Classes
Files
File List
All
Classes
Namespaces
Files
Functions
Variables
Enumerator
MicropolisTool.java
Go to the documentation of this file.
1
// This file is part of MicropolisJ.
2
// Copyright (C) 2013 Jason Long
3
// Portions Copyright (C) 1989-2007 Electronic Arts Inc.
4
//
5
// MicropolisJ is free software; you can redistribute it and/or modify
6
// it under the terms of the GNU GPLv3, with additional terms.
7
// See the README file, included in this distribution, for details.
8
9
package
micropolisj.engine;
10
11
import
java.io.Serializable;
12
13
18
public
enum
MicropolisTool
implements Serializable
19
{
20
BULLDOZER
(1, 1),
21
WIRE
(1, 5),
//cost=25 for underwater
22
ROADS
(1, 10),
//cost=50 for over water
23
RAIL
(1, 20),
//cost=100 for underwater
24
RESIDENTIAL
(3, 100),
25
COMMERCIAL
(3, 100),
26
INDUSTRIAL
(3, 100),
27
FIRE
(3, 500),
28
POLICE
(3, 500),
29
STADIUM
(4, 5000),
30
PARK
(1, 10),
31
SEAPORT
(4, 3000),
32
POWERPLANT
(4, 3000),
33
NUCLEAR
(4, 5000),
34
AIRPORT
(6, 10000),
35
QUERY
(1, 0),
36
UNIVERSITY
(3, 5000),
// TODO: adjust cost
37
ROCKET
(3, 10000),
// TODO: adjust cost
38
TEMPEL
(6, 30000);
// TODO: adjust cost
39
40
int
size
;
41
int
cost
;
42
43
private
MicropolisTool
(
int
size,
int
cost)
44
{
45
this.size = size;
46
this.cost = cost;
47
}
48
49
public
int
getWidth()
50
{
51
return
size;
52
}
53
54
public
int
getHeight()
55
{
56
return
getWidth();
57
}
58
59
public
ToolStroke
beginStroke(
Micropolis
engine,
int
xpos,
int
ypos)
60
{
61
if
(
this
== BULLDOZER) {
62
return
new
Bulldozer(engine, xpos, ypos);
63
}
64
else
if
(
this
== WIRE ||
65
this
== ROADS ||
66
this
== RAIL) {
67
return
new
RoadLikeTool(engine,
this
, xpos, ypos);
68
}
69
else
{
70
return
new
ToolStroke
(engine,
this
, xpos, ypos);
71
}
72
}
73
74
public
ToolResult
apply(
Micropolis
engine,
int
xpos,
int
ypos)
75
{
76
return
beginStroke(engine, xpos, ypos).apply();
77
}
78
85
public
int
getToolCost()
86
{
87
return
cost;
88
}
89
}
src
micropolisj
engine
MicropolisTool.java
Generated on Thu Mar 27 2014 18:07:30 for Methapolis by
1.8.1.2