Jump to content

Alina

Inactive Member
  • Posts

    174
  • Joined

  • Last visited

  • Days Won

    13
  • Feedback

    0%

Posts posted by Alina

  1. I talked at third person to give an example from the perspective of a normal user and.. well, nevermind.

    then why not at first use short int? If they want to raise the value above 32767 (which in normal cases doesn't happen) they'd also just change the datatype. Generally using int takes more memory and isn't the way you'd write your programs. If you don't need more, then just don't waste your resources on that ;)

    • Love 2
  2. Nice :D From Vanilla Sourcecode

    whew then vanilla must've made a little bit of a mess :D

    Let's play a little scenario. Here's what you'd do to have a bug in your CONFIG:

    MAX_HT: 32767

    MAX_STATUS: 100

     

    In this case, when the gamefile reads your max-status, it'll do the following statement:

                if(gPlayerMaxHT==32767)

                    gPlayerMaxHT = gPlayerMaxStatus;

     

    So what happened to our max_ht of 32767? Yep, it's now 100. Though I guess no one will use 32767 I think it still counts as a bug.

     

    Also I don't know why the variable isn't short int.. since.. well.. 32767 is the max length of short int. So it'd make more sense to chose short int :)

  3.  return "returns" a value. Simple as that :D

    In short: You can use this to create your own functions that return a value. Simple example:

     

    int add(int a1, int a2)

    {

     return a1 + a2;

    }

     

    int main()

    {

      int result = add(1, 1);

      printf("The result is %d", result);

      return 0; //in main() this tells the system that the program succeeded

      return 1; //in main() this tells the system that the program failed

    }

     

    Note that return ends the function immediately. That means, that in our example, the return 1; is completely nonsense and will not be reached since the main() function already returned 0.

    In int main() it's important to return 0 if the program succeeds (compilers will add that tho if you miss it) and otherweise 1 for program errors.

     

    Have fun :D

    • Love 1
  4.  

     

    Ouh, that's an easy one, leave it to me! :)

     

    unique_ptr is a function that's introduced with c++11. I guess you're not compiling with c++11 support then. Either replace all unique_ptr with auto_ptr (which is not recommended since auto_ptr is deprecated) or add -std=c++11 or -std=c++14 if you want c++14. Also make sure your compiler does support these instructions (c++11 support is poor in old gcc versions) and everything should work with unique_ptr  :)

     

     

    c++14 doesn't work for me, it's return me an error about the non-existence of the command. :x

     

     

    Which version of gcc/clang are you using? :)

    You need gcc 4.8 or higher! :) You can either use -std=c++14 or -std=c++1y

    If you're full brave and man enough you can try -std=c++17 or -std==c++1z but note that trigraphs won't work in this version since they're deprecated and now removed. So empire language won't work anymore unless you convert the trigraphs before :)

    • Love 1
  5. You either need to change it in src (there are a few tutorials around for that) or use a db cache that's capable of doing so.

     

    These files can do it:

     

    These sources can do it:

    guess so but I don't really know)

     

    Just went on searching on the first page, if there are any other files who can do that, feel free to use them :D

     

    With this guide you can build your own db cache with sql support:

  6. AntiCpXSrv.h is missing. You need that :)

    It's normally in any source, don't know why you don't have it. You can try and using the AntiCpXSrv.h from other sources, maybe that'll work :D

    • Love 1
  7. cZ3wb.png

    Help pls :)

     

    Ouh, that's an easy one, leave it to me! :)

     

    unique_ptr is a function that's introduced with c++11. I guess you're not compiling with c++11 support then. Either replace all unique_ptr with auto_ptr (which is not recommended since auto_ptr is deprecated) or add -std=c++11 or -std=c++14 if you want c++14. Also make sure your compiler does support these instructions (c++11 support is poor in old gcc versions) and everything should work with unique_ptr  :)

    • Love 1
  8.  

     

    m_expireTime = MIN(1800, g_iPlayerCacheFlushSeconds);

    Therefore, the min time for caching is 1800 no matter what you type in :)

    Read that again Alina! :P

     

    MIN(1800, 0) is most certainly 0.

    Max time for caching is 1800, though.

     

    But but but

     

     

    Also, for trying that, I hereby declare you guilty of trying to break your own server! No go to a dark corner and cry full of shame! Well.. Maybe that's exaggerated a bit. But you still shouldn't do something like this. Never. Ever. :)

    +1 haha

     

     

    Sorry, I missed something there. Thought that MIN would work like MINMAX, but that'd require for YMIR to write meaningful code... :D

    Actually MINMAX does define a minimum and maximum value, I thought with MIN it was the same but I miserably failed. Thanks for correcting me :)

    It also doesn't make sense for them to limit the max cache duration but not the minimum one. They're strange. Really. :/

     

    Still. Setting to 1 or 0 is plain suicide. Good luck with that :D

  9. That's why I said the results are cached either way. So it doesn't matter at all :)

    I chose mysql cloumn because there may be other implementing ways. Maybe someone wants to add commands to this, the easiest way is with a player table holding the variable. That's why^^ Or maybe it was just more fun to code it that way. Chose what you prefer :D

  10.  

     

    PLAYER_CACHE_FLUSH_SECONDS = 0

    Well. No. It does nearly to nothing to be honest :)

     

    Main.cpp stores the Config entry into the variable g_iPlayerCacheFlushSeconds.

    This variable is only called one more time then (the other two calls are commented). And the snippet looks like this:

    m_expireTime = MIN(1800, g_iPlayerCacheFlushSeconds);
    

    Therefore, the min time for caching is 1800 no matter what you type in :)

     

    Also, for trying that, I hereby declare you guilty of trying to break your own server! Now go to a dark corner and cry full of shame! Well.. Maybe that's exaggerated a bit. But you still shouldn't do something like this. Never. Ever. :)

  11. The results are cached either way and something that needs to be accessed more than just once should be hold in RAM so the server can access it without any delays. That's why I chose to add it to the player points table :) Note that everytime you mount/unmount the vnum of your horse will be loaded again (as long as you're using a horse of course...^^)

  12. Weeeeeeeeeeeeeeeeeell, the best way to do this is using the plain functions.

    You'd know how the cache works. The gamefile holds the player values in memory, so it allocates RAM for every player. Also it sends the data stored to the dbcache and there's the cache you're looking for. You can manually push the values to the dbcache by calling SaveReal() from the CHARACTER-class (the normal Save() has a delay)

    But there's no need to edit the cache itself! You only have to edit the values stored in the gamefile. The next update will push it to the dbcache where it's cached and then written to the database later. So. Yeah, you found it :D

    What you might be looking for is Show(long lMapIndex, long x, long y, long z = LONG_MAX, bool bShowSpawnMotion = false) or Goto(long x, long y) in CHARACTER-class.

     

    These functions will overwrite the position stored inside the game instance. The next Save cycle will push it to the dbcache. If you're getting the error and relocating your character, you can straight log in again and it will work, no need to terminate the server or reload anything ;)

    • Love 1
  13. Can you post the error you're getting when the player is at an invalid coordinate?

    I could provide a small solution, it's not that big. When the error occurs, you can just Set the player coordinates to a specific place and map index.

     

    Also. You're working on a map, don't you? Why not exten the server_attr so you won't get kicked off? You can extend it, walk around and do your job and then revert to the old server_attr after you're done ;)

  14. I cleared it^^

    But many people are using newer versions of gcc/clang which won't work like this.

     

    Since cc is only replaced in /etc/make.conf it will take part in compiling ports in the portstree or building the kernel, but it won't take effect in compiling the source at least not when you're doing something like this:

    CC = gcc49

    That's the point where ccache won't be a part of the compilation. Also, feel free to use

    cc -v

    This prints out the compiler version. If you replace it on /etc/make.conf, you'll notice that cc -v still prints out the system's compiler no matter if you're using a more actual version of gcc/clang or whatever. So the effects from make.conf are applied when building ports or kernel, but not when compiling your custom sources.

     

    Adding ccache to your Makefile is therefore needed to make it work. Maybe it'll work when using CC = cc but I don't know and I guess it won't but feel free to correct me if I'm wrong :)

×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.