From a4d577def9442ba0b43e7ea333e701b2fb6afbc0 Mon Sep 17 00:00:00 2001 From: johns <> Date: Mon, 4 Jun 2001 14:49:07 +0000 Subject: [PATCH] Functions Init, Save and CleanSelections added. --- src/stratagus/selection.cpp | 40 +++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/src/stratagus/selection.cpp b/src/stratagus/selection.cpp index da5fc9296..eedfad5c7 100644 --- a/src/stratagus/selection.cpp +++ b/src/stratagus/selection.cpp @@ -31,6 +31,7 @@ ----------------------------------------------------------------------------*/ #include <stdio.h> +#include <stdlib.h> #include "freecraft.h" #include "video.h" @@ -499,4 +500,43 @@ global int SelectUnitsInRectangle(int tx,int ty,int w,int h) return 0; } +/** +** Initialize the selection module. +*/ +global void InitSelections(void) +{ +} + +/** +** Save current selection state. +** +** @param file Output file. +*/ +global void SaveSelections(FILE* file) +{ + int i; + char *ref; + + fprintf(file,"\n;;; -----------------------------------------\n"); + fprintf(file,";;; MODULE: selection $Id$\n\n"); + + fprintf(file,";;(group-id %d)\n",GroupId); + fprintf(file,";;(selection %d '(",NumSelected); + for( i=0; i<NumSelected; ++i ) { + ref=UnitReference(Selected[i]); + fprintf(file,"%s ",ref); + free(ref); + } + fprintf(file,"))\n"); +} + +/** +** Clean up the selection module. +*/ +global void CleanSelections(void) +{ + NumSelected=0; + memset(Selected,0,sizeof(Selected)); +} + //@}