Permalink
Browse files

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

added ruby embeededing option, some additional fixes
  • Loading branch information...
1 parent f780aaa commit b1d8caf20288d206f61395c9a09de8d01161176e Daniel (dmilith) Dettlaff committed Aug 19, 2008
Showing with 498 additions and 71 deletions.
  1. +2 −0 .gitignore
  2. +1 −0 CleanAll
  3. +11 −13 Sconstruct
  4. +14 −4 character.cpp
  5. +11 −1 config.h
  6. +9 −18 coordinates.cpp
  7. +10 −6 coordinates.h
  8. +185 −0 cppcomplete.tags
  9. +0 −1 hashlib/hashlibpp.h
  10. +30 −0 hashlib/hl_tools.cpp
  11. +26 −0 hashlib/hl_tools.h
  12. +9 −0 item.cpp
  13. +9 −0 item.h
  14. +10 −0 job.cpp
  15. +15 −1 job.h
  16. +63 −18 main.cpp
  17. +2 −2 main.h
  18. +9 −0 map.cpp
  19. +9 −0 map.h
  20. +9 −0 place.cpp
  21. +10 −1 place.h
  22. +9 −0 soul.cpp
  23. +9 −0 soul.h
  24. +6 −0 tags
  25. +9 −0 theritory.cpp
  26. +9 −0 theritory.h
  27. +1 −0 world.cpp
  28. +11 −6 world.h
View
@@ -6,3 +6,5 @@ world
gmon.out
*.world
*.item
+*.swp
+*.job
View
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -44,7 +44,6 @@
#include "hl_sha1wrapper.h"
#include "hl_sha256wrapper.h"
-
//----------------------------------------------------------------------
#endif
Oops, something went wrong.

0 comments on commit b1d8caf

Please sign in to comment.