[crossfire] Server code structure

Mark Wedel mwedel at sonic.net
Fri Dec 11 00:57:17 CST 2020


On 12/10/20 9:06 AM, Nicolas Weeger wrote:
> Hello.
> 
> 
> The server code is currently divided in libraries, but without a clean
> separation IMO.
> 
> For instance why is "rod_adjust" in server and not in "common"? (forcing users
> of common to declare a stub)
> 
> 
> Should we just decide to put all code together and forget the 4 or 5
> libraries, or on the opposite try to really separate things?
> 
> 
> I was planning (someday :)) to tackle the events system, and move it to
> common, probably, that could help separate the logic - event "item_created"
> that the server could hook for rod adjustment. This would enable to remove the
> various stubs.
> 
> But if we decide it's ok to keep libraries separate, that's fine by me too :)

  Now days, it may not make that much sense.  Back when crossedit existed, it used the common to deal with the loading & saving of maps and archetypes, and more or less, stuff not related to that was in the server directory.  But crossedit is long since gone.

  At this point, some of the directories (socket, random_maps, etc) make sense in that it puts all the related code in one place.  But common is a bit of a mix.  Its a somewhat tricky balance - common was originally related to the load/save logic (and actual common things, like object handling, etc).  But then you get the case of having the logic to load the data file, doesn't it make sense to have the logic that uses that data to be in the same file, and then it becomes less clear where that line between common and server is.



More information about the crossfire mailing list