summaryrefslogtreecommitdiff
path: root/0.E.3.patch
blob: 32ad0f08d7226fb53458d0cd6938ccfebf19da65 (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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
From 767d9c26e9a9b42c8a86ae23e6b930c627df1831 Mon Sep 17 00:00:00 2001
From: Serhiy Zahoriya <serhiy.int@gmail.com>
Date: Mon, 15 Jun 2020 15:43:42 +0300
Subject: [PATCH 1/5] Skip unnecessary weather calculations for root cellar
 #41324

---
 src/item.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/item.cpp b/src/item.cpp
index 635b56c921..9dc9048a4b 100644
--- a/src/item.cpp
+++ b/src/item.cpp
@@ -8510,7 +8510,7 @@ void item::process_temperature_rot( float insulation, const tripoint &pos,
 
             //Use weather if above ground, use map temp if below
             double env_temperature = 0;
-            if( pos.z >= 0 ) {
+            if( pos.z >= 0 && flag != TEMP_ROOT_CELLAR ) {
                 double weather_temperature = wgen.get_weather_temperature( pos, time, seed );
                 env_temperature = weather_temperature + enviroment_mod + local_mod;
             } else {
-- 
2.29.2

From 2a6ac5bcc085f54a4e483c31f463f0e15d8abe18 Mon Sep 17 00:00:00 2001
From: Serhiy Zahoriya <serhiy.int@gmail.com>
Date: Mon, 15 Jun 2020 15:59:53 +0300
Subject: [PATCH 2/5] Backported fixes for ice lab spoiling #39813

Co-authored-by: Hirmuolio <hirmuolio@gmail.com>
---
 src/item.cpp | 3 +--
 src/map.cpp  | 3 +--
 2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/src/item.cpp b/src/item.cpp
index 9dc9048a4b..2dcc09858e 100644
--- a/src/item.cpp
+++ b/src/item.cpp
@@ -8486,8 +8486,7 @@ void item::process_temperature_rot( float insulation, const tripoint &pos,
 
         const weather_generator &wgen = g->weather.get_cur_weather_gen();
         const unsigned int seed = g->get_seed();
-        const tripoint &local = g->m.getlocal( pos );
-        int local_mod = g->new_game ? 0 : g->m.get_temperature( local );
+        int local_mod = g->new_game ? 0 : g->m.get_temperature( pos );
 
         int enviroment_mod;
         // Toilets and vending machines will try to get the heat radiation and convection during mapgen and segfault.
diff --git a/src/map.cpp b/src/map.cpp
index 8a13124b4d..9cc45a6ea6 100755
--- a/src/map.cpp
+++ b/src/map.cpp
@@ -6723,9 +6723,8 @@ bool map::has_rotten_away( item &itm, const tripoint &pnt ) const
 template <typename Container>
 void map::remove_rotten_items( Container &items, const tripoint &pnt )
 {
-    const tripoint abs_pnt = getabs( pnt );
     for( auto it = items.begin(); it != items.end(); ) {
-        if( has_rotten_away( *it, abs_pnt ) ) {
+        if( has_rotten_away( *it, pnt ) ) {
             if( it->is_comestible() ) {
                 rotten_item_spawn( *it, pnt );
             }
-- 
2.29.2

From ef29ca7c4bc6b9c3278e2bbca1598bdd15572d66 Mon Sep 17 00:00:00 2001
From: Serhiy Zahoriya <serhiy.int@gmail.com>
Date: Mon, 15 Jun 2020 16:15:15 +0300
Subject: [PATCH 3/5] Backported #39405: Update string extraction script and
 fix computer translation

Co-authored-by: Qrox <qrox@sina.com>
---
 lang/extract_json_strings.py | 18 ++++++++++++++----
 src/computer.cpp             |  5 +++--
 src/mapgen.cpp               |  7 ++++---
 3 files changed, 21 insertions(+), 9 deletions(-)

diff --git a/lang/extract_json_strings.py b/lang/extract_json_strings.py
index 92cb76fb0d..f36f705aeb 100755
--- a/lang/extract_json_strings.py
+++ b/lang/extract_json_strings.py
@@ -64,8 +64,10 @@ ignore_files = {os.path.normpath(i) for i in {
 ignorable = {
     "ammo_effect",
     "behavior",
+    "charge_removal_blacklist",
     "city_building",
     "colordef",
+    "disease_type",
     "emit",
     "enchantment",
     "event_transformation",
@@ -93,6 +95,7 @@ ignorable = {
     "region_settings",
     "requirement",
     "rotatable_symbol",
+    "SCENARIO_BLACKLIST",
     "scent_type",
     "skill_boost",
     "TRAIT_BLACKLIST",
@@ -247,6 +250,9 @@ def extract_martial_art(item):
     if "description" in item:
         writestr(outfile, item["description"],
                  comment="Description for martial art '{}'".format(name))
+    if "initiate" in item:
+        writestr(outfile, item["initiate"], format_strings=True,
+                 comment="initiate message for martial art '{}'".format(name))
     onhit_buffs = item.get("onhit_buffs", list())
     static_buffs = item.get("static_buffs", list())
     onmove_buffs = item.get("onmove_buffs", list())
@@ -641,10 +647,14 @@ def extract_missiondef(item):
 def extract_mutation(item):
     outfile = get_outfile("mutation")
 
-    item_name = found = item.get("name")
+    item_name_or_id = found = item.get("name")
     if found is None:
-        raise WrongJSONItem("JSON item don't contain 'name' field", item)
-    writestr(outfile, found)
+        if "copy-from" in item:
+            item_name_or_id = item["id"]
+        else:
+            raise WrongJSONItem("JSON item don't contain 'name' field", item)
+    else:
+        writestr(outfile, found)
 
     simple_fields = [ "description" ]
 
@@ -652,7 +662,7 @@ def extract_mutation(item):
         found = item.get(f)
         # Need that check due format string argument
         if found is not None:
-            writestr(outfile, found, comment="Description for {}".format(item_name))
+            writestr(outfile, found, comment="Description for {}".format(item_name_or_id))
 
     if "attacks" in item:
         attacks = item.get("attacks")
diff --git a/src/computer.cpp b/src/computer.cpp
index f11ce32832..b98d2f98c9 100644
--- a/src/computer.cpp
+++ b/src/computer.cpp
@@ -377,10 +377,11 @@ struct enum_traits<computer_failure_type> {
 
 computer_option computer_option::from_json( const JsonObject &jo )
 {
-    const std::string name = jo.get_string( "name" );
+    translation name;
+    jo.read( "name", name );
     const computer_action action = jo.get_enum_value<computer_action>( "action" );
     const int sec = jo.get_int( "security", 0 );
-    return computer_option( name, action, sec );
+    return computer_option( name.translated(), action, sec );
 }
 
 computer_failure computer_failure::from_json( const JsonObject &jo )
diff --git a/src/mapgen.cpp b/src/mapgen.cpp
index 0d0e8f5043..0da25ea2fb 100644
--- a/src/mapgen.cpp
+++ b/src/mapgen.cpp
@@ -1439,14 +1439,14 @@ class jmapgen_make_rubble : public jmapgen_piece
 class jmapgen_computer : public jmapgen_piece
 {
     public:
-        std::string name;
+        translation name;
         translation access_denied;
         int security;
         std::vector<computer_option> options;
         std::vector<computer_failure> failures;
         bool target;
         jmapgen_computer( const JsonObject &jsi ) {
-            name = jsi.get_string( "name" );
+            jsi.read( "name", name );
             jsi.read( "access_denied", access_denied );
             security = jsi.get_int( "security", 0 );
             target = jsi.get_bool( "target", false );
@@ -1466,7 +1466,8 @@ class jmapgen_computer : public jmapgen_piece
             const int ry = y.get();
             dat.m.ter_set( point( rx, ry ), t_console );
             dat.m.furn_set( point( rx, ry ), f_null );
-            computer *cpu = dat.m.add_computer( tripoint( rx, ry, dat.m.get_abs_sub().z ), name, security );
+            computer *cpu = dat.m.add_computer( tripoint( rx, ry, dat.m.get_abs_sub().z ), name.translated(),
+                                                security );
             for( const auto &opt : options ) {
                 cpu->add_option( opt );
             }
-- 
2.29.2

From 3dd040eed275303c8588bb0809e738e9d327cf0a Mon Sep 17 00:00:00 2001
From: Serhiy Zahoriya <serhiy.int@gmail.com>
Date: Mon, 15 Jun 2020 16:20:42 +0300
Subject: [PATCH 4/5] Backported #40025: Fix a crash when npc tries to heal
 horse-mounted player

Co-authored-by: Qrox <qrox@sina.com>
---
 src/game.cpp    | 18 ++++++++++++------
 src/npcmove.cpp | 24 +++++++++++++-----------
 2 files changed, 25 insertions(+), 17 deletions(-)

diff --git a/src/game.cpp b/src/game.cpp
index 71772ae859..0b218184fe 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -4538,16 +4538,22 @@ template const Creature *game::critter_at<Creature>( const tripoint &, bool ) co
 template<typename T>
 shared_ptr_fast<T> game::shared_from( const T &critter )
 {
-    if( const shared_ptr_fast<monster> mon_ptr = critter_tracker->find( critter.pos() ) ) {
-        return std::dynamic_pointer_cast<T>( mon_ptr );
-    }
     if( static_cast<const Creature *>( &critter ) == static_cast<const Creature *>( &u ) ) {
         // u is not stored in a shared_ptr, but it won't go out of scope anyway
         return std::dynamic_pointer_cast<T>( u_shared_ptr );
     }
-    for( auto &cur_npc : active_npc ) {
-        if( static_cast<const Creature *>( cur_npc.get() ) == static_cast<const Creature *>( &critter ) ) {
-            return std::dynamic_pointer_cast<T>( cur_npc );
+    if( critter.is_monster() ) {
+        if( const shared_ptr_fast<monster> mon_ptr = critter_tracker->find( critter.pos() ) ) {
+            if( static_cast<const Creature *>( mon_ptr.get() ) == static_cast<const Creature *>( &critter ) ) {
+                return std::dynamic_pointer_cast<T>( mon_ptr );
+            }
+        }
+    }
+    if( critter.is_npc() ) {
+        for( auto &cur_npc : active_npc ) {
+            if( static_cast<const Creature *>( cur_npc.get() ) == static_cast<const Creature *>( &critter ) ) {
+                return std::dynamic_pointer_cast<T>( cur_npc );
+            }
         }
     }
     return nullptr;
diff --git a/src/npcmove.cpp b/src/npcmove.cpp
index 822fc10a72..0a486dbe18 100644
--- a/src/npcmove.cpp
+++ b/src/npcmove.cpp
@@ -916,7 +916,6 @@ void npc::execute_action( npc_action action )
     int oldmoves = moves;
     tripoint tar = pos();
     Creature *cur = current_target();
-    player *patient = dynamic_cast<player *>( current_ally() );
     if( action == npc_flee ) {
         tar = good_escape_direction( false );
     } else if( cur != nullptr ) {
@@ -1082,18 +1081,21 @@ void npc::execute_action( npc_action action )
             }
             break;
 
-        case npc_heal_player:
-            update_path( patient->pos() );
-            if( path.size() == 1 ) { // We're adjacent to u, and thus can heal u
-                heal_player( *patient );
-            } else if( !path.empty() ) {
-                say( _( "Hold still %s, I'm coming to help you." ), patient->disp_name() );
-                move_to_next();
-            } else {
-                move_pause();
+        case npc_heal_player: {
+            player *patient = dynamic_cast<player *>( current_ally() );
+            if( patient ) {
+                update_path( patient->pos() );
+                if( path.size() == 1 ) { // We're adjacent to u, and thus can heal u
+                    heal_player( *patient );
+                } else if( !path.empty() ) {
+                    say( _( "Hold still %s, I'm coming to help you." ), patient->disp_name() );
+                    move_to_next();
+                } else {
+                    move_pause();
+                }
             }
             break;
-
+        }
         case npc_follow_player:
             update_path( g->u.pos() );
             if( static_cast<int>( path.size() ) <= follow_distance() &&
-- 
2.29.2

From 61c109645a63f1bafbcaeded9da50b564e983077 Mon Sep 17 00:00:00 2001
From: Serhiy Zahoriya <serhiy.int@gmail.com>
Date: Tue, 16 Jun 2020 10:45:42 +0300
Subject: [PATCH 5/5] Backported #41346: fix root cellars on map load

Co-authored-by: Hirmuolio <hirmuolio@gmail.com>
---
 src/map.cpp | 18 ++++++++++++------
 src/map.h   |  2 +-
 2 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/src/map.cpp b/src/map.cpp
index 9cc45a6ea6..e789bbcff5 100755
--- a/src/map.cpp
+++ b/src/map.cpp
@@ -6687,13 +6687,13 @@ void map::loadn( const tripoint &grid, const bool update_vehicles )
     abs_sub.z = old_abs_z;
 }
 
-bool map::has_rotten_away( item &itm, const tripoint &pnt ) const
+bool map::has_rotten_away( item &itm, const tripoint &pnt, const temperature_flag flag ) const
 {
     if( itm.is_corpse() && itm.goes_bad() ) {
-        itm.process_temperature_rot( 1, pnt, nullptr );
+        itm.process_temperature_rot( 1, pnt, nullptr, flag );
         return itm.get_rot() > 10_days && !itm.can_revive();
     } else if( itm.goes_bad() ) {
-        itm.process_temperature_rot( 1, pnt, nullptr );
+        itm.process_temperature_rot( 1, pnt, nullptr, flag );
         return itm.has_rotten_away();
     } else if( itm.type->container && itm.type->container->preserves ) {
         // Containers like tin cans preserves all items inside, they do not rot at all.
@@ -6702,14 +6702,14 @@ bool map::has_rotten_away( item &itm, const tripoint &pnt ) const
         // Items inside rot but do not vanish as the container seals them in.
         for( auto &c : itm.contents ) {
             if( c.goes_bad() ) {
-                c.process_temperature_rot( 1, pnt, nullptr );
+                c.process_temperature_rot( 1, pnt, nullptr, flag );
             }
         }
         return false;
     } else {
         // Check and remove rotten contents, but always keep the container.
         for( auto it = itm.contents.begin(); it != itm.contents.end(); ) {
-            if( has_rotten_away( *it, pnt ) ) {
+            if( has_rotten_away( *it, pnt, flag ) ) {
                 it = itm.contents.erase( it );
             } else {
                 ++it;
@@ -6723,8 +6723,14 @@ bool map::has_rotten_away( item &itm, const tripoint &pnt ) const
 template <typename Container>
 void map::remove_rotten_items( Container &items, const tripoint &pnt )
 {
+    temperature_flag flag;
+    if( ter( pnt ) == t_rootcellar ) {
+        flag = TEMP_ROOT_CELLAR;
+    } else {
+        flag = TEMP_NORMAL;
+    }
     for( auto it = items.begin(); it != items.end(); ) {
-        if( has_rotten_away( *it, pnt ) ) {
+        if( has_rotten_away( *it, pnt, flag ) ) {
             if( it->is_comestible() ) {
                 rotten_item_spawn( *it, pnt );
             }
diff --git a/src/map.h b/src/map.h
index 7cdb3dcb50..48ab479d88 100644
--- a/src/map.h
+++ b/src/map.h
@@ -1488,7 +1488,7 @@ class map
          * used for rot calculation.
          * @return true if the item has rotten away and should be removed, false otherwise.
          */
-        bool has_rotten_away( item &itm, const tripoint &pnt ) const;
+        bool has_rotten_away( item &itm, const tripoint &pnt, temperature_flag flag = TEMP_NORMAL ) const;
         /**
          * Go through the list of items, update their rotten status and remove items
          * that have rotten away completely.
-- 
2.29.2