Re: [Alephmodular-devel] High Level Modules
Status: Pre-Alpha
Brought to you by:
brefin
From: Chris P. <sf...@ma...> - 2002-12-31 03:20:35
|
>> - device.cpp >> - fades.cpp >> - game_window.cpp >> - item_definitions.cpp >> - media_definitions.cpp >> - scenery_definitions.cpp >> - sound_definitions.cpp > A very good list. I'm trying to think of what we should call this > group of ... extended physics. Scenario? Personality? (Do you play a > Map Scenario ala E:MR within AM with the Personality of M2?) I agree > that they should have their own module. Something that might interface > a bit more strongly with the other modules than any other module is > allowed to. > > An extended example would include not just monster definitions, but > also provide the monster control functions. (Hah! *MY* Scenario > implements a segmented worm as a monster!) > > I'd really like a decent name for this! Let me think... "Bio" modules? It's a little more interesting than calling them "Definitions" modules. A "Map Scenario ala E:MR with M2's Bio." Another issue that has just come to my mind is inter-module dependency. It's bound to happen - someone will add an extra item on to item_definitions, and then someone will write another module that depends on that item. If we're not careful, AM will screw up and leave the user wondering how to fix it. So, we create a "module_compatibility.h/.cpp" for modules to work with. Fairly simple: -------module_compatibility.cpp------- #define MAXIMUM_MODULES (64) /* Safe enough for the time being */ typedef struct module_reg { char *name; uint16 version; } module_reg; uint16 num_modules= 0; module_reg registered_modules[MAXIMUM_MODULES]; void register_module(char *name, uint16 version) { uint16 len = strlen(name); module_reg new_reg; assert (num_modules<MAXIMUM_MODULES); new_reg.name = new char[len]; strcpy(new_reg.name, name); new_reg.version = version; registered_modules[num_modules++] = new_reg; } bool require_module(char *name, uint16 min_version) { uint16 i; for (i=0; i<num_modules; i++) if (strcmp(registered_modules[i].name, name) == 0 && registered_modules[i].version >= min_version) return true; // Cancel startup, alert user to the problem return false; } |