Merge lp:~alocritani/widelands/bug585987 into lp:widelands

Proposed by Angelo Locritani
Status: Merged
Merged at revision: 6202
Proposed branch: lp:~alocritani/widelands/bug585987
Merge into: lp:widelands
Diff against target: 183 lines (+26/-3)
13 files modified
src/logic/warehouse.cc (+10/-2)
src/logic/warehouse.h (+4/-0)
tribes/atlanteans/headquarters/conf (+1/-0)
tribes/atlanteans/port/conf (+1/-0)
tribes/atlanteans/warehouse/conf (+1/-0)
tribes/barbarians/headquarters/conf (+1/-0)
tribes/barbarians/headquarters_interim/conf (+1/-0)
tribes/barbarians/port/conf (+1/-0)
tribes/barbarians/warehouse/conf (+1/-0)
tribes/empire/headquarters/conf (+1/-0)
tribes/empire/headquarters_shipwreck/conf (+2/-1)
tribes/empire/port/conf (+1/-0)
tribes/empire/warehouse/conf (+1/-0)
To merge this branch: bzr merge lp:~alocritani/widelands/bug585987
Reviewer Review Type Date Requested Status
SirVer Approve
Review via email: mp+89525@code.launchpad.net

Description of the change

just a proposal: healing in warehouses and headquarters, not in training. Logic: when soldiers are idle, their health increases: while training they are "busy" doing other things so no healing.

To post a comment you must log in.
Revision history for this message
SirVer (sirver) wrote :

This will not suffice. The proper code will also need to be done to Warehouse class in the code. There is a comment in warehouse.cc somewhere.

review: Needs Fixing
Revision history for this message
Angelo Locritani (alocritani) wrote :

I added the healing logic to warehouses (thanks for the tip). I tested it and seems to work fine, so I hope I'm not missing anything.

Revision history for this message
SirVer (sirver) wrote :

