[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Stratagus-CVS] stratagus data/ccl/stratagus.ccl src/clone/ccl....
From: |
Jimmy Salmon |
Subject: |
[Stratagus-CVS] stratagus data/ccl/stratagus.ccl src/clone/ccl.... |
Date: |
Tue, 21 Oct 2003 18:31:32 -0400 |
CVSROOT: /cvsroot/stratagus
Module name: stratagus
Branch:
Changes by: Jimmy Salmon <address@hidden> 03/10/21 18:31:32
Modified files:
data/ccl : stratagus.ccl
src/clone : ccl.c
src/editor : editloop.c
src/include : upgrade_structs.h
src/ui : ccl_ui.c
src/unit : unittype.c
Log message:
Added define-default-resource-amounts, fixed editor bug
Patches:
Index: stratagus/data/ccl/stratagus.ccl
diff -u stratagus/data/ccl/stratagus.ccl:1.21
stratagus/data/ccl/stratagus.ccl:1.22
--- stratagus/data/ccl/stratagus.ccl:1.21 Thu Oct 16 13:03:00 2003
+++ stratagus/data/ccl/stratagus.ccl Tue Oct 21 18:31:31 2003
@@ -26,7 +26,7 @@
;; along with this program; if not, write to the Free Software
;; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
USA
;;
-;; $Id: stratagus.ccl,v 1.21 2003/10/16 17:03:00 jsalmon3 Exp $
+;; $Id: stratagus.ccl,v 1.22 2003/10/21 22:31:31 jsalmon3 Exp $
;; For documentation see stratagus/doc/ccl/ccl.html
@@ -348,6 +348,10 @@
(define-default-resource-names
'time 'gold 'wood 'oil 'ore 'stone 'coal)
+
+(define-default-resource-amounts
+ 'gold 100000
+ 'oil 50000)
;;-----------------------------------------------------------------------------
Index: stratagus/src/clone/ccl.c
diff -u stratagus/src/clone/ccl.c:1.116 stratagus/src/clone/ccl.c:1.117
--- stratagus/src/clone/ccl.c:1.116 Thu Oct 16 13:03:00 2003
+++ stratagus/src/clone/ccl.c Tue Oct 21 18:31:31 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: ccl.c,v 1.116 2003/10/16 17:03:00 jsalmon3 Exp $
+// $Id: ccl.c,v 1.117 2003/10/21 22:31:31 jsalmon3 Exp $
//@{
@@ -607,6 +607,33 @@
}
/**
+** Define default names for the resources.
+*/
+local SCM CclDefineDefaultResourceAmounts(SCM list)
+{
+ int i;
+ SCM value;
+
+ while (!gh_null_p(list)) {
+ value = gh_car(list);
+ list = gh_cdr(list);
+
+ for (i = 0; i < MaxCosts; ++i) {
+ if (gh_eq_p(value, gh_symbol2scm(DefaultResourceNames[i]))) {
+ value = gh_car(list);
+ list = gh_cdr(list);
+ DefaultResourceAmounts[i] = gh_scm2int(value);
+ break;
+ }
+ }
+ if (i == MaxCosts) {
+ errl("Resource not found", value);
+ }
+ }
+ return SCM_UNSPECIFIED;
+}
+
+/**
** Debug unit slots.
*/
local SCM CclUnits(void)
@@ -848,6 +875,7 @@
gh_new_procedureN("define-default-incomes", CclDefineDefaultIncomes);
gh_new_procedureN("define-default-actions", CclDefineDefaultActions);
gh_new_procedureN("define-default-resource-names",
CclDefineDefaultResourceNames);
+ gh_new_procedureN("define-default-resource-amounts",
CclDefineDefaultResourceAmounts);
IconCclRegister();
MissileCclRegister();
@@ -1022,7 +1050,7 @@
}
fprintf(fd, ";;; -----------------------------------------\n");
- fprintf(fd, ";;; $Id: ccl.c,v 1.116 2003/10/16 17:03:00 jsalmon3 Exp $\n");
+ fprintf(fd, ";;; $Id: ccl.c,v 1.117 2003/10/21 22:31:31 jsalmon3 Exp $\n");
fprintf(fd, "(set-video-resolution! %d %d)\n", VideoWidth, VideoHeight);
@@ -1047,7 +1075,7 @@
}
fprintf(fd, ";;; -----------------------------------------\n");
- fprintf(fd, ";;; $Id: ccl.c,v 1.116 2003/10/16 17:03:00 jsalmon3 Exp $\n");
+ fprintf(fd, ";;; $Id: ccl.c,v 1.117 2003/10/21 22:31:31 jsalmon3 Exp $\n");
// Global options
if (OriginalFogOfWar) {
@@ -1157,7 +1185,7 @@
extern SCM oblistvar;
CLprintf(file, "\n;;; -----------------------------------------\n");
- CLprintf(file, ";;; MODULE: CCL $Id: ccl.c,v 1.116 2003/10/16 17:03:00
jsalmon3 Exp $\n\n");
+ CLprintf(file, ";;; MODULE: CCL $Id: ccl.c,v 1.117 2003/10/21 22:31:31
jsalmon3 Exp $\n\n");
for (list = oblistvar; gh_list_p(list); list = gh_cdr(list)) {
SCM sym;
Index: stratagus/src/editor/editloop.c
diff -u stratagus/src/editor/editloop.c:1.135
stratagus/src/editor/editloop.c:1.136
--- stratagus/src/editor/editloop.c:1.135 Fri Oct 17 12:17:11 2003
+++ stratagus/src/editor/editloop.c Tue Oct 21 18:31:31 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: editloop.c,v 1.135 2003/10/17 16:17:11 jsalmon3 Exp $
+// $Id: editloop.c,v 1.136 2003/10/21 22:31:31 jsalmon3 Exp $
//@{
@@ -286,13 +286,10 @@
{
Unit* unit;
- //FXIME: vladi: should check place when mirror editing is enabled...?
+ // FIXME: vladi: should check place when mirror editing is enabled...?
unit = MakeUnitAndPlace(x, y, type, player);
- if (type->GivesResource == OilCost) {
- unit->Value = 50000;
- }
- if (type->GivesResource == GoldCost) {
- unit->Value = 100000;
+ if (type->GivesResource) {
+ unit->Value = DefaultResourceAmounts[type->GivesResource];
}
}
@@ -913,7 +910,7 @@
}
DrawMenuButton(TheUI.MenuButton.Button,
(ButtonAreaUnderCursor == ButtonAreaMenu
- && ButtonUnderCursor == 0 ? MenuButtonActive : 0) |
+ && ButtonUnderCursor == ButtonUnderMenu ? MenuButtonActive : 0) |
(GameMenuButtonClicked ? MenuButtonClicked : 0),
TheUI.MenuButton.Width, TheUI.MenuButton.Height,
TheUI.MenuButton.X,TheUI.MenuButton.Y,
@@ -1011,7 +1008,7 @@
if ((1 << button) == LeftButton && GameMenuButtonClicked == 1) {
GameMenuButtonClicked = 0;
- if (ButtonUnderCursor == 0) {
+ if (ButtonUnderCursor == ButtonUnderMenu) {
ProcessMenu("menu-editor", 1);
}
}
@@ -1032,7 +1029,7 @@
//
// Click on menu button
//
- if (CursorOn == CursorOnButton && ButtonUnderCursor == 0 &&
+ if (CursorOn == CursorOnButton && ButtonAreaUnderCursor == ButtonAreaMenu
&&
(MouseButtons & LeftButton) && !GameMenuButtonClicked) {
PlayGameSound(GameSounds.Click.Sound, MaxSampleVolume);
GameMenuButtonClicked = 1;
@@ -1833,6 +1830,8 @@
strdup(Tilesets[TheMap.Info->MapTerrain]->Ident);
InitPlayers();
for (i = 0; i < PlayerMax; ++i) {
+ int j;
+
if (i == PlayerNumNeutral) {
CreatePlayer(PlayerNeutral);
TheMap.Info->PlayerType[i] = PlayerNeutral;
@@ -1841,9 +1840,9 @@
CreatePlayer(PlayerNobody);
TheMap.Info->PlayerType[i] = PlayerNobody;
}
- TheMap.Info->PlayerResources[i][GoldCost] =
Players[i].Resources[GoldCost];
- TheMap.Info->PlayerResources[i][WoodCost] =
Players[i].Resources[WoodCost];
- TheMap.Info->PlayerResources[i][OilCost] =
Players[i].Resources[OilCost];
+ for (j = 1; j < MaxCosts; ++j) {
+ TheMap.Info->PlayerResources[i][j] = Players[i].Resources[j];
+ }
}
strncpy(TheMap.Description, TheMap.Info->Description, 32);
Index: stratagus/src/include/upgrade_structs.h
diff -u stratagus/src/include/upgrade_structs.h:1.26
stratagus/src/include/upgrade_structs.h:1.27
--- stratagus/src/include/upgrade_structs.h:1.26 Sun Sep 21 08:13:42 2003
+++ stratagus/src/include/upgrade_structs.h Tue Oct 21 18:31:32 2003
@@ -27,7 +27,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: upgrade_structs.h,v 1.26 2003/09/21 12:13:42 mr-russ Exp $
+// $Id: upgrade_structs.h,v 1.27 2003/10/21 22:31:32 jsalmon3 Exp $
#ifndef __UPGRADE_STRUCTS_H__
#define __UPGRADE_STRUCTS_H__
@@ -113,6 +113,11 @@
** Default names for the resources.
*/
extern char* DefaultResourceNames[MaxCosts];
+
+/**
+** Default amounts for the resources.
+*/
+extern int DefaultResourceAmounts[MaxCosts];
/**
** This are the current stats of an unit. Upgraded or downgraded.
Index: stratagus/src/ui/ccl_ui.c
diff -u stratagus/src/ui/ccl_ui.c:1.139 stratagus/src/ui/ccl_ui.c:1.140
--- stratagus/src/ui/ccl_ui.c:1.139 Fri Oct 17 14:46:48 2003
+++ stratagus/src/ui/ccl_ui.c Tue Oct 21 18:31:32 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: ccl_ui.c,v 1.139 2003/10/17 18:46:48 jsalmon3 Exp $
+// $Id: ccl_ui.c,v 1.140 2003/10/21 22:31:32 jsalmon3 Exp $
//@{
@@ -1016,8 +1016,8 @@
y = gh_scm2int(value);
// Find slot: new or redefinition
- ui=NULL;
- i=0;
+ ui = NULL;
+ i = 0;
if (UI_Table) {
for (; UI_Table[i]; ++i) {
if (UI_Table[i]->Width == x && UI_Table[i]->Height == y &&
@@ -1144,7 +1144,7 @@
value = gh_car(sublist);
sublist = gh_cdr(sublist);
name = gh_scm2newstr(value, NULL);
- for (res=0; res < MaxCosts; ++res) {
+ for (res = 0; res < MaxCosts; ++res) {
if (!strcmp(name, DefaultResourceNames[res])) {
break;
}
Index: stratagus/src/unit/unittype.c
diff -u stratagus/src/unit/unittype.c:1.112 stratagus/src/unit/unittype.c:1.113
--- stratagus/src/unit/unittype.c:1.112 Sun Oct 12 12:18:13 2003
+++ stratagus/src/unit/unittype.c Tue Oct 21 18:31:32 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: unittype.c,v 1.112 2003/10/12 16:18:13 n0body Exp $
+// $Id: unittype.c,v 1.113 2003/10/21 22:31:32 jsalmon3 Exp $
//@{
@@ -137,6 +137,11 @@
*/
global char* DefaultResourceNames[MaxCosts];
+/**
+** Default amounts for the resources.
+*/
+global int DefaultResourceAmounts[MaxCosts];
+
/*----------------------------------------------------------------------------
-- Functions
----------------------------------------------------------------------------*/
@@ -1146,7 +1151,7 @@
char** sp;
CLprintf(file, "\n;;; -----------------------------------------\n");
- CLprintf(file, ";;; MODULE: unittypes $Id: unittype.c,v 1.112 2003/10/12
16:18:13 n0body Exp $\n\n");
+ CLprintf(file, ";;; MODULE: unittypes $Id: unittype.c,v 1.113 2003/10/21
22:31:32 jsalmon3 Exp $\n\n");
// Original number to internal unit-type name.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Stratagus-CVS] stratagus data/ccl/stratagus.ccl src/clone/ccl....,
Jimmy Salmon <=