mapcreator git · master
SDL3 2.5D game and engine using assets, with map editor
C++ 99.3%git clone https://git.christianimmanuel.de/sdl-graphics/mapcreator.gitwget https://git.christianimmanuel.de/sdl-graphics/mapcreator/archive/mapcreator.tar.gz..
src/character/character.cpp | 8 ++------ src/vegetables/vegetables.cpp | 5 ++--- src/vegetables/vegetables.hpp | 3 +-- 3 files changed, 5 insertions(+), 11 deletions(-) diff --git a/src/character/character.cpp b/src/character/character.cpp index 32f36ed..8daba3b 100644 --- a/src/character/character.cpp +++ b/src/character/character.cpp @@ -871,9 +871,8 @@ Character::plant_Vegetable() { } if (planting_logic.duration >= planting_logic.duration_max) { - const VegetableData::CropDefinition* crop_def = VegetableData::get_DataByType(planting_logic.type); - std::cout << "DEF " << (int)planting_logic.type << " " << crop_def->name << std::endl; - Vegetable* v = new Vegetable(crop_def, planting_logic.type, planting_logic.tile_world); + std::cout << "DEF " << (int)planting_logic.type << std::endl; + Vegetable* v = new Vegetable(planting_logic.type, planting_logic.tile_world); TileObject to = {{0,0}, true, v->id}; size_t id = Map::get_IdFromTilePoint(planting_logic.tile_world); std::cout << " " << id << std::endl; @@ -1380,7 +1379,6 @@ Character::handle_Input(Input& input, SDL_Rect win_size) { if (t > 1.0) t = 1.0; - // quadratic ramp stamina_drain *= (t * t); if (t >= 1.0) { @@ -1394,10 +1392,8 @@ Character::handle_Input(Input& input, SDL_Rect win_size) { if (stats.stamina <= 0) stamina_StopReg(); else { - // END SPRINT is_sprinting = true; if (!sprintstart_logic.is_starting && !sprintstart_logic.has_started) { - // begin sprint acceleration sprintstart_logic.started_gamesec = Default::get_TimeSinceStartInSec(); sprintstart_logic.is_starting = true; std::cout << "STARTING SPRINT\n"; diff --git a/src/vegetables/vegetables.cpp b/src/vegetables/vegetables.cpp index 2a8a7cd..3070e93 100644 --- a/src/vegetables/vegetables.cpp +++ b/src/vegetables/vegetables.cpp @@ -27,8 +27,7 @@ namespace VegetableData { } } -Vegetable::Vegetable(const VegetableData::CropDefinition* cd, VegetableData::Type t, - SDL_Point world_pos) +Vegetable::Vegetable( VegetableData::Type t, SDL_Point world_pos) : Object(ObjectType::VEGETABLE, ObjectCategory::FARM_CROP, @@ -39,11 +38,11 @@ Vegetable::Vegetable(const VegetableData::CropDefinition* cd, VegetableData::Typ {1,1}, 0), type(t), - definition(cd), growth_stage(0), next_update_sec(Default::get_TimeSinceStartInSec()), equipement_slot(EquipmentSlot::HAND_RIGHT) { + definition = &VegetableData::crop_defs[static_cast<size_t>(type)]; tileset_object_x = definition->start_tile_x; tileset_object_y = definition->start_tile_y; VegetableData::all_vegetables.push_back(this); diff --git a/src/vegetables/vegetables.hpp b/src/vegetables/vegetables.hpp index 982291d..bba1593 100644 --- a/src/vegetables/vegetables.hpp +++ b/src/vegetables/vegetables.hpp @@ -64,8 +64,7 @@ public: EquipmentSlot equipement_slot; - Vegetable(const VegetableData::CropDefinition* cd, VegetableData::Type t, - SDL_Point world_pos); + Vegetable(VegetableData::Type t, SDL_Point world_pos); SDL_Point get_SetPosition() override;