Looks good to me. I am gonna merge this right away.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/logic/warehouse.cc'
2--- src/logic/warehouse.cc 2011-11-30 21:38:37 +0000
3+++ src/logic/warehouse.cc 2012-01-26 17:32:28 +0000
4@@ -250,8 +250,10 @@
5 Tribe_Descr const & _tribe)
6 :
7 Building_Descr(_name, _descname, directory, prof, global_s, _tribe),
8-m_conquers (0)
9+m_conquers (0),
10+m_heal_per_second(0)
11 {
12+ m_heal_per_second = global_s.get_safe_int("heal_per_second");
13 if
14 ((m_conquers =
15 prof.get_safe_section("global").get_positive("conquers", 0)))
16@@ -639,6 +641,7 @@
17 if (m_incorporated_workers.count(ware)) {
18 WorkerList & soldiers = m_incorporated_workers[ware];
19
20+ uint32_t total_heal = descr().get_heal_per_second();
21 // Do not use container_iterate, as we plan to erase some
22 // of those guys
23 for
24@@ -656,7 +659,12 @@
25 m_supply->remove_workers(ware, 1);
26 continue;
27 }
28- // If warehouse can heal, this is the place to put it.
29+
30+ if (soldier->get_current_hitpoints() < soldier->get_max_hitpoints()) {
31+ soldier->heal(total_heal);
32+ continue;
33+ }
34+
35 }
36 }
37 m_next_military_act = schedule_act(game, 1000);
38
39=== modified file 'src/logic/warehouse.h'
40--- src/logic/warehouse.h 2011-11-30 21:38:37 +0000
41+++ src/logic/warehouse.h 2012-01-26 17:32:28 +0000
42@@ -55,8 +55,12 @@
43
44 virtual uint32_t get_conquers() const {return m_conquers;}
45
46+ uint32_t get_heal_per_second () const throw () {
47+ return m_heal_per_second;
48+ }
49 private:
50 int32_t m_conquers;
51+ uint32_t m_heal_per_second;
52 };
53
54
55
56=== modified file 'tribes/atlanteans/headquarters/conf'
57--- tribes/atlanteans/headquarters/conf 2009-12-31 18:36:51 +0000
58+++ tribes/atlanteans/headquarters/conf 2012-01-26 17:32:28 +0000
59@@ -2,6 +2,7 @@
60 size=big
61 buildable=no
62 destructible=no
63+heal_per_second=2
64 conquers=9
65
66 [idle]
67
68=== modified file 'tribes/atlanteans/port/conf'
69--- tribes/atlanteans/port/conf 2011-01-19 18:15:57 +0000
70+++ tribes/atlanteans/port/conf 2012-01-26 17:32:28 +0000
71@@ -1,5 +1,6 @@
72 size=port
73 conquers=5
74+heal_per_second=2
75
76 [buildcost]
77 trunk=3
78
79=== modified file 'tribes/atlanteans/warehouse/conf'
80--- tribes/atlanteans/warehouse/conf 2011-09-12 17:29:32 +0000
81+++ tribes/atlanteans/warehouse/conf 2012-01-26 17:32:28 +0000
82@@ -1,4 +1,5 @@
83 size=medium
84+heal_per_second=2
85
86 [buildcost]
87 trunk=2
88
89=== modified file 'tribes/barbarians/headquarters/conf'
90--- tribes/barbarians/headquarters/conf 2010-11-23 19:33:08 +0000
91+++ tribes/barbarians/headquarters/conf 2012-01-26 17:32:28 +0000
92@@ -6,6 +6,7 @@
93 size=big
94 buildable=no
95 destructible=no
96+heal_per_second=2
97 conquers=9
98
99 [idle]
100
101=== modified file 'tribes/barbarians/headquarters_interim/conf'
102--- tribes/barbarians/headquarters_interim/conf 2011-09-12 17:29:32 +0000
103+++ tribes/barbarians/headquarters_interim/conf 2012-01-26 17:32:28 +0000
104@@ -4,6 +4,7 @@
105 size=big
106 buildable=no
107 destructible=no
108+heal_per_second=2
109 conquers=9
110
111 [idle]
112
113=== modified file 'tribes/barbarians/port/conf'
114--- tribes/barbarians/port/conf 2011-12-15 23:09:47 +0000
115+++ tribes/barbarians/port/conf 2012-01-26 17:32:28 +0000
116@@ -1,5 +1,6 @@
117 size=port
118 conquers=5
119+heal_per_second=2
120
121 [buildcost]
122 trunk=3
123
124=== modified file 'tribes/barbarians/warehouse/conf'
125--- tribes/barbarians/warehouse/conf 2010-10-18 15:50:45 +0000
126+++ tribes/barbarians/warehouse/conf 2012-01-26 17:32:28 +0000
127@@ -1,4 +1,5 @@
128 size=medium
129+heal_per_second=2
130
131 [buildcost]
132 trunk=3
133
134=== modified file 'tribes/empire/headquarters/conf'
135--- tribes/empire/headquarters/conf 2010-08-01 14:35:38 +0000
136+++ tribes/empire/headquarters/conf 2012-01-26 17:32:28 +0000
137@@ -2,6 +2,7 @@
138 size=big
139 buildable=no
140 destructible=no
141+heal_per_second=2
142 conquers=9
143
144 [idle]
145
146=== modified file 'tribes/empire/headquarters_shipwreck/conf'
147--- tribes/empire/headquarters_shipwreck/conf 2011-09-12 17:29:32 +0000
148+++ tribes/empire/headquarters_shipwreck/conf 2012-01-26 17:32:28 +0000
149@@ -2,10 +2,11 @@
150 size=big
151 buildable=no
152 destructible=no
153+heal_per_second=2
154 conquers=9
155
156 [idle]
157 # sfx=0 ../../../sound/spoken/warehouse-bringitin
158 pics=headquarters_shipwreck_i_??.png
159 hotspot=93 40
160-playercolor=true
161\ No newline at end of file
162+playercolor=true
163
164=== modified file 'tribes/empire/port/conf'
165--- tribes/empire/port/conf 2011-12-15 23:09:47 +0000
166+++ tribes/empire/port/conf 2012-01-26 17:32:28 +0000
167@@ -1,5 +1,6 @@
168 size=port
169 conquers=5
170+heal_per_second=2
171
172 [buildcost]
173 trunk=3
174
175=== modified file 'tribes/empire/warehouse/conf'
176--- tribes/empire/warehouse/conf 2010-08-01 14:35:38 +0000
177+++ tribes/empire/warehouse/conf 2012-01-26 17:32:28 +0000
178@@ -1,4 +1,5 @@
179 size=medium
180+heal_per_second=2
181
182 [buildcost]
183 trunk=2

Subscribers

People subscribed via source and target branches

to status/vote changes: