Implemented task : Don't load the complete campaign configuration

This commit is contained in:
jsalmon3 2002-06-26 00:54:38 +00:00
parent cb04d21396
commit bdaaa70fa2
2 changed files with 24 additions and 7 deletions

View file

@ -878,9 +878,10 @@
<LI>Fixed multiplayer fog of war (from Jimmy Salmon).
<LI>Added free for all, top vs bottom, and left vs right game types (from
Jimmy Salmon).
<LI>Added if-resource trigger (from Jimmy Salmon).
<LI>Fixed bug #573331: Peasants don't chop wood (from Jimmy Salmon).
<LI>Added if-kills and if-score triggers (from Jimmy Salmon).
<LI>Added if-resource, if-kills, and if-score triggers (from Jimmy Salmon).
<LI>Implemented task #55513: Don't load the complete campaign configuration
(from Jimmy Salmon).
</UL>
</UL>

View file

@ -38,6 +38,7 @@
#include "map.h"
#include "campaign.h"
#include "settings.h"
#include "iolib.h"
/*----------------------------------------------------------------------------
-- Declarations
@ -149,6 +150,12 @@ global void PlayCampaign(const char* name)
return;
}
if (!CurrentCampaign->Chapters) {
char buf[1024];
filename=LibraryFileName(CurrentCampaign->File,buf);
vload(filename, 0, 1);
}
GameIntro.Objectives[0]=strdup(DefaultObjective);
CurrentChapter = CurrentCampaign->Chapters;
@ -190,13 +197,22 @@ local SCM CclDefineCampaign(SCM list)
if( Campaigns ) {
for( i=0; i<NumCampaigns; ++i ) {
if( !strcmp(Campaigns[i].Ident, ident) ) {
free(ident);
return SCM_UNSPECIFIED;
if( Campaigns[i].Chapters ) {
free(ident);
return SCM_UNSPECIFIED;
}
campaign=Campaigns+i;
free(campaign->Ident);
free(campaign->Name);
free(campaign->File);
break;
}
}
Campaigns=realloc(Campaigns,sizeof(Campaign)*(NumCampaigns+1));
campaign=Campaigns+NumCampaigns;
NumCampaigns++;
if( i==NumCampaigns ) {
Campaigns=realloc(Campaigns,sizeof(Campaign)*(NumCampaigns+1));
campaign=Campaigns+NumCampaigns;
NumCampaigns++;
}
} else {
campaign=Campaigns=malloc(sizeof(Campaign));
NumCampaigns++;