Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
14 changes: 7 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ ENDIF(OPENC2E_USE_OPENAL MATCHES "^(YES|AUTO)$")
FIND_PACKAGE(ALUT)

FIND_PACKAGE(Boost 1.34.0 COMPONENTS program_options filesystem thread regex serialization REQUIRED)
FIND_LIBRARY(BOOST_SYSTEM_LIBRARY NAMES boost_system-mt)
FIND_LIBRARY(BOOST_SYSTEM_LIBRARY NAMES boost_system)
IF(OPENC2E_USE_QT)
find_package(Qt4 REQUIRED)
ENDIF(OPENC2E_USE_QT)
Expand Down Expand Up @@ -267,14 +267,14 @@ TARGET_LINK_LIBRARIES(openc2e z m pthread
${OPENAL_LIBRARY}
${ALUT_LIBRARY}
${FRONTEND_LIBS}
boost_program_options-mt
boost_serialization-mt
boost_filesystem-mt
boost_thread-mt
boost_regex-mt
boost_program_options
boost_serialization
boost_filesystem
boost_thread
boost_regex
)
IF(BOOST_SYSTEM_LIBRARY)
TARGET_LINK_LIBRARIES(openc2e boost_system-mt)
TARGET_LINK_LIBRARIES(openc2e boost_system)
ENDIF(BOOST_SYSTEM_LIBRARY)

LINK_DIRECTORIES(${Boost_LIBRARY_DIRS})
Expand Down
2 changes: 0 additions & 2 deletions docs/openc2e.pod
Original file line number Diff line number Diff line change
Expand Up @@ -118,5 +118,3 @@ This program is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.

=end
18 changes: 14 additions & 4 deletions parsedocs.pl
Original file line number Diff line number Diff line change
Expand Up @@ -176,11 +176,21 @@
}

if (!$cat) {
$cat = lc $fnmap{$file} || 'unknown';
if ($fnmap{$file}) {
$cat = lc $fnmap{$file};
} else {
$cat = lc 'unknown';
}
}

$stackdelta = $pragma{stackdelta} if defined $pragma{stackdelta};
$stackdelta = "INT_MAX" if lc $pragma{stackdelta} eq "any";

if (defined $pragma{stackdelta}) {
$stackdelta = $pragma{stackdelta};
}

if (defined $pragma{stackdelta} && lc $pragma{stackdelta} eq "any") {
$stackdelta = "INT_MAX";
}

die "Deprecated use of pragma retc for $fullname" if defined $pragma{retc};


Expand Down
30 changes: 10 additions & 20 deletions src/AudioBackend.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,34 +28,24 @@

class AudioBuffer;

namespace boost {
static inline void intrusive_ptr_add_ref(AudioBuffer *p);
static inline void intrusive_ptr_release(AudioBuffer *p);
}

class AudioBuffer {
friend void boost::intrusive_ptr_add_ref(AudioBuffer *p);
friend void boost::intrusive_ptr_release(AudioBuffer *p);

protected:
virtual void add_ref() = 0;
virtual void del_ref() = 0;


friend void intrusive_ptr_add_ref(AudioBuffer *p) {
p->add_ref();
}
friend void intrusive_ptr_release(AudioBuffer *p) {
p->del_ref();
}

public:
virtual ~AudioBuffer() { }
virtual unsigned int length_ms() const = 0; /* milliseconds */
virtual unsigned int length_samples() const = 0;
virtual void add_ref() = 0;
virtual void del_ref() = 0;
};

typedef boost::intrusive_ptr<AudioBuffer> AudioClip;
namespace boost {
static inline void intrusive_ptr_add_ref(AudioBuffer *p) {
p->add_ref();
}
static inline void intrusive_ptr_release(AudioBuffer *p) {
p->del_ref();
}
}

