Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Moon phase checking bugfix #42

Open
wants to merge 58 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
1724f35
Fixed moon phase check (it was accidentally setting the moon phase in…
Mar 11, 2012
f0c0a0f
Fixed various issues with Preset Character menu, including crash
Mar 11, 2012
8688dc8
Fixed price_adjustment (was truncating integer division, barter skill…
Mar 12, 2012
e0ea44a
Defense mode. Keybindings.
Whales Apr 23, 2012
0f9d6ff
Some bug fixes, minor missing features, new motd
Whales Apr 23, 2012
84e7b70
Bug fixes left and right
Whales Apr 27, 2012
f926dc2
Forgot to remove keymap.txt
Whales Apr 27, 2012
2818169
A few more things.
Whales Apr 27, 2012
2cdbcd0
Bug fixes
May 1, 2012
b5aa6a1
Started Journey mode
May 2, 2012
f7db5c2
Merge /Users/creidieki/bin/Cataclysm
May 2, 2012
17cdd7b
Map damage
May 3, 2012
9f6665f
Merge /Users/creidieki/bin/Cataclysm
May 3, 2012
fc97693
Morale changes, continued development on Journey to the West, terrain…
May 3, 2012
72c0419
Merge /Users/creidieki/bin/Cataclysm
May 3, 2012
9d92187
Catacurses fix
May 3, 2012
20870dc
Fixed windows compile for my machine
May 3, 2012
46b3496
Give less direct information about distant hordes
May 12, 2012
6cffc53
Now easier to increase skills that have rusted; bug fixes
May 12, 2012
44fea16
change skill comprehension effect of rust to be more conservative
May 12, 2012
4afbdef
Windows makefile fix
May 12, 2012
527bf90
Even working-er Makefile.Windows
May 12, 2012
4ae5d40
Improve warnings
May 14, 2012
fb5f054
Merge branch 'whales'
May 14, 2012
5b80352
Fix bash crashes.
May 15, 2012
8c17a3b
A few bugs I've already reported; makefile with more debug symbols
May 17, 2012
81bbe83
Merge branch 'whales'
May 17, 2012
c7fea86
Fix mansion generation bugs
May 26, 2012
c856cec
Stop query for vehicle work (instead of automatically stopping for al…
May 31, 2012
5f461a4
Give practice for disarming traps.
Jun 6, 2012
228c02e
Fix map generation bug
Jun 6, 2012
a06caa2
Merge branch 'whales'
Jun 6, 2012
7df171d
Undo vehicle changes (these should have only been in mergey)
Jun 6, 2012
dcb65cc
Trying out horde messages as less intrusive again.
Jun 9, 2012
dfa8733
code cleanup
Jun 9, 2012
4b7038a
Melee update. Saved NPCs, wild NPCs, interruptable actions, much more.
Whales Jun 30, 2012
c4df7ad
Adding missing files, lol
Whales Jun 30, 2012
20fb52e
Fixed some NPC aggression issues.
Whales Jul 1, 2012
9597447
Fixed a crash when asking NPC to lead you to safety.
Whales Jul 1, 2012
5f39a42
Several game-breaking bug fixes. Good night.
Whales Jul 2, 2012
7af5bce
More fixes, you can toggle NPCs off
Whales Jul 3, 2012
3442805
Merge branch 'master' of http://www.github.com/creidieki/Cataclysm
Jul 4, 2012
f99a0b0
I don't even know, bug fixes or something
Jul 5, 2012
785d64a
Inventory sorts itself
Jul 5, 2012
7fbd1e1
Bug fixes through #91 in forum thread, rebalanced vehicle requirement…
Jul 6, 2012
adf7026
Merged extended view, bugfixes
Jul 6, 2012
da8635f
Fixed Windows makefile to work on my computer
Jul 6, 2012
ccf6d06
Vehicles are no longer damaged by passing bullets
Jun 14, 2012
9bbbbef
Make appropriate car parts generate in electronics store
Jun 6, 2012
1fd8d22
Equipped styles show their inventory letter ':'
Jul 6, 2012
96aa4e3
Changes to Journey mode to get it to compile in Windows.
Jul 6, 2012
9da2503
Improve NPC combat verbs
Jul 8, 2012
0caedec
Fix some NPC combat crashes
Jul 8, 2012
fa929c2
NPCs healing themselves now take movement points, NPCs won't try infi…
Jul 8, 2012
f35469f
Some barter fixes, typo
Jul 8, 2012
7d66722
Mission lists and NPC combat engagement rules save. BREAKS SAVE COMP…
Jul 8, 2012
7526f36
Improved spiral cavern generation
Jul 8, 2012
5e7bba0
Actually apply patch for bug #100
Jul 9, 2012
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
# WARNINGS will spam hundreds of warnings, mostly safe, if turned on
# DEBUG is best turned on if you plan to debug in gdb -- please do!
# PROFILE is for use with gprof or a similar program -- don't bother generally
#WARNINGS = -Wall
DEBUG = -g
#WARNINGS = -Wall -Wextra -Wno-switch -Wno-sign-compare -Wno-missing-braces -Wno-unused-parameter -Wno-char-subscripts
DEBUG = -g3 -ggdb
#PROFILE = -pg

ODIR = obj
Expand All @@ -14,7 +14,7 @@ TARGET = cataclysm
OS = $(shell uname -o)
CXX = g++

CFLAGS = $(WARNINGS) $(DEBUG) $(PROFILE)
CFLAGS = $(WARNINGS) $(DEBUG) $(PROFILE) --std=c++0x

ifeq ($(OS), Msys)
LDFLAGS = -static -lpdcurses
Expand Down
7 changes: 4 additions & 3 deletions Makefile.Windows
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,13 @@ DDIR = .deps

TARGET = cataclysm.exe

CXX = i486-mingw32-g++
CXX = /usr/local/mingw/bin/i386-mingw32-g++

LINKER = i486-mingw32-ld
LINKER = /usr/local/mingw/bin/i386-mingw32-ld
LINKERFLAGS = -Wl,-stack,12000000,-subsystem,windows

CFLAGS = $(WARNINGS) $(DEBUG) $(PROFILE)
CFLAGS = -O1 -std=gnu++0x
#CFLAGS = $(WARNINGS) $(DEBUG) $(PROFILE)

LDFLAGS = -static -lgdi32

Expand Down
166 changes: 166 additions & 0 deletions action.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,166 @@
#include "game.h"
#include "keypress.h"
#include <fstream>

action_id look_up_action(std::string ident);

void game::load_keyboard_settings()
{
std::ifstream fin;
fin.open("data/keymap.txt");
if (!fin) { // It doesn't exist
std::ofstream fout;
fout.open("data/keymap.txt");
fout << default_keymap_txt();
fout.close();
fin.open("data/keymap.txt");
}
if (!fin) { // Still can't open it--probably bad permissions
debugmsg("Can't open data/keymap.txt. This may be a permissions issue.");
return;
}
while (!fin.eof()) {
std::string id;
fin >> id;
if (id == "")
getline(fin, id); // Empty line, chomp it
else if (id[0] != '#') {
action_id act = look_up_action(id);
if (act == ACTION_NULL)
debugmsg("\
Warning! data/keymap.txt contains an unknown action, \"%s\"\n\
Fix data/keymap.txt at your next chance!", id.c_str());
else {
while (fin.peek() != '\n' && !fin.eof()) {
char ch;
fin >> ch;
if (keymap.find(ch) != keymap.end())
debugmsg("\
Warning! '%c' assigned twice in the keymap!\n\
%s is being ignored.\n\
Fix data/keymap.txt at your next chance!", ch, id.c_str());
else
keymap[ ch ] = act;
}
}
} else {
getline(fin, id); // Clear the whole line
}
}
}

action_id look_up_action(std::string ident)
{
if (ident == "pause")
return ACTION_PAUSE;
if (ident == "move_n")
return ACTION_MOVE_N;
if (ident == "move_ne")
return ACTION_MOVE_NE;
if (ident == "move_e")
return ACTION_MOVE_E;
if (ident == "move_se")
return ACTION_MOVE_SE;
if (ident == "move_s")
return ACTION_MOVE_S;
if (ident == "move_sw")
return ACTION_MOVE_SW;
if (ident == "move_w")
return ACTION_MOVE_W;
if (ident == "move_nw")
return ACTION_MOVE_NW;
if (ident == "move_down")
return ACTION_MOVE_DOWN;
if (ident == "move_up")
return ACTION_MOVE_UP;
if (ident == "open")
return ACTION_OPEN;
if (ident == "close")
return ACTION_CLOSE;
if (ident == "smash")
return ACTION_SMASH;
if (ident == "examine")
return ACTION_EXAMINE;
if (ident == "pickup")
return ACTION_PICKUP;
if (ident == "butcher")
return ACTION_BUTCHER;
if (ident == "chat")
return ACTION_CHAT;
if (ident == "look")
return ACTION_LOOK;
if (ident == "look_surroundings")
return ACTION_LOOK_SURROUNDINGS;
if (ident == "inventory")
return ACTION_INVENTORY;
if (ident == "organize")
return ACTION_ORGANIZE;
if (ident == "apply")
return ACTION_USE;
if (ident == "wear")
return ACTION_WEAR;
if (ident == "take_off")
return ACTION_TAKE_OFF;
if (ident == "eat")
return ACTION_EAT;
if (ident == "read")
return ACTION_READ;
if (ident == "wield")
return ACTION_WIELD;
if (ident == "pick_style")
return ACTION_PICK_STYLE;
if (ident == "reload")
return ACTION_RELOAD;
if (ident == "unload")
return ACTION_UNLOAD;
if (ident == "throw")
return ACTION_THROW;
if (ident == "fire")
return ACTION_FIRE;
if (ident == "fire_burst")
return ACTION_FIRE_BURST;
if (ident == "drop")
return ACTION_DROP;
if (ident == "drop_adj")
return ACTION_DIR_DROP;
if (ident == "bionics")
return ACTION_BIONICS;
if (ident == "wait")
return ACTION_WAIT;
if (ident == "craft")
return ACTION_CRAFT;
if (ident == "construct")
return ACTION_CONSTRUCT;
if (ident == "sleep")
return ACTION_SLEEP;
if (ident == "safemode")
return ACTION_TOGGLE_SAFEMODE;
if (ident == "autosafe")
return ACTION_TOGGLE_AUTOSAFE;
if (ident == "ignore_enemy")
return ACTION_IGNORE_ENEMY;
if (ident == "save")
return ACTION_SAVE;
if (ident == "quit")
return ACTION_QUIT;
if (ident == "player_data")
return ACTION_PL_INFO;
if (ident == "map")
return ACTION_MAP;
if (ident == "missions")
return ACTION_MISSIONS;
if (ident == "factions")
return ACTION_FACTIONS;
if (ident == "morale")
return ACTION_MORALE;
if (ident == "help")
return ACTION_HELP;
if (ident == "debug")
return ACTION_DEBUG;
if (ident == "debug_scent")
return ACTION_DISPLAY_SCENT;
if (ident == "debug_mode")
return ACTION_TOGGLE_DEBUGMON;

return ACTION_NULL;
}
70 changes: 70 additions & 0 deletions action.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
#ifndef _ACTION_H_
#define _ACTION_H_

enum action_id {
ACTION_NULL = 0,
// Movement
ACTION_PAUSE,
ACTION_MOVE_N,
ACTION_MOVE_NE,
ACTION_MOVE_E,
ACTION_MOVE_SE,
ACTION_MOVE_S,
ACTION_MOVE_SW,
ACTION_MOVE_W,
ACTION_MOVE_NW,
ACTION_MOVE_DOWN,
ACTION_MOVE_UP,
// Environment Interaction
ACTION_OPEN,
ACTION_CLOSE,
ACTION_SMASH,
ACTION_EXAMINE,
ACTION_PICKUP,
ACTION_BUTCHER,
ACTION_CHAT,
ACTION_LOOK,
ACTION_LOOK_SURROUNDINGS,
// Inventory Interaction (including quasi-inventories like bionics)
ACTION_INVENTORY,
ACTION_ORGANIZE,
ACTION_USE,
ACTION_WEAR,
ACTION_TAKE_OFF,
ACTION_EAT,
ACTION_READ,
ACTION_WIELD,
ACTION_PICK_STYLE,
ACTION_RELOAD,
ACTION_UNLOAD,
ACTION_THROW,
ACTION_FIRE,
ACTION_FIRE_BURST,
ACTION_DROP,
ACTION_DIR_DROP,
ACTION_BIONICS,
// Long-term / special actions
ACTION_WAIT,
ACTION_CRAFT,
ACTION_CONSTRUCT,
ACTION_SLEEP,
ACTION_TOGGLE_SAFEMODE,
ACTION_TOGGLE_AUTOSAFE,
ACTION_IGNORE_ENEMY,
ACTION_SAVE,
ACTION_QUIT,
// Info Screens
ACTION_PL_INFO,
ACTION_MAP,
ACTION_MISSIONS,
ACTION_FACTIONS,
ACTION_MORALE,
ACTION_HELP,
// Debug Functions
ACTION_DEBUG,
ACTION_DISPLAY_SCENT,
ACTION_TOGGLE_DEBUGMON,
NUM_ACTIONS
};

#endif
2 changes: 1 addition & 1 deletion addiction.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ void addict_effect(game *g, addiction &add)
g->u.moves -= move_pen;
g->u.int_cur--;
g->u.str_cur--;
if (in >= 20 || int(g->turn) % (100 - in * 5) == 0)
if (g->u.stim > -100 && (in >= 20 || int(g->turn) % (100 - in * 5) == 0))
g->u.stim--;
if (rng(0, 150) <= in)
g->u.health--;
Expand Down
4 changes: 4 additions & 0 deletions artifact.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ It may have unknown powers; use 'a' to activate them.";

// Wielded effects first
while (!good_effects.empty() && !bad_effects.empty() &&
num_good < 3 && num_bad < 3 &&
(num_good < 1 || num_bad < 1 || one_in(num_good + 1) ||
one_in(num_bad + 1) || value > 1)) {
if (value < 1 && one_in(2)) { // Good
Expand All @@ -87,6 +88,7 @@ It may have unknown powers; use 'a' to activate them.";
good_effects = fill_good_passive();
bad_effects = fill_bad_passive();
while (one_in(2) && !good_effects.empty() && !bad_effects.empty() &&
num_good < 3 && num_bad < 3 &&
((num_good > 2 && one_in(num_good + 1)) || num_bad < 1 ||
one_in(num_bad + 1) || value > 1)) {
if (value < 1 && one_in(3)) { // Good
Expand All @@ -111,6 +113,7 @@ It may have unknown powers; use 'a' to activate them.";
std::vector<art_effect_active> good_a_effects = fill_good_active();
std::vector<art_effect_active> bad_a_effects = fill_bad_active();
while (!good_a_effects.empty() && !bad_a_effects.empty() &&
num_good < 3 && num_bad < 3 &&
((num_bad > 0 && num_good == 0) || !one_in(3 - num_good) ||
!one_in(3 - num_bad))) {
if (!one_in(3)) { // Good effect
Expand Down Expand Up @@ -218,6 +221,7 @@ It may have unknown powers; use 'a' to activate them.";
std::vector<art_effect_passive> bad_effects = fill_bad_passive();

while (!good_effects.empty() && !bad_effects.empty() &&
num_good < 3 && num_bad < 3 &&
(num_good < 1 || one_in(num_good * 2) || value > 1 ||
(num_bad < 3 && !one_in(3 - num_bad)))) {
if (value < 1 && one_in(2)) { // Good effect
Expand Down
12 changes: 9 additions & 3 deletions bionics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ void player::activate_bionic(int b, game *g)
case bio_lighter:
g->draw();
mvprintw(0, 0, "Torch in which direction?");
get_direction(dirx, diry, input());
get_direction(g, dirx, diry, input());
if (dirx == -2) {
g->add_msg("Invalid direction.");
power_level += bionics[bio_lighter].power_cost;
Expand Down Expand Up @@ -252,7 +252,7 @@ void player::activate_bionic(int b, game *g)
case bio_emp:
g->draw();
mvprintw(0, 0, "Fire EMP in which direction?");
get_direction(dirx, diry, input());
get_direction(g, dirx, diry, input());
if (dirx == -2) {
g->add_msg("Invalid direction.");
power_level += bionics[bio_emp].power_cost;
Expand Down Expand Up @@ -337,7 +337,7 @@ void player::activate_bionic(int b, game *g)
case bio_lockpick:
g->draw();
mvprintw(0, 0, "Unlock in which direction?");
get_direction(dirx, diry, input());
get_direction(g, dirx, diry, input());
if (dirx == -2) {
g->add_msg("Invalid direction.");
power_level += bionics[bio_lockpick].power_cost;
Expand Down Expand Up @@ -432,6 +432,9 @@ charge mechanism, which must be installed from another CBM.");
ch = getch();
while (ch != 'q' && ch != '\n' && ch != KEY_ESCAPE);
if (ch == '\n') {
practice(sk_electronics, (100 - chance_of_success) * 1.5);
practice(sk_firstaid, (100 - chance_of_success) * 1.0);
practice(sk_mechanics, (100 - chance_of_success) * 0.5);
int success = chance_of_success - rng(1, 100);
if (success > 0) {
g->add_msg("Successfully installed batteries.");
Expand Down Expand Up @@ -496,6 +499,9 @@ charge mechanism, which must be installed from another CBM.");
} while (ch != '\n' && ch != 'q' && ch != KEY_ESCAPE);

if (ch == '\n') {
practice(sk_electronics, (100 - chance_of_success) * 1.5);
practice(sk_firstaid, (100 - chance_of_success) * 1.0);
practice(sk_mechanics, (100 - chance_of_success) * 0.5);
bionic_id id = type->options[selection];
int success = chance_of_success - rng(1, 100);
if (success > 0) {
Expand Down
1 change: 0 additions & 1 deletion bionics.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ bio_ads, bio_ods, bio_scent_mask,bio_scent_vision, bio_cloak, bio_painkiller, bi
bio_heatsink, bio_resonator, bio_time_freeze, bio_teleport, bio_blood_anal,
bio_blood_filter, bio_alarm,
bio_evap, bio_lighter, bio_claws, bio_blaster, bio_laser, bio_emp,
// TODO: fingerhack
bio_hydraulics, bio_water_extractor, bio_magnet, bio_fingerhack, bio_lockpick,
bio_ground_sonar,
max_bio_start,
Expand Down
2 changes: 1 addition & 1 deletion calendar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ moon_phase calendar::moon()
{
int phase = day / (DAYS_IN_SEASON / 4);
//phase %= 4; Redundant?
if (phase = 3)
if (phase == 3)
return MOON_HALF;
else
return moon_phase(phase);
Expand Down
Loading