From d178dcea633706e4c8a26a270da6b8464d23a107 Mon Sep 17 00:00:00 2001 From: Celtic Minstrel Date: Sun, 4 Oct 2015 18:26:16 -0400 Subject: [PATCH] Allow customizing how much food a waterfall takes --- doc/editor/Terrain.html | 4 +++- rsrc/strings/ter-flag2.txt | 4 ++-- rsrc/strings/ter-flag3.txt | 4 ++-- src/boe.actions.cpp | 15 +++++++-------- src/classes/terrain.cpp | 3 ++- 5 files changed, 16 insertions(+), 14 deletions(-) diff --git a/doc/editor/Terrain.html b/doc/editor/Terrain.html index 1dc47efe..37c503f6 100644 --- a/doc/editor/Terrain.html +++ b/doc/editor/Terrain.html @@ -195,7 +195,9 @@ a boat to the space (for example) just north of a spot of terrain with this prop are sucked through to the space south of it. There is a screaming noise and they lose some food. Extra 1 specifies the direction of suction (the example above is for a south waterfall). The choice of Cave/Surface determines whether the Cave Lore or Woodsman trait -is checked for to reduce the food lost. +is checked for to reduce the food lost. Extra 2 specifies how much food they lose as a +percentage of their total food, and Extra 3 places a hard cap on how much food they +lose.
  • Conveyor belt - This space is a conveyor belt, which moves everything on it in the indicated direction. Extra 1 specifies the direction it pushes in.
  • Blocked to Monsters -Monsters will never walk into a space of this type. Extra diff --git a/rsrc/strings/ter-flag2.txt b/rsrc/strings/ter-flag2.txt index 98911f94..cb13274d 100644 --- a/rsrc/strings/ter-flag2.txt +++ b/rsrc/strings/ter-flag2.txt @@ -15,8 +15,8 @@ Unused Unused Unused Unused -Unused -Unused +Percentage of food lost +Percentage of food lost Unused Unused Unused diff --git a/rsrc/strings/ter-flag3.txt b/rsrc/strings/ter-flag3.txt index 88e69d64..9ae1ed67 100644 --- a/rsrc/strings/ter-flag3.txt +++ b/rsrc/strings/ter-flag3.txt @@ -15,8 +15,8 @@ Unused Unused Unused Unused -Unused -Unused +Max food lost +Max food lost Unused Unused Unused diff --git a/src/boe.actions.cpp b/src/boe.actions.cpp index 8a4c6a8a..58c3d360 100644 --- a/src/boe.actions.cpp +++ b/src/boe.actions.cpp @@ -2802,15 +2802,14 @@ static void run_waterfalls(short mode){ // mode 0 - town, 1 - outdoors print_buf(); if(wilderness_lore_present(coord_to_ter(x - dir_x_dif[dir], y - dir_y_dif[dir]) > 0) && get_ran(1,0,1) == 0) add_string_to_buf(" (No supplies lost.)"); - else if(univ.party.food > 1800){ - // TODO: Shouldn't this check n instead of univ.party.food? - add_string_to_buf(" (Many supplies lost.)"); - univ.party.food -= 50; - } else { - int n = univ.party.food; - univ.party.food = (univ.party.food * 19) / 20; - add_string_to_buf(" (" + std::to_string(n - univ.party.food) + " supplies lost.)"); + cTerrain& ter = univ.scenario.ter_types[coord_to_ter(x, y)]; + int lost = univ.party.food * ter.flag2 / 100; + if(lost >= ter.flag3) { + lost = ter.flag3; + add_string_to_buf(" (Many supplies lost.)"); + } else add_string_to_buf(" (" + std::to_string(lost) + " supplies lost.)"); + univ.party.food -= lost; } put_pc_screen(); play_sound(28); diff --git a/src/classes/terrain.cpp b/src/classes/terrain.cpp index f62b54e1..10cb86ab 100644 --- a/src/classes/terrain.cpp +++ b/src/classes/terrain.cpp @@ -221,7 +221,8 @@ void cTerrain::append(legacy::terrain_type_type& old){ case 15: special = eTerSpec::WATERFALL_CAVE; flag1 = DIR_S; - flag3 = 0; + flag2 = 5; + flag3 = 90; break; case 16: special = eTerSpec::CONVEYOR;