Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

splited hashlib to separated library, added some new stuff via hl_tools,

added ruby embeededing option, some additional fixes
  • Loading branch information...
commit b1d8caf20288d206f61395c9a09de8d01161176e 1 parent f780aaa
Daniel (dmilith) Dettlaff authored
View
2  .gitignore
@@ -6,3 +6,5 @@ world
gmon.out
*.world
*.item
+*.swp
+*.job
View
1  CleanAll
@@ -2,6 +2,7 @@ echo "Cleaning up.."
scons -c
rm -f *.os
rm -f *.so
+rm -f test_*
cd tests/
rm -f test_*
echo "Done."
View
24 Sconstruct
@@ -3,20 +3,17 @@ print 'scons script written by dmilith[at]gmail[dot]com (c) 2oo8'
release32 = Environment( CXX = 'g++ -m32 -O2 -march=athlon64' )
release64 = Environment( CXX = 'g++ -O2 -march=athlon64' )
-debug32 = Environment( CXX = 'g++ -m32 -g -W' )
-debug64 = Environment( CXX = 'g++ -g -W' )
+debug32 = Environment( CXX = 'g++ -m32 -O0 -ggdb -W' )
+debug64 = Environment( CXX = 'g++ -O0 -ggdb -W' )
-#release = debug64
-release = release64
+release = debug64
+#release = release64
-#release.Library('hl-sha',
-# [ 'hashlib/hl_sha1.cpp', 'hashlib/hl_sha1wrapper.cpp', 'hashlib/hl_sha256.cpp', 'hashlib/hl_sha256wrapper.cpp' ] )
-
-release.SharedLibrary('character', 'character.cpp')
-release.SharedLibrary('coordinates',
- [ 'coordinates.cpp', 'hashlib/hl_sha1.cpp',
+release.SharedLibrary('hl-sha', [ 'hashlib/hl_sha1.cpp',
'hashlib/hl_sha1wrapper.cpp', 'hashlib/hl_sha256.cpp',
- 'hashlib/hl_sha256wrapper.cpp' ] )
+ 'hashlib/hl_sha256wrapper.cpp', 'hashlib/hl_tools.cpp' ] )
+release.SharedLibrary('character', 'character.cpp')
+release.SharedLibrary('coordinates', 'coordinates.cpp')
release.SharedLibrary('item', 'item.cpp')
release.SharedLibrary('map', 'map.cpp')
release.SharedLibrary('place', 'place.cpp')
@@ -25,8 +22,9 @@ release.SharedLibrary('theritory', 'theritory.cpp')
release.SharedLibrary('world', 'world.cpp')
release.SharedLibrary('job', 'job.cpp')
release.Program('world' , 'main.cpp',
- LIBS=[ 'boost_thread', 'boost_filesystem', 'boost_serialization',
+ LIBS=[ 'boost_thread', 'boost_filesystem', 'hl-sha', 'boost_serialization',
'job', 'character', 'coordinates',
'item', 'map', 'place', 'soul', 'theritory',
- 'world' ],
+ 'world'],
+#, 'ruby' ],
LIBPATH=[ '.', '/usr/local/lib', '/usr/lib' ])
View
18 character.cpp
@@ -1,7 +1,17 @@
+/*
+
+ This is OpenSource Project;
+ It's licensed on GPL/ LGPL public license;
+ It's written by Daniel (dmilith) Dettlaff since August 2oo8.
+ You can redistribute this project only with this header.
+
+*/
+
#include "character.h"
+
Ccharacter::Ccharacter( std::string new_name ) {
- name = new_name; ///imie/nazwa postaci
+ name = new_name; // creature name
race = human; //(0)
base_health = ( ( race * 100 ) + ( rand() % 10 ) ) + 100;
health = base_health + ( rand() % 125 ) - 75;
@@ -11,12 +21,12 @@ Ccharacter::Ccharacter( std::string new_name ) {
strength = ( race * 2 ) + ( rand() % 10 ) + 3;
dexterity = 0;
luck = ( rand() % 21 ) - 10;
- mind_strength = 0; //cechy postaci
+ mind_strength = 0; // creature properties
-} //obiekt npc'a/ postaci gracza/ potwora
+} // creature properties
Ccharacter::Ccharacter( Eraces born_race, std::string new_name ) {
- name = new_name; ///imie/nazwa postaci
+ name = new_name;
race = born_race; //(0)
base_health = ( ( race * 100 ) + ( rand() % 10 ) ) + 100;
health = base_health + ( rand() % 125 ) - 75 ;
View
12 config.h
@@ -1,10 +1,19 @@
+/*
+
+ This is OpenSource Project;
+ It's licensed on GPL/ LGPL public license;
+ It's written by Daniel (dmilith) Dettlaff since August 2oo8.
+ You can redistribute this project only with this header.
+
+*/
+
#ifndef _CCONFIG_H_
#define _CCONFIG_H_
#include <string>
#define DEBUG
-
+//#define RUBY_EMB
const std::string SLASH = "/";
const std::string BACKSLASH = "\\";
@@ -21,6 +30,7 @@ static std::string pp = SLASH; // "normal" UNIX slash to separate parts path
#endif
const std::string WORLD_SAVE_PATH = "save" + pp;
+const std::string JOB_SAVE_PATH = "jobs" + pp;
/*
View
27 coordinates.cpp
@@ -1,22 +1,13 @@
-#include "coordinates.h"
-
-const char*
-uint2cstr( uint64_t i ) {
- std::stringstream ss;
- std::string temp;
- ss << i;
- ss >> temp;
- return temp.c_str();
-}
+/*
+
+ This is OpenSource Project;
+ It's licensed on GPL/ LGPL public license;
+ It's written by Daniel (dmilith) Dettlaff since August 2oo8.
+ You can redistribute this project only with this header.
+
+*/
-std::string
-generate_sha1( bool timeize_srand ) {
- hashwrapper *sha1 = new sha1wrapper();
- if ( timeize_srand ) srand( (unsigned)time( NULL ) );
- std::string result = sha1->getHashFromString( (std::string)( uint2cstr( rand() % time( NULL ) ) ) );
- delete sha1;
- return result;
-}
+#include "coordinates.h"
Ccoordinates::Ccoordinates() {
position = generate_sha1(true);
View
16 coordinates.h
@@ -1,15 +1,19 @@
+/*
+
+ This is OpenSource Project;
+ It's licensed on GPL/ LGPL public license;
+ It's written by Daniel (dmilith) Dettlaff since August 2oo8.
+ You can redistribute this project only with this header.
+
+*/
+
#ifndef _CCOORDINATES_H_
#define _CCOORDINATES_H_
#include <boost/archive/binary_oarchive.hpp>
#include <boost/archive/binary_iarchive.hpp>
-#include <algorithm>
-#include <sstream>
-
-#include "hashlib/hashlibpp.h"
-std::string
-generate_sha1( bool timeize_srand = false );
+#include "hashlib/hl_tools.h" //instead of haslibpp.h. It's kinda proxy for hashlib
class Ccoordinates {
public:
View
185 cppcomplete.tags
@@ -0,0 +1,185 @@
+!_TAG_FILE_FORMAT 2 /extended format; --format=1 will not append ;" to lines/
+!_TAG_FILE_SORTED 1 /0=unsorted, 1=sorted, 2=foldcase/
+!_TAG_PROGRAM_AUTHOR Darren Hiebert /dhiebert@users.sourceforge.net/
+!_TAG_PROGRAM_NAME Exuberant Ctags //
+!_TAG_PROGRAM_URL http://ctags.sourceforge.net /official site/
+!_TAG_PROGRAM_VERSION 5.7 //
+BACKSLASH config.h 18;" v
+BG_BLACK config.h 65;" d
+BRIGHT config.h 66;" d
+CREALIS_VERSION version.h 5;" v
+Ccharacter character.cpp 13;" f class:Ccharacter
+Ccharacter character.cpp 28;" f class:Ccharacter
+Ccharacter character.h 38;" c
+Ccharacter character.h 40;" p class:Ccharacter access:public
+Ccharacter character.h 41;" p class:Ccharacter access:public
+Ccoordinates coordinates.cpp 30;" f class:Ccoordinates
+Ccoordinates coordinates.cpp 40;" f class:Ccoordinates
+Ccoordinates coordinates.h 23;" c
+Ccoordinates coordinates.h 25;" p class:Ccoordinates access:public
+Ccoordinates coordinates.h 26;" p class:Ccoordinates access:public
+Citem item.cpp 12;" f class:Citem
+Citem item.h 17;" c
+Citem item.h 19;" p class:Citem access:public
+Cmap map.cpp 12;" f class:Cmap
+Cmap map.cpp 17;" f class:Cmap
+Cmap map.h 16;" c
+Cmap map.h 18;" p class:Cmap access:public
+Cmap map.h 19;" p class:Cmap access:public
+Cplace place.cpp 12;" f class:Cplace
+Cplace place.cpp 16;" f class:Cplace
+Cplace place.h 17;" c
+Cplace place.h 19;" p class:Cplace access:public
+Cplace place.h 20;" p class:Cplace access:public
+Csoul soul.cpp 12;" f class:Csoul
+Csoul soul.h 26;" c
+Csoul soul.h 28;" p class:Csoul access:public
+Ctheritory theritory.cpp 14;" f class:Ctheritory
+Ctheritory theritory.h 18;" c
+Ctheritory theritory.h 20;" p class:Ctheritory access:public
+Cworld world.cpp 14;" f class:Cworld
+Cworld world.cpp 4;" f class:Cworld
+Cworld world.h 32;" c
+Cworld world.h 34;" p class:Cworld access:public
+Cworld world.h 35;" p class:Cworld access:public
+DEBUG config.h 15;" d
+DEFAULT_GRAVITY world.h 27;" v
+DEFAULT_THERITORY_X world.h 28;" v
+DEFAULT_THERITORY_Y world.h 29;" v
+ETypeOfJob job.h 22;" g
+Ealignment soul.h 15;" g
+Eraces character.h 27;" g
+Esize item.h 15;" g
+GREEN config.h 68;" d
+JOB_SAVE_PATH config.h 32;" v
+Job job.cpp 13;" f class:Job
+Job job.h 31;" c
+Job job.h 33;" p class:Job access:public
+MAGENTA config.h 69;" d
+MAIN_DIR config.h 24;" v
+MAIN_DIR config.h 28;" v
+MAX_DWARF_AGE character.h 25;" v
+MAX_ELVE_AGE character.h 24;" v
+MAX_HUMAN_AGE character.h 23;" v
+MAX_PLAYERS world.h 25;" v
+MAX_WORLDS world.h 26;" v
+RED config.h 67;" d
+SLASH config.h 17;" v
+SYSTEM_CLASS_VERSION version.h 6;" v
+WORLD_SAVE_PATH config.h 31;" v
+_CCHARACTER_H_ character.h 11;" d
+_CCONFIG_H_ config.h 11;" d
+_CCOORDINATES_H_ coordinates.h 11;" d
+_CITEM_H_ item.h 11;" d
+_CJOB_H_ job.h 11;" d
+_CMAP_H_ map.h 11;" d
+_CPLACE_H_ place.h 11;" d
+_CSOUL_H_ soul.h 11;" d
+_CTHERITORY_H_ theritory.h 11;" d
+_CWORLD_H_ world.h 12;" d
+_VERSION_H_ version.h 2;" d
+_do main.cpp 106;" f
+a_cave_troll main.cpp 18;" p file:
+a_dwarf main.cpp 18;" p file:
+a_man main.cpp 18;" p file:
+action_ATTACK job.h 26;" e enum:ETypeOfJob
+action_DEFEND job.h 27;" e enum:ETypeOfJob
+action_IDLE job.h 23;" e enum:ETypeOfJob
+action_RUN job.h 25;" e enum:ETypeOfJob
+action_WALK job.h 24;" e enum:ETypeOfJob
+actors job.h 37;" m class:Job access:public
+add_job_to_stack main.cpp 99;" f
+age character.h 56;" m class:Ccharacter access:public
+alignment soul.h 31;" m class:Csoul access:public
+an_elve main.cpp 18;" p file:
+annimal character.h 28;" e enum:Eraces
+base_health character.h 48;" m class:Ccharacter access:public
+boost main.h 22;" n
+cave_troll character.h 33;" e enum:Eraces
+chaoticEvil soul.h 16;" e enum:Ealignment
+characters main.cpp 20;" v file:
+cl_version world.h 39;" m class:Cworld access:public
+dead character.h 43;" m class:Ccharacter access:public
+demoan soul.h 23;" e enum:Ealignment
+dexterity character.h 52;" m class:Ccharacter access:public
+dwarf character.h 31;" e enum:Eraces
+elve character.h 29;" e enum:Eraces
+evil soul.h 17;" e enum:Ealignment
+fileName map.h 21;" m class:Cmap access:public
+generate_sha1 coordinates.cpp 22;" f
+generate_sha1 coordinates.h 21;" p
+get_job_from_stack main.cpp 78;" f
+gold character.h 55;" m class:Ccharacter access:public
+good soul.h 21;" e enum:Ealignment
+gravity world.h 37;" m class:Cworld access:public
+grizzly character.h 32;" e enum:Eraces
+health character.h 49;" m class:Ccharacter access:public
+huge item.h 15;" e enum:Esize
+human character.h 30;" e enum:Eraces
+instinct character.h 53;" m class:Ccharacter access:public
+intelligence character.h 50;" m class:Ccharacter access:public
+items character.h 63;" m class:Ccharacter access:public
+job_crc job.h 34;" m class:Job access:public
+job_flags job.h 35;" m class:Job access:public
+job_id job.h 34;" m class:Job access:public
+job_list main.cpp 16;" v file:
+kill character.cpp 68;" f class:Ccharacter
+kill character.h 44;" p class:Ccharacter access:public
+large item.h 15;" e enum:Esize
+lawfulGood soul.h 22;" e enum:Ealignment
+load_job main.cpp 34;" f
+load_world main.cpp 54;" f
+luck character.h 57;" m class:Ccharacter access:public
+main main.cpp 261;" f
+mana soul.h 29;" m class:Csoul access:public
+map place.h 24;" m class:Cplace access:public
+medium item.h 15;" e enum:Esize
+mind_strength character.h 54;" m class:Ccharacter access:public
+mind_strength soul.h 30;" m class:Csoul access:public
+name character.h 46;" m class:Ccharacter access:public
+name map.h 20;" m class:Cmap access:public
+name place.h 21;" m class:Cplace access:public
+name theritory.h 21;" m class:Ctheritory access:public
+name world.h 38;" m class:Cworld access:public
+neutral soul.h 19;" e enum:Ealignment
+neutralEvil soul.h 18;" e enum:Ealignment
+neutralGood soul.h 20;" e enum:Ealignment
+outgenerous item.h 15;" e enum:Esize
+parent_positions coordinates.h 28;" m class:Ccoordinates access:public
+place theritory.h 23;" m class:Ctheritory access:public
+pos character.h 58;" m class:Ccharacter access:public
+position coordinates.h 27;" m class:Ccoordinates access:public
+pp config.h 19;" v
+print_character main.cpp 128;" f
+private_box character.h 64;" m class:Ccharacter access:public
+race character.h 61;" m class:Ccharacter access:public
+recv_signal main.cpp 64;" f
+run job.cpp 17;" f class:Job
+run job.h 38;" p class:Job access:public
+save_job main.cpp 24;" f
+save_world main.cpp 44;" f
+serialization main.h 23;" n namespace:boost
+serialize main.h 25;" f namespace:boost::serialization
+serialize main.h 33;" f namespace:boost::serialization
+serialize main.h 42;" f namespace:boost::serialization
+serialize main.h 48;" f namespace:boost::serialization
+serialize main.h 54;" f namespace:boost::serialization
+serialize main.h 62;" f namespace:boost::serialization
+size_of_item item.h 21;" m class:Citem access:public
+small item.h 15;" e enum:Esize
+soul character.h 60;" m class:Ccharacter access:public
+soul_exist soul.h 33;" m class:Csoul access:public
+strength character.h 51;" m class:Ccharacter access:public
+thread_console main.cpp 146;" f
+thread_main_loop main.cpp 235;" f
+thread_timer main.cpp 200;" f
+timer main.cpp 17;" v file:
+tiny item.h 15;" e enum:Esize
+type job.h 36;" m class:Job access:public
+uint2cstr coordinates.cpp 13;" f
+weight item.h 20;" m class:Citem access:public
+worlds main.cpp 19;" v file:
+x_theritory_size world.h 36;" m class:Cworld access:public
+y_theritory_size world.h 36;" m class:Cworld access:public
+~Ccharacter character.cpp 65;" f class:Ccharacter
+~Ccharacter character.h 42;" p class:Ccharacter access:public
View
1  hashlib/hashlibpp.h
@@ -44,7 +44,6 @@
#include "hl_sha1wrapper.h"
#include "hl_sha256wrapper.h"
-
//----------------------------------------------------------------------
#endif
View
30 hashlib/hl_tools.cpp
@@ -0,0 +1,30 @@
+/*
+
+ This is OpenSource Project;
+ It's licensed on GPL/ LGPL public license;
+ It's written by Daniel (dmilith) Dettlaff since August 2oo8.
+ You can redistribute this project only with this header.
+
+*/
+
+#include "hl_tools.h"
+
+const char*
+uint2cstr( uint64_t i ) {
+ std::stringstream ss;
+ std::string temp;
+ ss << i;
+ ss >> temp;
+ return temp.c_str();
+}
+
+std::string
+generate_sha1( bool timeize_srand ) {
+ hashwrapper *sha1 = new sha1wrapper();
+ if ( timeize_srand ) srand( (unsigned)time( NULL ) );
+ std::string result = sha1->getHashFromString( (std::string)( uint2cstr( rand() % time( NULL ) ) ) );
+ delete sha1;
+ return result;
+}
+
+
View
26 hashlib/hl_tools.h
@@ -0,0 +1,26 @@
+/*
+
+ This is OpenSource Project;
+ It's licensed on GPL/ LGPL public license;
+ It's written by Daniel (dmilith) Dettlaff since August 2oo8.
+ You can redistribute this project only with this header.
+
+*/
+#ifndef _HL_TOOLS_H
+#define _HL_TOOLS_H
+
+#include <iostream>
+#include <algorithm>
+#include <string>
+#include <sstream>
+
+#include "hashlibpp.h"
+
+const char*
+uint2cstr( uint64_t i );
+
+std::string
+generate_sha1( bool timeize_srand = false );
+
+#endif
+
View
9 item.cpp
@@ -1,3 +1,12 @@
+/*
+
+ This is OpenSource Project;
+ It's licensed on GPL/ LGPL public license;
+ It's written by Daniel (dmilith) Dettlaff since August 2oo8.
+ You can redistribute this project only with this header.
+
+*/
+
#include "item.h"
Citem::Citem() {
View
9 item.h
@@ -1,3 +1,12 @@
+/*
+
+ This is OpenSource Project;
+ It's licensed on GPL/ LGPL public license;
+ It's written by Daniel (dmilith) Dettlaff since August 2oo8.
+ You can redistribute this project only with this header.
+
+*/
+
#ifndef _CITEM_H_
#define _CITEM_H_
View
10 job.cpp
@@ -1,7 +1,17 @@
+/*
+
+ This is OpenSource Project;
+ It's licensed on GPL/ LGPL public license;
+ It's written by Daniel (dmilith) Dettlaff since August 2oo8.
+ You can redistribute this project only with this header.
+
+*/
+
#include "job.h"
Job::Job() {
+ this->job_id = generate_sha1( true );
}
void Job::run() {
View
16 job.h
@@ -1,3 +1,12 @@
+/*
+
+ This is OpenSource Project;
+ It's licensed on GPL/ LGPL public license;
+ It's written by Daniel (dmilith) Dettlaff since August 2oo8.
+ You can redistribute this project only with this header.
+
+*/
+
#ifndef _CJOB_H_
#define _CJOB_H_
@@ -5,6 +14,11 @@
#include <string.h>
#include "character.h"
+// TODO #include "world.h"
+// TODO #include "map.h"
+#include "coordinates.h"
+
+#include "hashlib/hl_tools.h"
enum ETypeOfJob {
action_IDLE = 0,
@@ -18,7 +32,7 @@ enum ETypeOfJob {
class Job {
public:
Job();
- std::string job_id; // sha1? -not yet implemented
+ std::string job_id, job_crc; // sha1? -not yet implemented
uint32_t job_flags; // specified flags for non-standard types of jobs -not yet implemented
ETypeOfJob type;
Ccharacter actors[ 2 ]; // first is always main player, second one is optional
View
81 main.cpp
@@ -1,5 +1,13 @@
-#include "main.h"
+/*
+
+ This is OpenSource Project;
+ It's licensed on GPL/ LGPL public license;
+ It's written by Daniel (dmilith) Dettlaff since August 2oo8.
+ You can redistribute this project only with this header.
+
+*/
+#include "main.h"
//removing from stack
//std::vector<Job>::iterator rm = job_list.end();
@@ -7,10 +15,29 @@
static std::vector<Job> job_list;
static uint64_t timer;
-static Ccharacter a_man, an_elve, a_dwarf, a_cave_troll;
+Ccharacter a_man( human, "zdzich" ), an_elve( elve, "rodżer"), a_dwarf( dwarf, "glon"), a_cave_troll( cave_troll, "brugh" );
static Cworld worlds[ MAX_WORLDS ]; // world.h
static Ccharacter characters[ MAX_PLAYERS ]; // world.h
+// save data to archive
+void
+save_job( Job job, std::string filename ) {
+ std::ofstream ofs( filename.c_str() );
+ boost::archive::binary_oarchive oa( ofs, 1 ); // 1 means without header
+ // write class instance to archive
+ oa << job;
+ // archive and stream closed when destructors are called
+}
+
+// load data from archive
+void
+load_job( Job job, std::string filename ) {
+ // create and open an archive for input
+ std::ifstream ifs( filename.c_str() );
+ boost::archive::binary_iarchive ia( ifs, 1 );
+ // read class state from archive
+ ia >> job;
+}
// save data to archive
void
@@ -33,7 +60,8 @@ load_world( Cworld world, std::string filename ) {
}
-void recv_signal( int sig ) {
+void
+recv_signal( int sig ) {
std::cout << std::endl << "Bye" << std::endl;
#ifdef DEBUG
std::cout << "debug: saving world." << std::endl;
@@ -46,7 +74,8 @@ void recv_signal( int sig ) {
// execution of job
-void get_job_from_stack() {
+void
+get_job_from_stack() {
if ( job_list.empty() ) {
#ifdef DEBUG
printf("%c[%d;%d;%dm", 0x1B, BRIGHT, MAGENTA, BG_BLACK);
@@ -59,22 +88,26 @@ void get_job_from_stack() {
//running job
// if ( ( job_list.at( job_list.size() - 1 ) ).actors.size() >= 1 ) {
job_list.at( job_list.size() - 1 ).run();
+ save_job( (Job)job_list.at( job_list.size() - 1), JOB_SAVE_PATH +
+ (std::string)( job_list[ job_list.size() - 1 ] ).job_id + ".job" );
job_list.pop_back();
// }
}
-void add_job_to_stack( Job job ) {
+void
+add_job_to_stack( Job job ) {
job_list.push_back( job );
}
// perform one job
-void _do( ETypeOfJob action_to_perform, Ccharacter *c1, Ccharacter *c2 = NULL ) {
- Job *action = new Job();
- action->job_flags = 0;
- action->job_id = "std"; // should be identifier. maybe sha1?
- action->type = action_to_perform;
+void
+_do( ETypeOfJob action_to_perform, Ccharacter *c1, Ccharacter *c2 = NULL ) {
+ Job action;
+ action.job_flags = 0;
+ action.job_id = generate_sha1( true ); // should be identifier. maybe sha1?
+ action.type = action_to_perform;
if ( c1 == NULL ) {
#ifdef DEBUG
std::cout << "\nCatched on trying perform a job without c1! ";
@@ -83,12 +116,13 @@ void _do( ETypeOfJob action_to_perform, Ccharacter *c1, Ccharacter *c2 = NULL )
#endif
return;
}
- action->actors[ 0 ] = *c1;
+ action.actors[ 0 ] = *c1;
if ( c2 != NULL ) {
- action->actors[ 1 ] = *c2;
+ action.actors[ 1 ] = *c2;
}
- add_job_to_stack( *action );
- delete action;
+ add_job_to_stack( action );
+
+ //delete action;
}
std::string& print_character( Ccharacter& ch ) {
@@ -105,9 +139,15 @@ std::string& print_character( Ccharacter& ch ) {
std::cout.flush();
}
+
// main threads:
//
-void thread_console() {
+void
+thread_console() {
+#ifdef RUBY_EMB
+ ruby_init();
+ ruby_init_loadpath();
+#endif
char command = '-';
char command_s[128]; // = new std::string();
#ifdef DEBUG
@@ -115,9 +155,9 @@ void thread_console() {
std::cout.flush();
#endif
do {
- std::cout << std::endl << "#(console)_:";
+ std::cout << std::endl << "#(con)_:";
std::cout.flush();
- std::cin.getline( command_s, 127 );
+ std::cin.getline( command_s, 60 );
std::string command_str( command_s );
#ifdef DEBUG
#endif
@@ -129,6 +169,9 @@ void thread_console() {
if ( ( command_str == "q" ) || ( command_str == "quit" ) || ( command_str == "exit" ) ) command = 'q';
switch( command ) {
case 'q':
+#ifdef RUBY_EMB
+ ruby_finalize();
+#endif
recv_signal( 0 );
exit( 0 );
case '0':
@@ -158,7 +201,8 @@ void thread_console() {
}
-void thread_timer() {
+void
+thread_timer() {
boost::xtime xt;
do {
#ifdef DEBUG
@@ -226,6 +270,7 @@ int main( int argc, char* argv[] ) {
// creating worlds
Cworld umbra( "Umbra", 255, 255, 0 );
Cworld crealis( "Crealis", 20, 80, 50 );
+
//load_world( umbra, "umbra.world");
//load_world( crealis, "crealis.world");
//adding new worlds to worlds vector
View
4 main.h
@@ -1,6 +1,6 @@
#include <iostream>
#include <fstream>
-#include "boost/date_time/gregorian/gregorian.hpp"
+#include <boost/date_time/gregorian/gregorian.hpp>
#include <boost/filesystem/operations.hpp>
#include <boost/thread/thread.hpp>
#include <boost/thread/xtime.hpp>
@@ -8,7 +8,6 @@
#include <boost/archive/binary_oarchive.hpp>
#include <boost/archive/binary_iarchive.hpp>
#include <signal.h>
-
#include "job.h"
#include "world.h"
#include "config.h"
@@ -18,6 +17,7 @@
#include "place.h"
#include "soul.h"
#include "version.h"
+#include "../local/lib/ruby/1.8/x86_64-linux/ruby.h"
namespace boost {
namespace serialization {
View
9 map.cpp
@@ -1,3 +1,12 @@
+/*
+
+ This is OpenSource Project;
+ It's licensed on GPL/ LGPL public license;
+ It's written by Daniel (dmilith) Dettlaff since August 2oo8.
+ You can redistribute this project only with this header.
+
+*/
+
#include "map.h"
Cmap::Cmap() {
View
9 map.h
@@ -1,3 +1,12 @@
+/*
+
+ This is OpenSource Project;
+ It's licensed on GPL/ LGPL public license;
+ It's written by Daniel (dmilith) Dettlaff since August 2oo8.
+ You can redistribute this project only with this header.
+
+*/
+
#ifndef _CMAP_H_
#define _CMAP_H_
View
9 place.cpp
@@ -1,3 +1,12 @@
+/*
+
+ This is OpenSource Project;
+ It's licensed on GPL/ LGPL public license;
+ It's written by Daniel (dmilith) Dettlaff since August 2oo8.
+ You can redistribute this project only with this header.
+
+*/
+
#include "place.h"
Cplace::Cplace() {
View
11 place.h
@@ -1,3 +1,12 @@
+/*
+
+ This is OpenSource Project;
+ It's licensed on GPL/ LGPL public license;
+ It's written by Daniel (dmilith) Dettlaff since August 2oo8.
+ You can redistribute this project only with this header.
+
+*/
+
#ifndef _CPLACE_H_
#define _CPLACE_H_
@@ -15,4 +24,4 @@ class Cplace {
Cmap map; //mapa
}; //terytorium place'a
-#endif //_CPLACE_H_
+#endif //_CPLACE_H_
View
9 soul.cpp
@@ -1,3 +1,12 @@
+/*
+
+ This is OpenSource Project;
+ It's licensed on GPL/ LGPL public license;
+ It's written by Daniel (dmilith) Dettlaff since August 2oo8.
+ You can redistribute this project only with this header.
+
+*/
+
#include "soul.h"
Csoul::Csoul() {
View
9 soul.h
@@ -1,3 +1,12 @@
+/*
+
+ This is OpenSource Project;
+ It's licensed on GPL/ LGPL public license;
+ It's written by Daniel (dmilith) Dettlaff since August 2oo8.
+ You can redistribute this project only with this header.
+
+*/
+
#ifndef _CSOUL_H_
#define _CSOUL_H_
View
6 tags
@@ -0,0 +1,6 @@
+!_TAG_FILE_FORMAT 2 /extended format; --format=1 will not append ;" to lines/
+!_TAG_FILE_SORTED 1 /0=unsorted, 1=sorted, 2=foldcase/
+!_TAG_PROGRAM_AUTHOR Darren Hiebert /dhiebert@users.sourceforge.net/!_TAG_PROGRAM_NAME Exuberant Ctags //
+!_TAG_PROGRAM_URL http://ctags.sourceforge.net /official site/
+!_TAG_PROGRAM_VERSION 5.5.4 //
+!_TAG_CACHE 1912
View
9 theritory.cpp
@@ -1,3 +1,12 @@
+/*
+
+ This is OpenSource Project;
+ It's licensed on GPL/ LGPL public license;
+ It's written by Daniel (dmilith) Dettlaff since August 2oo8.
+ You can redistribute this project only with this header.
+
+*/
+
#include "theritory.h"
#include "place.h"
View
9 theritory.h
@@ -1,3 +1,12 @@
+/*
+
+ This is OpenSource Project;
+ It's licensed on GPL/ LGPL public license;
+ It's written by Daniel (dmilith) Dettlaff since August 2oo8.
+ You can redistribute this project only with this header.
+
+*/
+
#ifndef _CTHERITORY_H_
#define _CTHERITORY_H_
View
1  world.cpp
@@ -3,6 +3,7 @@
Cworld::Cworld() {
//domyslne wartosci zmiennych
+
this->name = "Somewhere in the bush";
this->x_theritory_size = DEFAULT_THERITORY_X;
this->y_theritory_size = DEFAULT_THERITORY_Y;
View
17 world.h
@@ -1,15 +1,20 @@
-#ifndef _CWORLD_H_
-#define _CWORLD_H_
-
/*
-#include <vector>
-#include <iostream>
-#include <string.h>
+
+ This is OpenSource Project;
+ It's licensed on GPL/ LGPL public license;
+ It's written by Daniel (dmilith) Dettlaff since August 2oo8.
+ You can redistribute this project only with this header.
+
*/
+
+#ifndef _CWORLD_H_
+#define _CWORLD_H_
+
#include <boost/archive/binary_oarchive.hpp>
#include <boost/archive/binary_iarchive.hpp>
#include <boost/serialization/string.hpp>
+
#include "item.h"
#include "character.h"
#include "place.h"
Please sign in to comment.
Something went wrong with that request. Please try again.