• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!
  • 2026 staff recruitment is open! Check it out and consider applying!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

MoveEvent Refill Stamina on PZ for premiums

Hi, can you help me? I get some errors:

Code:
[ 27%] Building CXX object CMakeFiles/tfs.dir/src/game.cpp.o
In file included from /home/Otserv/src/events.cpp:22:0:
/home/Otserv/src/events.h:54:48: error: ‘ZoneType_t’ has not been declared
   void eventPlayerOnChangeZone(Player* player, ZoneType_t zone);
                                                ^
[ 29%] Building CXX object CMakeFiles/tfs.dir/src/globalevent.cpp.o
/home/Otserv/src/events.cpp:542:6: error: prototype for ‘void Events::eventPlayerOnChangeZone(Player*, ZoneType_t)’ does not match any in class ‘Events’
void Events::eventPlayerOnChangeZone(Player* player, ZoneType_t zone)
      ^
In file included from /home/Otserv/src/events.cpp:22:0:
/home/Otserv/src/events.h:54:8: error: candidate is: void Events::eventPlayerOnChangeZone(Player*, int)
   void eventPlayerOnChangeZone(Player* player, ZoneType_t zone);
        ^
make[2]: *** [CMakeFiles/tfs.dir/src/events.cpp.o] Error 1

Same error, how I can fix it?
 
@Wusse asked me via pm to see this. My post was from 2021 so now I have better understanding on this.
We can see on TFS branch that function onChangeZone is applied to sources, and specifically triggered onChangeMount.


Looking in depth into it, it seems that onChangeZone is being used for example, on mount system (which removes mount on PZ). So taking this into account, we can go ahead and seek for:

C++:
if (zone == ZONE_PROTECTION) {
        if (attackedCreature && !hasFlag(PlayerFlag_IgnoreProtectionZone)) {
            removeAttackedCreature();
            onAttackedCreatureDisappear(false);
        }


What if we simply add a stamina function on this piece of code? Should work?.
Can't test by now but seems logic. Regards!
 
@Wusse asked me via pm to see this. My post was from 2021 so now I have better understanding on this.
We can see on TFS branch that function onChangeZone is applied to sources, and specifically triggered onChangeMount.


Looking in depth into it, it seems that onChangeZone is being used for example, on mount system (which removes mount on PZ). So taking this into account, we can go ahead and seek for:

C++:
if (zone == ZONE_PROTECTION) {
        if (attackedCreature && !hasFlag(PlayerFlag_IgnoreProtectionZone)) {
            removeAttackedCreature();
            onAttackedCreatureDisappear(false);
        }


What if we simply add a stamina function on this piece of code? Should work?.
Can't test by now but seems logic. Regards!
I looked into it myself and "ZoneType_t" is declared in src/tile.h

so another simple solution that ive tried and it seems to work just fine was:

in src/event.h:

to simply add another #include directive in this case: #include "tile.h"

that way the errors you would get on your previous post stop appearing.

now my question is... does including tile.h in event.h change/ruin anything?
from me testing i havent noticed any changes/bugs or anything of that matter game wise, nor source code wise. but i havent taken my time to test everything obviously.

if someone with a bit of a better understanding to source codes could confirm this then that would be highly appreciated.

TFS 1.4.2 10.98
 
Back
Top