Selaa lähdekoodia

* Changed the string hash of the script engine to SDBM.
* Reporting information about script data when an error occurs.
* More work on ticket #41 (array functions).

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@10813 54d463be-8e91-2dee-dedb-b68131a5f0ec

FlavioJS 18 vuotta sitten
vanhempi
commit
a75ec9a547
5 muutettua tiedostoa jossa 543 lisäystä ja 274 poistoa
  1. 4 0
      Changelog-Trunk.txt
  2. 20 15
      src/common/utils.c
  3. 4 4
      src/common/utils.h
  4. 511 253
      src/map/script.c
  5. 4 2
      src/map/script.h

+ 4 - 0
Changelog-Trunk.txt

@@ -3,6 +3,10 @@ Date	Added
 AS OF SVN REV. 5091, WE ARE NOW USING TRUNK.  ALL UNTESTED BUGFIXES/FEATURES GO INTO TRUNK.
 IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
 
+2007/06/26
+	* Changed the string hash of the script engine to SDBM.
+	* Reporting information about script data when an error occurs.
+	* More work on ticket #41 (array functions). [FlavioJS]
 2007/06/22
 	* Changed behavior of some guild-related code (according to X.4 tests):
 	- removed code that prevented Homunculus Resurrection during WoE

+ 20 - 15
src/common/utils.c

@@ -294,30 +294,35 @@ void findfile(const char *p, const char *pat, void (func)(const char*))
 }
 #endif
 
-unsigned char GetByte(unsigned long val, size_t num)
+uint8 GetByte(uint32 val, size_t num)
 {
-	switch(num) {
-	case 0:  return (unsigned char)((val & 0x000000FF)      );
-	case 1:	 return (unsigned char)((val & 0x0000FF00)>>0x08);
-	case 2:	 return (unsigned char)((val & 0x00FF0000)>>0x10);
-	case 3:	 return (unsigned char)((val & 0xFF000000)>>0x18);
+	switch( num )
+	{
+	case 0:  return (uint8)((val & 0x000000FF)        );
+	case 1:	 return (uint8)((val & 0x0000FF00) >> 0x08);
+	case 2:	 return (uint8)((val & 0x00FF0000) >> 0x10);
+	case 3:	 return (uint8)((val & 0xFF000000) >> 0x18);
 	default: return 0;	//better throw something here
 	}
 }
-unsigned short GetWord(unsigned long val, size_t num)
+uint16 GetWord(uint32 val, size_t num)
 {
-	switch(num) {
-	case 0:  return (unsigned short)((val & 0x0000FFFF)      );
-	case 1:  return (unsigned short)((val & 0xFFFF0000)>>0x10);
+	switch( num )
+	{
+	case 0:  return (uint16)((val & 0x0000FFFF)        );
+	case 1:  return (uint16)((val & 0xFFFF0000) >> 0x10);
 	default: return 0;	//better throw something here
 	}
 }
-unsigned short MakeWord(unsigned char byte0, unsigned char byte1)
+uint16 MakeWord(uint8 byte0, uint8 byte1)
 {
-	return byte0 | (byte1<<0x08);
+	return
+		((uint16)(byte0        ))|
+		((uint16)(byte1 << 0x08));
 }
-unsigned long MakeDWord(unsigned short word0, unsigned short word1)
+uint32 MakeDWord(uint16 word0, uint16 word1)
 {
-	return 	  ((unsigned long)word0)
-			| ((unsigned long)word1<<0x10);
+	return
+		((uint32)(word0        ))|
+		((uint32)(word1 << 0x10));
 }

+ 4 - 4
src/common/utils.h

@@ -38,9 +38,9 @@ void findfile(const char *p, const char *pat, void (func)(const char*));
 // byte word dword access [Shinomori]
 //////////////////////////////////////////////////////////////////////////
 
-extern unsigned char GetByte(unsigned long val, size_t num);
-extern unsigned short GetWord(unsigned long val, size_t num);
-extern unsigned short MakeWord(unsigned char byte0, unsigned char byte1);
-extern unsigned long MakeDWord(unsigned short word0, unsigned short word1);
+extern uint8 GetByte(uint32 val, size_t num);
+extern uint16 GetWord(uint32 val, size_t num);
+extern uint16 MakeWord(uint8 byte0, uint8 byte1);
+extern uint32 MakeDWord(uint16 word0, uint16 word1);
 
 #endif /* _UTILS_H_ */

Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 511 - 253
src/map/script.c


+ 4 - 2
src/map/script.h

@@ -44,8 +44,10 @@ struct script_code {
 };
 
 struct script_stack {
-	int sp,sp_max,defsp;
-	struct script_data *stack_data;
+	int sp;// number of entries in the stack
+	int sp_max;// capacity of the stack
+	int defsp;
+	struct script_data *stack_data;// stack
 	struct linkdb_node **var_function;	// ŠÖ�”ˆË‘¶•Ï�”
 };
 

Kaikkia tiedostoja ei voida näyttää, sillä liian monta tiedostoa muuttui tässä diffissä