/* Base class for sources of streaming data (eg, MNG music)
*
Expand Down
4 changes: 2 additions & 2 deletions src/Catalogue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ void Catalogue::initFrom(fs::path path) {
assert(fs::exists(path));
assert(fs::is_directory(path));

//std::cout << "Catalogue is reading " << path.native_directory_string() << std::endl;
//std::cout << "Catalogue is reading " << path.string() << std::endl;

fs::directory_iterator end;
std::string file;
Expand All @@ -148,7 +148,7 @@ void Catalogue::initFrom(fs::path path) {
}
}
catch (const std::exception &ex) {
std::cerr << "directory_iterator died on '" << i->path().leaf() << "' with " << ex.what() << std::endl;
std::cerr << "directory_iterator died on '" << i->path().filename().string() << "' with " << ex.what() << std::endl;
}
}
}
Expand Down
28 changes: 14 additions & 14 deletions src/Engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ void Engine::loadGameData() {
if (fs::exists(palpath) && !fs::is_directory(palpath)) {
palette = new unsigned char[768];

std::ifstream f(palpath.native_directory_string().c_str(), std::ios::binary);
std::ifstream f(palpath.string().c_str(), std::ios::binary);
f >> std::noskipws;
f.read((char *)palette, 768);

Expand Down Expand Up @@ -624,7 +624,7 @@ bool Engine::parseCommandLine(int argc, char *argv[]) {

// add all the data directories to the list
for (std::vector<std::string>::iterator i = data_vec.begin(); i != data_vec.end(); i++) {
fs::path datadir(*i, fs::native);
fs::path datadir(*i);
if (!fs::exists(datadir)) {
throw creaturesException("data path '" + *i + "' doesn't exist");
}
Expand Down Expand Up @@ -746,11 +746,11 @@ bool Engine::initialSetup() {
// inform the user of the port used, and store it in the relevant file
std::cout << "Listening for connections on port " << listenport << "." << std::endl;
#ifndef _WIN32
fs::path p = fs::path(homeDirectory().native_directory_string() + "/.creaturesengine", fs::native);
fs::path p = fs::path(homeDirectory().string() + "/.creaturesengine");
if (!fs::exists(p))
fs::create_directory(p);
if (fs::is_directory(p)) {
std::ofstream f((p.native_directory_string() + "/port").c_str(), std::ios::trunc);
std::ofstream f((p.string() + "/port").c_str(), std::ios::trunc);
f << boost::str(boost::format("%d") % listenport);
}
#endif
Expand All @@ -776,7 +776,7 @@ bool Engine::initialSetup() {
throw creaturesException("multiple bootstrap files provided in C1/C2 mode");

for (std::vector< std::string >::iterator bsi = cmdline_bootstrap.begin(); bsi != cmdline_bootstrap.end(); bsi++) {
fs::path scriptdir(*bsi, fs::native);
fs::path scriptdir(*bsi);
if (engine.version > 2 || fs::extension(scriptdir) == ".cos") {
// pass it to the world to execute (it handles both files and directories)

Expand All @@ -792,7 +792,7 @@ bool Engine::initialSetup() {
throw creaturesException("non-existant bootstrap file provided in C1/C2 mode");
// TODO: the default SFCFile loading code is in World, maybe this should be too..
SFCFile sfc;
std::ifstream f(scriptdir.native_directory_string().c_str(), std::ios::binary);
std::ifstream f(scriptdir.string().c_str(), std::ios::binary);
f >> std::noskipws;
sfc.read(&f);
sfc.copyToWorld();
Expand Down Expand Up @@ -832,18 +832,18 @@ fs::path Engine::homeDirectory() {
#ifndef _WIN32
char *envhome = getenv("HOME");
if (envhome)
p = fs::path(envhome, fs::native);
p = fs::path(envhome);
if ((!envhome) || (!fs::is_directory(p)))
p = fs::path(getpwuid(getuid())->pw_dir, fs::native);
p = fs::path(getpwuid(getuid())->pw_dir);
if (!fs::is_directory(p)) {
std::cerr << "Can't work out what your home directory is, giving up and using /tmp for now." << std::endl;
p = fs::path("/tmp", fs::native); // sigh
p = fs::path("/tmp"); // sigh
}
#else
TCHAR szPath[_MAX_PATH];
SHGetSpecialFolderPath(NULL, szPath, CSIDL_PERSONAL, TRUE);

p = fs::path(szPath, fs::native);
p = fs::path(szPath);
if (!fs::exists(p) || !fs::is_directory(p))
throw creaturesException("Windows reported that your My Documents folder is at '" + std::string(szPath) + "' but there's no directory there!");
#endif
Expand All @@ -863,18 +863,18 @@ fs::path Engine::storageDirectory() {
#endif

// main storage dir
fs::path p = fs::path(homeDirectory().native_directory_string() + dirname, fs::native);
fs::path p = fs::path(homeDirectory().string() + dirname);
if (!fs::exists(p))
fs::create_directory(p);
else if (!fs::is_directory(p))
throw creaturesException("Your openc2e data directory " + p.native_directory_string() + " is a file, not a directory. That's bad.");
throw creaturesException("Your openc2e data directory " + p.string() + " is a file, not a directory. That's bad.");

// game-specific storage dir
p = fs::path(p.native_directory_string() + std::string("/" + gamename), fs::native);
p = fs::path(p.string() + std::string("/" + gamename));
if (!fs::exists(p))
fs::create_directory(p);
else if (!fs::is_directory(p))
throw creaturesException("Your openc2e game data directory " + p.native_directory_string() + " is a file, not a directory. That's bad.");
throw creaturesException("Your openc2e game data directory " + p.string() + " is a file, not a directory. That's bad.");

return p;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Map.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ bool Map::collideLineWithRoomBoundaries(Point src, Point dest, shared_ptr<Room>

float distance = 100000000.0f; // TODO: lots.
bool foundsomething = false;
bool previousroom = (newroom);
boost::shared_ptr<Room> previousroom = (newroom);
Point oldpoint = where;
Line movement(src, dest);

Expand Down
20 changes: 10 additions & 10 deletions src/MetaRoom.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,14 @@ class MetaRoom {
protected:
FRIEND_SERIALIZE(MetaRoom)
unsigned int xloc, yloc, wid, hei, fullwid, fullhei;
std::map<std::string, shared_ptr<creaturesImage> > backgrounds;
shared_ptr<creaturesImage> firstback;
std::map<std::string, boost::shared_ptr<creaturesImage> > backgrounds;
boost::shared_ptr<creaturesImage> firstback;
bool wraps;

MetaRoom() { }

public:
std::vector<shared_ptr<class Room> > rooms;
std::vector<boost::shared_ptr<class Room> > rooms;

unsigned int x() { return xloc; }
unsigned int y() { return yloc; }
Expand All @@ -49,21 +49,21 @@ class MetaRoom {
bool wraparound() { return wraps; }
void setWraparound(bool w) { wraps = !!w; }

unsigned int addRoom(shared_ptr<class Room>);
void addBackground(std::string, shared_ptr<creaturesImage> = shared_ptr<creaturesImage>());
shared_ptr<creaturesImage> getBackground(std::string);
unsigned int addRoom(boost::shared_ptr<class Room>);
void addBackground(std::string, boost::shared_ptr<creaturesImage> = boost::shared_ptr<creaturesImage>());
boost::shared_ptr<creaturesImage> getBackground(std::string);
std::vector<std::string> backgroundList();

shared_ptr<Room> nextFloorFromPoint(float x, float y);
boost::shared_ptr<Room> nextFloorFromPoint(float x, float y);

shared_ptr<Room> roomAt(float x, float y);
std::vector<shared_ptr<Room> > roomsAt(float x, float y);
boost::shared_ptr<Room> roomAt(float x, float y);
std::vector<boost::shared_ptr<Room> > roomsAt(float x, float y);

std::string music;

unsigned int id;

MetaRoom(int _x, int _y, int width, int height, const std::string &back, shared_ptr<creaturesImage> = shared_ptr<creaturesImage>(), bool wrap = false);
MetaRoom(int _x, int _y, int width, int height, const std::string &back, boost::shared_ptr<creaturesImage> = boost::shared_ptr<creaturesImage>(), bool wrap = false);
~MetaRoom();
};

Expand Down
Loading