Stilllegung des Forums
Das Forum wurde am 05.06.2023 nach über 20 Jahren stillgelegt (weitere Informationen und ein kleiner Rückblick).
Registrierungen, Anmeldungen und Postings sind nicht mehr möglich. Öffentliche Inhalte sind weiterhin zugänglich.
Das Team von spieleprogrammierer.de bedankt sich bei der Community für die vielen schönen Jahre.
Wenn du eine deutschsprachige Spieleentwickler-Community suchst, schau doch mal im Discord und auf ZFX vorbei!
Werbeanzeige
C-/C++-Quelltext |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
#ifndef UNIT_DATA #define UNIT_DATA #include <SFML\Graphics.hpp> #include <string> #include <vector> class c_framework; class c_unit { private: // references c_framework &framework; // unit data std::string name; sf::Sprite sprite; int hp_max; int hp_act; int atk_max; int atk_act; int def_max; int def_act; int run_max; int run_act; public: c_unit(c_framework &framework); // functions out void load_unit( std::string name_data ); void set_sprite_pos( float x , float y ); void draw(); void update(); void clear(); int get_move(); }; #endif |
C-/C++-Quelltext |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
#ifndef UNIT_MANAGMENT #define UNIT_MANAGMENT #include <SFML\Graphics.hpp> #include <string> #include <vector> #include "unit.hpp" class c_framework; class c_battle_background; class c_unit_managment { private: // references c_framework &framework; c_battle_background &background; // units std::vector< std::vector< c_unit > > test_1; std::vector< c_unit > test_2; public: c_unit_managment( c_framework &framework , c_battle_background &backgroundm ); load_units(); }; #endif |
C-/C++-Quelltext |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
#include "unit_managment.hpp" #include "battle_background.hpp" c_unit_managment::c_unit_managment( c_framework &framework , c_battle_background &backgroundm ) : framework ( framework ) , background ( backgroundm ) { } void c_unit_managment::load_units() { std::vector< c_unit > temp_unit; c_unit temp( framework ); test_1.push_back( temp_unit ); // das hier Ergibt den Fehler test_2.push_back( temp ); // das hier Funktioniert; } |
C-/C++-Quelltext |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
c:\program files (x86)\microsoft visual studio 10.0\vc\include\xutility(2514): error C2582: Die Funktion 'operator =' ist in 'c_unit' nicht verfügbar 1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\xutility(2535): Siehe Verweis auf die Instanziierung der gerade kompilierten Funktions-template "_OutIt std::_Move<_InIt,_OutIt>(_InIt,_InIt,_OutIt,std::_Nonscalar_ptr_iterator_tag)". 1> with 1> [ 1> _OutIt=c_unit *, 1> _InIt=c_unit * 1> ] 1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\vector(1202): Siehe Verweis auf die Instanziierung der gerade kompilierten Funktions-template "_OutIt std::_Move<c_unit*,c_unit*>(_InIt,_InIt,_OutIt)". 1> with 1> [ 1> _OutIt=c_unit *, 1> _InIt=c_unit * 1> ] 1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\vector(1190): Bei der Kompilierung der Klassen-template der std::_Vector_iterator<_Myvec> std::vector<_Ty>::erase(std::_Vector_const_iterator<_Myvec>,std::_Vector_const_iterator<_Myvec>)-Memberfunktion 1> with 1> [ 1> _Myvec=std::_Vector_val<c_unit,std::allocator<c_unit>>, 1> _Ty=c_unit 1> ] 1> c:\users\shork\documents\visual studio 2010\projects\phönix\phönix\unit_managment.cpp(14): Siehe Verweis auf die Instanziierung der gerade kompilierten Klassen-template "std::vector<_Ty>". 1> with 1> [ 1> _Ty=c_unit 1> ] |
Community-Fossil
Beruf: Teamleiter Mobile Applikationen & Senior Software Engineer
C-/C++-Quelltext |
|
1 |
c_framework& operator=( c_framework& framework ); |
Community-Fossil
Benutze am besten gleich SmartPointer.
SmartPointer hätte ich garnicht, die gibts ja in VisualStudio 2010 noch nicht und boost habe ich bis jetzt noch nie benützt.
Werbeanzeige