diff options
| author | fusion32 <marcopuzziello@gmail.com> | 2025-05-28 18:51:06 -0300 |
|---|---|---|
| committer | fusion32 <marcopuzziello@gmail.com> | 2025-05-28 18:51:06 -0300 |
| commit | 565d28e480a5a320682f87cb598404f1a34bbc5d (patch) | |
| tree | c0a728eb7d2192707f3460dbc063cb4ab00de9ee | |
| parent | 02d243c531a5c7886c89024e592a2ccdeab3d3b3 (diff) | |
| download | game-565d28e480a5a320682f87cb598404f1a34bbc5d.tar.gz game-565d28e480a5a320682f87cb598404f1a34bbc5d.zip | |
rename/create some files
The most annoying thing with C++ classes being in their "own" header
file is that it makes it easy to create cyclic dependencies. We might
end up merging all creature related header files into the original
`cr.hh` that shows up in the original's debug information.
| -rw-r--r-- | Makefile | 14 | ||||
| -rw-r--r-- | src/crcombat.hh | 43 | ||||
| -rw-r--r-- | src/creature.hh | 53 | ||||
| -rw-r--r-- | src/crskill.cc (renamed from src/skill.cc) | 3 | ||||
| -rw-r--r-- | src/crskill.hh (renamed from src/skill.hh) | 6 | ||||
| -rw-r--r-- | src/player.hh | 2 |
6 files changed, 62 insertions, 59 deletions
@@ -13,20 +13,24 @@ else CFLAGS += -O2 endif -HEADERS = $(SRCDIR)/common.hh $(SRCDIR)/config.hh $(SRCDIR)/connection.hh $(SRCDIR)/containers.hh $(SRCDIR)/creature.hh $(SRCDIR)/enums.hh $(SRCDIR)/map.hh $(SRCDIR)/monster.hh $(SRCDIR)/objects.hh $(SRCDIR)/player.hh $(SRCDIR)/script.hh $(SRCDIR)/skill.hh $(SRCDIR)/thread.hh +HEADERS = $(SRCDIR)/common.hh $(SRCDIR)/config.hh $(SRCDIR)/connection.hh $(SRCDIR)/containers.hh $(SRCDIR)/creature.hh $(SRCDIR)/crcombat.hh $(SRCDIR)/crskill.hh $(SRCDIR)/enums.hh $(SRCDIR)/map.hh $(SRCDIR)/monster.hh $(SRCDIR)/objects.hh $(SRCDIR)/player.hh $(SRCDIR)/script.hh $(SRCDIR)/thread.hh -$(BUILDDIR)/$(OUTPUTEXE): $(BUILDDIR)/config.obj $(BUILDDIR)/crcombat.obj $(BUILDDIR)/creature.obj $(BUILDDIR)/main.obj $(BUILDDIR)/map.obj $(BUILDDIR)/objects.obj $(BUILDDIR)/player.obj $(BUILDDIR)/script.obj $(BUILDDIR)/shm.obj $(BUILDDIR)/skill.obj $(BUILDDIR)/strings.obj $(BUILDDIR)/thread.obj $(BUILDDIR)/time.obj $(BUILDDIR)/util.obj +$(BUILDDIR)/$(OUTPUTEXE): $(BUILDDIR)/config.obj $(BUILDDIR)/creature.obj $(BUILDDIR)/crcombat.obj $(BUILDDIR)/crskill.obj $(BUILDDIR)/main.obj $(BUILDDIR)/map.obj $(BUILDDIR)/objects.obj $(BUILDDIR)/player.obj $(BUILDDIR)/script.obj $(BUILDDIR)/shm.obj $(BUILDDIR)/strings.obj $(BUILDDIR)/thread.obj $(BUILDDIR)/time.obj $(BUILDDIR)/util.obj $(CC) $(CFLAGS) $(LFLAGS) -o $@ $^ $(BUILDDIR)/config.obj: $(SRCDIR)/config.cc $(HEADERS) @mkdir -p $(@D) $(CC) -c $(CFLAGS) -o $@ $< +$(BUILDDIR)/creature.obj: $(SRCDIR)/creature.cc $(HEADERS) + @mkdir -p $(@D) + $(CC) -c $(CFLAGS) -o $@ $< + $(BUILDDIR)/crcombat.obj: $(SRCDIR)/crcombat.cc $(HEADERS) @mkdir -p $(@D) $(CC) -c $(CFLAGS) -o $@ $< -$(BUILDDIR)/creature.obj: $(SRCDIR)/creature.cc $(HEADERS) +$(BUILDDIR)/crskill.obj: $(SRCDIR)/crskill.cc $(HEADERS) @mkdir -p $(@D) $(CC) -c $(CFLAGS) -o $@ $< @@ -54,10 +58,6 @@ $(BUILDDIR)/shm.obj: $(SRCDIR)/shm.cc $(HEADERS) @mkdir -p $(@D) $(CC) -c $(CFLAGS) -o $@ $< -$(BUILDDIR)/skill.obj: $(SRCDIR)/skill.cc $(HEADERS) - @mkdir -p $(@D) - $(CC) -c $(CFLAGS) -o $@ $< - $(BUILDDIR)/strings.obj: $(SRCDIR)/strings.cc $(HEADERS) @mkdir -p $(@D) $(CC) -c $(CFLAGS) -o $@ $< diff --git a/src/crcombat.hh b/src/crcombat.hh new file mode 100644 index 0000000..ce75002 --- /dev/null +++ b/src/crcombat.hh @@ -0,0 +1,43 @@ +#ifndef TIBIA_CRCOMBAT_HH_ +#define TIBIA_CRCOMBAT_HH_ 1 + +struct TCreature; + +struct TCombatEntry{ + uint32 ID; + uint32 Damage; + int TimeStamp; +}; + +struct TCombat{ + // REGULAR FUNCTIONS + // ========================================================================= + TCombat(void); + void CheckCombatValues(void); + + // DATA + // ========================================================================= + TCreature *Master; + uint32 EarliestAttackTime; + uint32 EarliestDefendTime; + uint32 LastDefendTime; + uint32 LatestAttackTime; + uint32 AttackMode; + uint32 ChaseMode; + uint32 SecureMode; + uint32 AttackDest; + bool Following; + Object Shield; + Object Close; + Object Missile; + Object Throw; + Object Wand; + Object Ammo; + bool Fist; + uint32 CombatDamage; + int ActCombatEntry; + TCombatEntry CombatList[20]; + int LearningPoints; +}; + +#endif //TIBIA_CRCOMBAT_HH_ diff --git a/src/creature.hh b/src/creature.hh index 423ad8c..bafc55e 100644 --- a/src/creature.hh +++ b/src/creature.hh @@ -5,45 +5,16 @@ #include "connection.hh" #include "containers.hh" #include "map.hh" -#include "skill.hh" -struct TCreature; +#include "crcombat.hh" +#include "crskill.hh" -struct TCombatEntry{ - uint32 ID; - uint32 Damage; - int TimeStamp; -}; - -struct TCombat{ - // REGULAR FUNCTIONS - // ========================================================================= - TCombat(void); - void CheckCombatValues(void); - - // DATA - // ========================================================================= - TCreature *Master; - uint32 EarliestAttackTime; - uint32 EarliestDefendTime; - uint32 LastDefendTime; - uint32 LatestAttackTime; - uint32 AttackMode; - uint32 ChaseMode; - uint32 SecureMode; - uint32 AttackDest; - bool Following; - Object Shield; - Object Close; - Object Missile; - Object Throw; - Object Wand; - Object Ammo; - bool Fist; - uint32 CombatDamage; - int ActCombatEntry; - TCombatEntry CombatList[20]; - int LearningPoints; +struct TOutfit{ + int OutfitID; + union{ + uint16 ObjectType; + uint8 Colors[4]; + }; }; struct TToDoEntry { @@ -99,14 +70,6 @@ struct TToDoEntry { }; }; -struct TOutfit{ - int OutfitID; - union{ - uint16 ObjectType; - uint8 Colors[4]; - }; -}; - struct TCreature: TSkillBase { // REGULAR FUNCTIONS // ========================================================================= diff --git a/src/skill.cc b/src/crskill.cc index aa69658..ce12cad 100644 --- a/src/skill.cc +++ b/src/crskill.cc @@ -1,8 +1,5 @@ -#include "skill.hh" -#include "enums.hh" #include "creature.hh" #include "monster.hh" -#include "player.hh" #include "stubs.hh" diff --git a/src/skill.hh b/src/crskill.hh index 353eb7d..abb2476 100644 --- a/src/skill.hh +++ b/src/crskill.hh @@ -1,5 +1,5 @@ -#ifndef TIBIA_SKILL_HH_ -#define TIBIA_SKILL_HH_ 1 +#ifndef TIBIA_CRSKILL_HH_ +#define TIBIA_CRSKILL_HH_ 1 #include "common.hh" @@ -170,4 +170,4 @@ struct TSkillBase{ uint16 FirstFreeTimer; }; -#endif //TIBIA_SKILL_HH_ +#endif //TIBIA_CRSKILL_HH_ diff --git a/src/player.hh b/src/player.hh index c985408..bb58ac3 100644 --- a/src/player.hh +++ b/src/player.hh @@ -2,8 +2,8 @@ #define TIBIA_PLAYER_HH_ 1 #include "common.hh" -#include "creature.hh" #include "containers.hh" +#include "creature.hh" struct TPlayerData { uint32 CharacterID; |
