Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

added lots of stuff. core in main code from now. added purelib shared…

… object, added job tests, refactoring Csoul and Job
  • Loading branch information...
commit fa5630eaa99d69bd2d2d306542c9bd00548df14a 1 parent 715004c
Daniel (dmilith) Dettlaff authored
View
1  .gitignore
@@ -16,3 +16,4 @@ tests/test_*
*~
tests/.sconsign.dblite
tests/core/objects
+data/objects
View
5 Sconstruct
@@ -19,6 +19,8 @@ debug_optimized = Environment( CXX = 'g++ -O2 -ggdb -W' )
#release = debug64
release = debug_optimized
+release.SharedLibrary('purecore', 'core.cpp')
+release.SharedLibrary('job', 'job.cpp')
release.SharedLibrary('hl-sha', [ 'hashlib/hl_sha1.cpp',
'hashlib/hl_sha1wrapper.cpp', 'hashlib/hl_sha256.cpp',
'hashlib/hl_sha256wrapper.cpp', 'hashlib/hl_tools.cpp' ] )
@@ -30,11 +32,10 @@ release.SharedLibrary('place', 'place.cpp')
release.SharedLibrary('soul', 'soul.cpp')
release.SharedLibrary('theritory', 'theritory.cpp')
release.SharedLibrary('world', 'world.cpp')
-release.SharedLibrary('job', 'job.cpp')
#release.Program('main' , 'main2.cpp',
# LIBS=[ 'boost_thread', 'boost_filesystem', 'hl-sha', 'boost_serialization',
# 'job', 'character', 'coordinates',
# 'item', 'map', 'place', 'soul', 'theritory',
-# 'world'],
+# 'world', 'purecore' ],
#, 'ruby' ],
# LIBPATH=[ '.', '/usr/local/lib', '/usr/lib' ])
View
1  character.cpp
@@ -280,3 +280,4 @@ void
Ccharacter::set_name( std::string name_ ) {
name = name_;
}
+
View
2  coordinates.h
@@ -10,6 +10,8 @@
#ifndef _CCOORDINATES_H_
#define _CCOORDINATES_H_
+#include <iostream>
+#include <string.h>
#include "hashlib/hl_tools.h" //instead of haslibpp.h. It's kinda proxy for hashlib
static const uint8_t SHA1_SIZE = 41; // 40 + \0
View
170 core.cpp
@@ -0,0 +1,170 @@
+/*
+
+ 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.
+
+*/
+
+/*
+ * TODO:
+ *
+ */
+
+#define DEBUG
+
+#include "core.h"
+
+using namespace std;
+using namespace core;
+using namespace boost;
+
+
+//Ccore
+
+Ccore::Ccore() {
+}
+
+
+Ccore::~Ccore() {
+}
+
+
+string
+Ccore::get_core_version() {
+ return CREALIS_CORE_VERSION;
+}
+
+
+uint32_t
+Ccore::get_current_objects_amount() {
+ return objects_amount;
+}
+
+
+uint32_t
+Ccore::get_max_objects_amount() {
+ return MAX_OBJECTS_AMOUNT;
+}
+
+void
+Ccore::set_amount( uint32_t value_ ) {
+ this->objects_amount = value_;
+}
+
+
+
+//Cobject
+
+Cobject::Cobject() {
+ this->set_id( generate_sha1() );
+ this->set_priority( 1 );
+}
+
+
+Cobject::Cobject( string id_ ) {
+ this->set_id( id_ );
+ this->set_priority( 1 );
+}
+
+
+Cobject::Cobject( int8_t priority_ ) {
+ this->set_id( generate_sha1() );
+ this->set_priority( priority_ );
+}
+
+
+Cobject::Cobject( string id_, int8_t priority_ ) {
+ this->set_id( id_ );
+ this->set_priority( priority_ );
+}
+
+
+bool
+Cobject::is_changed() {
+ return false;
+}
+
+
+string
+Cobject::get_id() {
+ return this->id;
+}
+
+
+void
+Cobject::set_id( string id_ ) {
+ this->id = id_;
+}
+
+
+void
+Cobject::set_priority( int8_t priority_ ) {
+ this->priority = priority_;
+}
+
+
+int8_t
+Cobject::get_priority() {
+ return this->priority;
+}
+
+
+Ccoordinates
+Cobject::get_position() {
+ return this->position;
+}
+
+
+void
+Cobject::set_position( Ccoordinates position_ ) {
+ this->position = position_;
+}
+
+
+bool
+Cobject::save_object() {
+ COBJECT_DATA *temp = new COBJECT_DATA;
+ strcpy( temp->id, ( this->get_id() ).c_str() );
+ temp->priority = this->get_priority();
+ temp->position = this->get_position();
+#ifdef DEBUG
+ cout << "Saving " + CORE_INFO_PATH + this->get_id() << endl << flush;
+#endif
+ try {
+ ofstream file( ( CORE_INFO_PATH + this->get_id() ).c_str(), ios_base::out | ios_base::binary );
+ file.write( (char*)temp, sizeof( COBJECT_DATA ) );
+ file.close();
+ } catch (exception& e) {
+ cout << e.what() << flush;
+ exit( 1 );
+ }
+ delete temp;
+ return true;
+}
+
+
+Cobject
+load_object( string filename_ ) {
+ Cobject temp_obj;
+ COBJECT_DATA *temp = new COBJECT_DATA;
+#ifdef DEBUG
+ cout << "Loading " + CORE_INFO_PATH + filename_ << endl << flush;
+#endif
+ try {
+ ifstream file( ( CORE_INFO_PATH + filename_ ).c_str(), ios_base::in | ios_base::binary );
+ file.read( (char*)temp, sizeof( COBJECT_DATA ) );
+ file.close();
+ } catch (exception& e) {
+ cout << e.what() << flush;
+ exit( 1 );
+ }
+ temp_obj.set_id( temp->id );
+ temp_obj.set_priority( temp->priority );
+ temp_obj.set_position( temp->position );
+ delete temp;
+ return temp_obj;
+}
+
+
View
83 core.h
@@ -0,0 +1,83 @@
+#ifndef _CCORE_H
+#define _CCORE_H
+
+#include <iostream>
+#include <cassert>
+#include <fstream>
+#include <boost/shared_ptr.hpp>
+#include <boost/shared_array.hpp>
+#include "hashlib/hl_tools.h"
+#include "coordinates.h"
+#include "version.h"
+#include "config.h"
+
+/*
+ * TODO: add asserts in all tests!
+ *
+ * XXX: to be fixed, or with poor code style
+ *
+ * FIXME: things to be fixed cause of bad working
+ *
+ */
+
+static const uint32_t MAX_OBJECTS_AMOUNT = 10000; //temporarely
+
+using namespace std;
+
+
+namespace core {
+
+ struct COBJECT_DATA { // to save/ load structure data
+ char id[40 + 1]; // additional \0 !
+ Ccoordinates position;
+ int8_t priority;
+ };
+
+ class Ccore {
+
+ private:
+ uint32_t objects_amount;
+ void save_objects_amount();
+ void load_objects_amount();
+
+ public:
+ Ccore();
+ ~Ccore();
+ string get_core_version();
+ void set_amount( uint32_t value_ );
+ uint32_t get_current_objects_amount();
+ uint32_t get_max_objects_amount();
+ };
+
+
+
+
+
+ class Cobject : public Ccore {
+
+ private:
+ string id;
+ Ccoordinates position; // localization of object in world
+ int8_t priority;
+
+ public:
+ Cobject();
+ Cobject( int8_t priority_ );
+ Cobject( string id_ );
+ Cobject( string id_, int8_t priority_ ) ;
+ string get_id();
+ virtual bool is_changed();
+ void set_id( string id_ );
+ int8_t get_priority();
+ Ccoordinates get_position();
+ void set_position( Ccoordinates position_ );
+ void set_priority( int8_t priority_ );
+ virtual bool save_object(); // saving with id as filename
+ friend Cobject load_object( string filename_ );
+
+ };
+
+}; // namespace
+
+
+#endif
View
118 job.cpp
@@ -12,107 +12,65 @@
Job::Job() {
job_id = generate_sha1();
- actors[ 0 ] = NULL;
- actors[ 1 ] = NULL;
+ job_flags = 0;
}
Job::~Job() {
- actors[ 0 ] = NULL;
- actors[ 1 ] = NULL;
}
+
+void
+Job::create_job( Cobject& object0_, Cobject& object1_, ETypeOfJob action_ ) {
+ //shared_ptr<Cobject> actor0( object0_ );
+ //shared_ptr<Cobject> actor1( object1_ );
+ actor0 = (const Csoul&)object0_;
+ actor1 = (const Csoul&)object1_;
+ set_action( action_ );
+}
+
+
+Csoul&
+Job::get_actor( uint8_t actor_num_ ) {
+ if ( actor_num_ == 0 )
+ return actor0;
+ else
+ return actor1;
+}
+
+
+void
+Job::set_action( ETypeOfJob type_ ) {
+ this->type = type_;
+}
+
+
void
Job::run() {
-#ifdef DEBUG
- std::cout << "R";
- std::cout.flush();
-#endif
- // matter on job type, do something with data
+
+// matter on job type, do something with data
switch ( type ) {
case action_IDLE:
#ifdef DEBUG
- std::cout << "I:" << action_IDLE;
- std::cout << this->actors[ 0 ]->get_name << ":" << this->actors[ 0 ]->health; // self only
- std::cout.flush();
+ cout << "I:" << action_IDLE << flush;
#endif
- break;
+ break;
case action_WALK:
#ifdef DEBUG
- std::cout << "W:" << action_WALK;
-
+ cout << "W:" << action_WALK << flush;
#endif
- break;
- case action_RUN: // running away from monster for example
+ break;
+ case action_RUN: // running away from monsters for example
#ifdef DEBUG
- std::cout << "U:" << action_RUN;
+ cout << "U:" << action_RUN << flush;
#endif
- break;
+ break;
case action_ATTACK:
#ifdef DEBUG
-// std::cout << "(s:" << this->actors.size() << ")";
-// std::cout.flush();
-#endif
- //if ( this->actors[ 1 ] == ) break; // attack with no target? always must be attacker and someone to attack to
- if ( this->actors[ 0 ]->get_health() <= 0 ) {
-#ifdef DEBUG
- std::cout << "A(0)h:0 ";
- std::cout.flush();
-#endif
- break;
- }
- if ( this->actors[ 0 ]->get_health() <= 0 ) {
-#ifdef DEBUG
- std::cout << "A(1)h:0 ";
- std::cout.flush();
-#endif
- break;
- }
- if ( this->actors[ 0 ]->is_dead() ) {
-#ifdef DEBUG
- std::cout << "#KDD, "; // killing a dead
- std::cout << this->actors[ 0 ]->get_name() << ":" << this->actors[ 0 ]->get_health(); // self only
- std::cout.flush();
-#endif
- break;
- }
- if ( this->actors[ 1 ]->is_dead() ) {
-#ifdef DEBUG
- std::cout << "#KDD, "; // killing a dead
- std::cout << this->actors[ 1 ]->get_name() << ":" << this->actors[ 1 ]->get_health(); // self only
- std::cout.flush();
-#endif
- break;
- }
- this->actors[ 0 ]->gain_health( -1 ); // first is always attacking player, and every attack costs 1hp
- this->actors[ 1 ]->gain_health( this->actors[ 0 ]->get_strength() ); // always attacking at least one target
- if ( this->actors[ 0 ]->get_health() <= 0 ) {
- this->actors[ 0 ]->kill();
-#ifdef DEBUG
- std::cout << "DEAD0";
- std::cout.flush();
-#endif
- }
-
- if ( this->actors[ 1 ]->get_health() <= 0 ) {
- this->actors[ 1 ]->kill();
-#ifdef DEBUG
- std::cout << "DEAD1";
- std::cout.flush();
-#endif
- }
-#ifdef DEBUG
- std::cout << " A=>" << this->actors[ 0 ]->get_health() << ", "; // << std::endl;
- std::cout << " B=>" << this->actors[ 1 ]->get_health() << ", "; // << std::endl;
- std::cout.flush();
+ std::cout << "A:" << action_DEFEND << flush;
#endif
+ break;
- break;
- case action_DEFEND:
-#ifdef DEBUG
- std::cout << "A:" << action_DEFEND;
-#endif
- break;
default: break;
}
}
View
45 job.h
@@ -11,33 +11,48 @@
#define _CJOB_H_
#include <iostream>
-#include <string.h>
-
-#include "character.h"
+#include <string>
+#include <boost/shared_ptr.hpp>
// TODO #include "world.h"
// TODO #include "map.h"
+#include "character.h"
#include "coordinates.h"
-
+#include "core.h"
#include "hashlib/hl_tools.h"
+using namespace std;
+using namespace core;
+using namespace boost;
+
enum ETypeOfJob {
action_IDLE = 0,
action_WALK = 1,
action_RUN = 2,
- action_ATTACK = 10,
- action_DEFEND = 11,
+ action_ATTACK = 10
};
-class Job {
- public:
- Job();
- ~Job();
- 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
- void run();
+class Job : public Cobject {
+
+ private:
+
+ string job_id, job_crc;
+ uint32_t job_flags; // specified flags for non-standard types of jobs -not yet implemented
+ ETypeOfJob type;
+ Csoul actor0;
+ Csoul actor1;
+ void set_crc(); // FIXME
+
+ public:
+ // adding two objects with related action
+ void create_job( Cobject& object0_, Cobject& object1_, ETypeOfJob action_ );
+ void set_action( ETypeOfJob type_ );
+ Csoul& get_actor( uint8_t actor_num_ );
+ Job();
+ ~Job();
+ void run();
+
};
+
#endif
View
28 soul.cpp
@@ -12,6 +12,32 @@
Csoul::Csoul() {
mana = 10;
mind_strength = 0;
- soul_exist = 0; //domyslnie postac jest bezduszna -czyli npc/potwor
+// soul_exist = 0; //domyslnie postac jest bezduszna -czyli npc/potwor
alignment = neutral; //neutralny
}
+
+
+uint64_t
+Csoul::get_mana() {
+ return this->mana;
+}
+
+
+uint64_t
+Csoul::get_mind_strength() {
+ return this->mind_strength;
+}
+
+
+void
+Csoul::set_mana( uint64_t mana_ ) {
+ this->mana = mana_;
+}
+
+
+void
+Csoul::set_mind_strength( uint64_t mind_strength_ ) {
+ this->mind_strength = mind_strength_;
+}
+
+
View
45 soul.h
@@ -12,25 +12,38 @@
#include <iostream>
+#include "core.h"
+
+using namespace core;
+
enum Ealignment {
- chaoticEvil = -3,
- evil = -2,
- neutralEvil = -1,
- neutral = 0,
- neutralGood = 1,
- good = 2,
- lawfulGood = 3,
- demoan = 4 //demoan, polaczenie demona i aniola -cos jak chaoticNeutral
+ chaoticEvil = 0,
+ evil = 1,
+ neutralEvil = 2,
+ neutral = 3,
+ neutralGood = 4,
+ good = 5,
+ lawfulGood = 6,
+ demoan = 7 //demoan, polaczenie demona i aniola -cos jak chaoticNeutral
};
-class Csoul {
-public:
- Csoul();
- uint64_t mana,
- mind_strength; //sila umyslu
- Ealignment alignment; //charakter
-
- bool soul_exist; //czy istnieje dusza. czyli czy postac jest graczem czy nie
+class Csoul : public Cobject {
+
+ private:
+
+ uint64_t mana, /* mana */
+ mind_strength; /* sila umyslu */
+ Ealignment alignment; //charakter
+// XXX: it should be possible to bool soul_exist; // does soul exist? - is it player or AI*
+
+ public:
+
+ uint64_t get_mana();
+ uint64_t get_mind_strength();
+ void set_mana( uint64_t mana_ );
+ void set_mind_strength( uint64_t mind_strength_ );
+
+ Csoul();
};
View
33 tests/Sconstruct
@@ -11,77 +11,77 @@ release = Environment( CXX = 'g++ -O0 -ggdb -W' )
release.Program('test_sha1_speed_threads' , 'hashlib/sha1_speed_test_with_threads.cpp',
LIBS=[ 'boost_thread', 'hl-sha', 'job', 'character', 'coordinates',
'item', 'map', 'place', 'soul', 'theritory',
- 'world'],
+ 'world', 'purecore'],
LIBPATH=[ '../', '/usr/local/lib', '/usr/lib' ])
release2 = Environment( CXX = 'g++ -O0 -ggdb -W' )
release2.Program('test_sha1_speed_without_threads' , 'hashlib/sha1_speed_test_without_threads.cpp',
LIBS=[ 'boost_thread', 'hl-sha', 'job', 'character', 'coordinates',
'item', 'map', 'place', 'soul', 'theritory',
- 'world'],
+ 'world', 'purecore'],
LIBPATH=[ '../', '/usr/local/lib', '/usr/lib' ])
release3 = Environment( CXX = 'g++ -O0 -ggdb -W' )
release3.Program('test_asio_udp_server' , 'network/asio_udp_server_test.cpp',
LIBS=[ 'boost_thread', 'boost_system', 'hl-sha', 'job', 'character', 'coordinates',
'item', 'map', 'place', 'soul', 'theritory',
- 'world'],
+ 'world', 'purecore'],
LIBPATH=[ '../', '/usr/local/lib', '/usr/lib' ])
release4 = Environment( CXX = 'g++ -O0 -ggdb -W' )
release4.Program('test_asio_udp_client' , 'network/asio_udp_client_test.cpp',
LIBS=[ 'boost_thread', 'boost_system', 'hl-sha', 'job', 'character', 'coordinates',
'item', 'map', 'place', 'soul', 'theritory',
- 'world'],
+ 'world', 'purecore'],
LIBPATH=[ '../', '/usr/local/lib', '/usr/lib' ])
release5 = Environment( CXX = 'g++ -O0 -ggdb -W' )
release5.Program('test_asio_tcp_server' , 'network/asio_tcp_server_test.cpp',
LIBS=[ 'boost_thread', 'boost_system', 'hl-sha', 'job', 'character', 'coordinates',
'item', 'map', 'place', 'soul', 'theritory',
- 'world'],
+ 'world', 'purecore' ],
LIBPATH=[ '../', '/usr/local/lib', '/usr/lib' ])
release6 = Environment( CXX = 'g++ -O0 -ggdb -W' )
release6.Program('test_asio_tcp_client' , 'network/asio_tcp_client_test.cpp',
LIBS=[ 'boost_thread', 'boost_system', 'hl-sha', 'job', 'character', 'coordinates',
'item', 'map', 'place', 'soul', 'theritory',
- 'world'],
+ 'world', 'purecore' ],
LIBPATH=[ '../', '/usr/local/lib', '/usr/lib' ])
release7 = Environment( CXX = 'g++ -O0 -ggdb -W' )
release7.Program('test_serialization' , 'other/serialization_test.cpp',
LIBS=[ 'boost_thread', 'hl-sha', 'job', 'character', 'coordinates',
'item', 'map', 'place', 'soul', 'theritory',
- 'world'],
+ 'world', 'purecore'],
LIBPATH=[ '../', '/usr/local/lib', '/usr/lib' ])
release8 = Environment( CXX = 'g++ -O0 -ggdb -W' )
release8.Program('test_thread' , 'thread/thread_group_test.cpp',
LIBS=[ 'boost_thread', 'hl-sha', 'job', 'character', 'coordinates',
'item', 'map', 'place', 'soul', 'theritory',
- 'world'],
+ 'world', 'purecore'],
LIBPATH=[ '../', '/usr/local/lib', '/usr/lib' ])
release9 = Environment( CXX = 'g++ -O0 -ggdb -W' )
release9.Program('test_thread_synchronization_1' , 'thread/synchronization_test.cpp',
LIBS=[ 'boost_thread', 'hl-sha', 'job', 'character', 'coordinates',
'item', 'map', 'place', 'soul', 'theritory',
- 'world'],
+ 'world', 'purecore'],
LIBPATH=[ '../', '/usr/local/lib', '/usr/lib' ])
release10 = Environment( CXX = 'g++ -O0 -ggdb -W' )
release10.Program('test_thread_synchronization_2' , 'thread/synchronization_test_2.cpp',
LIBS=[ 'boost_thread', 'hl-sha', 'job', 'character', 'coordinates',
'item', 'map', 'place', 'soul', 'theritory',
- 'world'],
+ 'world', 'purecore'],
LIBPATH=[ '../', '/usr/local/lib', '/usr/lib' ])
release11 = Environment( CXX = 'g++ -O0 -ggdb -W' )
release11.Program('test_ncurses_thread_monitor' , 'thread/ncurses_thread_monitor_test.cpp',
LIBS=[ 'boost_thread', 'hl-sha', 'job', 'character', 'coordinates', 'ncurses',
'item', 'map', 'place', 'soul', 'theritory',
- 'world'],
+ 'world', 'purecore'],
LIBPATH=[ '../', '/usr/local/lib', '/usr/lib' ])
release12 = Environment( CXX = 'g++ -O0 -ggdb -W' )
@@ -89,12 +89,19 @@ release12.Library('core', 'core/core.cpp')
release12.Program('test_core' , 'core/corechief.cpp',
LIBS=[ 'boost_thread', 'hl-sha', 'job', 'character', 'coordinates',
'item', 'map', 'place', 'soul', 'theritory',
- 'world', 'core'],
+ 'world', 'purecore'],
LIBPATH=[ '.', '../', '/usr/local/lib', '/usr/lib' ])
release13 = Environment( CXX = 'g++ -O0 -ggdb -W' )
release13.Program('test_coordinates' , 'other/coordinates_test.cpp',
LIBS=[ 'boost_thread', 'hl-sha', 'job', 'character', 'coordinates',
'item', 'map', 'place', 'soul', 'theritory',
- 'world', 'core'],
+ 'world', 'purecore'],
+ LIBPATH=[ '.', '../', '/usr/local/lib', '/usr/lib' ])
+
+release14 = Environment( CXX = 'g++ -O0 -ggdb -W' )
+release14.Program('test_job_0' , 'jobs/job_test_0.cpp',
+ LIBS=[ 'boost_thread', 'hl-sha', 'purecore', 'job', 'character', 'coordinates',
+ 'item', 'map', 'place', 'soul', 'theritory',
+ 'world', 'purecore'],
LIBPATH=[ '.', '../', '/usr/local/lib', '/usr/lib' ])
View
2  tests/core/core.cpp
@@ -68,8 +68,6 @@ uint32_t
Ccore::get_current_objects_amount() {
return objects_amount;
}
-
-
uint32_t
Ccore::get_max_objects_amount() {
return MAX_OBJECTS_AMOUNT;
View
43 tests/jobs/job_test_0.cpp
@@ -0,0 +1,43 @@
+
+#include <iostream>
+#include <cassert>
+#include <fstream>
+#include <boost/shared_ptr.hpp>
+#include <boost/shared_array.hpp>
+#include "../../hashlib/hl_tools.h"
+#include "../../coordinates.h"
+#include "../../version.h"
+#include "../../config.h"
+#include "../../job.h"
+#include "../../soul.h"
+
+using namespace std;
+using namespace boost;
+using namespace core;
+
+extern void create_job( Cobject* object0, Cobject* object1 );
+
+int main() {
+
+ Csoul *x = new Csoul();
+ Csoul *y = new Csoul();
+
+ x->set_mana( 56700000 );
+ y->set_mana( 12300000 );
+ Job *job = new Job();
+ job->create_job( *x, *y, action_ATTACK );
+ job->run();
+ cout << endl << job->get_actor( 0 ).get_mana() << flush << endl;
+ assert( (uint64_t)job->get_actor( 0 ).get_mana() == (uint64_t)56700000 );
+ assert( (uint64_t)job->get_actor( 1 ).get_mana() == (uint64_t)12300000 );
+
+ Cobject myjob;
+ myjob = job->get_actor( 0 );
+
+ delete job;
+ //delete x;
+ //delete y;
+ return 0;
+}
+
+
View
8 tests/network/asio_tcp_client_test.cpp
@@ -17,13 +17,7 @@ int main(int argc, char* argv[]) {
boost::asio::io_service io_service;
tcp::resolver resolver( io_service );
-/* std::string host = DEFAULT_HOST;
-
- if ( argc == 2 ) {
- host = argv[1];
- }
-*/
- tcp::resolver::query query( tcp::v4(), "83.21.212.127", DEFAULT_PORT );
+ tcp::resolver::query query( tcp::v4(), "0.0.0.0", DEFAULT_PORT );
tcp::resolver::iterator iterator = resolver.resolve( query );
tcp::socket s( io_service );
View
4 tests/other/serialization_test.cpp
@@ -58,7 +58,7 @@ int main() {
Citem item;
Csoul* soul = new Csoul();
item.weight = 5;
- soul->mana = 666;
+ soul->set_mana( 666 );
g.set_age( 12 );
g.gain_gold( 10000 );
g.set_soul( soul );
@@ -84,7 +84,7 @@ int main() {
//boost::archive::text_iarchive ia( ofs );
// read class state from archive
// ia >> newg;
- std::cout << "x: " << g.get_soul()->mana << std::endl;
+ std::cout << "x: " << g.get_soul()->get_mana() << std::endl;
std::cout << "y: " << g.get_gold() << std::endl;
//std::cout << "z: " << newg.items[0]->weight << std::endl;
//std::cout << "p: " << newg.private_box[0]->weight << std::endl;
Please sign in to comment.
Something went wrong with that request. Please try again.