Complete.Org: Mailing Lists: Archives: freeciv-dev: May 2005:
[Freeciv-Dev] (PR#13019) Meta-Ticket: Improved scripting
Home

[Freeciv-Dev] (PR#13019) Meta-Ticket: Improved scripting

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Subject: [Freeciv-Dev] (PR#13019) Meta-Ticket: Improved scripting
From: "Vasco Alexandre da Silva Costa" <vasc@xxxxxxxxxxxxxx>
Date: Mon, 9 May 2005 19:09:21 -0700
Reply-to: bugs@xxxxxxxxxxx

<URL: http://bugs.freeciv.org/Ticket/Display.html?id=13019 >

Add myplayer:is_human() method.

Requested by Jason Dorje Short. Patch by me.


Index: server/scripting/api.pkg
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/scripting/api.pkg,v
retrieving revision 1.4
diff -u -u -r1.4 api.pkg
--- server/scripting/api.pkg    10 May 2005 00:35:15 -0000      1.4
+++ server/scripting/api.pkg    10 May 2005 02:08:31 -0000
@@ -24,10 +24,16 @@
 $#include "script.h"
 
 /* Classes. */
+struct Player_ai {
+   bool control;
+};
+
 struct Player {
   const char *name;
   int nation @ nation_id;
 
+  Player_ai ai;
+
   const int player_no @ id;
 };
 
@@ -88,6 +94,10 @@
 
 $[
 -- Player methods.
+function Player:is_human()
+  return not self.ai.control
+end
+
 function Player:nation()
   return find.nation(self.nation_id)
 end
Index: server/scripting/api_types.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/scripting/api_types.h,v
retrieving revision 1.4
diff -u -u -r1.4 api_types.h
--- server/scripting/api_types.h        10 May 2005 00:35:15 -0000      1.4
+++ server/scripting/api_types.h        10 May 2005 02:08:31 -0000
@@ -29,6 +29,7 @@
 
 /* Classes. */
 typedef struct player Player;
+typedef struct player_ai Player_ai;
 typedef struct city City;
 typedef struct unit Unit;
 typedef struct tile Tile;

[Prev in Thread] Current Thread [Next in Thread]