summaryrefslogtreecommitdiff
path: root/0015-stop-sleeping-on-tables.patch
blob: b114fdd2dfaeb1b70f4ba40b1b45a219e5b19f38 (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
--- a/src/character.cpp
+++ b/src/character.cpp
@@ -8725,12 +8725,29 @@
     const optional_vpart_position vp = g->m.veh_at( pos );
     const cata::optional<vpart_reference> boardable = vp.part_with_feature( "BOARDABLE", true );
     // Search the floor for bedding
+    // Note by jc:
+    // Items without floor_bedding_warmth set appear to assume 0
+    // Added clause to assume 0 == unset and thus -2000
+    // And same thing for random vehicles.
+    // No more sleeping on tables, bumpers, and funnels.
     if( furn_at_pos != f_null ) {
-        floor_bedding_warmth += furn_at_pos.obj().floor_bedding_warmth;
+        if( furn_at_pos.obj().floor_bedding_warmth != 0 ) {
+            floor_bedding_warmth += furn_at_pos.obj().floor_bedding_warmth;
+        } else {
+            floor_bedding_warmth -= 2000;
+        }
     } else if( !trap_at_pos.is_null() ) {
-        floor_bedding_warmth += trap_at_pos.floor_bedding_warmth;
+        if( trap_at_pos.floor_bedding_warmth != 0 ) {
+            floor_bedding_warmth += trap_at_pos.floor_bedding_warmth;
+        } else {
+            floor_bedding_warmth -= 2000;
+        }
     } else if( boardable ) {
-        floor_bedding_warmth += boardable->info().floor_bedding_warmth;
+        if( boardable->info().floor_bedding_warmth != 0 ) {
+            floor_bedding_warmth += boardable->info().floor_bedding_warmth;
+        } else {
+            floor_bedding_warmth -= 2000;
+        }
     } else if( ter_at_pos == t_improvised_shelter ) {
         floor_bedding_warmth -= 500;
     } else {